Skip to content

Commit

Permalink
Merge pull request #23 from n-bachmann/master
Browse files Browse the repository at this point in the history
update LTV1 by difference in CRPIX1 between direct and spectral image
  • Loading branch information
sebastian-zieba authored Nov 22, 2023
2 parents 2a6fe89 + ac3e189 commit f7a9908
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/pacman/s10_direct_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,17 @@ def run10(eventlabel, workdir: Path, meta=None):
pos1_all = np.zeros(len(meta.files_di))
pos2_all = np.zeros(len(meta.files_di))

files_sp = meta.files_sp # spectra files
sp = fits.open(files_sp[0]) # opens first spectral file

#iterate over the direct images
for i, file in enumerate(tqdm(meta.files_di, desc='Determining Source Positions for Direct Images', ascii=True)):
ima = fits.open(file)

LTV1 = ima[1].header['LTV1'] #X offset to get into physical pixels
LTV2 = ima[1].header['LTV2'] #Y offset to get to physical pixels

#NEW: account for difference in CRPIX1 between direct image and spectroscopic images
LTV1 = ima[1].header['LTV1'] + int(abs(ima[1].header['CRPIX1'] - sp[1].header['CRPIX1'])) #X offset to get into physical pixels + difference in CRPIX1 between direct and spectral image
LTV2 = ima[1].header['LTV2'] + int(abs(ima[1].header['CRPIX1'] - sp[1].header['CRPIX1'])) #Y offset to get to physical pixels + difference in CRPIX1 between direct and spectral image

dat = ima[1].data[meta.di_rmin:meta.di_rmax, meta.di_cmin:meta.di_cmax] #cuts out stamp around the target star
err = ima[2].data[meta.di_rmin:meta.di_rmax, meta.di_cmin:meta.di_cmax]

Expand Down

0 comments on commit f7a9908

Please sign in to comment.