Пример #1
0
def get_baseline(s, var="radiance", Iunit=None):
    """Calculate and returns a baseline

    Parameters
    ----------
    s: Spectrum
        Spectrum which needs a baseline

    var: str
        on which spectral quantity to read the baseline. Default ``'radiance'``.
        See :py:data:`~radis.spectrum.utils.SPECTRAL_QUANTITIES`

    Returns
    -------
    baseline: Spectrum
        Spectrum object where intenisity is the baseline of s is computed by peakutils

    See Also
    --------

    :py:func:`~radis.spectrum.operations.sub_baseline`
    """
    import peakutils

    w1, I1 = s.get(var=var, Iunit=Iunit)
    baseline = peakutils.baseline(I1, deg=1, max_it=500)
    baselineSpectrum = Spectrum.from_array(w1,
                                           baseline,
                                           var,
                                           unit=Iunit,
                                           name=s.get_name() + "_baseline")
    return baselineSpectrum
Пример #2
0
def experimental_spectrum(w,
                          I,
                          wunit='nm',
                          Iunit='counts',
                          conditions=None,
                          cond_units=None,
                          name=None):  # -> Spectrum:
    ''' Convert (w, I) into a Spectrum object that has unit conversion and plotting
    capabilities. Convolution is not available as the spectrum is assumed to
    be measured experimentally (hence deconvolution of the slit function would
    be required)


    Parameters    
    ----------

    w, I: np.array
        wavelength and intensity

    wunit: 'nm', 'cm-1'
        wavespace unit

    Iunit: str
        intensity unit (can be 'counts', 'mW/cm2/sr/nm', etc...). Default
        'counts' (default Winspec output)

    Other Parameters
    ----------------

    conditions: dict
        (optional) calculation conditions to be stored with Spectrum

    cond_units: dict
        (optional) calculation conditions units

    name: str
        (optional) give a name


    See Also
    --------

    :func:`~radis.spectrum.spectrum.calculated_spectrum`, 
    :func:`~radis.spectrum.spectrum.transmittance_spectrum`, 
    :meth:`~radis.spectrum.spectrum.Spectrum.from_array`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_txt`,
    :func:`~radis.tools.database.load_spec`

    '''

    return Spectrum.from_array(np.array(w),
                               np.array(I),
                               'radiance',
                               waveunit=wunit,
                               unit=Iunit,
                               conditions=conditions,
                               cond_units=cond_units,
                               name=name)
Пример #3
0
def transmittance_spectrum(w,
                           T,
                           wunit='nm',
                           Tunit='I/I0',
                           conditions=None,
                           cond_units=None,
                           name=None):  # -> Spectrum:
    ''' Convert (w, I) into a Spectrum object that has unit conversion, plotting
    and slit convolution capabilities


    Parameters    
    ----------

    w, I: np.array
        wavelength and transmittance (no slit)

    wunit: 'nm', 'cm-1'
        wavespace unit

    Iunit: str
        intensity unit. Default 'I/I0'


    Other Parameters
    ----------------

    conditions: dict
        (optional) calculation conditions to be stored with Spectrum

    cond_units: dict
        (optional) calculation conditions units

    name: str
        (optional) give a name


    See Also
    --------

    :func:`~radis.spectrum.models.calculated_spectrum`, 
    :func:`~radis.spectrum.models.experimental_spectrum`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_array`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_txt`,
    :func:`~radis.tools.database.load_spec`

    '''

    return Spectrum.from_array(np.array(w),
                               np.array(T),
                               'transmittance_noslit',
                               waveunit=wunit,
                               unit=Tunit,
                               conditions=conditions,
                               cond_units=cond_units,
                               name=name)
Пример #4
0
def calculated_spectrum(
    w,
    I,
    wunit="nm",
    Iunit="mW/cm2/sr/nm",
    conditions=None,
    cond_units=None,
    populations=None,
    name=None,
):  # -> Spectrum:
    """Convert ``(w, I)`` into a :py:class:`~radis.spectrum.spectrum.Spectrum`
    object that has unit conversion, plotting and slit convolution capabilities


    Parameters
    ----------

    w: np.array
        wavelength, or wavenumber

    I: np.array
        intensity (no slit)

    wunit: ``'nm'``, ``'cm-1'``, ``'nm_vac'``
        wavespace unit: wavelength in air (``'nm'``), wavenumber
        (``'cm-1'``), or wavelength in vacuum (``'nm_vac'``). Default ``'nm'``.

    Iunit: str
        intensity unit (can be 'counts', 'mW/cm2/sr/nm', etc...). Default
        'mW/cm2/sr/nm' (note that non-convoluted Specair spectra are in 'mW/cm2/sr/µm')


    Other Parameters
    ----------------

    conditions: dict
        (optional) calculation conditions to be stored with Spectrum. Default ``None``

    cond_units: dict
        (optional) calculation conditions units. Default ``None``

    populations: dict
        populations to be stored in Spectrum. Default ``None``

    name: str
        (optional) give a name


    Examples
    --------

    ::

        # w, I are numpy arrays for wavelength and radiance
        from radis import calculated_spectrum
        s = calculated_spectrum(w, I, wunit='nm', Iunit='W/cm2/sr/nm')     # creates 'radiance_noslit'



    See Also
    --------

    :func:`~radis.spectrum.models.transmittance_spectrum`,
    :func:`~radis.spectrum.models.experimental_spectrum`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_array`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_txt`,
    :func:`~radis.tools.database.load_spec`

    """

    return Spectrum.from_array(
        np.array(w),
        np.array(I),
        "radiance_noslit",
        waveunit=wunit,
        unit=Iunit,
        conditions=conditions,
        cond_units=cond_units,
        populations=populations,
        name=name,
    )
Пример #5
0
def experimental_spectrum(w,
                          I,
                          wunit="nm",
                          Iunit="counts",
                          conditions={},
                          cond_units=None,
                          name=None):  # -> Spectrum:
    """Convert ``(w, I)`` into a :py:class:`~radis.spectrum.spectrum.Spectrum`
    object that has unit conversion and plotting
    capabilities. Convolution is not available as the spectrum is assumed to
    have be measured experimentally (hence it is already convolved with the slit function)


    Parameters
    ----------

    w: np.array
        wavelength, or wavenumber

    I: np.array
        intensity

    wunit: ``'nm'``, ``'cm-1'``, ``'nm_vac'``
        wavespace unit: wavelength in air (``'nm'``), wavenumber
        (``'cm-1'``), or wavelength in vacuum (``'nm_vac'``). Default ``'nm'``.

    Iunit: str
        intensity unit (can be 'counts', 'mW/cm2/sr/nm', etc...). Default
        'counts' (default Winspec output)

    Other Parameters
    ----------------

    conditions: dict
        (optional) calculation conditions to be stored with Spectrum

    cond_units: dict
        (optional) calculation conditions units

    name: str
        (optional) give a name

    Examples
    --------

    Load and plot an experimental spectrum::

        from numpy import loadtxt
        from radis import experimental_spectrum
        w, I = loadtxt('my_file.txt').T    # assuming 2 columns
        s = experimental_spectrum(w, I, Iunit='mW/cm2/sr/nm')             # creates 'radiance'
        s.plot()


    See Also
    --------

    :func:`~radis.spectrum.models.calculated_spectrum`,
    :func:`~radis.spectrum.models.transmittance_spectrum`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_array`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_txt`,
    :func:`~radis.tools.database.load_spec`

    """

    if np.shape(w) != np.shape(I):
        raise ValueError(
            "Wavelength {0} and intensity {1} do not have the same shape".
            format(np.shape(w), np.shape(I)))
    return Spectrum.from_array(
        np.array(w),
        np.array(I),
        "radiance",
        waveunit=wunit,
        unit=Iunit,
        conditions=conditions,
        cond_units=cond_units,
        name=name,
    )
Пример #6
0
def transmittance_spectrum(w,
                           T,
                           wunit="nm",
                           Tunit="",
                           conditions=None,
                           cond_units=None,
                           name=None):  # -> Spectrum:
    """Convert ``(w, I)`` into a :py:class:`~radis.spectrum.spectrum.Spectrum`
    object that has unit conversion, plotting and slit convolution capabilities


    Parameters
    ----------

    w: np.array
        wavelength, or wavenumber

    T: np.array
        transmittance (no slit)

    wunit: ``'nm'``, ``'cm-1'``, ``'nm_vac'``
        wavespace unit: wavelength in air (``'nm'``), wavenumber
        (``'cm-1'``), or wavelength in vacuum (``'nm_vac'``). Default ``'nm'``.

    Iunit: str
        intensity unit. Default ``""`` (adimensionned)


    Other Parameters
    ----------------

    conditions: dict
        (optional) calculation conditions to be stored with Spectrum

    cond_units: dict
        (optional) calculation conditions units

    name: str
        (optional) give a name


    Examples
    --------

    ::

        # w, T are numpy arrays for wavelength and transmittance
        from radis import transmittance_spectrum
        s2 = transmittance_spectrum(w, T, wunit='nm')                       # creates 'transmittance_noslit'



    See Also
    --------

    :func:`~radis.spectrum.models.calculated_spectrum`,
    :func:`~radis.spectrum.models.experimental_spectrum`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_array`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_txt`,
    :func:`~radis.tools.database.load_spec`

    """

    return Spectrum.from_array(
        np.array(w),
        np.array(T),
        "transmittance_noslit",
        waveunit=wunit,
        unit=Tunit,
        conditions=conditions,
        cond_units=cond_units,
        name=name,
    )
Пример #7
0
def test_broadening_vs_hapi(rtol=1e-2,
                            verbose=True,
                            plot=False,
                            *args,
                            **kwargs):
    """
    Test broadening against HAPI and tabulated data

    We're looking at CO(0->1) line 'R1' at 2150.86 cm-1
    """
    from hapi import absorptionCoefficient_Voigt, db_begin, fetch, tableList

    if plot:  # Make sure matplotlib is interactive so that test are not stuck in pytest
        plt.ion()

    setup_test_line_databases()  # add HITRAN-CO-TEST in ~/.radis if not there

    # Conditions
    T = 3000
    p = 0.0001
    wstep = 0.001
    wmin = 2150  # cm-1
    wmax = 2152  # cm-1
    broadening_max_width = 10  # cm-1

    # %% HITRAN calculation
    # -----------

    # Generate HAPI database locally
    hapi_data_path = join(dirname(__file__),
                          __file__.replace(".py", "_HAPIdata"))

    db_begin(hapi_data_path)
    if not "CO" in tableList():  # only if data not downloaded already
        fetch("CO", 5, 1, wmin - broadening_max_width / 2,
              wmax + broadening_max_width / 2)
        # HAPI doesnt correct for side effects

    # Calculate with HAPI
    nu, coef = absorptionCoefficient_Voigt(
        SourceTables="CO",
        Environment={
            "T": T,
            "p": p / 1.01325,
        },  # K  # atm
        WavenumberStep=wstep,
        HITRAN_units=False,
    )

    s_hapi = Spectrum.from_array(nu,
                                 coef,
                                 "abscoeff",
                                 "cm-1",
                                 "cm-1",
                                 conditions={"Tgas": T},
                                 name="HAPI")

    # %% Calculate with RADIS
    # ----------
    sf = SpectrumFactory(
        wavenum_min=wmin,
        wavenum_max=wmax,
        mole_fraction=1,
        path_length=1,  # doesnt change anything
        wstep=wstep,
        pressure=p,
        broadening_max_width=broadening_max_width,
        isotope=[1],
        warnings={
            "MissingSelfBroadeningWarning": "ignore",
            "NegativeEnergiesWarning": "ignore",
            "HighTemperatureWarning": "ignore",
            "GaussianBroadeningWarning": "ignore",
        },
    )  # 0.2)
    sf.load_databank(path=join(hapi_data_path, "CO.data"),
                     format="hitran",
                     parfuncfmt="hapi")
    #    s = pl.non_eq_spectrum(Tvib=T, Trot=T, Ttrans=T)
    s = sf.eq_spectrum(Tgas=T, name="RADIS")

    if plot:  # plot broadening of line of largest linestrength
        sf.plot_broadening(i=sf.df1.S.idxmax())

    # Plot and compare
    res = abs(get_residual_integral(s, s_hapi, "abscoeff"))
    if plot:
        plot_diff(
            s,
            s_hapi,
            var="abscoeff",
            title="{0} bar, {1} K (residual {2:.2g}%)".format(p, T, res * 100),
            show_points=False,
        )
        plt.xlim((wmin, wmax))
    if verbose:
        printm("residual:", res)
    assert res < rtol
Пример #8
0
def test_broadening(rtol=1e-2, verbose=True, plot=False, *args, **kwargs):
    '''
    Test broadening against HAPI and tabulated data

    We're looking at CO(0->1) line 'R1' at 2150.86 cm-1
    '''
    from radis.io.hapi import db_begin, fetch, tableList, absorptionCoefficient_Voigt

    if plot:  # Make sure matplotlib is interactive so that test are not stuck in pytest
        plt.ion()

    setup_test_line_databases()  # add HITRAN-CO-TEST in ~/.radis if not there

    # Conditions
    T = 3000
    p = 0.0001
    wstep = 0.001
    wmin = 2150  # cm-1
    wmax = 2152  # cm-1
    broadening_max_width = 10  # cm-1

    # %% HITRAN calculation
    # -----------

    # Generate HAPI database locally
    db_begin(join(dirname(__file__), __file__.replace('.py', '_HAPIdata')))
    if not 'CO' in tableList():  # only if data not downloaded already
        fetch('CO', 5, 1, wmin - broadening_max_width / 2,
              wmax + broadening_max_width / 2)
        # HAPI doesnt correct for side effects

    # Calculate with HAPI
    nu, coef = absorptionCoefficient_Voigt(
        SourceTables='CO',
        Environment={
            'T': T,  # K
            'p': p / 1.01325,  # atm
        },
        WavenumberStep=wstep,
        HITRAN_units=False)

    s_hapi = Spectrum.from_array(nu,
                                 coef,
                                 'abscoeff',
                                 'cm-1',
                                 'cm_1',
                                 conditions={'Tgas': T},
                                 name='HAPI')

    # %% Calculate with RADIS
    # ----------
    sf = SpectrumFactory(
        wavenum_min=wmin,
        wavenum_max=wmax,
        mole_fraction=1,
        path_length=1,  # doesnt change anything
        wstep=wstep,
        pressure=p,
        broadening_max_width=broadening_max_width,
        isotope=[1],
        warnings={
            'MissingSelfBroadeningWarning': 'ignore',
            'NegativeEnergiesWarning': 'ignore',
            'HighTemperatureWarning': 'ignore',
            'GaussianBroadeningWarning': 'ignore'
        })  # 0.2)
    sf.load_databank('HITRAN-CO-TEST')
    #    s = pl.non_eq_spectrum(Tvib=T, Trot=T, Ttrans=T)
    s = sf.eq_spectrum(Tgas=T, name='RADIS')

    if plot:  # plot broadening of line of largest linestrength
        sf.plot_broadening(i=sf.df1.S.idxmax())

    # Plot and compare
    res = abs(get_residual_integral(s, s_hapi, 'abscoeff'))
    if plot:
        plot_diff(s,
                  s_hapi,
                  var='abscoeff',
                  title='{0} bar, {1} K (residual {2:.2g}%)'.format(
                      p, T, res * 100),
                  show_points=False)
        plt.xlim((wmin, wmax))
    if verbose:
        printm('residual:', res)
    assert res < rtol
Пример #9
0
def concat_spectra(s1, s2, var=None):
    """Concatenate two spectra ``s1`` and ``s2`` side by side.

    Note: their spectral range should not overlap

    Returns
    -------

    s: Spectrum
        Spectrum object with the same units and waveunits as ``s1``

    Parameters
    ----------

    s1, s2: Spectrum objects
        Spectrum you want to concatenate
    var: str
        quantity to manipulate: 'radiance', 'transmittance', ... If ``None``,
        get the unique spectral quantity of ``s1``, or the unique spectral
        quantity of ``s2``, or raises an error if there is any ambiguity

    Notes
    -----

    .. warning::

        the output Spectrum has the sum of the spectral ranges of s1 and s2.
        It won't be evenly spaced. This means that you cannot apply a slit without
        side effects. Typically, you want to use this function for convolved
        quantities only, such as experimental spectra. Else, use
        :func:`~radis.los.slabs.MergeSlabs` with the options
        ``resample='full', out='transparent'``

    See Also
    --------

    :func:`~radis.spectrum.operations.add_spectra`,
    :func:`~radis.los.slabs.MergeSlabs`

    """

    # Get variable
    if var is None:
        try:
            var = _get_unique_var(
                s2, var, inplace=False)  # unique variable of 2nd spectrum
        except KeyError:
            var = _get_unique_var(
                s1, var, inplace=False
            )  # if doesnt exist, unique variable of 1st spectrum
            # if it fails, let it fail
    # Make sure it is in both Spectra
    if var not in s1.get_vars():
        raise KeyError("Variable {0} not in Spectrum {1}".format(
            var, s1.get_name()))
    if var not in s2.get_vars():
        raise KeyError("Variable {0} not in Spectrum {1}".format(
            var, s1.get_name()))

    if var in ["transmittance_noslit", "transmittance"]:
        warn(
            "It does not make much physical sense to sum transmittances. Are "
            +
            "you sure of what you are doing? See also // (MergeSlabs) and > " +
            "(SerialSlabs)")

    # Use same units
    Iunit1 = s1.units[var]
    wunit1 = s1.get_waveunit()

    # Get the value, on the same wunit)
    w1, I1 = s1.get(var=var,
                    copy=False)  # @dev: faster to just get the stored value.
    # it's copied in hstack() below anyway).
    w2, I2 = s2.get(var=var, Iunit=Iunit1, wunit=wunit1)

    if not (w1.max() < w2.min() or w2.max() > w1.min()):
        raise ValueError(
            "You cannot use concat_spectra for overlapping spectral ranges. " +
            "Got: {0:.2f}-{1:.2f} and {2:.2f}-{3:.2f} {4}. ".format(
                w1.min(), w1.max(), w2.min(), w2.max(), wunit1) +
            "Use MergeSlabs instead, with the correct `out=` parameter " +
            "for your case")

    w_tot = hstack((w1, w2))
    I_tot = hstack((I1, I2))

    name = s1.get_name() + "&" + s2.get_name()  # use "&" instead of "+"

    concat = Spectrum.from_array(w_tot,
                                 I_tot,
                                 var,
                                 waveunit=wunit1,
                                 unit=Iunit1,
                                 name=name)

    return concat
Пример #10
0
def substract_spectra(s1, s2, var=None):
    """Return a new spectrum with ``s2`` substracted from ``s1``.
    Equivalent to::

        s1 - s2

    Parameters
    ----------

    s1, s2: Spectrum objects
        Spectrum you want to substract
    var: str
        quantity to manipulate: 'radiance', 'transmittance', ... If ``None``,
        get the unique spectral quantity of ``s1``, or the unique spectral
        quantity of ``s2``, or raises an error if there is any ambiguity

    Returns
    -------

    s: Spectrum
        Spectrum object with the same units and waveunits as ``s1``

    See Also
    --------

    :func:`~radis.spectrum.operations.add_spectra`

    """

    # Get variable
    if var is None:
        try:
            var = _get_unique_var(
                s2, var, inplace=False)  # unique variable of 2nd spectrum
        except KeyError:
            var = _get_unique_var(
                s1, var, inplace=False
            )  # if doesnt exist, unique variable of 1st spectrum
            # if it fails, let it fail
    # Make sure it is in both Spectra
    if var not in s1.get_vars():
        raise KeyError("Variable {0} not in Spectrum {1}".format(
            var, s1.get_name()))
    if var not in s2.get_vars():
        raise KeyError("Variable {0} not in Spectrum {1}".format(
            var, s1.get_name()))

    # Use same units
    Iunit1 = s1.units[var]
    wunit1 = s1.get_waveunit()

    # Resample s2 on s1
    s2 = s2.resample(s1, inplace=False)

    # Substract
    w1, I1 = s1.get(var=var, Iunit=Iunit1, wunit=wunit1)
    w2, I2 = s2.get(var=var, Iunit=Iunit1, wunit=wunit1)

    name = s1.get_name() + "-" + s2.get_name()

    sub = Spectrum.from_array(w1,
                              I1 - I2,
                              var,
                              waveunit=wunit1,
                              unit=Iunit1,
                              name=name)
    #    warn("Conditions of the left spectrum were copied in the substraction.", Warning)
    return sub
Пример #11
0
def add_spectra(s1, s2, var=None, force=False):
    """Return a new spectrum with ``s2`` added to ``s1``.
    Equivalent to::

        s1 + s2

    .. warning::
        we are just algebrically adding the quantities. If you want to merge
        spectra while preserving the radiative transfer equation, see
        :func:`~radis.los.slabs.MergeSlabs` and :func:`~radis.los.slabs.SerialSlabs`

    Parameters
    ----------

    s1, s2: Spectrum objects
        Spectrum you want to substract
    var: str
        quantity to manipulate: 'radiance', 'transmittance', ... If ``None``,
        get the unique spectral quantity of ``s1``, or the unique spectral
        quantity of ``s2``, or raises an error if there is any ambiguity

    Returns
    -------

    s: Spectrum
        Spectrum object with the same units and waveunits as ``s1``

    See Also
    --------

    :func:`~radis.los.slabs.MergeSlabs`,
    :func:`~radis.spectrum.operations.substract_spectra`

    """

    # Get variable
    if var is None:
        try:
            var = _get_unique_var(
                s2, var, inplace=False)  # unique variable of 2nd spectrum
        except KeyError:
            var = _get_unique_var(
                s1, var, inplace=False
            )  # if doesnt exist, unique variable of 1st spectrum
            # if it fails, let it fail
    # Make sure it is in both Spectra
    if var not in s1.get_vars():
        raise KeyError("Variable {0} not in Spectrum {1}".format(
            var, s1.get_name()))
    if var not in s2.get_vars():
        raise KeyError("Variable {0} not in Spectrum {1}".format(
            var, s1.get_name()))

    if var in ["transmittance_noslit", "transmittance"] and not force:
        raise ValueError(
            "It does not make much physical sense to sum transmittances. Are "
            +
            "you sure of what you are doing? See also `//` (MergeSlabs), `>` "
            +
            "(SerialSlabs) and `concat_spectra`. If you're sure, use `force=True`"
        )

    # Get s1 units
    Iunit1 = s1.units[var]
    wunit1 = s1.get_waveunit()

    # Resample s2 on s1
    s2 = s2.resample(s1, inplace=False)

    # Add, change output unit if needed.
    w1, I1 = s1.get(var=var, Iunit=Iunit1, wunit=wunit1)
    w2, I2 = s2.get(var=var, Iunit=Iunit1, wunit=wunit1)

    name = s1.get_name() + "+" + s2.get_name()

    sub = Spectrum.from_array(w1,
                              I1 + I2,
                              var,
                              waveunit=wunit1,
                              unit=Iunit1,
                              name=name)
    #    warn("Conditions of the left spectrum were copied in the substraction.", Warning)
    return sub
Пример #12
0
def calculated_spectrum(w,
                        I,
                        wunit='nm',
                        Iunit='mW/cm2/sr/nm',
                        conditions=None,
                        cond_units=None,
                        populations=None,
                        name=None):  # -> Spectrum:
    ''' Convert (w, I) into a Spectrum object that has unit conversion, plotting
    and slit convolution capabilities


    Parameters    
    ----------

    w, I: np.array
        wavelength and intensity

    wunit: 'nm', 'cm-1'
        wavespace unit

    Iunit: str
        intensity unit (can be 'counts', 'mW/cm2/sr/nm', etc...). Default
        'mW/cm2/sr/nm' (note that non-convoluted Specair spectra are in 'mW/cm2/sr/µm')


    Other Parameters
    ----------------

    conditions: dict
        (optional) calculation conditions to be stored with Spectrum. Default ``None``

    cond_units: dict
        (optional) calculation conditions units. Default ``None``

    populations: dict
        populations to be stored in Spectrum. Default ``None``

    name: str
        (optional) give a name


    See Also
    --------

    :func:`~radis.spectrum.spectrum.transmittance_spectrum`, 
    :func:`~radis.spectrum.spectrum.experimental_spectrum`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_array`,
    :meth:`~radis.spectrum.spectrum.Spectrum.from_txt`,
    :func:`~radis.tools.database.load_spec`

    '''

    return Spectrum.from_array(np.array(w),
                               np.array(I),
                               'radiance_noslit',
                               waveunit=wunit,
                               unit=Iunit,
                               conditions=conditions,
                               cond_units=cond_units,
                               populations=populations,
                               name=name)