예제 #1
0
파일: test_models.py 프로젝트: OSSOS/MOP
 def create_real_first_image(self, path="data/testimg.fits"):
     # Put a real fits image on the first source, first observation
     apcor = ApcorData.from_string("4 15   0.19   0.01")
     hdulist = fits.open(self.get_abs_path(path))
     first_reading = self.model.get_current_workunit().get_sources()[0].get_readings()[0]
     self.first_snapshot = SourceCutout(first_reading, hdulist, apcor)
     self.image_manager.on_singlet_image_loaded(self.first_snapshot)
예제 #2
0
 def create_real_first_image(self, path="data/testimg.fits"):
     # Put a real fits image on the first source, first observation
     apcor = ApcorData.from_string("4 15   0.19   0.01")
     hdulist = fits.open(self.get_abs_path(path))
     first_reading = self.model.get_current_workunit().get_sources(
     )[0].get_readings()[0]
     self.first_snapshot = SourceCutout(first_reading, hdulist, apcor)
     self.image_manager.on_singlet_image_loaded(self.first_snapshot)
예제 #3
0
    def test_from_raw_string(self):
        rawstr = "4 15   0.19   0.01\n"

        # NOTE: not undertest
        self.parsed = ApcorData.from_string(rawstr)

        assert_that(self.parsed.ap_in, equal_to(self.ap_in))
        assert_that(self.parsed.ap_out, equal_to(self.ap_out))
        assert_that(self.parsed.apcor, equal_to(self.apcor))
        assert_that(self.parsed.apcor_err, equal_to(self.apcor_err))
예제 #4
0
    def setUp(self):
        """
        Example data from
        vos://cadc.nrc.ca~vospace/OSSOS/dbimages/1616681/ccd22/1616681p22.apcor
        """
        self.ap_in = 4
        self.ap_out = 15
        self.apcor = 0.19
        self.apcor_err = 0.01

        self.undertest = ApcorData(self.ap_in, self.ap_out, self.apcor,
                                   self.apcor_err)
예제 #5
0
    def setUp(self):
        test_file = self.path("realstest2.measure3.reals.astrom")
        astrom_data = AstromParser().parse(test_file)

        self.reading = astrom_data.get_sources()[0].get_reading(0)

        # Load the real image
        hdulist = fits.open(self.path("cutout-1616687p.fits"))

        with open(self.path("1616687p10.apcor")) as fh:
            apcor = ApcorData.from_string(fh.read())

        # NOTE: the test image
        # vos://cadc.nrc.ca~vospace/OSSOS/dbimages/1616687/1616687p.fits
        # has cutout: [11][1449:1199,1429:1179] and is inverted.
        #
        # Therefore the first reading at (772.13, 3334.70) in observed
        # coordinates is at
        # (NAX1 - max cutout x, NAX2 - max cutout y)
        #  = (2112 - 1449, 4644 - 1429) = (663, 3215)
        self.original_pixel_x = 663
        self.original_pixel_y = 3215

        self.original_observed_x = 772.13
        self.original_observed_y = 3334.70

        x_offset = self.original_observed_x - self.original_pixel_x
        y_offset = self.original_observed_y - self.original_pixel_y

        self.undertest = SourceCutout(self.reading, hdulist,
                                      CoordinateConverter(x_offset, y_offset),
                                      apcor=apcor)

        assert_that(self.undertest.observed_x, equal_to(self.original_observed_x))
        assert_that(self.undertest.observed_y, equal_to(self.original_observed_y))

        assert_that(self.undertest.pixel_x, equal_to(self.original_pixel_x))
        assert_that(self.undertest.pixel_y, equal_to(self.original_pixel_y))