โ† Back to list

๐ŸŒฑ A fast line-by-line code for high-resolution infrared molecular spectra

RADIS is a Python library to compute high resolution infrared spectra from databases like HITRAN and HITEMP. It works line by line, meaningโ€ฆ

Merin Theres Jose ยท 2026-04-16 14:12 ยท 11 claps ยท 1.5 min read
#radi #python-libraries #dataframes #open-source #scientific-computing
Open on Medium โ†—
Wiki topics: ๐Ÿ”“ ยท Open Source ๐Ÿ”ฌ ยท Science ยท General ๐Ÿ“š ยท Books & Reading

๐ŸŒฑ A fast line-by-line code for high-resolution infrared molecular spectra

RADIS is a Python library to compute high resolution infrared spectra from databases like HITRAN and HITEMP. It works line by line, meaning each molecular transition is processed for accurate results, while hiding the complexity of large datasets.

What problem it solves?

Spectroscopic databases are huge (millionsโ€“billions of lines). To compute spectra manually, you need to:

  • load large datasets
  • filter required wavenumber range
  • apply physics (broadening, temperature, etc.)
  • combine all line contributions

This is slow and memory heavy.

RADIS:

  • Loads only required data (Lazy loading).
  • Avoids repeated parsing using cache.
  • Handles computation internally.

Example

from radis import calc_spectrum
s = calc_spectrum(1900, 2300,
                  molecule='CO',
                  isotope='1,2,3',
                  pressure=1.01325,
                  Tgas=700,
                  mole_fraction=0.1,
                  path_length=1,
                  databank='hitran'
                  )
s.apply_slit(0.5, 'nm')
s.plot('radiance')PTY
  • range โ†’ 1900โ€“2300 cmโปยน
  • temperature โ†’ affects intensity
  • pressure โ†’ affects broadening
  • mole fraction โ†’ gas concentration

Output

spikes โ†’ molecular lines

spikes โ†’ molecular lines

Current system

Pipeline:

compressed files โ†’ parsed โ†’ DataFrame โ†’ HDF5 cache โ†’ reused

Uses:

  • Vaex โ†’ lazy loading (memory mapped)
  • Pandas โ†’ full load (fallback)

Current issues

  • Vaex not maintained โ†’ blocks newer Python versions
  • Pandas loads full data โ†’ memory crashes

My contributions

I worked on improving performance and data handling in RADIS. In PR #885, I added parallel COโ‚‚ chunk downloads, which improved download speed by around 16%. In PR #954, I implemented proper registration of partial COโ‚‚ downloads with metadata like wavenumber range and last_used, enabling better tracking and future caching strategies. In PR #977, I fixed an issue where temporary files were being written to the working directory by redirecting them to the correct RADIS cache.

Direction ahead

  • Remove Vaex dependency
  • Support better backends (Parquet)
  • Implement optional LRU cache

Conclusion

RADIS helps convert large molecular databases into usable spectra efficiently. This was my first open source project, and I started without knowing testing, pre-commit, or proper workflows. Through these contributions, I learned how real systems are built and improved, and how to work with a large codebase. From a small first PR to multiple meaningful contributions, this project has been a big step in my learning.


๋ฉ”ํƒ€๋ฐ์ดํ„ฐ
post_id
9ba8a3693a56
slug
a-fast-line-by-line-code-for-high-resolution-infrared-molecular-spectra-9ba8a3693a56
url
https://medium.com/@merintheresjose/a-fast-line-by-line-code-for-high-resolution-infrared-molecular-spectra-9ba8a3693a56
canonical_url
https://medium.com/@merintheresjose/a-fast-line-by-line-code-for-high-resolution-infrared-molecular-spectra-9ba8a3693a56
author_url
https://medium.com/@merintheresjose
status
ok
fetched_at
2026-06-22 08:06:21