obs

Module defining a class for storing, calculating and reading in observables from molecular dynamics trajectories.

class MDMC.trajectory_analysis.observables.obs.Observable[source]

Abstract class that defines methods common to all observable data containers

Observable data can either be from a file or calculated from MD and stored in the data property, along with the associated uncertainty. The bool property from_MD states the source of the information.

reader

The file reader for reading experimental data

Type

ObservableReader

abstract calculate_from_MD(MD_input: Union[CompactTrajectory, list[CompactTrajectory]], verbose: int = 0, **parameters: dict) None[source]

Calculates the observable using input from an MD simulation

Parameters
  • MD_input (Object) – Some input from an MD simulation, commonly a CompactTrajectory

  • verbose (int) – Enables verbose printing of the calculation

  • **parameters – Additional parameters required for calculation specific Observable objects

property data: dict

Get the independent, dependent and error data

Returns

The independent, dependent and error data

Return type

dict

abstract property dependent_variables: dict

The dependent variables

Returns

The dependent variables

Return type

dict

abstract property dependent_variables_structure: dict

The structure of the dependent variables with respect to the independent variables. Specifically, the order in which the dependent variables are indexed with regards to the independent variables. Example: if dep_var1[indep_var1_index, indep_var2_index, …] = data point for values of the independent_variables with the stated indices then the relevant entry in the returned dict should be: {‘dependent_variable1’: [independent_variable1, independent_variable2, …]} Note that this would also correspond to numpy.shape of the dependent variable being: np.shape(dependent_variable1)=(np.size(independent_variable1), np.size(independent_variable2), …)

The purpose of this method is to ensure that all ``Observable``s of a particular type are created with ‘dependent_variables’ that are consistent regardless of how they were created (e.g. by different ``Reader``s).

Returns

The np.shape of the dependent variables

Return type

dict

abstract property errors: dict

The errors on the dependent variables

Returns

The errors on the dependent_variables

Return type

dict

abstract property independent_variables: dict

The independent variables

Returns

The independent variables

Return type

dict

abstract maximum_frames() int[source]

The maximum number of CompactTrajectory frames that can be used to calculate the dependent_variables

Returns

The maximum number of frames

Return type

int

abstract minimum_frames(dt: float = None) int[source]

The minimum number of CompactTrajectory frames needed to calculate the dependent_variables

Parameters

dt (float, optional) – The time separation of frames in fs, default is None

Returns

The minimum number of frames

Return type

int

property name: str

Get or set the module name that used for factory instantiation

Returns

The name of the module in which the Observable is located

Return type

str

property origin: str

Get or set the origin of the observable

Returns

The origin of the Observable, either 'experiment' or 'MD'

Return type

str

read_from_file(reader: str, file_name: str) None[source]

Reads in experimental data from a file using a specified reader

Parameters
  • reader (str) – The name of the required file reader

  • file_name (str) – The name of the file

abstract property uniformity_requirements: dict[str, dict[str, bool]]

Represents the current limitations on independent_variables of the Observable. It captures if the independent_variables are required to be uniform or to start at zero The keys of the returned dictionary should be the variables that have such a restriction, with the associated values being a dictionary with booleans if the variables are ‘uniform’ or ‘zeroed’. Variables without any requirements do not need to be included, but can be included. If there are no uniformity requirements it is okay to return ‘None’.

Returns

Dictionary of independent variables with their uniformity restrictions represented as booleans

Return type

dict[str, dict[str, bool]]

property use_FFT: bool

Get or set whether to use FFT when calculating from MD

Returns

Whether to use FFT

Return type

bool