コード例 #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
ファイル: raypath.py プロジェクト: david-deboer/pyplanet
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
ファイル: raypath.py プロジェクト: david-deboer/pyplanet
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
ファイル: raypath.py プロジェクト: jtollefs/pyplanet
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