pwspy.analysis.pws.PWSAnalysisResults

class pwspy.analysis.pws.PWSAnalysisResults(file=None, variablesDict=None, analysisName=None)[source]

Bases: pwspy.analysis._abstract.AbstractHDFAnalysisResults

A representation of analysis results. Items are loaded from disk using lazy-loading strategy and are then cached in memory.

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, reflectance, meanReflectance, rms, polynomialRms, autoCorrelationSlope, rSquared, ld, imCubeIdTag, referenceIdTag, extraReflectionTag)[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.

releaseMemory()[source]

The cached properties continue to stay in RAM until they are deleted, this method deletes all cached data to release the memory.

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.

autoCorrelationSlope

A 2D array giving the slope of the ACF of the spectra at each position in the image.

extraReflectionTag

The idtag of the extra reflectance correction used.

imCubeIdTag

The idtag of the acquisition that was analyzed.

ld

A 2D array giving Ld. A parameter derived from RMS and the ACF slope.

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.

opd

The 3D array of values, opdIndex: The sequence of OPD values associated with each 2D slice along the 3rd axis of the opd data.

Type

A tuple containing

Type

opd

polynomialRms

A 2D array giving the variance of the polynomial fit that was subtracted from the reflectance before calculating RMS.

rSquared

A 2D array giving the r^2 coefficient of determination for the linear fit to the logarithm of the ACF. This basically tells us how confident to be in the autoCorrelationSlope.

referenceIdTag

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

reflectance

The KCube containing the 3D reflectance data after all corrections and analysis.

rms

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

settings

The settings used for the analysis

time

The time that the analysis was performed.