# 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
        b = -3.503 + 2.057 * x[tt] + 0.7180 / ((x[tt] - 4.59) ** 2 + 0.0530)
        Xx[tt] = self.R_V * a + b

        tt = (x > 5.9) & (x <= 11.0)
        a = 1.896 - 0.372 * x[tt] - 0.0108 / ((x[tt] - 4.57) ** 2 + 0.0422)
        b = -3.503 + 2.057 * x[tt] + 0.7180 / ((x[tt] - 4.59) ** 2 + 0.0530)
        y = x[tt] - 5.9
        a += -(0.110 + 0.0099 * y) * y ** 2
        b += (0.537 + 0.0530 * y) * y ** 2
        Xx[tt] = self.R_V * a + b

        return np.squeeze(Xx)
        """

    def _K76(self, wave):
        """
        Kaler 1976, ApJS, 31, 517
        http://adsabs.harvard.edu/abs/1976ApJS...31..517K
        
        Comments:
        This function returns the correction relative to Hbeta (f_lambda) and not
        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)

# 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

        b = -3.503 + 2.057 * x[tt] + 0.7180 / ((x[tt] - 4.59) ** 2 + 0.0530)
        Xx[tt] = self.R_V * a + b

        tt = (x > 5.9) & (x <= 11.0)
        a = 1.896 - 0.372 * x[tt] - 0.0108 / ((x[tt] - 4.57) ** 2 + 0.0422)
        b = -3.503 + 2.057 * x[tt] + 0.7180 / ((x[tt] - 4.59) ** 2 + 0.0530)
        y = x[tt] - 5.9
        a += -(0.110 + 0.0099 * y) * y ** 2
        b += (0.537 + 0.0530 * y) * y ** 2
        Xx[tt] = self.R_V * a + b

        return np.squeeze(Xx)
        """

    def _K76(self, wave):
        """
        Kaler 1976, ApJS, 31, 517
        http://adsabs.harvard.edu/abs/1976ApJS...31..517K
        
        Comments:
        This function returns the correction relative to Hbeta (f_lambda) and not
        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')