Data loading

RamanSPy can be used to easily load experimental Raman spectroscopic data from different instruments and manufacturers. This is enabled through the introduction of custom data loading functions, which can parse and load different data formats into the appropriate Data containers.

Loading methods are available within the ramanspy.load module.

WITec Suite (WITec)

ramanspy.load.witec(filename: str, *, preprocess: Pipeline = None, laser_excitation: Number = 532) Spectrum[source]

Loads MATLAB files exported from WITec’s WITec Suite software.

Parameters:
  • filename (str) – The name of the MATLAB file to load. Full path or relative to working directory.

  • preprocess (Pipeline, optional) – A preprocessing pipeline to apply to the loaded data. If not specified (default), no preprocessing is applied.

  • laser_excitation (numeric, optional) – The excitation wavelength of the laser (in nm). Default is 532 nm.

Returns:

The loaded data.

Return type:

Union[core.Spectrum, core.SpectralImage]

Example

import ramanspy as rp

# Loading a single spectrum
raman_spectrum = rp.load.witec("path/to/file/witec_spectrum.mat")

# Loading Raman image data
raman_image = rp.load.witec("path/to/file/witec_image.mat")

# Loading volumetric Raman data from a list of Raman image files by stacking them as layers along the z-axis
image_layer_files = ["path/to/file/witec_image_1.mat", ..., "path/to/file/witec_image_n.mat"]
raman_image_stack = [rp.load.witec(image_layer_file) for image_layer_file in image_layer_files]
raman_volume =  rp.SpectralVolume.from_image_stack(raman_image_stack)

See also

Check the Loading WITec data tutorial for more information about how to load data from WITec instruments.

WiRE (Renishaw)

ramanspy.load.renishaw(filename: str, *, preprocess: Pipeline = None) SpectralContainer[source]

Loads spectra data from Ranishaw’s WiRE software .wdf files.

Parameters:
  • filename (str) – The name of the .wdf file to load. Full path or relative to working directory.

  • preprocess (Pipeline, optional) – A preprocessing pipeline to apply to the loaded data. If not specified (default), no preprocessing is applied.

Returns:

The loaded data.

Return type:

Union[core.SpectralContainer, core.Spectrum, core.SpectralImage]

Note

Implementation based on renishawWiRE.

Example

import ramanspy as rp

raman_spectrum = rp.load.renishaw("path/to/file/wire_data.wdf")

See also

Check the Loading Renishaw data tutorial for more information about how to load data from Renishaw instruments.

OceanView (Ocean Insight)

ramanspy.load.ocean_insight(filename: str, *, preprocess: Pipeline = None, laser_excitation: Number = 532) Spectrum[source]

Loads spectra data from Ocean Insight’s OceanView software .txt files.

Parameters:
  • filename (str) – The name of the .txt file to load. Full path or relative to working directory.

  • preprocess (Pipeline, optional) – A preprocessing pipeline to apply to the loaded data. If not specified (default), no preprocessing is applied.

  • laser_excitation (numeric, optional) – The excitation wavelength of the laser (in nm). Default is 532 nm.

Returns:

The loaded data.

Return type:

core.Spectrum

Example

import ramanspy as rp

# Loading a single spectrum
raman_spectrum = rp.load.ocean_insight("path/to/file/ocean_insight_spectrum.txt")

See also

Check the Loading Ocean Insight data tutorial for more information about how to load data from Ocean Insight instruments.

LabSpec (HORIBA)

ramanspy.load.labspec(filename: str, *, preprocess: Pipeline = None) SpectralContainer[source]

Loads spectra data from HORIBA’s LabSpec software .txt files.

Parameters:
  • filename (str) – The name of the .txt file to load. Full path or relative to working directory.

  • preprocess (Pipeline, optional) – A preprocessing pipeline to apply to the loaded data. If not specified (default), no preprocessing is applied.

Returns:

The loaded data.

Return type:

core.SpectralContainer or core.Spectrum

Example

import ramanspy as rp

# Loading Raman data from labspec
raman_object = rp.load.labspec("path/to/file/ocean_insight_spectrum.txtO")

Other

To allow the loading of other data file formats, simply define an appropriate data loading function, which parses the specific spectroscopic files of interest into SpectralContainer objects (e.g. SpectralContainer, Spectrum, SpectralImage or SpectralVolume).

Then, the core of RamanSPy will automatically deal with the rest of the workflow for you and you will be able to access all its preprocessing, analysis and data visualisation functionalities as usual.

See also

Check the Loading other data tutorial for more information about how to use RamanSPy to load other types of data.