desihub / desihub/gpu_specter

cpu - get_xyrange differs from specter

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Follow up from #31

Here is a simple test comparing `xyrange` between gpu_specter and specter:

```python
import pkg_resources
import numpy as np

from gpu_specter.extract.cpu import get_xyrange, get_spots
from gpu_specter.io import read_psf

import specter.psf

psffile = pkg_resources.resource_filename(
'gpu_specter', 'test/data/psf-r0-00051060.fits')

# gpu_specter
psfdata = read_psf(psffile)
wavelengths = np.arange(6000.0, 6050.0, 1.0)
spots, corners = get_spots(0, 25, wavelengths, psfdata)

ispec, nspec, iwave, nwave = (0, 5, 0, 25)

xyrange = get_xyrange(
ispec=ispec, nspec=nspec, iwave=iwave, nwave=nwave,
spots=spots, corners=corners
)

# specter
psf = specter.psf.load_psf(psffile)

specter_xyrange = psf.xyrange(
spec_range=(ispec, ispec+nspec),
wavelengths=(wavelengths[iwave], wavelengths[iwave+nwave])
)

assert xyrange == specter_xyrange, f'{xyrange} != {specter_xyrange}'
```

Currently this test fails:

```
AssertionError: (113, 159, 794, 851) != (113, 159, 793, 853)
```

The following plot compares a set patch pixels that are passed to `ex2d_patch`. The solid red lined rectangle and white dashed lined rectangle outline the pixels considered by spex and specter respectively. The patch sizes are slightly narrower in the y-direction by a couple of pixels on each end.

![image](https://user-images.githubusercontent.com/1648834/81420168-66464780-9104-11ea-9c49-4762eb6aa410.png)

The following plot compares `xyrange` used to determine the projection matrix in spex.
It seems to reasonably respond to adjustments to `wavepad`. It's a bit harder for me to figure out the xyrange used in specter for this part so I don't have a comparison for that right now.

![image](https://user-images.githubusercontent.com/1648834/81420143-5890c200-9104-11ea-91e3-8edf248fd9fe.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.