예제 #1
0
    def outline(self, tip='auto', reference='ref'):
        """Finds approximate elliptical outline.
              - tip:  angle in the plane of the sky, 'auto' to match observation, 0 for aligned vertical
              - reference:  ['edge' or 'ref' or number_km]"""
        outline = [[], []]
        try:  # this is all done in km
            radii = []
            for i in range(len(self.header['radii'])):
                if isinstance(self.header['radii'][i], self.scalar):
                    radii.append(self.header['radii'][i])
            Req = np.max(radii)
            Rpol = np.min(radii)
            rNorm = self.header['rNorm'][0]
            dist = self.header['distance'][0] * utils.Units[
                self.header['distance'][1]] / utils.Units['km']
            checkResolution = (180.0 / math.pi) * 3600.0 * math.atan(
                self.header['b'][0] * rNorm / dist)
            lat_pg = self.header['orientation'][1] * np.pi / 180.0
        except KeyError:
            print('Not enough header information')
            return None

        print('Reference disc is {:.1f} x {:.1f} km at {:.1f} km distance'.
              format(Req, Rpol, dist))
        print('Image resolution is %f arcsec' % (self.resolution))
        if isinstance(reference, self.scalar):
            a = float(reference)
        elif reference == 'edge':
            a = self.header['rNorm'][0]
        else:  # assume reference (1-bar) level
            a = Req
        # print 'assuming reference diameter of %.1f' % (a)
        f = (Req - Rpol) / Req
        lat_pc = math.atan(math.tan(lat_pg) * (1.0 - f)**2)
        b = a * (1.0 - f * math.cos(lat_pc)**2)

        # ## Convert to arcsec
        a = (180.0 / math.pi) * 3600.0 * math.atan(a / dist)
        b = (180.0 / math.pi) * 3600.0 * math.atan(b / dist)
        for phi in np.arange(0.0, 2.0 * np.pi, np.pi / 180.0):
            outline[0].append(a * math.cos(phi))
            outline[1].append(b * math.sin(phi))
        if tip == 'auto':
            tip = self.header['orientation'][0]
        if tip:
            tip = tip * np.pi / 180.0
            for i in range(len(outline[0])):
                r = np.array([outline[0][i], outline[1][i], 0.0])
                r = shape.rotZ(tip, r)
                outline[0][i] = r[0]
                outline[1][i] = r[1]
        return outline
예제 #2
0
파일: img.py 프로젝트: jtollefs/pyplanet
    def outline(self,tip='auto',reference='ref'):
        """Finds approximate elliptical outline.  
              - tip:  angle in the plane of the sky, 'auto' to match observation, 0 for aligned vertical
              - reference:  ['edge' or 'ref' or number_km]"""
        outline = [[],[]]
        try:  # this is all done in km
            radii = []
            for i in range(len(self.header['radii'])):
                if type(self.header['radii'][i])==float or type(self.header['radii'][i])==int:
                    radii.append(self.header['radii'][i])
            Req = np.max(radii)
            Rpol = np.min(radii)
            rNorm = self.header['rNorm'][0]
            dist = self.header['distance'][0]*utils.Units[self.header['distance'][1]]/utils.Units['km']
            checkResolution = (180.0/math.pi)*3600.0*math.atan(self.header['b'][0]*rNorm/dist)
            lat_pg = self.header['orientation'][1]*np.pi/180.0
        except KeyError:
            print 'Not enough header information'
            return None
        
        print 'Reference disc is %.1f x %.1f km at %.1f km distance' % (Req,Rpol,dist)
        print 'Image resolution is %f arcsec' % (self.resolution)   
        if type(reference)==float or type(reference)==int:
            a = float(reference)
        elif reference=='edge':
            a = self.header['rNorm'][0]
        else:  # assume reference (1-bar) level
            a = Req
        #print 'assuming reference diameter of %.1f' % (a)
        f = (Req-Rpol)/Req
        lat_pc = math.atan(math.tan(lat_pg)*(1.0-f)**2)
        b = a*(1.0 - f*math.cos( lat_pc )**2)
 
        ### Convert to arcsec
        a = (180.0/math.pi)*3600.0*math.atan(a/dist)
        b = (180.0/math.pi)*3600.0*math.atan(b/dist)
        for phi in np.arange(0.0,2.0*np.pi,np.pi/180.0):
            outline[0].append( a*math.cos(phi) )
            outline[1].append( b*math.sin(phi) )
        if tip=='auto':
            tip = self.header['orientation'][0]
        if tip:
            tip = tip*np.pi/180.0
            for i in range(len(outline[0])):
                r = np.array([outline[0][i],outline[1][i],0.0])
                r = shape.rotZ(tip,r)
                outline[0][i] = r[0]
                outline[1][i] = r[1]
        return outline
예제 #3
0
def rotate2obs(rotate, tip, b):
    """This should be opposite to rotate2planet..."""
    out_vec = shape.rotZ(tip, shape.rotX(rotate, b))
    return out_vec
예제 #4
0
def rotate2planet(rotate, tip, b):
    """separate out to keep use consistent!"""
    # out_vec = shape.rotZ(tip,shape.rotX(rotate,b))  # the first way, which is seemingly incorrect
    out_vec = shape.rotX(rotate, shape.rotZ(tip, b))
    return out_vec
예제 #5
0
def __rotate2obs__(rotate,tip,b):
    """This should be opposite to __rotate2planet__..."""
    out_vec = shape.rotZ(tip,shape.rotX(rotate,b))
    return out_vec
예제 #6
0
def rotate2obs(rotate, tip, b):
    """This should be opposite to rotate2planet..."""
    out_vec = shape.rotZ(tip, shape.rotX(rotate, b))
    return out_vec
예제 #7
0
def rotate2planet(rotate, tip, b):
    """separate out to keep use consistent!"""
    # out_vec = shape.rotZ(tip,shape.rotX(rotate,b))  # the first way, which is seemingly incorrect
    out_vec = shape.rotX(rotate, shape.rotZ(tip, b))
    return out_vec