pwspy.dataTypes.PwsMetaData

class pwspy.dataTypes.PwsMetaData(metadata, filePath=None, fileFormat=None, acquisitionDirectory=None)[source]

Bases: pwspy.dataTypes._metadata.MetaDataBase, pwspy.dataTypes._metadata.AnalysisManager

A class that represents the metadata of a PWS acquisition.

Parameters

metadata (dict) – The dictionary containing the metadata.

class FileFormats(value)[source]

Bases: enum.Enum

An enumeration.

static decodeHdfMetadata(d)

Attempt to extract a dictionary of metadata from an HDF5 dataset.

Parameters

d (Dataset) – The h5py.Dataset to load from.

Return type

dict

Returns

A dictionary containing the metadata

encodeHdfMetadata(d)

Save this metadata object as a json string in an HDF5 dataset.

Parameters

d (Dataset) – The h5py.Dataset to save the metadata to.

Return type

Dataset

classmethod fromNano(directory, lock=None, acquisitionDirectory=None)[source]

Attempt to load from NanoCytomic .mat file format

Parameters

directory (str) – The file path to load the metadata from.

Return type

PwsMetaData

Returns

A new instance of PwsMetaData loaded from file

classmethod fromOldPWS(directory, lock=None, acquisitionDirectory=None)[source]

Attempt to load from the old .mat file format.

Parameters

directory – The file path to load the metadata from.

Return type

PwsMetaData

Returns

A new instance of PwsMetaData loaded from file

classmethod fromTiff(directory, lock=None, acquisitionDirectory=None)[source]

Attempt to load from the standard TIFF file format.

Parameters

directory – The file path to load the metadata from.

Return type

PwsMetaData

Returns

A new instance of PwsMetaData loaded from file

getAnalyses()
Return type

List[str]

Returns

A list of the names of analyses that were found.

classmethod getAnalysesAtPath(path)
Parameters

path (str) – The path to search for analysis files.

Return type

List[str]

Returns

A list of the names of analyses that were found.

static getAnalysisResultsClass()[source]
Return type

t_.Type[AbstractHDFAnalysisResults]

Returns

The class that is used to contain analysis results for this acquisition type.

getThumbnail()[source]
Return type

ndarray

Returns

An image for quick viewing of the acquisition. No numerical significance.

loadAnalysis(name)
Parameters

name (str) – The name of the analysis to load.

Return type

AbstractHDFAnalysisResults

Returns

A new instance of an AnalysisResults object.

classmethod loadAny(directory, lock=None, acquisitionDirectory=None)[source]

Attempt to load from any file format.

Parameters

directory – The file path to load the metadata from.

Return type

PwsMetaData

Returns

A new instance of PwsMetaData loaded from file

metadataToJson(directory)[source]

Save the metadata to a JSON file.

Parameters

directory – The folder path to save the new file to.

removeAnalysis(name)
Parameters

name (str) – The name of the analysis to be deleted

saveAnalysis(analysis, name, overwrite=False)
Parameters
  • analysis (AbstractHDFAnalysisResults) – An AnalysisResults object to be saved.

  • name (str) – The name to save the analysis as

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

toDataClass(lock=None)[source]

Convert the metadata class to a class that loads the data

Parameters

lock (Optional[Lock]) – A Lock object used to synchronize IO in multithreaded and multiprocessing applications.

Return type

PwsCube

property binning: int

The binning setting used by the camera. This is needed in order to properly correct dark counts. This is generally extracted from metadata saved by Micromanager

Return type

int

property exposure: float

The exposure time of the camera expressed in milliseconds.

Return type

float

idTag
property pixelSizeUm: float

The pixelSize expressed in microns. This represents the length of each square pixel in object space. Binning has already been accounted for here. This is generally extracted from metadata saved my MicroManager

Return type

float

property systemName: str

The name of the system this was acquired on. The name is set in the PWS Acquisition Plugin for Micromanager.

Return type

str

property time: str

The date and time that the acquisition was taken.

Return type

str