Skip to main content

Non-uniform Temperature Fitting (NTfit)

DOI License PyPI

Nonuniform-temperature fitting code, to extract spatial temperature variations along a laser path. For high-temperature gas diagnostics.

In support of the 2-part paper series N.A. Malarich and G.B. Rieker, "Resolving nonuniform temperature distributions with single-beam absorption spectroscopy"

Nonuniform-temperature fitting is a two-step process. The Python package ntfit has sub-packages for each step.

  1. ntfit.spectrafit: Extract linestrengths from broadband spectrum with E"-binning.
  2. ntfit.tdist: Fit temperature distribution from linestrength fit in (1) with Tikhonov regularization.

For help running the fits, check out examples/Example_td.py, or the associated .ipynb (Jupyter Notebook) file.

Should I use this code?

If you are fitting temperature from an absorption spectrum with more than two visible absorption features, then try it.

You might not have great success if

  1. You don't have an accurate lineshape model for many of your absorption features
  2. You have multiple absorbing species in your spectral fitting window. (This was designed for a pure H2O spectrum. However, if you are, say, fitting CO2, you can subtract out the nominal background absorption of your weaker H2O lines first and then try this code for CO2)
  3. Check the lower-state energies of your strongest absorption features. If they are clumped together around 1 or 2 values, all the E" within 10% of each other, then your spectrum might not have enough information. However, if you have weaker absorption features above your noise floor but buried underneath stronger absorption features, then this might be exactly the code you want (see Figs 2, 8 of my paper ).

Package requirements

Your computer must already have the following Python packages: This package developed on WinPython64-3680, using

python3.6.8
numpy=1.16.2
matplotlib=3.3.4
scipy=1.2.1

NTfit also includes HAPI, available under MIT license. NTfit changed HAPI version 1.1.0.9.6 lineshape equations (power-law temperature dependence) from original HAPI to improve high-temperature acuracy. See ntfit/hapi/hapi_combustion.py docstring for details. Partition functions are calculated using TIPS2017.

References

If you use this package, please cite the following articles. for E"-bin fitting with HAPI:

  • 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.

  • N.A. Malarich and G.B. Rieker, "Resolving nonuniform temperature distributions with single-beam absorption spectroscopy. Part II: Implementation from broadband spectra" JQSRT (2021) DOI: 10.1016/j.jqsrt.2021.107805

  • (time-domain fitting) R.K. Cole, A.S. Makowiecki, Z. Hoghooghi, G.B. Rieker, "Baseline-free Quantitative Absorption Spectroscopy Based on Cepstral Analysis" Optics Express 27 (2019) DOI: 10.1364/OE.27.037920.

for ntfit.tdist:

  • N.A. Malarich and G.B. Rieker, "Resolving nonuniform temperature distributions with single-beam absorption spectroscopy. Part I: Theoretical capabilities and limitations" JQSRT (2021) DOI: 10.1016/j.jqsrt.2020.107455

Author

Nathan Malarich (nathan.malarich@colorado.edu)

Change Log

[2.2.2] - 2024-08-16

  • less buggy handling of full spectrum bandwidth vs subrange for time-domain fit

[2.2.1] -2024-08-15

  • Added molefraction-column result to temperature inversion

[2.2] - 2024-08-10

Changed

  • fit_snorm_width_shift() scales Lorentz-width and shift of original model, rather than recalculating Voigt lineshapes each iteration. Huge speed and stability improvements at a small cost of accuracy for E"-bins having lines with varied air-lineshape coefficients.
  • p_rat a Lorentz-scaling, not a pressure-ratio. Values << 1, detect magnitude or saved fits for backwards compatibility.
  • changed several variable names to be (hopefully) more intuitive and following Python style guide
  • Absorption models calculated further into wings

Added

  • r-squared fit statistics to ntfit.spectrafit

[2.1] - 2022-09-23

Changed

  • ntfit now a separate sub-package, compatible with pip install
  • hapi sub-package has separate file for Q(T) tables
  • Removed uniform_fit example, as lookup table is much more efficient way to fit temperature
  • Tikhonov regularization module now ntfit.tdist
  • E"-bin spectral-fitting now ntfit.spectrafit

[2.0] - 2021-03-01

Added

  • E"-bin spectral fitting package with hapi

Release files for ntfit 2.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ntfit 2.2.2
File Size Uploaded
ntfit-2.2.2.tar.gz 366.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ntfit 2.2.2
File Interpreter ABI Platform
ntfit-2.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 743.0 kB

Release files / ntfit-2.2.2.tar.gz

Download URL ntfit-2.2.2.tar.gz
Size 366.2 kB
Tags Source
SHA-256 checksum
How to use checksums
43d7bb44cd042573ba6d74f98b27d0d14f5ea78e22339e078be4b45059bf7583
BLAKE2b-256 checksum
How to use checksums
925d41c46c8e8ca4c9eb27c831bedc6edf290339e0ceac205a7b86d9a99553b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release files / ntfit-2.2.2-py3-none-any.whl

Download URL ntfit-2.2.2-py3-none-any.whl
Size 376.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
725c0842c908f94a1064c43ea6cf8d2963ea4ecad26930ade2e5899424c6e788
BLAKE2b-256 checksum
How to use checksums
9a7491a9520f054f127e32fca410903d51104d791707e786945daab012508102
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

2.2.2 This release

2 release files

2.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page