Skip to content

Commit

Permalink
adding mwmvisit to spectra model
Browse files Browse the repository at this point in the history
  • Loading branch information
havok2063 committed Dec 5, 2024
1 parent 092f162 commit 60e9a3f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
13 changes: 13 additions & 0 deletions python/valis/io/model_spectra_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,18 @@
"error": {"extension": 1, "type": "table", "column": "ivar"},
"mask": {"extension": 1, "type": "table", "column": "pixel_flags"}
}
},
{
"product": "mwmVisit",
"aliases": ["mwmvisit"],
"pipeline": "astra",
"multi_spectra": true,
"spectral_extensions": ["BOSS/APO", "BOSS/LCO", "APOGEE/APO", "APOGEE/LCO"],
"parameters": {
"flux": {"extension": 1, "type": "table", "column": "flux", "units": "1e-17 * erg / (s * cm**2 * Angstrom)"},
"wavelength": {"extension": 1, "type": "wcscon", "column": "LOGLIN", "nwave": "NPIXELS", "units": "Angstrom", "crval": "CRVAL", "cdelt": "CDELT"},
"error": {"extension": 1, "type": "table", "column": "ivar"},
"mask": {"extension": 1, "type": "table", "column": "pixel_flags"}
}
}
]
7 changes: 7 additions & 0 deletions python/valis/io/spectra.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ def extract_data(product: str, filepath: str, multispec: Union[int, str] = None)
vals = vals.value

data[param] = vals
elif info['type'] == "wcscon":
# extract the correct wcs header column
npixels = hdulist[extension].header[info['nwave']]
cdelt = hdulist[extension].header[info['cdelt']]
crval = hdulist[extension].header[info['crval']]

data[param] = 10 ** (np.arange(npixels) * cdelt + crval)
else:
data[param] = hdulist[extension].data

Expand Down

0 comments on commit 60e9a3f

Please sign in to comment.