grizli
grizli copied to clipboard
utils_c.interp.interp_conserve_c lose flux at particular wavelength grid
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
In this wave grid, all three method are consistent
However, In this wave grid, the grizli method seems to lose flux (blue dashed line, in the left bottom point)
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)