예제 #1
0
    def extinguish(self, x, Av=None, Ebv=None):
        """
        Calculate the extinction as a fraction

        Parameters
        ----------
        x: float
           expects either x in units of wavelengths or frequency
           or assumes wavelengths in wavenumbers [1/micron]

           internally wavenumbers are used

        Av: float
           A(V) value of dust column
           Av or Ebv must be set

        Ebv: float
           E(B-V) value of dust column
           Av or Ebv must be set

        Returns
        -------
        frac_ext: np array (float)
           fractional extinction as a function of x
        """
        # get the extinction curve
        axav = self(x)

        # check that av or ebv is set
        if (Av is None) and (Ebv is None):
            raise InputParameterError("neither Av or Ebv passed, one required")

        # if Av is not set and Ebv set, convert to Av
        if Av is None:
            Av = self.Rv * Ebv

        # return fractional extinction
        return np.power(10.0, -0.4 * axav * Av)
예제 #2
0
 def matrix(self, value):
     """ Validates that the input matrix is a 2x2 2D array. """
     if np.shape(value) != (2, 2):
         raise InputParameterError(  # pragma: no cover
             "Expected transformation matrix to be a 2x2 array")
예제 #3
0
 def cd(self, value):
     """ Validates that the input CD matrix is a 2x2 2D array. """
     if np.shape(value) != (2, 2):
         raise InputParameterError("Expected CD matrix to be a 2x2 array")