Exemplo n.º 1
0
 def getAk(self,distance=None,map='marshall',law='Fitz2004Chiar2006'):
 
     '''
     Helper method to retrieve the Ak extinction magnitude for a given 
     distance.
     
     The Ak values are saved in the sed object, to cut down the overhead in 
     subsequent calls. 
     
     The law and map have to be passed as well. Defaults are marshall and 
     Fitz2004Chiar2006 respectively.
     
     @param distance: The distance to the source. If the default, the total
                      extinction is calculated in given direction. 
                      
                      (default: None)
     @type distance: float
     @keyword map: The galactic 3d extinction model. 
 
                   (default: 'marshall')
     @type map: str
     @keyword law: The reddening law
             
                   (default: 'Fitz2004Chiar2006')
     @type law: str
 
     @return: The extinction magnitude in K-band for the requested distance.
     @rtype: float
     
     '''
     
     distance = float(distance)
     if not self.ak.has_key((distance,map,law)):
         aki = Reddening.getAk(self.ll,self.bb,distance,map,law)
         self.ak[(distance,map,law)] = aki
     
     return self.ak[(distance,map,law)]
Exemplo n.º 2
0
    def getAk(self, distance=None, map='marshall', law='Fitz2004Chiar2006'):
        '''
        Helper method to retrieve the Ak extinction magnitude for a given 
        distance.
        
        The Ak values are saved in the sed object, to cut down the overhead in 
        subsequent calls. 
        
        The law and map have to be passed as well. Defaults are marshall and 
        Fitz2004Chiar2006 respectively.
        
        @param distance: The distance to the source. If the default, the total
                         extinction is calculated in given direction. 
                         
                         (default: None)
        @type distance: float
        @keyword map: The galactic 3d extinction model. 
    
                      (default: 'marshall')
        @type map: str
        @keyword law: The reddening law
                
                      (default: 'Fitz2004Chiar2006')
        @type law: str
    
        @return: The extinction magnitude in K-band for the requested distance.
        @rtype: float
        
        '''

        distance = float(distance)
        if not self.ak.has_key((distance, map, law)):
            aki = Reddening.getAk(self.ll, self.bb, distance, map, law)
            self.ak[(distance, map, law)] = aki

        return self.ak[(distance, map, law)]