specio.specread

specio.specread(uri, format=None, tol_wavelength=1e-05, **kwargs)[source][source]

Read spectra in a given format.

Reads spectrum from the specified file. Returns a list or a specio.Spectrum instance containing the data, wavelength, and the meta data

Parameters:

uri : {str, list of str, file}

The resource to load the spectrum from. The input accepted are:

  • a filename or a list of filename of spectrum;
  • a filename or a list of filename containing a wildcard (e.g. './data/*.spc');
  • a file object.

format : str

The format to use to read the file. By default specio selects the appropriate for you based on the filename and its contents.

tol_wavelength : float, optional

Tolerance to merge spectrum when their wavelength are slightly different.

kwargs : dict

Further keyword arguments are passed to the reader. See help() to see what arguments are available for a particular format.

Returns:

spectrum : specio.core.Spectrum or a list of specio.core.Spectrum

A specio.core.Spectrum or a list of specio.core.Spectrum. A specio.core.Spectrum contains:

  • a 1D ndarray of shape (n_wavelength,) or 2D ndarray of shape (n_spectra, n_wavelength) amplitudes;
  • a 1D ndarray of shape (n_wavelength,) wavelength;
  • a dict meta.