Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to simulate UV spectra with snlc_sim #1458

Closed
qnwang93 opened this issue Dec 11, 2024 · 6 comments
Closed

Unable to simulate UV spectra with snlc_sim #1458

qnwang93 opened this issue Dec 11, 2024 · 6 comments

Comments

@qnwang93
Copy link

I was trying to simulated some SNe Ia sample with UV spectra (wavelngth range ~ 1800-10000A) with snlc_sim.exe. However, the minimum wavelength of output spectra only goes down to 3600A. Is there a way to simulate the UV spectra?

I moved related files to $SNDATA/simlib/UVEXT/ . Sorry I don't have access to $SNANA_DEBUG so I made a new directory there. Feel free to move it to elsewhere applicable.

@qnwang93
Copy link
Author

uploaded a new input file named SALT3_SIM_UVEXT.INPUT to $SNANA_DEBUG/qnwang/UVEXT_spectral_wavelength/ and it should be able to reproduce this issue now.

@RickKessler
Copy link
Owner

There are two issues with your spectra being truncated.
First, when using TAKE_SPECTRUM keys in the SIMLIB file, the output spectrum is constrained to be within the wavelengths provided in the SNR_LAMOBS key. The reasoning is that the sim should only generate within the wave range of the actual data that these TAKE_SPECTRUM keys represent. It doesn't make sense to simulate & analyze spectra that extend in wavelength beyond actual data.

Beyond the first issue, there is additional wavelength truncation due to invalid ZP_SPECTROGRAPH calculation (see manual screen shot below). The current sim code rejects wave bins with ZP<0 (i.e., "invalid"), but does not give any warning, which can result in wave bins mysteriously not appearing in the output spectra. For your spectrograph, about 1/3 of the wave bins have invalid ZP_SPECTROGRAPH < 0, and this is because of the values in
MAGREF_LIST: 17.0 32.0
The bright end of 17 is fine, but the faint end of 32 is far too faint, resulting in a poor estimate of ZP. Would suggest increasing the faint end to be closer to the faint end of SN that pass your selection criteria.

To avoid future confusion, I added a diagnostic to print ZP(min, max) and to abort if more than 2% of the wave bins fail the ZP>0 cut. Your test job now aborts with this error:
FATAL ERROR ABORT called by INIT_SPECTROGRAPH_SEDMODEL
Invalid ZP_SPECTROGRAPH frac = 0.335; exceeds FRAC_ZP_INVALID_ABORT=0.020
Check MAGREF_LIST in spectrograph table

I checked this diagnostic on the Roman PRISM, and ZPmin/max is about 10-11, well above the ZP>0 requirement. If this 2% abort threshold is too severe, I can loosen it or add another sim-input key allowing user-defined threshold, but was hoping to avoid yet another input key.

ZP_SPECTROGRAPH

@qnwang93
Copy link
Author

update: I tried two new MAGREF_LIST setting (17-27 and 17-22) with updated SNRs.
With 17-27 I got the same error as invalid ZP_SPECTROGRAPH frac = 0.335.
With 17-22 setting, program aborted when I try to make new kcor files with following message:
`PRE-ABORT DUMP from function check_SNR_SPECTROGRAPH :
MAGREF[0,1] = 17.000, 32.000
FLUXREF_RATIO = 1.000000e-06
SNR1/SNR0[real,Poisson] = 0.100010, 0.001000
LOGSNR_RATIO = 2.000045 (TOL=0.699)

|```````|
<| o\ /o |>
| ' ; ' |
| ___ | ABORT program on Fatal Error.
| |' '| |
| `---' |
_______/

FATAL ERROR ABORT called by check_SNR_SPECTROGRAPH
Possible crazy SNR1/SNR0 ratio (way off from Poisson)
LAM=1980.3 TEXPOSE=30.00 (l=0, t=0)`

I've uploaded the related files under $SNANA_DEBUG/qnwang/UVEXT_spectral_wavelength/ and the above issue can be reproduced by running kcor.exe kcor_uvext.input in the above folder.

@RickKessler
Copy link
Owner

Your kcor file is still pointing to a spectrograph file with
MAGREF_LIST: 17.0 32.0

@qnwang93
Copy link
Author

Sorry for that. Now I corrected it and made a kcor file with MAGREF_LIST: 17.0 22.0 named as kcor_uvext.fits. Then I tried to run snlc_sim.exe SALT3_SIM_FORQINAN.INPUT again, and got the same error with previous 27/32 settings, i.e. invalid ZP_SPECTROGRAPH frac = 0.335.

@RickKessler
Copy link
Owner

sorry I lost track of this issue over the holidays. I just modified
sntools_spectrograph.h and set
ZPMIN_SPECTROGRAPH -10 (instead of zero) and now your simulation runs without aborting, but I have not checked the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants