Open astrolojo opened 7 months ago
Hi astrolojo,
Thanks for your comment. We will look into how to make this scaling more robust but a quick solution to your problem would be to try not fit the 6.2um (or any other noisy) PAH feature, since CAFE will likely not be able to provide a good fit anyway. To do so, you can edit the "pah_template.txt" file within the "tables/" folder in your CAFE installation directory. There you can simply comment (#) or delete the PAH lines you don't want to fit, and only leave the features located in less noisy parts of the spectra, so CAFE will be able to make a better scaling with a well measured PAH in the pah_inspection_order list.
Let us know if that works.
Tanio
Context: I am using CAFE to extract attenuation information in ~4500 MIRI/MRS spaxels. To minimize the runtime over such a large dataset, I’ve turned emission line fitting off so I can do my own Gaussian fitting separately, after subtracting off the best-fit continuum+PAH models. I should also note that some spaxels near the edge of my MRS Channel 1 field of view can have substantial gaps in spectral coverage, which I attribute to wavelength calibration and drizzling in the MRS pipeline. These gaps often include some or most of the interval between 5.5 and 6.5 micron.
Description: Because some edge spaxels are missing the 6.22 micron feature, CAFE ingests the spectra but fails to plot them, fit them, etc. Trying to do so raises the following error:
ValueError: Input spectrum does not contain any PAH band available to perform the PAH component scaling.
I understand from comments in the source code that
cafe_helper.init_feats()
“cannot deal with spectrum with gaps” and should raise an error if gaps are present. However, theValueError
persists even when the affected spectra have all NANs replaced with finite filler values. Also, the 7.6, 11.3, and 17.0 micron PAH features, which come later in the PAH inspection order, are always present without any gaps, so I would expect them to to be used instead forref_pah_wave
withincafe_helper.init_feats()
.Attempted solutions & potential explanations: Setting a non-zero
ref_pah_peak
may require Gaussian line fitting to be turned on, since it depends on having a nonzero value for the variable flux_left (on, e.g., lines 307 and 309). I can confirm, however, that theValueError
persists for these choppy spaxels even whenFitLINs = True
.I'm happy to give more information about my installation, other attempted hacks/solutions, etc as needed.