Commit f905c166 authored by eric pellegrini's avatar eric pellegrini
Browse files

docstringed new Configurator derived classes

parent 84668f96
......@@ -58,7 +58,7 @@ class AtomSelectionConfigurator(IConfigurator):
#. Drag a molecular viewer on it
#. Drag into the Molecular Viewer the Atom selection plugin
:note: this configurator depends on 'trajectory' configurator to be configured
:note: this configurator depends on 'trajectory' and 'grouping_level' configurators to be configured
'''
type = 'atom_selection'
......
......@@ -27,28 +27,49 @@
'''
Created on Mar 30, 2015
@author: pellegrini
@author: Eric C. Pellegrini
'''
from MDANSE.Framework.Configurators.RangeConfigurator import RangeConfigurator
class FramesConfigurator(RangeConfigurator):
"""
This frames configurator allow to select as input of the analysis a range of frame
given 3 parameters : the first frame, the last frame, and the value of the step
This configurator allows to input a frame selection for the analysis.
The frame selection can be be input as:
#. a 3-tuple where the 1st, 2nd will corresponds respectively to the indexes of the first and last (excluded) frames to be selected while the 3rd element
will correspond to the step number between two frames. For example (1,11,3) will give 1,4,7,10
#. 'all' keyword, in such case, all the frames of the trajectory are selected
#. None keyword, in such case, all the frames of the trajectory are selected
:note: this configurator depends on 'trajectory' configurator to be configured
"""
type = 'frames'
def __init__(self, name, **kwargs):
'''
Initializes the configurator.
:param name: the name of the configurator as it will be appear in the configuration
:type name: str
'''
RangeConfigurator.__init__(self, name, sort=True, **kwargs)
def configure(self, configuration, value):
'''
Configure an input value.
:param configuration: the current configuration
:type configuration: a MDANSE.Framework.Configurable.Configurable object
:param value: the input value
:type value: 3-tuples, 'all' or None
'''
trajConfig = configuration[self._dependencies['trajectory']]
if value == "all":
if value in ["all",None]:
value = (0, trajConfig['length'], 1)
self._mini = -1
......@@ -69,6 +90,12 @@ class FramesConfigurator(RangeConfigurator):
self['time_step'] = 1.0
def get_information(self):
'''
Returns some informations about this configurator.
:return: the information about this configurator
:rtype: str
'''
return "%d frames selected (first=%.3f ; last = %.3f ; time step = %.3f)" % \
(self["n_frames"],self["time"][0],self["time"][-1],self["time_step"])
\ No newline at end of file
......@@ -27,7 +27,7 @@
'''
Created on Mar 30, 2015
@author: pellegrini
@author: Eric C. Pellegrini
'''
import collections
......@@ -44,7 +44,20 @@ LEVELS["molecule"] = {"atom" : 0, "atomcluster" : 1, "molecule" : 1, "nucleotide
class GroupingLevelConfigurator(SingleChoiceConfigurator):
"""
This configurator allow to choose the level of coarseness which will be apply into the calculation
This configurator allows to choose the level of granularity in the atom selection.
The level of granularity will be applied, when reading the trajectory, by grouping the atoms of the selection according to
their level of granularity to a single dummy-atoms located on the center of gravity of those atoms.
The level of granularity currently supported are:
#. 'atom': no grouping will be performed
#. 'group': the atoms that belongs to a MMTK AtomCluster object will be grouped as a single atom per object while the ones that belongs to a MMTK Molecule,
NucleotideChain, PeptideChain and Protein object will be grouped according to the chemical group they belong to (e.g. peptide group, methyl group ...).
#. 'residue': the atoms that belongs to a MMTK AtomCluster or Molecule object will be grouped as a single atom per object while the ones thta belongs to a
MMTK NucleotideChain, PeptideChain or Protein object will be grouped according to the residue to which they belong to (e.g. Histidine, Cytosyl ...)
#. 'chain': the atoms that belongs to a MMTK AtomCluster or Molecule object will be grouped as a single atom per object while the ones that belongs to a
MMTK NucleotideChain, PeptideChain or Protein object will be grouped according to the chain they belong to
#. 'molecule': the atoms that belongs to any MMTK chemical object will be grouped as a single atom per object
"""
type = 'grouping_level'
......@@ -52,20 +65,28 @@ class GroupingLevelConfigurator(SingleChoiceConfigurator):
_default = "atom"
def __init__(self, name, choices=None, **kwargs):
'''
Initializes the configurator.
choices = choices if choices is not None else LEVELS.keys()
:param name: the name of the configurator as it will be appear in the configuration
:type name: str
:param choices: the level of granularities allowed for the input value. If None all levels are allowed.
:type choices: one of ['atom','group','residue','chain','molecule'] or None
'''
if choices is None:
choices = LEVELS.keys()
else:
choices = list(set(LEVELS.keys()).intersection(choices))
SingleChoiceConfigurator.__init__(self, name, choices=choices, **kwargs)
def configure(self, configuration, value):
value = value.lower()
if not value in LEVELS.keys():
raise ConfiguratorError("%r is not a valid grouping level." % value, self)
self["value"] = value
def get_information(self):
'''
Returns some informations about this configurator.
:return: the information about this configurator
:rtype: str
'''
return "Grouping level: %r\n" % self["value"]
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment