spyfit.io.sfit4.read_spectra

spyfit.io.sfit4.read_spectra(filename, spdim='spectrum', idim='iteration', wcoord='spec_wn', scoord='spec_scan', bcoord='spec_band', parse_sp_header=None)

Read observed and fitted spectra in SFIT4 ascii files.

Use this function to load ‘out.pbpfile’.

Parameters:

filename : str

Name or path to the file.

spdim : str

Name of the dimension of the spectral data (default: ‘spectra’). spectral data for all fitted micro-windows (i.e., bands and scans) will be flattened as a 1-d array.

idim : str

Name of the iteration dimension (default: ‘iteration’). This is not very useful here as ‘out.pbpfile’ stores spectral data for only the last iteration but this is to be consistent with data returned by the read_single_spectrum and read_single_spectra functions.

wcoord : str

Name of the wavenumber coordinate for spectral data (default: ‘spec_wn’).

scoord : str

Name of the coordinate for spectral scans (default: ‘spec_scan’).

bcoord : str

Name of the coordinate for spectral bands (default: ‘spec_band’).

parse_sp_header : callable or None

A callable wich must accept the header line of a spectrum as input and must return a dictionary of extracted metadata that will be added in the attributes of the observed spectrum entry. If None (default), only the plain header line (string) will be added in the attributes.

Returns:

datase t : dict

A CDM-structured dictionary.