amep.base.BaseTrajectory#

class amep.base.BaseTrajectory(reader)#

Bases: object

Trajectory base object.

__init__(reader)#

Creates a trajectory object containing data frames for multiple time steps.

Parameters:

reader (BaseReader) – Reader of the data.

Return type:

None.

Methods

__init__(reader)

Creates a trajectory object containing data frames for multiple time steps.

add_author_info(author, key, value)

Adds author information for the given author to the trajectory.

add_param(param, value)

Adds a parameter to the trajectory.

add_script(path)

Adds a script in text format to the hdf5 file.

add_software_info(key, value)

Add software information to the hdf5 trajectory file.

delete_author_info(author[, key])

Deletes all information (key=None) or specific information given by the key keyword of the given author.

delete_param(param)

Deletes the given parameter.

delete_script(filename)

Deletes the script of the given filename.

delete_software_info([key])

Deletes all software information (key=None) or specific information given by the key keyword.

get_author_info(author)

Returns all information for the given author.

get_script(filename[, store, directory])

Returns a stored script as a list of lines and stores it as a file in the given directory if store is True.

Attributes

authors

Returns a list of all author names.

dim

dt

Size of the time step used for the simulation.

info

Returns all stored metadata information as a dictionary.

nframes

Total number of loaded frames.

nth

Every which dump file was loaded.

params

Returns all parameters stored within the trajectory as a dictionary.

reader

savedir

Trajectory file directory.

scripts

Returns a list of all scripts (filenames) that are stored in the trajectory object.

software

Returns all software information.

start

Start fraction.

steps

Array of the number of time steps for each frame.

stop

Stop fraction.

times

Physical times.

type

Returns the data type ('particles' or 'field').

version

AMEP version with which the trajectory file has been created.

add_author_info(author: str, key: str, value: int | float | str) None#

Adds author information for the given author to the trajectory.

Parameters:
  • author (str) – Author name.

  • key (str) – Name or category of the information to be added.

  • value (int or float or str) – Information to be added.

Return type:

None.

add_param(param: str, value: int | float | str) None#

Adds a parameter to the trajectory.

Parameters:
  • param (str) – Parameter.

  • value (str or float or int) – Value of the parameter.

Raises:

ValueError – Raises an error if param is not of type str.

Return type:

None.

add_script(path: Path | str) None#

Adds a script in text format to the hdf5 file.

Parameters:

path (str or Path) – Path of the script to add.

Return type:

None.

add_software_info(key: str, value: str | int | float) None#

Add software information to the hdf5 trajectory file.

Parameters:
  • key (str) – Name of the parameter.

  • value (str or int or float) – Value of the parameter.

Return type:

None.

property authors: list[str]#

Returns a list of all author names.

Returns:

keys – List of author names.

Return type:

list

delete_author_info(author: str, key: str | None = None) None#

Deletes all information (key=None) or specific information given by the key keyword of the given author.

Parameters:
  • author (str) – Author name.

  • key (str or None, optional) – Info that should be deleted. If None, all info is deleted. The default is None.

Return type:

None.

delete_param(param: str) None#

Deletes the given parameter.

Parameters:

param (str) – Parameter.

Raises:

ValueError – Raises an error if param is not of type str.

Return type:

None.

delete_script(filename: str) None#

Deletes the script of the given filename.

Parameters:

filename (str) – Filename.

Return type:

None.

delete_software_info(key: str | None = None) None#

Deletes all software information (key=None) or specific information given by the key keyword.

Parameters:

key (str or None, optional) – Information that should be deleted. If None, all information is deleted. The default is None.

Return type:

None.

property dt#

Size of the time step used for the simulation.

get_author_info(author: str) dict#

Returns all information for the given author.

Parameters:

author (str) – Author name.

Returns:

p – Author information.

Return type:

dict

get_script(filename: str, store: bool = False, directory: str = '.') list#

Returns a stored script as a list of lines and stores it as a file in the given directory if store is True.

Parameters:
  • filename (str) – File name.

  • store (bool, optional) – If True, the script is stored in a file. The default is False.

  • directory (str, optional) – Directory in which the file is stored if store is True. The default is ‘.’.

Returns:

decoded – List of lines.

Return type:

list

property info: dict#

Returns all stored metadata information as a dictionary.

Returns:

Metadata.

Return type:

dict

property nframes#

Total number of loaded frames.

property nth#

Every which dump file was loaded.

property params: dict#

Returns all parameters stored within the trajectory as a dictionary.

Returns:

p – Parameter dictionary.

Return type:

dict

property savedir#

Trajectory file directory.

property scripts: list#

Returns a list of all scripts (filenames) that are stored in the trajectory object.

Returns:

keys – List of filenames.

Return type:

list

property software: dict#

Returns all software information.

Returns:

keys – Software information.

Return type:

dict

property start#

Start fraction.

property steps#

Array of the number of time steps for each frame.

property stop#

Stop fraction.

property times#

Physical times.

property type: str#

Returns the data type (‘particles’ or ‘field’).

Returns:

Data type.

Return type:

str

property version#

AMEP version with which the trajectory file has been created.

Returns:

ver – Version.

Return type:

str