desihub / gpu_specter

Scratch work for porting spectroperfectionism extractions to GPUs
BSD 3-Clause "New" or "Revised" License
2 stars 3 forks source link

old vs new psf incompatibility issues in ProjectionMatrix #1

Closed lastephey closed 1 year ago

lastephey commented 4 years ago

This notebook assumes that we are using an older style psf (for example, psf.fits which is included in this repo) and does not fully support using a newer psf (/global/cscratch1/sd/stephey/desitest/data/psfnight-r0.fits, for example). We should probably add some kind of

if old_psf:
    do one thing
else:
    do another thing

while we are loading the data to ensure psf compatibility.

In eval_coeffs, the line:

wavemin, wavemax = psfdata['WAVEMIN'][0], psfdata['WAVEMAX'][0]

must be changed to

wavemin, wavemax = psfdata.meta['WAVEMIN'], psfdata.meta['WAVEMAX']

for the new psf.

In eval_coeffs, there are no issues reading 'X' and 'Y' from the old psf. In the new psf, we must add some mechanism for reading 'X' and 'Y'. For now I borrowed from gausshermite (https://github.com/desihub/specter/blob/master/py/specter/psf/gausshermite.py#L76) and added in some additional logic (which may or may not be right):

    #and for X and Y do what gausshermite does
    from astropy.io import fits
    fx = fits.open('/global/cscratch1/sd/stephey/desitest/data/psfnight-r0.fits', memmap=False)
    data = fx['PSF'].data
    p['X'] = fx["XTRACE"].data
    p['Y'] = fx["YTRACE"].data

Finally, the way I am storing 'X' and 'Y' may be contributing to this last issue, which is a dimension mismatch in calc_pgh on line:

xedges = ((xedges - p['X'][ispec]%1)/p['GHSIGX'][ispec])
lastephey commented 1 year ago

Closing in the spirit of Closember.