Skip to content

Commit

Permalink
fix bug where autocentroid would fail to index correctly if crop size…
Browse files Browse the repository at this point in the history
… was larger than frame size
  • Loading branch information
mileslucas committed Sep 17, 2024
1 parent 3c48aea commit 47b1c6f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/vampires_dpp/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ def safe_annulus_sum(frame, Rin, Rout, center=None):
return flux[0], fluxerr[0]


def estimate_strehl(*args, **kwargs):
raise NotImplementedError()


def analyze_fields(
cube,
cube_err,
Expand Down
4 changes: 2 additions & 2 deletions src/vampires_dpp/cli/centroids.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ def centroid(config: Path, filenames, num_proc, outdir, manual, plot):
centroids = get_psf_centroids_manual(cams=cams, npsfs=npsfs)

else:
name = paths.aux / f"{pipeline_config.name}_raw_psf"
name = paths.aux / f"{pipeline_config.name}_mean_image"
# choose 4 to 20 files, depending on file size (avoid loading more than 500 frames, ~2GB of MBI)
number_files = int(max(4, min(10, 500 // table["NAXIS3"].median())))
number_files = int(max(2, min(10, 500 // table["NAXIS3"].median())))
input_hduls_dict = create_raw_input_psfs(table, basename=name, max_files=number_files)
centroids = {}
for key, input_hdul in input_hduls_dict.items():
Expand Down
4 changes: 3 additions & 1 deletion src/vampires_dpp/image_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ def autocentroid_hdul(
# find centroid of image with square scaling to help bias towards PSF
rough_ctr = centroids.centroid_com(cutout.data**2, mask=np.isnan(cutout.data))
# take a large crop, large enough to see satellite spots plus misregistration
rough_cutout = Cutout2D(cutout.data, rough_ctr, crop_size, mode="partial")
rough_cutout = Cutout2D(
cutout.data, rough_ctr, min(*cutout.shape[-2:], crop_size), mode="partial"
)
# high-pass filter the data with a large median-- note, this requires the data to have
# a certain level of S/N or it will wipe out the satellite spots. Therefore it's only suggested
# to run the autocentroid on a big stack of mean-combined data instead of individual frames
Expand Down
3 changes: 3 additions & 0 deletions src/vampires_dpp/pipeline/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,9 @@ def get_centroids(self):
return self.centroids

def get_reproject_tforms(self):
if not ("cam1" in self.centroids and "cam2" in self.centroids):
self.reproject_tforms = None
return self.reproject_tforms
cam1_centroids = self.centroids["cam1"].copy()
cam2_centroids = self.centroids["cam2"].copy()
# flip cam1 on y!!
Expand Down

0 comments on commit 47b1c6f

Please sign in to comment.