def automatically_detect_star_in_box(self): pixscale = self.mosaic_box.unbinned_pixel_scale() xmin, ymin, xmax, ymax = self.acq_box.get_predicted_extents(pixscale) debug("...box extents = %r, %r, %r, %r" % (xmin, ymin, xmax, ymax)) # make sure the limits are integral and we only get pixels # inside the box to not skew the function fitting xmin = int(round(xmin + 1.0)) ymin = int(round(ymin + 1.0)) xmax = int(round(xmax - 1.0)) ymax = int(round(ymax - 1.0)) data = self.mosaic_box.get_data() boxdata = data[ymin:ymax,xmin:xmax] origin = np.array([xmin, ymin]) debug("...origin of data to be fit = %r" % origin) boxcenter = self.acq_box.get_center() - origin selection = get_selection_peak(boxdata, boxcenter, pixscale, verbose=is_debug_mode(), pixel_buffer=max(*boxdata.shape)) # force the entire box of data to be used self.handle_select_star(MosaicTileSelection(selection, origin, self.mosaic_box))
def test_finding_an_easier_center(): ad = AstroData(get_data_file_name("N20060131S0012.fits")) selection = get_selection_peak(ad.data, (489.07, 478.99), float(ad.pixel_scale())) predicted_center = selection.get_center() assert_tolerance(predicted_center, (489.11025833697016, 478.68088198208636), tolerance=0.02)
def test_finding_the_center_of_titan(): ad = AstroData(get_data_file_name("N20060131S0011.fits")) selection = get_selection_peak(ad.data, (391.0, 539.0), float(ad.pixel_scale())) predicted_center = selection.get_center() # the object is titan, doesn't have a very clearly defined center assert_tolerance(predicted_center, (384.87060478881705, 542.73266988305159), tolerance=0.07)
def test_out_of_bound_aperture(): ad = AstroData(get_data_file_name("N20060131S0012.fits")) selection = get_selection_peak(ad.data, (10.0, 10.0), float(ad.pixel_scale())) predicted_center = selection.get_center() # should be rather non-sense that is returned assert_tolerance(predicted_center, (50.0, 50.0), tolerance=50.0)
def get_fitted_star_selection(self, point, display_plot, cursor_listener=None, radial=False): # uses the entire tile of data instead of just the data inside the detected box point = point - self.mosaic_box.get_mosaic_offset() selection = get_selection_peak(self.mosaic_box.get_data(), point, self.mosaic_box.unbinned_pixel_scale(), verbose=display_plot, cursor_listener=cursor_listener, radial=radial) # don't need to specify an origin since we're not doing any subsetting in this function origin = np.array([0, 0]) return MosaicTileSelection(selection, origin, self.mosaic_box)