desihub / specsim

Quick simulations of spectrograph response
2 stars 10 forks source link

Reproduce the wavelength array in observed data. #122

Closed alxogm closed 10 months ago

alxogm commented 1 year ago

Changes required to reproduce the wavelength array in observed data.

One of the changes is to change the file $DESIMODEL/data/specpsf/psf-quicksim.fits for a modified version $DESIMODEL/data/specpsf/psf-quicksim-y1.fits, so that the minimum and maximum wavelength for each band correspond to the corresponding ones in the observed data.

@dkirkby would you agree on these modifications so that we are able to have the same wavelength arrays in our simulated spectra with quickquasars than in the data?

I'm setting the PR as draft in case there is much discussion on how to proceed.

alxogm commented 1 year ago

What changed in specpsf/psf-quicksim-y1.fits?

For the change to the per-camera wavelength grids, it looks like you are swapping bin edges and bin centers (which is at least confusing now, given the comments in the code). What is the problem this is trying to solve? Presumably the wavelengths in the new quicksim file are bin centers associated with each tabulated value (fwhm, neff, ...)? In that case, why aren't the +/-wavelength_step/2 adjustments needed to calculate the corresponding bin edges?

What I'm trying to obtain is an output wavelength array with the following limits


wave_min={'b':3600, 'r':5760, 'z':7520}
wave_max={'b':5800, 'r':7620, 'z':9824}

if I put exactly this limits in the quicksim file and leave everything else as is, I get a shifted array. I need to check again why exactly it was not working and post an example.

But putting this limits

wave_min={'b':3599.5, 'r':5759.5, 'z':7519.5}
wave_max={'b':5801, 'r':7621, 'z':9825}

in the quicksim file and removing the '+/-wavelength_step/2' did the work. I did it a time ago so I need to remind myself of the details.

alxogm commented 1 year ago

Hi @dkirkby sorry I didn’t followed up in the issue I mentioned above, it didn’t seemed so urgent at the time and then I kept delaying it. However, we have recently noticed that such changes might help reduce the delta_rp bias we see in Y5 mocks. I pushed a new change to the branch to restore the construction of self._output_wavelength as it was before… however I still don’t fully understand how that array is constructed from the files that are being passed, I have tried different modifications of specpsf/psf-quicksim.fits but I always get a shifted array from what I pass through that file…

So the closest I get is with the current file specpsf/psf-quicksim-y1.fits but still requires a shift of 0.1, this motivated my recent change. Would this make sense? If modifying specpsf/psf-quicksim.fits is not what I should be doing could you please advice on how to proceed?

alxogm commented 10 months ago

superseded by https://github.com/desihub/specsim/pull/125