Skip to content

Commit 47b1c6f

Browse files
committed
fix bug where autocentroid would fail to index correctly if crop size was larger than frame size
1 parent 3c48aea commit 47b1c6f

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

src/vampires_dpp/analysis.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ def safe_annulus_sum(frame, Rin, Rout, center=None):
6767
return flux[0], fluxerr[0]
6868

6969

70-
def estimate_strehl(*args, **kwargs):
71-
raise NotImplementedError()
72-
73-
7470
def analyze_fields(
7571
cube,
7672
cube_err,

src/vampires_dpp/cli/centroids.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ def centroid(config: Path, filenames, num_proc, outdir, manual, plot):
124124
centroids = get_psf_centroids_manual(cams=cams, npsfs=npsfs)
125125

126126
else:
127-
name = paths.aux / f"{pipeline_config.name}_raw_psf"
127+
name = paths.aux / f"{pipeline_config.name}_mean_image"
128128
# choose 4 to 20 files, depending on file size (avoid loading more than 500 frames, ~2GB of MBI)
129-
number_files = int(max(4, min(10, 500 // table["NAXIS3"].median())))
129+
number_files = int(max(2, min(10, 500 // table["NAXIS3"].median())))
130130
input_hduls_dict = create_raw_input_psfs(table, basename=name, max_files=number_files)
131131
centroids = {}
132132
for key, input_hdul in input_hduls_dict.items():

src/vampires_dpp/image_registration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,9 @@ def autocentroid_hdul(
409409
# find centroid of image with square scaling to help bias towards PSF
410410
rough_ctr = centroids.centroid_com(cutout.data**2, mask=np.isnan(cutout.data))
411411
# take a large crop, large enough to see satellite spots plus misregistration
412-
rough_cutout = Cutout2D(cutout.data, rough_ctr, crop_size, mode="partial")
412+
rough_cutout = Cutout2D(
413+
cutout.data, rough_ctr, min(*cutout.shape[-2:], crop_size), mode="partial"
414+
)
413415
# high-pass filter the data with a large median-- note, this requires the data to have
414416
# a certain level of S/N or it will wipe out the satellite spots. Therefore it's only suggested
415417
# to run the autocentroid on a big stack of mean-combined data instead of individual frames

src/vampires_dpp/pipeline/pipeline.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ def get_centroids(self):
176176
return self.centroids
177177

178178
def get_reproject_tforms(self):
179+
if not ("cam1" in self.centroids and "cam2" in self.centroids):
180+
self.reproject_tforms = None
181+
return self.reproject_tforms
179182
cam1_centroids = self.centroids["cam1"].copy()
180183
cam2_centroids = self.centroids["cam2"].copy()
181184
# flip cam1 on y!!

0 commit comments

Comments
 (0)