TikhoTests

class jwst.extract_1d.soss_extract.atoca_utils.TikhoTests(test_dict, default_chi2='chi2_cauchy')[source]

Bases: dict

Store results of Tikhonov tests for different factors.

Merge output of Tikhonov solver with chi2 and curvature.

Parameters:
test_dictdict

Dictionary holding arrays for factors, solution, error, reg, and grid.

default_chi2str, optional

Type of chi2 loss used by default. Options are 'chi2', 'chi2_soft_l1', or 'chi2_cauchy' (default).

Methods Summary

best_factor([mode])

Compute the best scale factor for Tikhonov regularisation.

merge(addnl_dict)

Merge an additional dictionary onto the present instance.

Methods Documentation

best_factor(mode='curvature')[source]

Compute the best scale factor for Tikhonov regularisation.

Best factor is determined by taking the factor giving the highest log L on the detector or the highest curvature of the l-curve, depending on the chosen mode.

Parameters:
modestr, optional

How to find the best factor: 'chi2', 'curvature' (default), or 'd_chi2'

Returns:
float

Best scale factor as determined by the selected algorithm

merge(addnl_dict)[source]

Merge an additional dictionary onto the present instance.

The arrays of chi squared values will also need to be recomputed from the expanded arrays.

Parameters:
addnl_dictdict

Dictionary holding arrays for factors, solution, error, and reg. Will be appended onto the existing arrays using numpy.hstack or numpy.vstack, as appropriate.