msd_output_file_writer

A module containing the classes for writing related to an MSD analysis to a file.

Summary

Classes:

MSDDataWriter

Class for writing the data of an MSD analysis to a file.

MSDLogWriter

Class for writing the log (setup parameters) of an MSD analysis to a file.

Reference

class MSDDataWriter(
filename: str,
export_files: Sequence[str] | None = None,
)[source]

Bases: AnalysisDataWriter

Class for writing the data of an MSD analysis to a file.

The output file is written in the legacy Diffcalc format: one row per lag index with the columns lag index, MSD in x, MSD in y and MSD in z (all in Angstrom^2).

Parameters:
  • filename (str) – The primary output filename. Its extension selects the format.

  • export_files (Sequence[str] | None, optional) – Additional output filenames, by default None.

write(
data: tuple[Np1DNumberArray, Np1DNumberArray, Np1DNumberArray, Np1DNumberArray, Np1DNumberArray],
)[source]

Writes the data to the file.

Parameters:

data (Tuple[Np1DNumberArray, Np1DNumberArray,) – Np1DNumberArray, Np1DNumberArray, Np1DNumberArray] the data output from the MSD.run() method

header = '# PQAnalysis: Mean squared displacement\n# FIELDS lag msd_x msd_y msd_z\n# SYMBOLS k ⟨Δx(k)²⟩ ⟨Δy(k)²⟩ ⟨Δz(k)²⟩\n# UNITS frames Ų Ų Ų'
schema: AnalysisSchema = AnalysisSchema(title='Mean squared displacement', columns=(AnalysisColumn(field='lag', symbol='k', unit='frames'), AnalysisColumn(field='msd_x', symbol='⟨Δx(k)²⟩', unit='Ų'), AnalysisColumn(field='msd_y', symbol='⟨Δy(k)²⟩', unit='Ų'), AnalysisColumn(field='msd_z', symbol='⟨Δz(k)²⟩', unit='Ų')), plot=AnalysisPlotPreset(x_field='lag', y_fields=('msd_x', 'msd_y', 'msd_z'), x_label='Lag [frames]', y_label='MSD [\\cE\\C\\S2\\N]', legends=('x', 'y', 'z')))
class MSDLogWriter(filename: str | None)[source]

Bases: BaseWriter

Class for writing the log (setup parameters) of an MSD analysis to a file.

Parameters:

filename (str | None) – the filename to write to if None, the output is printed to stdout

write_after_run(
msd: MSD,
)[source]

Writes the log after the MSD run() method is called.

This includes the elapsed time of the MSD run() method and, if a time step was given, the diffusion coefficients obtained from the linear fit of the MSD tail.

Parameters:

msd (MSD) – the MSD analysis object

write_before_run(
msd: MSD,
)[source]

Writes the log before the MSD run() method is called.

This includes the general header of PQAnalysis and the most important setup parameters of the MSD analysis.

Parameters:

msd (MSD) – the MSD analysis object