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

utils_c.interp.interp_conserve_c lose flux at particular wavelength grid #90

Open
Fmajor opened this issue Jun 14, 2022 · 1 comment
Open

Comments

@Fmajor
Copy link

Fmajor commented Jun 14, 2022

from grizli.utils_c import interp
iy = interps.interp_conserve_c(ix, x, y, integrate=0, left=0, right=0)

This function may lose flux at boundary points at some particular wavelength grid

the origin x,y is from the sensitivity of beam B
the ix is the lam calculate with axeconf.get_beam_trace

In the below figures, I do interp_conserve_c using three methods
jin method is my method, xin method is from Xin Zhang

trapz_s
In this wave grid, all three method are consistent

trapz_d
However, In this wave grid, the grizli method seems to lose flux (blue dashed line, in the left bottom point)

@Fmajor
Copy link
Author

Fmajor commented Jun 14, 2022

grizli-interp-function-debug-data.fits.txt

here is the data for you to debug, rename it to fits type.

Filename: ./grizli-interp-function-debug-data.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU       4   ()
  1                1 BinTableHDU     29   5301R x 3C   ['D', 'D', 'D']
  2                1 BinTableHDU     12   60R x 2C   ['D', 'D']
import astropy.io.fits as fits
from astropy.table import Table
dobj = fits.open('./grizli-interp-function-debug-data.fits')
sens = Table.read(dobj[1])
lams = Table.read(dobj[2])
x = sens['WAVELENGTH'].data.byteswap().newbyteorder()
y = sens['SENSITIVITY'].data.byteswap().newbyteorder()
lam0 = lams['lam0'].data.byteswap().newbyteorder()
lam1 = lams['lam1'].data.byteswap().newbyteorder()

lam0 is the wave grid in figure2 (the bad one)
lam1 is the wave grid in figure1 (the good one)

@Fmajor Fmajor changed the title utils_c.interp.interp_conserve_c lose flux at wavelength grid utils_c.interp.interp_conserve_c lose flux at particular wavelength grid Jun 14, 2022
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

1 participant