spectrochempy.read_dir

read_dir(directory=None, **kwargs)[source]

Read an entire directory.

Open a list of readable files in a and store data/metadata in a dataset or a list of datasets according to the following rules :

  • 2D spectroscopic data (e.g. valid .spg files or matlab arrays, etc…) from distinct files are stored in distinct `NDdataset`s.

  • 1D spectroscopic data (e.g., .spa files) in a given directory are merged into single NDDataset, providing their unique dimension are compatible. If not, an error is generated.

  • non-readable files are ignored

Parameters:

directory (str or pathlib) – Folder where are located the files to read.

Returns:

object (NDDataset or ScpObjectList of NDDataset) – The returned dataset(s). When several datasets are returned without merging, the result is a list-like ScpObjectList with convenience helpers such as .names, .select_largest(), .select_by_name(), .filter_by_ndim(), and .filter_by_shape(). Depending on the python version, the order of the datasets in the list may change.

See also

spectrochempy.read

Generic reader inferring protocol from the filename extension.

spectrochempy.read_zip

Read Zip archives (containing spectrochempy readable files)

spectrochempy.read_opus

Read OPUS spectra.

spectrochempy.read_labspec

Read Raman LABSPEC spectra (.txt).

spectrochempy.read_omnic

Read Omnic spectra (.spa, .spg, .srs).

spectrochempy.read_soc

Read Surface Optics Corps. files (.ddr , .hdr or .sdr).

spectrochempy.read_spc

Read Galactic files (.spc).

spectrochempy.read_quadera

Read a Pfeiffer Vacuum’s QUADERA mass spectrometer software file.

spectrochempy.read_csv

Read CSV files (.csv).

spectrochempy.read_matlab

Read Matlab files (.mat, .dso).

spectrochempy.read_wire

Read Renishaw Wire files (.wdf).

Examples

>>> scp.preferences.csv_delimiter = ','
>>> A = scp.read_dir('irdata')
>>> len(A)
4
>>> names = A.names
>>> len(names)
4
>>> largest = A.select_largest()
>>> largest.ndim
2
>>> B = scp.read_dir()