sheap.Utils.PathsFunctions module
Cross-matching spectra with metadata
This module provides utilities to cross-match lists of spectra stored in a directory with metadata stored in a CSV or pandas DataFrame. It supports both SDSS and DESI-style naming conventions.
Functions
- cross_pandas_spectra(path_dr16, path_data, name_csv)
Cross-match SDSS-style spectra (PLATE-MJD-FIBERID) with metadata.
- cross_pandas_spectra_desi(path_dr16, path_data, name_csv)
Cross-match DESI-style spectra with metadata.
- cross_pandas_spectra(path_dr16, path_data, name_csv)[source]
Cross-match SDSS spectra with entries in a metadata CSV.
- Parameters:
path_dr16 (str) – Base path to the DR16/DR data directory.
path_data (str) – Subdirectory under path_dr16 containing .fits spectra.
name_csv (str) – CSV file with metadata table. Must include
PLATE,MJD,FIBERID.
- Returns:
file_paths (list of str) – All spectrum file paths found in the directory.
objs_panda_paths_filtered (pandas.DataFrame or None) – Filtered DataFrame of metadata entries with matches to actual spectra. Includes a new column
fit_pathwith the resolved file paths. ReturnsNone, Noneif no matches were found.
- cross_pandas_spectra_desi(path_dr16, path_data, name_csv)[source]
Cross-match DESI spectra with entries in a metadata CSV.
- Parameters:
path_dr16 (str) – Base path to the DR16/DR data directory.
path_data (str) – Subdirectory under path_dr16 containing .fits spectra.
name_csv (str) – CSV file with metadata table. Must include
PLATE,MJD,FIBERID.
- Returns:
file_paths (list of str) – All spectrum file paths found in the directory.
objs_panda_paths_filtered (pandas.DataFrame or None) – Filtered DataFrame of metadata entries with matches to actual spectra. Includes a new column
fit_pathwith the resolved file paths. ReturnsNone, Noneif no matches were found.