uvvis package

Submodules

uvvis.uvvis_spectrum module

class uvvis.uvvis_spectrum.UVVisSpectrum(filename: Optional[str] = None)

Bases: object

Class to read the Ocean Insight uv-vis spectral file format.

The file must be in ‘ASCII (with header data)’ text format.

Public properties:
  • _filename: a string containing the file’s location.

  • metadata: a dict containing the file’s headers (see also metadata_as_dict).

  • header: a dict containing the raw header information in the file.

  • data: a pandas.dataframe containing the spectral data.

Parameters

filename (str, optional) – An Ocean Insight uv-vis spectrum file in ‘ASCII (with header data)’ text format.

data() pandas.core.frame.DataFrame

The spectral x- and y-values as a pandas.DataFrame.

Returns

The XY pairs representing the UVVIS spectrum

Return type

pandas.DataFrame

filename() Optional[str]

Retrieve the name of the current spectrum file, or None if no filename is available.

Returns

The name of the currently active file

Return type

Optional[str]

header() dict

A dict containing the spectrum file’s headers.

Returns

A dict containing the spectrum file’s headers.

Return type

dict

metadata() dict

Retrieve metadata relating to the spectrum file as a dict.

Returns

A dict of the file’s metadata.

Return type

dict

metadata_as_json(indent=4) str

Convert the metadata to a JSON string.

Parameters

indent (int, optional) – Number of spaces to indent the JSON entries

Returns

A string containing the JSON text

Return type

str

read(filename: Optional[str] = None) None

Reads an Ocean Insight uv-vis spectrum file in ‘ASCII (with header data)’ text format.

If a _filename is present in the object, perhaps passed to the constructor, and no _filename is passed in here, the object’s _filename will be read.

If this function is passed a _filename, and one is already present, the _filename here will overwrite the object’s _filename and be read by this function.

If no _filename is already present, and one is not passed in here, a FileNotFoundError exception is raised.

Parameters

filename (str, optional) – An Ocean Insight uv-vis spectrum file in ‘ASCII (with header data)’ text format.

Raises

FileNotFoundError – Raised if no _filename is available, or the _filename is invalid.

Returns

This function returns no variable.

Return type

NoReturn

Module contents