Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pypeit/kcwitools
Browse files Browse the repository at this point in the history
  • Loading branch information
rongmon committed Feb 10, 2022
2 parents 4f9e562 + 6b0ea82 commit a85a336
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions kcwitools/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,14 @@ def extract_rectangle(xcen, ycen, wave, flux, var, deltax=5,deltay=5, outfile=No
"""

x_halfbox = (deltax-1)//2
y_halfbox= (deltay-1)//2



# create an error array assuming poisson noise for flux
sub_flux = flux[:, ycen-deltay:ycen+deltay, xcen-deltax:xcen+deltax]
sub_var = var[:, deltay:ycen+deltay, xcen-deltax:xcen+deltax]
sub_flux = flux[:, ycen-y_halfbox:ycen+y_halfbox+1, xcen-x_halfbox:xcen+x_halfbox+1]
sub_var = var[:, y_halfbox:ycen+y_halfbox+1, xcen-x_halfbox:xcen+x_halfbox+1]

spec = np.nansum(sub_flux, axis=(1,2))
err_spec = np.sqrt(np.sum(sub_var, axis=(1,2)))
Expand Down

0 comments on commit a85a336

Please sign in to comment.