Closed themiyan closed 1 year ago
Hi Themiya! Sorry, I guess this should be better documented. Indeed you can't use a string here, it must be an integer. The HDU index is 0-based, not 1-based, so the primary HDU has index 0, the first extension has index 1, etc. So lsf_hdu=5
should be what you want.
The data in the HDU should be a 1D image, just like the flux and error spectra, and not a table. The 1D image must have the same wavelength sampling as the flux spectrum (CDELT, etc.).
I'll try to take a look at the data when I get a chance.
Ok, I just had a look at your input, at first glance it looks good. I'll try to run it through.
Well that didn't take long; slinefit
assumes the LSF is in microns, but yours seems to be in Angstroms. You should convert the LSF to microns. In the meantime, I'll change the code to read the BUNIT
keyword rather than blindly assume microns, so in the next commit you'll have to set BUNIT
in the LSF HDU (either to micron
or angstrom
).
After adding BUNIT = angstrom
to the header, and the latest commit 97baeb7d4bf0dbe0772a6db81180ebcce1dd09ef, it seems to be alright (white: observed, yellow: best fit model without LSF, red: best with model with LSF)
The command I used:
slinefit onedspec_obs200_12629_for_slinefit.fits fit_continuum_template template_dir="../bin/templates" full_range use_global_chi2 residual_rescale z0=3.2 dz=0.5 delta_z=0.1 flux_hdu=1 error_hdu=2 lsf_hdu=5 verbose save_model
Output without LSF:
note: rescaling uncertainties from global residual (10.3732)
best redshift: 3.20523 + 0.00212125 - 0.000719856 (chi2: 354.76, reduced: 1.20258, odds: 0.996995)
Output with LSF:
note: rescaling uncertainties from global residual (10.3056)
best redshift: 3.20662 + 0.00486101 - 0.00455042 (chi2: 321.487, reduced: 1.08979, odds: 0.955948)
Great I get the same results as you when I add the BUNIT = angstrom
keyword.
Also I was just being stupid, I interpolated the sigma grid to be microns but forgot sigma is not dimensionless unlike R, so didn't do that conversion.
I think for the PRISM mode in NIRSpec LSF will be important, specially for breaks around 1-2 microns. The chi2 is quite better after errors are scaled too.
Thanks Corentin!
We did some sims. Clear improvement with the LSF!
Hi Corentin,
Thanks for the LSF 🍻🍻🍻🍻
Trying to get it run but running into a problem as follows:
This could be just the string not being converted correctly, I've tried caps etc.
It does work if I give an integer but cannot give the correct number. For example when using tabular input LSF should be the 6th integer (counting from 1).
It works when
lsf_hdu=5
is given but fit fails because it is the wrong extension.The input can be found here: https://www.dropbox.com/scl/fi/p3iqxeaemjvb1lsimhj1n/onedspec_obs200_12629_for_slinefit.fits?rlkey=5mynpgwdddlbwl04yc5fiesqe&dl=0