How to use the extinction.Fitzpatrick99 function in extinction

To help you get started, we’ve selected a few extinction examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gbrammer / grizli / grizli / utils.py View on Github external
def __init__(self, a_v, r_v=3.1):
        self.a_v = a_v
        self.r_v = r_v
        
        self.IS_SPECUTILS = False
        self.IS_EXTINCTION = False
        
        try:
            from specutils.extinction import ExtinctionF99
            self.IS_SPECUTILS = True
            self.F99 = ExtinctionF99(self.a_v, r_v=self.r_v)
        except(ImportError):
            try:
                from extinction import Fitzpatrick99
                self.IS_EXTINCTION = True
                self.F99 = Fitzpatrick99(r_v=self.r_v)
                
            except(ImportError):
                print("""
Couldn\'t find extinction modules in 
`specutils.extinction` or 
`extinction.Fitzpatrick99`.

MW extinction not implemented.
""")

        self.status = self.IS_SPECUTILS | self.IS_EXTINCTION