qspec logo qspec logo

A physics toolbox for laser spectroscopy.

Static Badge Static Badge Static Badge

Static Badge Static Badge

© 2026 Patrick Müller. All rights reserved.

qspec.models. gen_model  (  ijj ,  shape=None ,  qi=False ,  hf_mixing=False ,  hf_config=None ,  n_peaks=None ,  offsets=None ,  x_cuts=None ,  convolve=None  )[source]

Create a lineshape model to fit arbitrary atomic fluorescence spectra. The model is composed of the Spectrum, a Splitter for each set of quantum numbers in ijj, optionally an NPeak and a Convolved model, and an Offset model.

Parameters:
ijjscalar_nd

The three or an iterable of three quantum numbers $I$, $J_l$ and $J_u$. Must be a list with the format [I, J_l, J_u] or [[I0, J0_l, J0_u], [I1, J1_l, J1_u], ...].

shapestr | type | _spectrum.Spectrum | None

A str representation of a Spectrum type, see SPECTRA, or a Spectrum type. If None, the Empty model is used.

qibool

Whether to use a quantum interference model, see HyperfineQI.

hf_mixingbool

Whether to use a hyperfine-induced mixing model, see HyperfineMixed. Not implemented for qi=True.

hf_configdict | None

A dict containing the configuration for the hf mixing. Only used if hf_mixing=True.

n_peaksint | None

The number of "peaks per resonance" or "lineshape duplicates", see NPeak.

offsetsarray_like | None

The orders of the offset polynomials of the separate x-axis intervals. Must be a list or a single value. In the former case len(offsets) == len(x_cuts) + 1 must hold. If offsets is None, a single constant offset is assumed.

x_cutsarray_like | None

The x values where to cut the x-axis. Must be a list or a single value. In the former case len(offsets) == len(x_cuts) + 1 must hold. If x_cuts is None, the x-axis will not be cut.

convolvestr | type | _convolved.Convolved | None

A str representation of a Convolved type, see CONVOLVE, or a Convolved type.

Returns:
model_base.Model

The constructed lineshape model.

Raises:
NotImplementedError

If both qi and hf_mixing are True.

ValueError

If ijj, shape or convolve have an invalid format or value.