# Path: pyneb/utils/misc.py
# ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))


import numpy as np
import pyneb as pn
    import matplotlib.pyplot as plt
    from scipy import interpolate
from ..utils.misc import ROOT_DIR
        the extinction law (X(1/lambda)).
        It cannot be used for absolute correction.
        
        Range: 3000 to >20000
        
        """
        w = np.asarray([wave]) # inv microns
        if self.E_BV == 0.:
            return np.ones_like(w)
        f_tab = np.loadtxt(ROOT_DIR + '/extinction/Gal_Kaler.txt')
        f = np.interp(w, f_tab[:, 0], f_tab[:, 1])
        return np.squeeze(f * self.cHbeta / 0.4 / self.E_BV)
    

    def _SM79_Gal(self, wave):
        """
        Galactic extinction law
        Savage & Mathis 1979, ARA&A, 17, 73
        http://adsabs.harvard.edu/abs/1979ARA%26A..17...73S
        
        Comments:
        Average of several extinction laws
        R_V=3.1
        
        Scope: Galactic
        Range: UV through IR
        
        """
        x = 1e4 / np.asarray([wave]) # inv microns


# Path: pyneb/utils/misc.py
# ROOT_DIR = os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir))


# Path: pyneb/extinction/red_corr.py
import numpy as np
import pyneb as pn
    import matplotlib.pyplot as plt
    from scipy import interpolate
from ..utils.misc import ROOT_DIR

        the extinction law (X(1/lambda)).
        It cannot be used for absolute correction.
        
        Range: 3000 to >20000
        
        """
        w = np.asarray([wave]) # inv microns
        if self.E_BV == 0.:
            return np.ones_like(w)
        f_tab = np.loadtxt(ROOT_DIR + '/extinction/Gal_Kaler.txt')
        f = np.interp(w, f_tab[:, 0], f_tab[:, 1])
        return np.squeeze(f * self.cHbeta / 0.4 / self.E_BV)
    

    def _SM79_Gal(self, wave):
        """
        Galactic extinction law
        Savage & Mathis 1979, ARA&A, 17, 73
        http://adsabs.harvard.edu/abs/1979ARA%26A..17...73S
        
        Comments:
        Average of several extinction laws
        R_V=3.1
        
        Scope: Galactic
        Range: UV through IR
        
        """
        x = 1e4 / np.asarray([wave]) # inv microns


        X_tab = np.loadtxt(ROOT_DIR + '/extinction/Gal_SM79.txt')