Esempio n. 1
0
    def test_coord(self):

        c = Config({"DMS": Coord.fromDMS(10), "HMS": Coord.fromHMS(10)})

        assert c["DMS"].state == State.DMS
        assert c["HMS"].state == State.HMS

        c["DMS"] = 20
        assert c["DMS"] == Coord.fromDMS(20)

        c["HMS"] = 20
        assert c["HMS"] == Coord.fromHMS(20)
        assert c["HMS"] == Coord.fromDMS(20 * 15)
Esempio n. 2
0
    def test_coord (self):

        c = Config({"DMS": Coord.fromDMS(10),
                    "HMS": Coord.fromHMS(10)})

        assert c["DMS"].state == State.DMS
        assert c["HMS"].state == State.HMS

        c["DMS"] = 20
        assert c["DMS"] == Coord.fromDMS(20)

        c["HMS"] = 20
        assert c["HMS"] == Coord.fromHMS(20)
        assert c["HMS"] == Coord.fromDMS(20*15)
Esempio n. 3
0
    def find(self, near=None, limit=9999, **conditions):

        self.useCat("II/183A/")
        #self.useCat("II/118/")

        if conditions.get("closest", False):
            limit = 1
            self.useColumns(
                "*POS_EQ_RA_MAIN,*POS_EQ_DEC_MAIN,*ID_MAIN,Vmag,_r",
                sortBy="_r")
        else:
            self.useColumns(
                "*POS_EQ_RA_MAIN,*POS_EQ_DEC_MAIN,*ID_MAIN,Vmag,_r",
                sortBy="*POS_EQ_RA_MAIN")

        if near:
            self.useTarget(near, radius=conditions.get("radius", 45))

        x = super(Landolt, self).find(limit)

        for i in x:
            RA = i.pop("*POS_EQ_RA_MAIN")
            i["RA"] = Coord.fromHMS(str(RA))
            DEC = i.pop("*POS_EQ_DEC_MAIN")
            i["DEC"] = Coord.fromDMS(str(DEC))
            ID = i.pop("*ID_MAIN")
            i["ID"] = str(ID)
            V = i.pop("Vmag")
            i["V"] = str(V)
            i.pop("_r")

        return x
Esempio n. 4
0
    def find (self, near=None, limit=9999, **conditions):

        self.useCat("II/183A/")

        if conditions.get("closest", False):
            limit = 1
            self.useColumns("*POS_EQ_RA_MAIN,*POS_EQ_DEC_MAIN,*ID_MAIN,Vmag,_r", sortBy="_r")
        else:
            self.useColumns("*POS_EQ_RA_MAIN,*POS_EQ_DEC_MAIN,*ID_MAIN,Vmag,_r", sortBy="*POS_EQ_RA_MAIN")
        
        if near:
            self.useTarget(near, radius=conditions.get("radius", 45))
        
        x = super(Landolt,self).find(limit)

        for i in x:
            RA = i.pop("*POS_EQ_RA_MAIN")
            i["RA"] = Coord.fromHMS(str(RA))
            DEC = i.pop("*POS_EQ_DEC_MAIN")
            i["DEC"] = Coord.fromDMS(str(DEC))
            ID = i.pop("*ID_MAIN")
            i["ID"] = str(ID)
            V = i.pop("Vmag")
            i["V"] = str(V)
            i.pop("_r")

        return x 
Esempio n. 5
0
	def extinctionCoefficient(self,dbase,ra1,dec1,error,startTime1,endTime1,latitude1,outfile):
	  outname = outfile
	  self.ra = Coord.fromD(ra1)
	  self.dec = Coord.fromD(dec1)
	  self.error = error
	  self.starttime = startTime1
	  self.endtime = endTime1
	  self.latitude = Coord.fromHMS(latitude1)
	  self.outname = outfile
	  self.doDatabaseModeEC(dbase)
Esempio n. 6
0
    def getRa(self):
        self._write(":GR#")
        ret = self._readline()

        # meade bugs: sometimes, after use Move commands, getRa
        # returns a 1 before the RA, so we just check this and discard
        # it here
        if len(ret) > 9:
            ret = ret[1:]
        
        return Coord.fromHMS(ret[:-1])
Esempio n. 7
0
    def getRa(self):
        self._write(":GR#")
        ret = self._readline()

        # meade bugs: sometimes, after use Move commands, getRa
        # returns a 1 before the RA, so we just check this and discard
        # it here
        if len(ret) > 9:
            ret = ret[1:]

        return Coord.fromHMS(ret[:-1])
Esempio n. 8
0
    def setTargetRa(self, ra):  # converted to Astelco
        if not isinstance(ra, Coord):
            ra = Coord.fromHMS(ra)

        cmdid = self._tpl.set('OBJECT.EQUATORIAL.RA', ra.H, wait=True)

        ret = self._tpl.succeeded(cmdid)

        if not ret:
            raise AstelcoException("Invalid RA '%s'" % ra)

        return True
Esempio n. 9
0
    def test_parsing_conversion_hipparcos(self):
        """Parsing and comparing a subset of the Hipparcos and Tycho Catalog"""

        hipp = ascii.read(os.path.abspath(
            os.path.join(os.path.dirname(__file__), 'hipparcos-tycho.dat')),
                          format="tab")

        expected_ra = []
        expected_ra_str = []

        expected_dec = []
        expected_dec_str = []

        ra = []
        ra_hms = []

        dec = []
        dec_dms = []

        for row in hipp:
            expected_ra_str.append(row[0].strip())
            expected_dec_str.append(row[1].strip())

            expected_ra.append(float(row[2]))
            expected_dec.append(float(row[3]))

            ra.append(Coord.fromD(str(row[2])))
            dec.append(Coord.fromD(str(row[3])))

            ra_hms.append(Coord.fromHMS(str(row[0])))
            dec_dms.append(Coord.fromDMS(str(row[1])))

        for i in range(len(hipp)):
            assert expected_ra_str[i] == ra_hms[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"), \
                "ra: %s != coord ra: %s" % (expected_ra_str[i], ra_hms[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"))

            assert expected_dec_str[i] == dec_dms[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"), \
                "dec: %s != coord dec: %s" % (expected_dec_str[i], dec_dms[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"))

            # test conversion from D to D
            assert TestCoord.equal(ra[i].D, expected_ra[i], e=1e-8), \
                "ra: %.6f != coord ra: %.6f (%.6f)" % (expected_ra[i], ra[i].D, expected_ra[i]-ra[i].D)

            assert TestCoord.equal(dec[i].D, expected_dec[i], e=1e-8), \
                "dec: %.6f != coord dec: %.64f (%.6f)" % (expected_dec[i], dec[i].D, expected_dec[i]-dec[i].D)

            # test conversion from DMS HMS to D
            assert TestCoord.equal(ra_hms[i].D, expected_ra[i], e=1e-4), \
                "ra: %.6f != coord ra: %.6f (%.6f)" % (expected_ra[i], ra_hms[i].D, expected_ra[i]-ra_hms[i].D)

            assert TestCoord.equal(dec_dms[i].D, expected_dec[i], e=1e-4), \
                "dec: %.6f != coord dec: %.64f (%.6f)" % (expected_dec[i], dec_dms[i].D, expected_dec[i]-dec_dms[i].D)
Esempio n. 10
0
    def setTargetRa(self, ra):

        if not isinstance(ra, Coord):
            ra = Coord.fromHMS(ra)

        self._write(":Sr%s#" % ra.strfcoord("%(h)02d\xdf%(m)02d:%(s)02d"))

        ret = self._readbool()

        if not ret:
            raise MeadeException("Invalid RA '%s'" % ra)

        return True
Esempio n. 11
0
    def setTargetRa(self, ra):

        if not isinstance (ra, Coord):
            ra = Coord.fromHMS(ra)

        self._write(":Sr%s#" % ra.strfcoord("%(h)02d\xdf%(m)02d:%(s)02d"))

        ret = self._readbool()

        if not ret:
            raise MeadeException("Invalid RA '%s'" % ra)

        return True
Esempio n. 12
0
    def test_parsing_conversion_bsc(self):
        """Parsing and comparing to Vizier calculated values the entire 5th Bright Star Catalogue"""

        bsc = asciidata.open(os.path.abspath(
            os.path.join(os.path.dirname(__file__), 'bsc.dat')),
                             comment_char='#',
                             delimiter='\t')

        expected_ra = []
        expected_ra_str = []

        expected_dec = []
        expected_dec_str = []

        ra = []
        dec = []

        for i in range(bsc.nrows):
            expected_ra.append(bsc[0][i])
            expected_dec.append(bsc[1][i])

            expected_ra_str.append(bsc[2][i].strip())
            expected_dec_str.append(bsc[3][i].strip())

            ra.append(Coord.fromHMS(bsc[2][i]))
            dec.append(Coord.fromDMS(bsc[3][i]))

        for i in range(bsc.nrows):
            # use e=0.0001 'cause its the maximum we can get with Vizier data (4 decimal places only)

            # test conversion from HMS DMS to decimal
            assert TestCoord.equal(
                ra[i].D, expected_ra[i],
                e=1e-4), "ra: %.6f != coord ra: %.6f (%.6f)" % (
                    expected_ra[i], ra[i].D, expected_ra[i] - ra[i].D)
            assert TestCoord.equal(
                dec[i].D, expected_dec[i],
                e=1e-4), "dec: %.6f != coord dec: %.64f (%.6f)" % (
                    expected_dec[i], dec[i].D, expected_dec[i] - dec[i].D)

            # test strfcoord implementation
            assert expected_ra_str[i] == ra[i].strfcoord(
                "%(h)02d %(m)02d %(s)04.1f"), "ra: %s != coord ra: %s" % (
                    expected_ra_str[i],
                    ra[i].strfcoord("%(h)02d %(m)02d %(s)04.1f"))

            assert expected_dec_str[i] == dec[i].strfcoord(
                "%(d)02d %(m)02d %(s)02.0f"), "dec: %s != coord dec: %s" % (
                    expected_dec_str[i],
                    dec[i].strfcoord("%(d)02d %(m)02d %(s)02.0f"))
Esempio n. 13
0
    def test_parsing_conversion_hipparcos (self):
        """Parsing and comparing a subset of the Hipparcos and Tycho Catalog"""

        hipp = ascii.read(os.path.abspath(os.path.join(os.path.dirname(__file__), 'hipparcos-tycho.dat')), format="tab")

        expected_ra  = []
        expected_ra_str = []

        expected_dec = []
        expected_dec_str = []

        ra  = []
        ra_hms = []

        dec = []
        dec_dms = []

        for row in hipp:
            expected_ra_str.append(row[0].strip())
            expected_dec_str.append(row[1].strip())

            expected_ra.append(float(row[2]))
            expected_dec.append(float(row[3]))

            ra.append(Coord.fromD(str(row[2])))
            dec.append(Coord.fromD(str(row[3])))

            ra_hms.append(Coord.fromHMS(str(row[0])))
            dec_dms.append(Coord.fromDMS(str(row[1])))

        for i in range(len(hipp)):
            assert expected_ra_str[i] == ra_hms[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"), \
                "ra: %s != coord ra: %s" % (expected_ra_str[i], ra_hms[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"))

            assert expected_dec_str[i] == dec_dms[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"), \
                "dec: %s != coord dec: %s" % (expected_dec_str[i], dec_dms[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"))

            # test conversion from D to D
            assert TestCoord.equal(ra[i].D, expected_ra[i], e=1e-8), \
                "ra: %.6f != coord ra: %.6f (%.6f)" % (expected_ra[i], ra[i].D, expected_ra[i]-ra[i].D)

            assert TestCoord.equal(dec[i].D, expected_dec[i], e=1e-8), \
                "dec: %.6f != coord dec: %.64f (%.6f)" % (expected_dec[i], dec[i].D, expected_dec[i]-dec[i].D)

            # test conversion from DMS HMS to D
            assert TestCoord.equal(ra_hms[i].D, expected_ra[i], e=1e-4), \
                "ra: %.6f != coord ra: %.6f (%.6f)" % (expected_ra[i], ra_hms[i].D, expected_ra[i]-ra_hms[i].D)

            assert TestCoord.equal(dec_dms[i].D, expected_dec[i], e=1e-4), \
                "dec: %.6f != coord dec: %.64f (%.6f)" % (expected_dec[i], dec_dms[i].D, expected_dec[i]-dec_dms[i].D)
Esempio n. 14
0
    def fromRaDec(ra, dec, epoch=Epoch.J2000):

        try:
            if type(ra) is str:
                ra = Coord.fromHMS(ra)
            elif isinstance(ra, Coord):
                ra = ra.toHMS()
            else:
                try:
                    ra = Coord.fromH(float(ra))
                    ra = ra.toHMS()
                except ValueError:
                    raise ValueError(
                        "Invalid RA coordinate type %s. Expected numbers, strings or Coords."
                        % str(type(ra)))

            Position._checkRange(float(ra), 0, 360)

        except ValueError as e:
            raise ValueError("Invalid RA coordinate %s" % str(ra))
        except PositionOutsideLimitsError:
            raise ValueError(
                "Invalid RA range %s. Must be between 0-24 hours or 0-360 deg."
                % str(ra))

        try:
            if type(dec) is str:
                dec = Coord.fromDMS(dec)
            elif isinstance(dec, Coord):
                dec = dec.toDMS()
            else:
                try:
                    dec = Coord.fromD(float(dec))
                    dec = dec.toDMS()
                except ValueError:
                    raise ValueError(
                        "Invalid DEC coordinate type %s. Expected numbers, strings or Coords."
                        % str(type(dec)))

            Position._checkRange(float(dec), -90, 360)

        except ValueError as e:
            raise ValueError("Invalid DEC coordinate %s" % str(dec))
        except PositionOutsideLimitsError:
            raise ValueError(
                "Invalid DEC range %s. Must be between 0-360 deg or -90 - +90 deg."
                % str(dec))

        return Position((ra, dec), system=System.CELESTIAL, epoch=epoch)
Esempio n. 15
0
	def doFileModeEC(self,path):
	  self.path = path
	  #Initial setup variables, these will be passed to CalculateExtinctionCoefficient
	  fluxArr = []
	  altArr = []
	  for infile in glob.glob( os.path.join(path, '*.fits') ):
	    print "current file is: " + infile
	    #Read the Altitude from the FITS file
	    hdulist = pyfits.open(infile)
	    altCoord = Coord.fromHMS(hdulist[0].header['ALT'])
	    altArr.append(altCoord.toR())
	    #Set the latitude. This really only needs to be done once though.
	    latitude = Coord.fromHMS(hdulist[0].header['LATITUDE'])
	    #Get the RA and DEC for this star
	    ra = Coord.fromHMS(hdulist[0].header['RA'])
	    dec = Coord.fromHMS(hdulist[0].header['DEC'])
	    #Run the file through seeing
	    self.seeing.run(infile)
	    star = self.seeing.getStarClosestTo(ra, dec)
	    fluxArr.append(self.seeing.getFlux(star))
	  if debugmode:
	    print fluxArr
	    print altArr
	  print "Extinction Coefficient: " + str(self.computeExtinctionCoefficient(fluxArr, altArr))
    def fromRaDec (ra, dec, epoch=Epoch.J2000):

        try:
            if type(ra) == StringType:
                ra = Coord.fromHMS(ra)
            elif isinstance(ra, Coord):
                ra = ra.toHMS()
            else:
                try:
                    ra = Coord.fromH(float(ra))
                    ra = ra.toHMS()
                except ValueError:
                    raise ValueError("Invalid RA coordinate type %s. Expected numbers, strings or Coords." % str(type(ra)))

            Position._checkRange(float(ra), 0, 360)

        except ValueError, e:
            raise ValueError("Invalid RA coordinate %s" % str(ra))
Esempio n. 17
0
    def test_parsing_conversion_bsc (self):
        """Parsing and comparing to Vizier calculated values the entire 5th Bright Star Catalogue"""

        bsc = ascii.read(os.path.abspath(os.path.join(os.path.dirname(__file__), 'bsc.dat')), format="tab", converters={})

        expected_ra  = []
        expected_ra_str = []

        expected_dec = []
        expected_dec_str = []

        ra  = []
        dec = []

        for row in bsc:
            expected_ra.append(row[0])
            expected_dec.append(row[1])

            expected_ra_str.append(row[2].strip())
            expected_dec_str.append(row[3].strip())

            ra.append(Coord.fromHMS(str(row[2])))
            dec.append(Coord.fromDMS(str(row[3])))

        for i in range(len(bsc)):
            # use e=0.0001 'cause its the maximum we can get with Vizier data (4 decimal places only)

            # test conversion from HMS DMS to decimal
            assert TestCoord.equal(ra[i].D, expected_ra[i], e=1e-4), \
                "ra: %.6f != coord ra: %.6f (%.6f)" % (expected_ra[i], ra[i].D, expected_ra[i]-ra[i].D)

            assert TestCoord.equal(dec[i].D, expected_dec[i], e=1e-4), \
                "dec: %.6f != coord dec: %.64f (%.6f)" % (expected_dec[i], dec[i].D, expected_dec[i]-dec[i].D)

            # test strfcoord implementation
            assert expected_ra_str[i] == ra[i].strfcoord("%(h)02d %(m)02d %(s)04.1f"), \
                "ra: %s != coord ra: %s" % (expected_ra_str[i], ra[i].strfcoord("%(h)02d %(m)02d %(s)04.1f"))

            assert expected_dec_str[i] == dec[i].strfcoord("%(d)02d %(m)02d %(s)02.0f"), \
                "dec: %s != coord dec: %s" % (expected_dec_str[i], dec[i].strfcoord("%(d)02d %(m)02d %(s)02.0f"))
Esempio n. 18
0
 def telegram_set_target(self, bot, update, args, job_queue, chat_data):
     if len(args) != 2:
         update.message.reply_text(
             "Usage: /set HH:MM:SS.S DD:MM:SS.S or /set ra dec (J2000)")
     else:
         self.last_update = datetime.datetime.now()
         ra = Coord.fromHMS(args[0]) if ":" in args[0] else Coord.fromD(
             float(args[0]))
         dec = Coord.fromDMS(args[1]) if ":" in args[1] else Coord.fromD(
             float(args[1]))
         self.target = Position.fromRaDec(ra, dec)
         site = self.getSite()
         lst = site.LST_inRads()
         alt = float(site.raDecToAltAz(self.target, lst).alt)
         # TODO: reject if alt< telescope_min_alt!
         moonPos = site.moonpos()
         moonRaDec = site.altAzToRaDec(moonPos, lst)
         moonDist = self.target.angsep(moonRaDec)
         update.message.reply_text(
             'Hello {} arg is {} {}. Object alt = {}, Moon dist = {}'.
             format(update.message.from_user.first_name, args[0], args[1],
                    alt, moonDist))
Esempio n. 19
0
    def test_parsing_conversion_hipparcos (self):
        """Parsing and comparing a subset of the Hipparcos and Tycho Catalog"""

        bsc = asciidata.open(os.path.abspath(os.path.join(os.path.dirname(__file__), 'hipparcos-tycho.dat')), comment_char='#', delimiter='\t')

        expected_ra  = []
        expected_ra_str = []

        expected_dec = []
        expected_dec_str = []

        ra  = []
        ra_hms = []
        
        dec = []
        dec_dms = []

        for i in range(bsc.nrows):

            expected_ra_str.append(bsc[0][i].strip())
            expected_dec_str.append(bsc[1][i].strip())

            expected_ra.append(float(bsc[2][i]))
            expected_dec.append(float(bsc[3][i]))
            
            ra.append(Coord.fromD(bsc[2][i]))
            dec.append(Coord.fromD(bsc[3][i]))

            ra_hms.append(Coord.fromHMS(bsc[0][i]))
            dec_dms.append(Coord.fromDMS(bsc[1][i]))

        for i in range(bsc.nrows):

            # FIXME: bexause of rounding errors, when we got fromD with a high precision number,
            # not every time we can convert it to DMS/HMS rounding seconds correctly. FP sucks!
            
            # test strfcoord implementation
            #assert expected_ra_str[i] == ra[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"), "ra: %s (%.8f) != coord ra: %s (%.8f)" % (expected_ra_str[i],
            #                                                                                    expected_ra[i],
            #                                                                                    ra[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"),ra[i].D)
            # 
            #assert expected_dec_str[i] == dec[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"), "dec: %s (%s) != coord dec: %s (%.8f)" % (expected_dec_str[i],
            #                                                                                    expected_dec[i],
            #                                                                                    dec[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"), dec[i].D)
            #
            assert expected_ra_str[i] == ra_hms[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"), "ra: %s != coord ra: %s" % (expected_ra_str[i],
                                                                                                    ra_hms[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"))
            
            assert expected_dec_str[i] == dec_dms[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"), "dec: %s != coord dec: %s" % (expected_dec_str[i],
                                                                                                    dec_dms[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"))

            # test conversion from D to D
            assert TestCoord.equal(ra[i].D, expected_ra[i], e=1e-8), "ra: %.6f != coord ra: %.6f (%.6f)" % (expected_ra[i], ra[i].D,
                                                                                                            expected_ra[i]-ra[i].D)
            assert TestCoord.equal(dec[i].D, expected_dec[i], e=1e-8), "dec: %.6f != coord dec: %.64f (%.6f)" % (expected_dec[i], dec[i].D,
                                                                                                                 expected_dec[i]-dec[i].D)

            # test conversion from DMS HMS to D
            assert TestCoord.equal(ra_hms[i].D, expected_ra[i], e=1e-4), "ra: %.6f != coord ra: %.6f (%.6f)" % (expected_ra[i], ra_hms[i].D,
                                                                                                                expected_ra[i]-ra_hms[i].D)
            assert TestCoord.equal(dec_dms[i].D, expected_dec[i], e=1e-4), "dec: %.6f != coord dec: %.64f (%.6f)" % (expected_dec[i], dec_dms[i].D,
                                                                                                                     expected_dec[i]-dec_dms[i].D)
Esempio n. 20
0
    def test_parsing_conversion_hipparcos(self):
        """Parsing and comparing a subset of the Hipparcos and Tycho Catalog"""

        bsc = asciidata.open(os.path.abspath(
            os.path.join(os.path.dirname(__file__), 'hipparcos-tycho.dat')),
                             comment_char='#',
                             delimiter='\t')

        expected_ra = []
        expected_ra_str = []

        expected_dec = []
        expected_dec_str = []

        ra = []
        ra_hms = []

        dec = []
        dec_dms = []

        for i in range(bsc.nrows):

            expected_ra_str.append(bsc[0][i].strip())
            expected_dec_str.append(bsc[1][i].strip())

            expected_ra.append(float(bsc[2][i]))
            expected_dec.append(float(bsc[3][i]))

            ra.append(Coord.fromD(bsc[2][i]))
            dec.append(Coord.fromD(bsc[3][i]))

            ra_hms.append(Coord.fromHMS(bsc[0][i]))
            dec_dms.append(Coord.fromDMS(bsc[1][i]))

        for i in range(bsc.nrows):

            # FIXME: bexause of rounding errors, when we got fromD with a high precision number,
            # not every time we can convert it to DMS/HMS rounding seconds correctly. FP sucks!

            # test strfcoord implementation
            #assert expected_ra_str[i] == ra[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"), "ra: %s (%.8f) != coord ra: %s (%.8f)" % (expected_ra_str[i],
            #                                                                                    expected_ra[i],
            #                                                                                    ra[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"),ra[i].D)
            #
            #assert expected_dec_str[i] == dec[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"), "dec: %s (%s) != coord dec: %s (%.8f)" % (expected_dec_str[i],
            #                                                                                    expected_dec[i],
            #                                                                                    dec[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"), dec[i].D)
            #
            assert expected_ra_str[i] == ra_hms[i].strfcoord(
                "%(h)02d %(m)02d %(s)05.2f"), "ra: %s != coord ra: %s" % (
                    expected_ra_str[i],
                    ra_hms[i].strfcoord("%(h)02d %(m)02d %(s)05.2f"))

            assert expected_dec_str[i] == dec_dms[i].strfcoord(
                "%(d)02d %(m)02d %(s)04.1f"), "dec: %s != coord dec: %s" % (
                    expected_dec_str[i],
                    dec_dms[i].strfcoord("%(d)02d %(m)02d %(s)04.1f"))

            # test conversion from D to D
            assert TestCoord.equal(
                ra[i].D, expected_ra[i],
                e=1e-8), "ra: %.6f != coord ra: %.6f (%.6f)" % (
                    expected_ra[i], ra[i].D, expected_ra[i] - ra[i].D)
            assert TestCoord.equal(
                dec[i].D, expected_dec[i],
                e=1e-8), "dec: %.6f != coord dec: %.64f (%.6f)" % (
                    expected_dec[i], dec[i].D, expected_dec[i] - dec[i].D)

            # test conversion from DMS HMS to D
            assert TestCoord.equal(
                ra_hms[i].D, expected_ra[i],
                e=1e-4), "ra: %.6f != coord ra: %.6f (%.6f)" % (
                    expected_ra[i], ra_hms[i].D, expected_ra[i] - ra_hms[i].D)
            assert TestCoord.equal(
                dec_dms[i].D, expected_dec[i],
                e=1e-4), "dec: %.6f != coord dec: %.64f (%.6f)" % (
                    expected_dec[i], dec_dms[i].D,
                    expected_dec[i] - dec_dms[i].D)
Esempio n. 21
0
#Using the DB will read the LST from the DB and calculate ext. coeff from there.

#Example code calling from the command line with DB:
#python extinctioncoefficient.py ra=320.1 dec=69.2 s=2009-05-03 18:58:30 e=2009-05-03 18:58:50 l=-22:32:04.000 -o:test -d:chimera -u:dschlege -p:password -s:moxie.oswego.edu

#Example code calling from the command line with file output:
#python extinctioncoefficient.py -f:images/

from extinction import Extinction
from chimeradb import database
from chimera.util.coord import Coord
import os, glob, sys
#from seeing import Seeing

#This sets latitude, we need to pull this from the fits or DB, default is the brazil telescope.
latitude = Coord.fromHMS('-22:32:04.000')

#Default to DB mode
filemode = 0
db = 0
dbserver = 0
dbname = 0
dbuser = 0
dbpass = 0

#Default output filename
outname = "extinction"

#Default error in RA and DEC
error = 0
Esempio n. 22
0
    def getTargetRa(self):

        self._write(":Gr#")
        ret = self._readline()

        return Coord.fromHMS(ret[:-1])
Esempio n. 23
0
    def getTargetRa(self):

        self._write(":Gr#")
        ret = self._readline()

        return Coord.fromHMS(ret[:-1])
Esempio n. 24
0
 def getPositionRaDec(self):
     self._telescope.GetRaDec()
     # FIXME: returns Position (pickle error)
     return (Coord.fromHMS(self._telescope.dRa),
             Coord.fromDMS(self._telescope.dDec))
Esempio n. 25
0
 def getRa(self):
     self._telescope.GetRaDec()
     return Coord.fromHMS(self._telescope.dRa)