Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'fitzpatrick99', 'fm07'}
:type law: str
:param Av: The scaling total extinction value.
:type Av: float
:param Rv: The ratio of total to selective extinction. If using law 'fm07' you do
not need to provide this (fixed 3.1).
:type Rv: float
:raises ValueError: If not using an expected law or ill-specifying Av or Rv
"""
LAWS = {
'ccm89': extinction.ccm89,
'odonnell94': extinction.odonnell94,
'calzetti00': extinction.calzetti00,
'fitzpatrick99': extinction.fitzpatrick99,
'fm07': extinction.fm07,
}
def __init__(self, law, Av, Rv=None):
if not law in self.LAWS:
raise ValueError('Need to specify a law from {}'.format(self.LAWS.keys()))
if Av < 0:
raise ValueError('Cannot have negative extinction')
if Rv is None or Rv < 0 and law is not 'fm07':
raise ValueError('Must provide positive r_v for law "{}"'.format(law))
elif law is 'fm07':
Rv = None
self.law = self.LAWS[law]
self.Av = Av
self.Rv = Rv
def transform(self, wave, flux):
if self.Rv is not None: