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 singleNDDataset
, 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 list ofNDDataset
) – The returned dataset(s). Depending on the python version, the order of the datasets in the list may change.
See also
read
Generic reader inferring protocol from the filename extension.
read_zip
Read Zip archives (containing spectrochempy readable files)
read_opus
Read OPUS spectra.
read_labspec
Read Raman LABSPEC spectra (
.txt
).read_omnic
Read Omnic spectra (
.spa
,.spg
,.srs
).read_soc
Read Surface Optics Corps. files (
.ddr
,.hdr
or.sdr
).read_galactic
Read Galactic files (
.spc
).read_quadera
Read a Pfeiffer Vacuum’s QUADERA mass spectrometer software file.
read_topspin
Read TopSpin Bruker NMR spectra.
read_csv
Read CSV files (
.csv
).read_jcamp
Read Infrared JCAMP-DX files (
.jdx
,.dx
).read_matlab
Read Matlab files (
.mat
,.dso
).read_carroucell
Read files in a directory after a carroucell experiment.
read_wire
Read REnishaw Wire files (
.wdf
).
Examples
>>> scp.preferences.csv_delimiter = ',' >>> A = scp.read_dir('irdata') >>> len(A) 4
>>> B = scp.read_dir()