perses.storage.NetCDFStorage¶
-
class
perses.storage.
NetCDFStorage
(filename, mode='w')[source]¶ NetCDF storage layer.
Methods
close
()Close the storage layer. get_object
(envname, modname, varname[, …])Get the serialized Python object. sync
()Flush write buffer. write_array
(varname, array[, iteration])Write a numpy array as a native NetCDF array write_configuration
(varname, positions, topology)Write a configuration (or one of a sequence of configurations) to be stored as a native NetCDF array write_object
(varname, obj[, iteration])Serialize a Python object, encoding as pickle when storing as string in NetCDF. write_quantity
(varname, value[, iteration])Write a floating-point number -
__init__
(filename, mode='w')[source]¶ Create NetCDF storage layer, creating or appending to an existing file.
Parameters: - filename : str
Name of storage file to bind to.
- mode : str, optional, default=’w’
File open mode, ‘w’ for (over)write, ‘a’ for append.
Methods
__init__
(filename[, mode])Create NetCDF storage layer, creating or appending to an existing file. close
()Close the storage layer. get_object
(envname, modname, varname[, …])Get the serialized Python object. sync
()Flush write buffer. write_array
(varname, array[, iteration])Write a numpy array as a native NetCDF array write_configuration
(varname, positions, topology)Write a configuration (or one of a sequence of configurations) to be stored as a native NetCDF array write_object
(varname, obj[, iteration])Serialize a Python object, encoding as pickle when storing as string in NetCDF. write_quantity
(varname, value[, iteration])Write a floating-point number -
get_object
(envname, modname, varname, iteration=None)[source]¶ Get the serialized Python object.
Parameters: - envname : str
The name of the environment for the variable
- modname : str
The name of the module for the variable
- varname : str
The variable name to be stored
- iteration : int, optional, default=None
The local iteration for the module, or None if this is a singleton
Returns: - obj : object
The retrieved object
-
write_array
(varname, array, iteration=None)[source]¶ Write a numpy array as a native NetCDF array
Parameters: - varname : str
The variable name to be stored
- array : numpy.array of arbitrary dimension
The numpy array to be written
- iteration : int, optional, default=None
The local iteration for the module, or None if this is a singleton
-
write_configuration
(varname, positions, topology, iteration=None, frame=None, nframes=None)[source]¶ Write a configuration (or one of a sequence of configurations) to be stored as a native NetCDF array
Parameters: - varname : str
The variable name to be stored
- positions : simtk.unit.Quantity of size [natoms,3] with units compatible with angstroms
The positions to be written
- topology : md.Topology object
The corresponding Topology object
- iteration : int, optional, default=None
The local iteration for the module, or None if this is a singleton
- frame : int, optional, default=None
If these coordinates are part of multiple frames in a sequence, the frame number
- nframes : int, optional, default=None
If these coordinates are part of multiple frames in a sequence, the total number of frames in the sequence
-
write_object
(varname, obj, iteration=None)[source]¶ Serialize a Python object, encoding as pickle when storing as string in NetCDF.
Parameters: - varname : str
The variable name to be stored
- obj : object
The object to be serialized
- iteration : int, optional, default=None
The local iteration for the module, or None if this is a singleton
-
write_quantity
(varname, value, iteration=None)[source]¶ Write a floating-point number
Parameters: - varname : str
The variable name to be stored
- value : float
The floating-point value to be written
- iteration : int, optional, default=None
The local iteration for the module, or None if this is a singleton
-