Package schrodinger :: Package trajectory :: Module atomselection :: Class FrameAslSelection
[hide private]
[frames] | no frames]

Class FrameAslSelection

A class for selecting atoms from frames in a given simulation using ASL.

Note that there is no control over the order of indices retrieved in an ASL selection - they will always be returned in numerical order. As such, FrameAslSelection objects are not appropriate for analyses with more than one selection.

Instance Methods [hide private]
 
__init__(self, asl_expr, is_dynamic=None)
 
isDynamic(self)
Returns: A bool indicating whether this selection changes from frame to frame.
 
getAtomIndices(self, frame)
Returns: A selection as a sequence of integers, using one based indexing so it can be used with a Structure.
 
getOffsets(self, frame)
Returns: A selection as a sequence of integers, using zero based indexing so it can be used with a numpy array.
 
getArraySelection(self, frame)
Returns: A selection as a sequence of integers, using zero based indexing so it can be used with a numpy array.
FrameIndexSelection
createIndexSelection(self, frame, cmp=None, key=None)
Create a FrameIndexSelection from this instance.
Method Details [hide private]

isDynamic(self)

 
Returns:
A bool indicating whether this selection changes from frame to frame.

getAtomIndices(self, frame)

 
Returns:
A selection as a sequence of integers, using one based indexing so it can be used with a Structure.

getOffsets(self, frame)

 
Returns:
A selection as a sequence of integers, using zero based indexing so it can be used with a numpy array.

getArraySelection(self, frame)

 
Returns:
A selection as a sequence of integers, using zero based indexing so it can be used with a numpy array.

createIndexSelection(self, frame, cmp=None, key=None)

 

Create a FrameIndexSelection from this instance.

Because FrameAslSelections do not imply an ordering of atoms, two methods of ordering the new selection are available. The first is to provide a cmp method. This method should expect two _StructureAtom instances as arguments and should behave like the cmp argument to the sort method of the built-in list. The second ordering method is to specify a _StructureAtom attribute on which to sort.

If neither of these is specified, the selection will be returned in order of atom indices. In this case, the frame instance is not needed and can be specified as None.

Raises a ValueError if the FrameAslSelection is dynamic.

Parameters:
  • cmp (callable) - A comparison function expecting two _StructureAtom instances.
  • key (str) - A _StructureAtom attribute on which to order the selection.
  • frame (_DesmondFrame)
Returns: FrameIndexSelection
A FrameIndexSelection with the same atom selection as the current instance.