finesse.utilities.storage module
Methods for saving outputs to files.
Currently just uses pickles until HDF is working.
- finesse.utilities.storage.np_dtype_to_json(dtype)[source]
Converts a numpy dtype into a json string format.
- finesse.utilities.storage.save(obj, filename, format=None)[source]
Saves a Finesse solution object to a file. Two options are available: HDF5 and Pickle.
Parameters
- objSolution
Solution object generated by a Finesse simulation
- filenamestr
A path and filename to save the output. If the path does not exist it will be created.
- formatstr, optional
For HDF files use one of “.h5”, “.hdf5”, “.hdf” or pickle files use one of “.pkl”, “.pickle”. If None then the extension of the filename is used.
- finesse.utilities.storage.to_generic_hdf(obj, grp)[source]
Used to convert a generic Python class into a HDF group.
Scalar values (as determined by np.isscalar) are added as HDF group attributes. This includes class attributes that are int, float, strings, etc. Attributes that are representable with a numpy array are written as datasets within the group. Any attribute that does not fit in the above will be pickled and added as a byte stream dataset.