Ejemplo n.º 1
0
    def test_phot_mag(self):
        fits_filename = self.get_abs_path("data/1616681p22.fits")
        x_in = 560.06
        y_in = 406.51
        ap = 4
        insky = 11
        outsky = 15
        maxcount = 30000.0
        exptime = 1.0

        swidth = outsky - insky
        apcor = 0.0

        x, y, mag, magerr = daophot.phot_mag(fits_filename,
                                             x_in,
                                             y_in,
                                             aperture=ap,
                                             sky=insky,
                                             swidth=swidth,
                                             apcor=apcor,
                                             maxcount=maxcount,
                                             exptime=exptime)

        assert_that(x, close_to(560.000, DELTA))
        assert_that(y, close_to(406.600, DELTA))
        assert_that(mag, close_to(24.769, DELTA))
        # NOTE: minor difference in magnitude error: 0.290 vs 0.291
        assert_that(magerr, close_to(0.290, 0.0011))
Ejemplo n.º 2
0
Archivo: source.py Proyecto: ijiraq/MOP
    def get_observed_magnitude(self, centroid=True):
        # NOTE: this import is only here so that we don't load up IRAF
        # unnecessarily (ex: for candidates processing).
        """
        Get the magnitude at the current pixel x/y location.

        :return: Table
        """

        max_count = float(self.astrom_header.get("MAXCOUNT", 30000))
        (x, y, hdulist_index) = self.pixel_coord
        tmp_file = self._hdu_on_disk(hdulist_index)
        try:
            from ossos import daophot
            phot = daophot.phot_mag(tmp_file,
                                    x,
                                    y,
                                    aperture=self.apcor.aperture,
                                    sky=self.apcor.sky,
                                    swidth=self.apcor.swidth,
                                    apcor=self.apcor.apcor,
                                    zmag=self.zmag,
                                    maxcount=max_count,
                                    extno=1,
                                    centroid=centroid)
            if not self.apcor.valid:
                logger.error(f'No valid apcor, invalidating phot {phot}')
                phot['PIER'][0] = 1
            return phot
        except Exception as ex:
            print(ex)
            raise ex
        finally:
            self.close()
Ejemplo n.º 3
0
    def get_observed_magnitude(self):
        # NOTE: this import is only here so that we don't load up IRAF
        # unnecessarily (ex: for candidates processing).
        """
        Get the magnitude at the current pixel x/y location.

        :return: Table
        """

        max_count = float(self.astrom_header.get("MAXCOUNT", 30000))
        (x, y, hdulist_index) = self.pixel_coord
        tmp_file = self._hdu_on_disk(hdulist_index)
        try:
            from ossos import daophot
            phot = daophot.phot_mag(tmp_file,
                                    x, y,
                                    aperture=self.apcor.aperture,
                                    sky=self.apcor.sky,
                                    swidth=self.apcor.swidth,
                                    apcor=self.apcor.apcor,
                                    zmag=self.zmag,
                                    maxcount=max_count, extno=1)
            if not self.apcor.valid:
                phot['PIER'][0] = 1
            return phot
        finally:
            self.close()
Ejemplo n.º 4
0
Archivo: source.py Proyecto: drusk/MOP
    def get_observed_magnitude(self):
        if self.apcor is None:
            raise ValueError("Apcor data is required in order to calculate "
                             "observed magnitude.")

        # NOTE: this import is only here so that we don't load up IRAF
        # unnecessarily (ex: for candidates processing).
        from ossos import daophot

        maxcount = float(self.astrom_header["MAXCOUNT"])
        return daophot.phot_mag(self._hdulist_on_disk(),
                                self.pixel_x, self.pixel_y,
                                aperture=self.apcor.aperture,
                                sky=self.apcor.sky,
                                swidth=self.apcor.swidth,
                                apcor=self.apcor.apcor,
                                maxcount=maxcount)
Ejemplo n.º 5
0
    def get_observed_magnitude(self, x, y, maxcount=30000.0):
        if not self.has_apcord_data():
            raise ValueError("Apcor data is required in order to calculate "
                             "observed magnitude.")

        # NOTE: this import is only here so that we don't load up IRAF
        # unnecessarily (ex: for candidates processing).
        from ossos import daophot

        # TODO refactor: associate SourceReadings here?  Don't want to pass
        # in maxcount like this...
        return daophot.phot_mag(self.as_file().name, x, y,
                                aperture=self._apcordata.aperture,
                                sky=self._apcordata.sky,
                                swidth=self._apcordata.swidth,
                                apcor=self._apcordata.apcor,
                                maxcount=maxcount)
Ejemplo n.º 6
0
    def get_observed_magnitude(self, **kwargs):
        if self.apcor is None:
            raise TaskError("No aperture correction available. Photometry cannot be performed.  ")

        # NOTE: this import is only here so that we don't load up IRAF
        # unnecessarily (ex: for candidates processing).
        from ossos import daophot

        maxcount = float(self.astrom_header.get("MAXCOUNT", 30000))
        return daophot.phot_mag(self._hdulist_on_disk(),
                                   self.pixel_x, self.pixel_y,
                                   aperture=self.apcor.aperture,
                                   sky=self.apcor.sky,
                                   swidth=self.apcor.swidth,
                                   apcor=self.apcor.apcor,
                                   zmag=self.zmag,
                                   maxcount=maxcount)
Ejemplo n.º 7
0
    def test_phot_mag(self):
        fits_filename = self.get_abs_path("data/1616681p22.fits")
        x_in = 560.06
        y_in = 406.51
        ap = 4
        insky = 11
        outsky = 15
        maxcount = 30000.0
        exptime = 1.0

        swidth = outsky - insky
        apcor = 0.0

        mag = daophot.phot_mag(fits_filename, x_in, y_in, aperture=ap, sky=insky,
                               swidth=swidth, apcor=apcor, maxcount=maxcount,
                               exptime=exptime)

        assert_that(mag, close_to(24.769, DELTA))
Ejemplo n.º 8
0
    def get_observed_magnitude(self):
        if self.apcor is None:
            raise TaskError("Photometry cannot be performed.  "
                        "No magnitude calculated.")

        # NOTE: this import is only here so that we don't load up IRAF
        # unnecessarily (ex: for candidates processing).
        from ossos import daophot

        maxcount = float(self.astrom_header["MAXCOUNT"])
        return daophot.phot_mag(self._hdulist_on_disk(),
                                self.pixel_x, self.pixel_y,
                                aperture=self.apcor.aperture,
                                sky=self.apcor.sky,
                                swidth=self.apcor.swidth,
                                apcor=self.apcor.apcor,
                                zmag=self.zmag,
                                maxcount=maxcount)
Ejemplo n.º 9
0
    def get_observed_magnitude(self, x, y, maxcount=30000.0):
        if not self.has_apcord_data():
            raise ValueError("Apcor data is required in order to calculate "
                             "observed magnitude.")

        # NOTE: this import is only here so that we don't load up IRAF
        # unnecessarily (ex: for candidates processing).
        from ossos import daophot

        # TODO refactor: associate SourceReadings here?  Don't want to pass
        # in maxcount like this...
        return daophot.phot_mag(self.as_file().name,
                                x,
                                y,
                                aperture=self._apcordata.aperture,
                                sky=self._apcordata.sky,
                                swidth=self._apcordata.swidth,
                                apcor=self._apcordata.apcor,
                                maxcount=maxcount)
Ejemplo n.º 10
0
    def test_phot_mag(self):
        fits_filename = self.get_abs_path("data/1616681p22.fits")
        x_in = 560.06
        y_in = 406.51
        ap = 4
        insky = 11
        outsky = 15
        maxcount = 30000.0
        exptime = 1.0

        swidth = outsky - insky
        apcor = 0.0

        x, y, mag, magerr = daophot.phot_mag(fits_filename, x_in, y_in,
                                             aperture=ap, sky=insky,
                                             swidth=swidth, apcor=apcor,
                                             maxcount=maxcount,
                                             exptime=exptime)

        assert_that(x, close_to(560.000, DELTA))
        assert_that(y, close_to(406.600, DELTA))
        assert_that(mag, close_to(24.769, DELTA))
        # NOTE: minor difference in magnitude error: 0.290 vs 0.291
        assert_that(magerr, close_to(0.290, 0.0011))
Ejemplo n.º 11
0
    def test_phot_mag(self):
        fits_filename = self.get_abs_path("data/1616681p22.fits")
        x_in = 560.06
        y_in = 406.51
        ap = 4
        insky = 11
        outsky = 15
        maxcount = 30000.0
        exptime = 1.0

        swidth = outsky - insky
        apcor = 0.0

        mag = daophot.phot_mag(fits_filename,
                               x_in,
                               y_in,
                               aperture=ap,
                               sky=insky,
                               swidth=swidth,
                               apcor=apcor,
                               maxcount=maxcount,
                               exptime=exptime)

        assert_that(mag, close_to(24.769, DELTA))