Giter Club home page Giter Club logo

radis-examples's Introduction

RADIS is a fast line-by-line code for high resolution infrared molecular spectra (emission / absorption, equilibrium / non-LTE) based on HITRAN/HITEMP/ExoMol.

It includes post-processing tools to compare experimental spectra and spectra calculated with RADIS or other spectral codes.

User full documentation (advanced install and examples) are available on the RADIS Website.

Getting Started

Install

Assuming you have Python installed with the Anaconda distribution you can use pip:

pip install radis

or mamba or conda via the conda-forge channel:

conda install radis -c conda-forge

That's it! You can now run your first example below. If you encounter any issue, or to upgrade the package later, please refer to the detailed installation procedure .

Quick Start

Calculate a CO equilibrium spectrum from the HITRAN database

from radis import calc_spectrum
s = calc_spectrum(1900, 2300,         # cm-1
                  molecule='CO',
                  isotope='1,2,3',
                  pressure=1.01325,   # bar
                  Tgas=700,           # K
                  mole_fraction=0.1,
                  path_length=1,      # cm
                  databank='hitran'   # or 'hitemp'
                  )
s.apply_slit(0.5, 'nm')       # simulate an experimental slit
s.plot('radiance')
https://radis.readthedocs.io/en/latest/_images/co_spectrum_700K.png

Advanced use

The Quick Start examples automatically downloads the line databases from HITRAN-2016, which is valid for temperatures below 700 K. For high temperature cases, you may need to use other line databases such as HITEMP-2010 (typically T < 2000 K) or CDSD-4000 (T < 5000 K). HITEMP can also be downloaded automatically, or can be downloaded manually and described in a ~/radis.json Configuration file.

More complex examples will require to use the SpectrumFactory class, which is the core of RADIS line-by-line calculations. calc_spectrum is a wrapper to SpectrumFactory for the simple cases.

Compare with experiments

Experimental spectra can be loaded using the experimental_spectrum function and compared with the plot_diff function. For instance:

from numpy import loadtxt
from radis import experimental_spectrum, plot_diff
w, I = loadtxt('my_file.txt').T    # assuming 2 columns
sexp = experimental_spectrum(w, I, Iunit='mW/cm2/sr/nm')
plot_diff(sexp, s)    # comparing with spectrum 's' calculated previously

Typical output of plot_diff:

https://radis.readthedocs.io/en/latest/_images/cdsd4000_vs_hitemp_3409K.svg

Refer to the Examples section for more examples, and to the Spectrum page for more post-processing functions.

GPU Acceleration

RADIS supports GPU acceleration for super-fast computation of spectra. Refer to GPU Spectrum Calculation on RADIS for more details on GPU acceleration.:

=======================================
Try online (no installation needed!)

๐ŸŒฑ Radis-app

A simple web-app for RADIS under development - GitHub

https://radis.app/

๐Ÿ”ฌ RADIS-lab

An online environment for advanced spectrum processing and comparison with experimental data:

  • no need to install anything
  • use pre-configured line databases (HITEMP)
  • upload your data files, download your results !
https://radis.github.io/radis-lab/

See more on GitHub


Cite

Articles are available at Article Spectral Synthesis Algorithm

For reproducibility, do not forget to cite the line database used, and the spectroscopic constants if running nonequilibrium calculations. See How to cite?


Developer Guide

Contribute

Want to contribute to RADIS? Join the Slack community and we'll help you through the process. Want to get started immediatly? Nice. Have a look at the the Developer Guide.

Contributors Slack

RADIS internals are also described in the full documentation

License

The code is available on this repository under GNU LESSER GENERAL PUBLIC LICENSE (v3) License


References

Links

Other Spectroscopic tools

See awesome-spectra Examples


RADIS logo

radis-examples's People

Contributors

erwanp avatar maillardj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

radis-examples's Issues

exp overflow in radiative_forcing_co2.py

Hi All,

I'm seeing exp overflow errors in radiative_forcing_co2.py presumably due to extreme values of absorbance in eq_spectrum and some other functions at certain slabs in the middle of the atmosphere.

Any ideas on how to workaround this? Happy to submit a PR if it's an easy fix

HAPI version: 1.1.2.0
To get the most up-to-date version please check http://hitran.org/hapi
ATTENTION: Python versions of partition sums from TIPS-2017 are now available in HAPI code

           It is free to use HAPI. If you use HAPI in your research or software development,
           please cite it using the following reference:
           R.V. Kochanov, I.E. Gordon, L.S. Rothman, P. Wcislo, C. Hill, J.S. Wilzewski,
           HITRAN Application Programming Interface (HAPI): A comprehensive approach
           to working with spectroscopic data, J. Quant. Spectrosc. Radiat. Transfer 177, 15-30 (2016)
           DOI: 10.1016/j.jqsrt.2016.03.005
Calculating Atmosphere layers
(58s)   39.1%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(60s)   40.2%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(62s)   41.4%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(64s)   42.5%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(65s)   43.7%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(67s)   44.8%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(69s)   46.0%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(71s)   47.1%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(73s)   48.3%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(75s)   49.4%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\lbl\factory.py:798: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
(168s)  100.0%
Solving radiative transfer equation
C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\los\slabs.py:250: RuntimeWarning: overflow encountered in multiply
  quantities["radiance_noslit"] = (w, I * Tn + In)
C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\los\slabs.py:254: RuntimeWarning: invalid value encountered in multiply
  quantities["transmittance_noslit"] = (w, Tn * T)
C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\los\slabs.py:314: UserWarning: Nans detected in Spectrum object for multi-slab operation. Results may be wrong!
  warn(
Calculating Reference Atmosphere
(1s)    42.5%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\spectrum\rescale.py:721: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\spectrum\rescale.py:730: RuntimeWarning: invalid value encountered in true_divide
  radiance_noslit[~b] / (1 - transmittance_noslit[~b]) * abscoeff[~b]
(1s)    43.7%C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\spectrum\rescale.py:721: RuntimeWarning: overflow encountered in exp
  transmittance_noslit = exp(-absorbance)
C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\spectrum\rescale.py:730: RuntimeWarning: invalid value encountered in true_divide
  radiance_noslit[~b] / (1 - transmittance_noslit[~b]) * abscoeff[~b]
(3s)    100.0%
Solving radiative transfer equation
C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\los\slabs.py:250: RuntimeWarning: overflow encountered in multiply
  quantities["radiance_noslit"] = (w, I * Tn + In)
C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\los\slabs.py:254: RuntimeWarning: invalid value encountered in multiply
  quantities["transmittance_noslit"] = (w, Tn * T)
C:\Users\anjum\Miniconda3\envs\zeus\lib\site-packages\radis\los\slabs.py:314: UserWarning: Nans detected in Spectrum object for multi-slab operation. Results may be wrong!
  warn(
Upward radiation @278 ppm: nan W/m2
Upward radiation @400 ppm: nan W/m2

More examples

We're looking for more examples, for instance of Radis being used to fit experimental spectra. If you have any idea file a Pull Request !

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.