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.,
.spafiles) 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 (
NDDatasetorScpObjectListofNDDataset) – The returned dataset(s). When several datasets are returned without merging, the result is a list-likeScpObjectListwith 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.readGeneric reader inferring protocol from the filename extension.
spectrochempy.read_zipRead Zip archives (containing spectrochempy readable files)
spectrochempy.read_opusRead OPUS spectra.
spectrochempy.read_labspecRead Raman LABSPEC spectra (
.txt).spectrochempy.read_omnicRead Omnic spectra (
.spa,.spg,.srs).spectrochempy.read_socRead Surface Optics Corps. files (
.ddr,.hdror.sdr).spectrochempy.read_spcRead Galactic files (
.spc).spectrochempy.read_quaderaRead a Pfeiffer Vacuum’s QUADERA mass spectrometer software file.
spectrochempy.read_csvRead CSV files (
.csv).spectrochempy.read_matlabRead Matlab files (
.mat,.dso).spectrochempy.read_wireRead 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()