Exemplo n.º 1
0
def get_ratio(s1, s2, var, wunit="default", Iunit="default", resample=True):
    # type: (Spectrum, Spectrum, str, str, str, str, bool) -> np.array, np.array
    """Get the ratio between two spectra
    Basically returns w1, I1 / I2 where (w1, I1) and (w2, I2) are the values of
    s1 and s2 for variable var. (w2, I2) is linearly interpolated if needed.

        .. math::

            R = I_1 / I_2


    Parameters
    ----------

    s1, s2: Spectrum objects
        :py:class:`~radis.spectrum.spectrum.Spectrum`

    var: str
        spectral quantity

    wunit: ``'nm'``, ``'cm-1'``, ``'nm_vac'``
        waveunit to compare in: wavelength air, wavenumber, wavelength vacuum

    Iunit: str
        if ``'default'`` use s1 unit for variable var

    Notes
    -----

    Uses :func:`~radis.misc.curve.curve_divide` internally

    See Also
    --------

    :func:`~radis.spectrum.compare.get_diff`,
    :func:`~radis.spectrum.compare.get_distance`,
    :func:`~radis.spectrum.compare.get_residual`,
    :func:`~radis.spectrum.compare.get_residual_integral`,
    :func:`~radis.spectrum.compare.plot_diff`,
    :meth:`~radis.spectrum.spectrum.compare_with`


    """

    w1, I1, w2, I2 = _get_defaults(s1,
                                   s2,
                                   var=var,
                                   wunit=wunit,
                                   Iunit=Iunit,
                                   assert_same_wavelength=not resample)

    # basically w1, I1 - I2 (on same range)
    return curve_divide(w1, I1, w2, I2)
Exemplo n.º 2
0
def get_ratio(s1,
              s2,
              var,
              wunit='default',
              Iunit='default',
              medium='default',
              resample=True):
    ''' Get the ratio between two spectra
    Basically returns w1, I1 / I2 where (w1, I1) and (w2, I2) are the values of
    s1 and s2 for variable var. (w2, I2) is linearly interpolated if needed.
    
    
    Parameters    
    ----------
    
    s1, s2: Spectrum objects
    
    var: str
        spectral quantity 
    
    wunit: 'nm', 'cm-1'
        waveunit to compare in
        
    Iunit: str
        If 'default' use s1 unit for variable var
    
    medium: 'air', 'vacuum', default'
        propagating medium to compare in (if in wavelength)
    
    
    See Also
    --------
    
    :func:`~radis.spectrum.compare.get_diff`, 
    :func:`~radis.spectrum.compare.get_distance`,  
    :func:`~radis.spectrum.compare.get_residual`,
    :func:`~radis.spectrum.compare.get_residual_integral`, 
    :func:`~radis.spectrum.compare.plot_diff` 
    :meth:`~radis.spectrum.spectrum.compare_with` 
    
    '''

    w1, I1, w2, I2 = _get_defaults(s1,
                                   s2,
                                   var=var,
                                   wunit=wunit,
                                   Iunit=Iunit,
                                   medium=medium,
                                   resample=resample)

    return curve_divide(w1, I1, w2,
                        I2)  # basically w1, I1 - I2 (on same range)
Exemplo n.º 3
0
def get_ratio(s1,
              s2,
              var,
              wunit='default',
              Iunit='default',
              medium='default',
              resample=True):
    # type: (Spectrum, Spectrum, str, str, str, str, bool) -> np.array, np.array
    ''' Get the ratio between two spectra
    Basically returns w1, I1 / I2 where (w1, I1) and (w2, I2) are the values of
    s1 and s2 for variable var. (w2, I2) is linearly interpolated if needed.

        .. math::

            R = I_1 / I_2


    Parameters    
    ----------

    s1, s2: Spectrum objects

    var: str
        spectral quantity 

    wunit: 'nm', 'cm-1'
        waveunit to compare in

    Iunit: str
        if ``'default'`` use s1 unit for variable var

    medium: 'air', 'vacuum', default'
        propagating medium to compare in (if in wavelength)

    Notes
    -----
    
    Uses :func:`~radis.misc.curve.curve_divide` internally

    See Also
    --------

    :func:`~radis.spectrum.compare.get_diff`, 
    :func:`~radis.spectrum.compare.get_distance`,  
    :func:`~radis.spectrum.compare.get_residual`,
    :func:`~radis.spectrum.compare.get_residual_integral`, 
    :func:`~radis.spectrum.compare.plot_diff`,
    :meth:`~radis.spectrum.spectrum.compare_with` 
    

    '''

    w1, I1, w2, I2 = _get_defaults(s1,
                                   s2,
                                   var=var,
                                   wunit=wunit,
                                   Iunit=Iunit,
                                   medium=medium,
                                   assert_same_wavelength=not resample)

    # basically w1, I1 - I2 (on same range)
    return curve_divide(w1, I1, w2, I2)