pwspy.analysis.dynamics.DynamicsAnalysisResults

class pwspy.analysis.dynamics.DynamicsAnalysisResults(file=None, variablesDict=None, analysisName=None)[source]

Bases: pwspy.analysis._abstract.AbstractHDFAnalysisResults

static FieldDecorator(func)

Decorate functions in subclasses that access their fields from the HDF file with this decorator. It will: 1: Make it so the data is load from disk on the first access and stored in memory for every further access. 2: Report an understandable error if the field isn’t found in the HDF file. 3: Make the accessors work even if the the object isn’t associated with an HDF file.

classmethod create(settings, meanReflectance, rms_t_squared, reflectance, diffusion, imCubeIdTag, referenceIdTag, extraReflectionIdTag)[source]

Used to create results from existing variables. These results can then be saved to file.

Returns

A new instance of analysis results.

static fields()[source]
Returns

A sequence of string names of the datafields that the analysis results contains.

static fileName2Name(fileName)[source]
Parameters

fileName (str) – The filename that the HDF file was saved as.

Return type

str

Returns

The analysis name.

classmethod load(directory, name)

Load an analyis results object from an HDF5 file located in directory.

Parameters
  • directory (str) – The path to the folder containing the file.

  • name (str) – The name of the analysis.

Return type

AbstractHDFAnalysisResults

Returns

A new instance of analysis results loaded from file.

static name2FileName(name)[source]
Parameters

name (str) – An analysis name.

Return type

str

Returns

The corresponding file name for the hdf5 file.

toHDF(directory, name, overwrite=False, compression=None)

Save the AnalysisResults object to an HDF file in directory. The name of the file will be determined by name. If you want to know what the full file name will be you can use this class’s name2FileName method.

Parameters
  • directory (str) – The path to the folder to save the file in.

  • name (str) – The name of the analysis. This determines the file name.

  • overwrite (bool) – If True then any existing file of the same name will be replaced.

  • compression (Optional[str]) – The value of this argument will be passed to h5py.create_dataset for numpy arrays. See h5py documentation for available options.

diffusion

A 2D array indicating the diffusion at each position in the image.

extraReflectionIdTag

The idtag of the extra reflection correction that was used.

imCubeIdTag

The idtag of the dynamics cube that was analyzed.

meanReflectance

A 2D array giving the reflectance of the image averaged over the full spectra.

moduleVersion

The version of PWSpy code that this file was saved with.

referenceIdTag

The idtag of the dynamics cube that was used as a reference for normalization.

reflectance

A dynamics cube containing the 3D reflectance array after all corrections and analysis.

rms_t_squared

A 2D array giving the spectral variance at each position in the image.

settings

The settings used to generate these results.

time

The time that the analysis was performed.