utils : Miscellanea boiler plate

idpflex.utils.namedtuplefy(func)[source]

Decorator to transform the return dictionary of a function into a namedtuple

Parameters:
  • func (Function) – Function to be decorated
  • name (str) – Class name for the namedtuple. If None, the name of the function will be used
Returns:

Return type:

Function

idpflex.utils.temporary_file(*args, **kwds)[source]

Creates a temporary file

Parameters:kwargs (dict) – optional arguments to tempfile.mkstemp
Yields:str – Absolute path name to file
idpflex.utils.write_frame(a_universe, iframe, file_name)[source]

Write a single trajectory frame to file.

Format is guessed from the file’s extension.

Parameters:
  • a_universe (Universe) – Universe describing the simulation
  • iframe (int) – Trajectory frame index (indexes begin with zero)
  • file_name (str) – Name of the file to create