Intensity Correction#
Because of the cutoff or sub-Lorentzian treatment of the line wings, the total line intensity is not conserved anymore. To account for that, line racer uses pre-calculated intensity correction grids. These are downloaded by default when you prepare the opacity calculation for the first time. However, if that does not work, you can download them manually from this link and store the files in a folder data/. The pre-calculated grid
ranges from Gaussian widths of \(10^{-6}\) to 100 1/cm, gamma/sigma ratios from \(10^{-9}\) to \(10^{6}\) and cutoff values from 1 to 5000 1/cm. The grid has 500 points in the width direction and 100 points in the gamma/sigma ratio and cutoff direction. The intensity correction is calculated for three cases: with Hartmann et al. (2002) corrections, Burch et al. (1969) corrections, and cutoff only. Depending on whether you use the Hartmann or Burch corrections or not, the respective
grid is used for the intensity correction. If your cutoff is larger than 5000 1/cm, no intensity correction is applied. If the line widths are outside the range of the correction grid, the nearest value is used.
You can also calculate the grids manually by running the following code, for example if you want to use a larger cutoff or range of line widths. The grids are stored in the data/ folder. More about the intensity correction and how it works can be found in the background information of the line calculation.
[1]:
import numpy as np
import os
from line_racer.intensity_correction_precalculation import calculate_correction_grid
# Define parameters for the correction grid calculation
gamma_sigma_ratio_minimum = 1e-9
gamma_sigma_ratio_maximum = 1e6
sigma_minimum = 1e-6
sigma_maximum = 1e2
width_points = 50 # normally at least 500!!!
cutoff_minimum = 1
cutoff_maximum = 5000
cutoff_points = 1 # normally at least 100!!!
os.makedirs("dataa/", exist_ok=True)
# calculate the grid for the Hartmann and cutoff correction
Hartmann = True
hartmann_cutoff_correction_grid, sigma_grid, gamma_sigma_ratio_grid, cutoff_grid = calculate_correction_grid(
gamma_sigma_ratio_minimum,
gamma_sigma_ratio_maximum,
sigma_minimum, sigma_maximum, width_points,
cutoff_minimum, cutoff_maximum,
cutoff_points, use_hartmann=Hartmann)
np.savez('dataa/correction_grid_hartmann_cutoff.npz', sigma_grid=sigma_grid, gamma_sigma_ratio_grid=gamma_sigma_ratio_grid,
cutoff_grid=cutoff_grid, correction_grid=hartmann_cutoff_correction_grid)
# calculate the grid for the Hartmann and cutoff correction
Burch = True
burch_cutoff_correction_grid, sigma_grid, gamma_sigma_ratio_grid, cutoff_grid = calculate_correction_grid(
gamma_sigma_ratio_minimum,
gamma_sigma_ratio_maximum,
sigma_minimum, sigma_maximum, width_points,
cutoff_minimum, cutoff_maximum,
cutoff_points, use_burch=Burch)
np.savez('dataa/correction_grid_burch_cutoff.npz', sigma_grid=sigma_grid, gamma_sigma_ratio_grid=gamma_sigma_ratio_grid,
cutoff_grid=cutoff_grid, correction_grid=burch_cutoff_correction_grid)
# calculate the grid for the cutoff correction only
cutoff_correction_grid, sigma_grid, gamma_sigma_ratio_grid, cutoff_grid = calculate_correction_grid(
gamma_sigma_ratio_minimum,
gamma_sigma_ratio_maximum,
sigma_minimum, sigma_maximum, width_points,
cutoff_minimum, cutoff_maximum,
cutoff_points)
np.savez('dataa/correction_grid_cutoff.npz', sigma_grid=sigma_grid, gamma_sigma_ratio_grid=gamma_sigma_ratio_grid,
cutoff_grid=cutoff_grid, correction_grid=cutoff_correction_grid)
import shutil
shutil.rmtree("dataa/")
Calculating correction grid for cutoff and using Hartmann correction 1.00 cm^-1 (1/1)
Calculating correction grid for cutoff and using Burch correction 1.00 cm^-1 (1/1)
Calculating correction grid for cutoff 1.00 cm^-1 (1/1)
For calculation time reasons, we are just using one cutoff value and 50 width values here for the grid and also create a folder dataa/ instead of data/. In practice, you would want to use 100 cutoff points and store the files in the data/ folder.