コード例 #1
0
 def raDecToAltAz(raDec, latitude, lst):
     decR = CoordUtil.coordToR(raDec.dec)
     latR = CoordUtil.coordToR(latitude)
     ha = CoordUtil.raToHa(raDec.ra, lst)
     haR = CoordUtil.coordToR(ha)
     
     altR,azR = CoordUtil.coordRotate(decR, latR, haR)
     
     return Position.fromAltAz(Coord.fromR(CoordUtil.makeValid180to180(altR)), Coord.fromR(CoordUtil.makeValid0to360(azR)))
コード例 #2
0
    def solve_dome_azimuth(self, telescope_pos, lst, nloops=10):

        # Find the altitude and azimuth of the current pointing
        # This should be valid in either hemisphere
        pos = Position.raDecToAltAz(telescope_pos, self.site_latitude, lst)
        telaz, telalt, ha = pos.az.R, pos.alt.R, CoordUtil.raToHa(
            telescope_pos.ra, lst).R

        # Find the reference point on the optical axis in dome coordinates
        # z: vertical
        # y: north - south
        # x: east - west
        # theta: altitude of the polar axis from the horizontal plane
        # phi: rotation of dec axis about polar axis

        # Meaning of x and y compared to sky depends on the hemisphere!
        # z: always + up
        # y: always + toward N for +lat or S for -lat
        # x: maintains right-handed coordinate system with z and y
        #  thus x is + to E for +lat and to W for -lat
        # theta: always positive from the horizontal plane to the pole
        # phi: rotation about polar axis
        #  and is +90 for a horizontal axis with OTA toward +x
        #  and is   0 for OTA over mount with dec axis counterweight down
        #  and is -90 for a horizontal axis with OTA toward -x

        # We have a German equatorial and the origin changes with ha
        # Assign phi based on an assumption about the basis derived from the ha
        phi = ha

        # Assign theta
        theta = abs(self.site_latitude.R)

        # Find the dome coordinates of the OTA reference point for a German equatorial
        # This works in either hemisphere
        x0 = self.mount_dec_length * sin(phi)
        y0 = -self.mount_dec_length * cos(phi) * sin(
            theta) + self.mount_dec_offset
        z0 = self.mount_dec_length * cos(phi) * cos(
            theta) + self.mount_dec_height

        # (x,y,z) is on the optical axis
        # Iterate to make this point also lie on the dome surface
        # Begin iteration assuming the zero point is at the center of the dome
        # Telescope azimuth is measured from the direction to the pole

        d = 0.
        r = self.dome_radius

        if self.site_latitude.R <= 0.:
            telaz2 = telaz - pi
            # between (0, 2pi):
            if telaz2 > 2 * pi:
                telaz2 -= 2 * pi
            elif telaz2 < 0:
                telaz2 += 2 * pi

            telalt2 = telalt

        # Iterate for convergence

        n = 0
        while n < nloops:
            d -= r - self.dome_radius
            rp = self.dome_radius + d
            x = x0 + rp * cos(telalt2) * sin(telaz2)
            y = y0 + rp * cos(telalt2) * cos(telaz2)
            z = z0 + rp * sin(telalt2)
            r = sqrt(x * x + y * y + z * z)

            # Repeat the calculation correcting the assumed OTA path length each time
            # This converges quickly  so just do a few loops and assume it is ok

            # print "n, r, rp: ", n, r, rp

            n += 1

        # Use (x,y,0) from the interation to find the azimuth of the dome
        # Azimuth is N (0), E (90), S (180), W (270) in both hemispheres
        # However x and y are different in the hemispheres so we fix that here

        zeta = atan2(x, y)
        if (zeta > -2. * pi) and (zeta < 2. * pi):
            if self.site_latitude.R <= 0.:
                zeta += pi
        else:
            zeta = telaz

        if zeta < 0:
            zeta = zeta + 2 * pi
        elif zeta > 2 * pi:
            zeta - 2 * pi

        return zeta * 180 / pi
コード例 #3
0
 def haToRa(self, ha):
     return CoordUtil.raToHa(ha, self.LST_inRads())
コード例 #4
0
 def raToHa(self, ra):
     return CoordUtil.raToHa(ra, self.LST_inRads())
コード例 #5
0
ファイル: site.py プロジェクト: agati/chimera
 def haToRa(self, ha):
     return CoordUtil.raToHa(ha, self.LST_inRads())
コード例 #6
0
ファイル: site.py プロジェクト: agati/chimera
 def raToHa(self, ra):
     return CoordUtil.raToHa(ra, self.LST_inRads())
コード例 #7
0
    def solve_dome_azimuth(self, telescope_pos, lst, nloops=10):

        # Find the altitude and azimuth of the current pointing
        # This should be valid in either hemisphere
        pos = Position.raDecToAltAz(telescope_pos, self.site_latitude, lst)
        telaz, telalt, ha = pos.az.R, pos.alt.R, CoordUtil.raToHa(telescope_pos.ra, lst).R

        # Find the reference point on the optical axis in dome coordinates
        # z: vertical
        # y: north - south
        # x: east - west
        # theta: altitude of the polar axis from the horizontal plane
        # phi: rotation of dec axis about polar axis

        # Meaning of x and y compared to sky depends on the hemisphere!
        # z: always + up
        # y: always + toward N for +lat or S for -lat
        # x: maintains right-handed coordinate system with z and y
        #  thus x is + to E for +lat and to W for -lat
        # theta: always positive from the horizontal plane to the pole
        # phi: rotation about polar axis
        #  and is +90 for a horizontal axis with OTA toward +x
        #  and is   0 for OTA over mount with dec axis counterweight down
        #  and is -90 for a horizontal axis with OTA toward -x


        # We have a German equatorial and the origin changes with ha
        # Assign phi based on an assumption about the basis derived from the ha
        phi = ha

        # Assign theta
        theta = abs(self.site_latitude.R)

        # Find the dome coordinates of the OTA reference point for a German equatorial
        # This works in either hemisphere
        x0 = self.mount_dec_length * sin(phi)
        y0 = -self.mount_dec_length * cos(phi) * sin(theta) + self.mount_dec_offset
        z0 = self.mount_dec_length * cos(phi) * cos(theta) + self.mount_dec_height

        # (x,y,z) is on the optical axis
        # Iterate to make this point also lie on the dome surface
        # Begin iteration assuming the zero point is at the center of the dome
        # Telescope azimuth is measured from the direction to the pole

        d = 0.
        r = self.dome_radius

        if self.site_latitude.R <= 0.:
            telaz2 = telaz - pi
            # between (0, 2pi):
            if telaz2 > 2 * pi:
                telaz2 -= 2 * pi
            elif telaz2 < 0:
                telaz2 += 2 * pi

            telalt2 = telalt

        # Iterate for convergence

        n = 0
        while n < nloops:
            d -= r - self.dome_radius
            rp = self.dome_radius + d
            x = x0 + rp * cos(telalt2) * sin(telaz2)
            y = y0 + rp * cos(telalt2) * cos(telaz2)
            z = z0 + rp * sin(telalt2)
            r = sqrt(x * x + y * y + z * z)

            # Repeat the calculation correcting the assumed OTA path length each time
            # This converges quickly  so just do a few loops and assume it is ok

            # print "n, r, rp: ", n, r, rp

            n += 1

        # Use (x,y,0) from the interation to find the azimuth of the dome
        # Azimuth is N (0), E (90), S (180), W (270) in both hemispheres
        # However x and y are different in the hemispheres so we fix that here

        zeta = atan2(x, y)
        if (zeta > - 2. * pi) and (zeta < 2. * pi):
            if self.site_latitude.R <= 0.:
                zeta += pi
        else:
            zeta = telaz

        if zeta < 0:
            zeta = zeta + 2 * pi
        elif zeta > 2 * pi:
            zeta - 2 * pi

        return zeta * 180 / pi
コード例 #8
0
ファイル: dome_test.py プロジェクト: astroufsc/chimera-lna
# model_file.write('Latitude, %s\n' % site["latitude"].R)
#
# model_file.write('Dome Azm, Scope Ha, Scope Dec, Pier Side\n')
i = 1

try:
    # for az, alt in [(ii, jj) for ii in np.arange(15, 360, 10) for jj in np.arange(25, 90, 20)]:
    while sheet.cell(i, 1).value != '':
        if sheet.cell(i, 9).value == '':
            az, alt = float(sheet.cell(i, 1).value), float(sheet.cell(i, 2).value)
            print '@> alt, az', alt, az
            telescope.slewToAltAz(Position.fromAltAz(Coord.fromD(alt), Coord.fromD(az)))
            etiqueta = raw_input('Etiqueta: ')
            alt, az, ra, dec = telescope.getAlt().R, telescope.getAz().R, telescope.getRa().R, telescope.getDec().R
            lst = site.LST()
            ha = CoordUtil.raToHa(ra, lst).R
            j = 3
            for val in (alt, az, ha, ra, dec, lst, etiqueta, str(datetime.datetime.now())):
                sheet.update_cell(i, j, val) #model_file.write('%f,%f,%f,pierWest\n' % (az, ha, dec))
                j += 1
            # i += 1
            # raw_input('Move the telescope, re-center, and press ENTER to grab. CRTL+C to finish.')
        i += 1
except KeyboardInterrupt:
    # model_file.close()
    print '\nDone'

# Generate the file like:
# Latitude, 51,07861
# Dome Azm, Scope Ha, Scope Dec, Pier Side
# 180,-4,44089209850063E-16,-3,18055468146352E-15,pierWest