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 NDdatasets.

  • 1D spectroscopic data (e.g., *.spa files) in a given directory are grouped 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

  • read_dirNDDataset or list of NDDataset .

  • Depending on the python version, the order of the datasets in the list may change.

See also

read_topspin

Read TopSpin Bruker NMR spectra.

read_omnic

Read Omnic spectra.

read_opus

Read OPUS spectra.

read_spg

Read Omnic *.spg grouped spectra.

read_spa

Read Omnic *.Spa single spectra.

read_srs

Read Omnic series.

read_csv

Read CSV files.

read_zip

Read Zip files.

read_matlab

Read Matlab files.

Examples

>>> scp.preferences.csv_delimiter = ','
>>> A = scp.read_dir('irdata')
>>> len(A)
4
>>> B = scp.NDDataset.read_dir()