Plotting, recipes, models, and solvers

Plotting

qsospec.plot_line_result(result, output_path=None, ax=None, show_components=True, title=None)[source]

Plot one fitted local line-complex result.

Returns the Matplotlib axes when output_path is not provided, otherwise saves the figure and returns the written path.

Parameters:
qsospec.plot_local_result(result, output_path=None, show_components=True)[source]

Plot all windows from a local fit in stacked panels.

Parameters:
qsospec.save_local_window_plots(result, output_dir, show_components=True)[source]

Write one PNG per local-fit window and return {window: path}.

Parameters:
Return type:

Dict[str, str]

Registries

qsospec.recipes.list_complexes()[source]
Return type:

Tuple[ComplexRecipe, …]

qsospec.recipes.get(value)[source]
Parameters:

value (str)

Return type:

ComplexRecipe

qsospec.recipes.resolve(value)[source]
Parameters:

value (str)

Return type:

str

qsospec.recipes.describe(value)[source]
Parameters:

value (str)

Return type:

Dict[str, Any]

qsospec.recipes.generic_narrow_lines(line_ids, **changes)[source]
Parameters:
Return type:

ComplexRecipe

qsospec.lines.list()[source]

Return all registered line definitions in wavelength order.

Return type:

Tuple[LineDefinition, …]

qsospec.lines.get(value)[source]

Return one immutable line definition.

Parameters:

value (str)

Return type:

LineDefinition

qsospec.lines.resolve(value)[source]

Resolve a canonical line ID from a normalized or historical alias.

Parameters:

value (str)

Return type:

str

Models and solvers

qsospec.models.gaussian(wave, amp, center, sigma)[source]

Evaluate amp * exp(-0.5 * ((wave - center) / sigma)**2).

Parameters:
Return type:

ndarray

qsospec.models.gaussian_partials(wave, amp, center, sigma)[source]

Return dense model derivatives with columns amp, center, sigma.

Parameters:
Return type:

ndarray

qsospec.models.lorentzian(wave, amp, center, gamma)[source]

Evaluate a peak-normalized Lorentzian profile.

Parameters:
Return type:

ndarray

qsospec.models.lorentzian_partials(wave, amp, center, gamma)[source]

Return dense derivatives with columns amp, center, gamma.

Parameters:
Return type:

ndarray

qsospec.models.continuum(wave, mode, params, wave_ref, scale)[source]

Evaluate the MVP local continuum model.

Parameters:
Return type:

ndarray

qsospec.models.continuum_partials(wave, mode, wave_ref, scale)[source]

Return dense model derivatives for the local continuum parameters.

Parameters:
Return type:

ndarray

qsospec.solvers.solve_variable_projection(flux, err, nonlinear_initial, nonlinear_bounds, linear_bounds, evaluator, *, jacobian_method='semi_analytic', max_nfev=None)[source]

Solve a bounded separable nonlinear least-squares problem.

Parameters:
Return type:

VariableProjectionResult

qsospec.solvers.run_least_squares(packed, wave, flux, err, jacobian='analytic_dense', max_nfev=None)[source]

Run SciPy least-squares for a packed local line-complex model.

Parameters: