Featurizer#

class nearl.featurizer.Featurizer(parms={}, **kwargs)[source]#

Bases: object

Featurizer aims to automate the process of featurization of multiple Features for a batch of structures or trajectories

Parameters:
parmsdict

A dictionary of parameters for the featurizer

Notes

Required parameters:

  • dimensions: the dimensions of the 3D grid

  • lengths: the lengths of the 3D grid (optional)

  • spacing: the spacing of the 3D grid (optional)

  • time_window: the time window for the trajectory (default is 1), Simple integer.

The following are optional parameters for features. If the initialization of the feature did not explicitly define the following parameters, the following parameters will be inherited from the featurizer:

  • outfile: The output file to dump the parameters and the results

  • sigma: The smoothness of the Gaussian-based feature distribution

  • cutoff: The cutoff distance for the grid-based feature calculation

Attributes:
trajnearl.Trajectory or pytraj.Trajectory

The trajectory being processed.

toppytraj.Topology

The topology of the trajectory being processed.

dimsnp.ndarray

The 3 dimensions of the 3D grid

lengthsnp.ndarray

The lengths of the 3D grid in Angstrom

spacingfloat

The spacing (also the resolution) between grid points of the 3D grid

time_windowint, default = 1

The time window for the trajectory (default is 1), Simple integer.

frame_sliceslice

The frame-slice being processed in the trajectory

FRAMENUMBERint

The number of frames in the trajectory to be processed

FRAMESLICENUMBERint

The number of slices of frames in the trajectory

FRAMESLICESlist

A list of slices of frames in the trajectory to be processed

FEATURESPACElist

A list of features to be processed

FEATURENUMBERint

The number of features to be processed

FOCALPOINTS_PROTOTYPE

The prototype of the focal points

FOCALPOINTSnp.ndarray

The focal points to be processed

FOCALNUMBERint

The number of focal points for each frame slice

property parms#

Return the parameters of the featurizer

property dims#

The 3 dimensions of the 3D grid

property lengths#

The lengths of the 3D grid in Angstrom

property spacing#

The spacing (also the resolution) between grid points of the 3D grid

property traj#

The trajectory being processed.

property top#

The topology of the trajectory being processed.

register_feature(feature)[source]#

Register a nearl.features.Feature to the featurizer

Parameters:
featurenearl.features.Feature
register_features(features)[source]#

Register multiple nearl.features.Feature in a list or dictionary to the featurizer

Parameters:
featureslist-like or dict-like
register_trajloader(trajloader)[source]#

Register a trajectory loader to the featurizer for further processing

Parameters:
trajloadernearl.io.trajloader.TrajectoryLoader
register_focus(focus, format)[source]#

Register a set of focal points to the featurizer for further processing

Parameters:
focuslist_like

The focal points to process

formatstr

The format of the focal points

Notes

The following 4 formats of focuses are supported:

  • mask: provide a selection of atoms (Amber’s selection convention)

  • index: provide a list of atom indices (int)

  • absolute: provide a list of 3D coordina tes

  • json: provide a json file containing the indexes of the atoms for each trajectory (the key for each trajectory should match the feat.identity attribute)

parse_focus()[source]#

After registering the active trajectory, parse the focal points for each frame-slice in the run method. The resulting shape will be a 3D array with the shape (slice_number, focus_number, 3)

run()[source]#

Run the featurization for each iteration over trajectory, frame-slice, focal-point, and feature.

loop_by_residue(restype, tag_limit=0)[source]#

TO BE ADDED