specsrbench.methods

The nine reconstructions, their display names, and the keys they are cached under.

Three different naming schemes meet in this project and none of them can be retired without invalidating a shipped cache:

  • snr.npz is keyed by a short name – LR, RL, MF, SR2.

  • fit_params_cache.npz is keyed by the display name – Cubic (LR), R-L, Wiener + MF, ML (SR2).

  • The arrays themselves are separate .npy files named after the method.

Each notebook carried its own copy of all three maps, and they had drifted: three of the six mapped ML (SR2) to the S/N key "ML (SR2)", which does not exist in snr.npz. It never raised, because those three defined the map and then did not use it. One table here, with the cache’s own key names checked by tests/test_cache_integrity.py, is what replaces that.

Display labels still vary by figure – figure 2 writes LR (cubic) and Wiener + TV where figure 3 writes Cubic (LR) and TV – and figure 3 recolours two methods to keep them legible against its diverging colour map. Those variations are real and are preserved by registry() overrides rather than by nine more copies of the table.

Module Attributes

METHODS

Fixed display order, and the order every bar chart and panel grid uses: baseline -> linear -> non-linear/regularised -> line-list-aware -> learned, with the reference last.

LINES

(cache key, display label, rest wavelength in um) for the four lines the paper measures.

Functions

colors(reg)

labels(reg)

line_keys()

registry([label_overrides, color_overrides, ...])

The method table, keyed by canonical name, with per-figure overrides.

Classes

Method(key, label, array, color)

One reconstruction: how to find it, what to call it, how to draw it.

class specsrbench.methods.Method(key, label, array, color)[source]

Bases: object

One reconstruction: how to find it, what to call it, how to draw it.

Parameters:
key: str

canonical short name, and the snr.npz key prefix

label: str

display name, and the fit_params_cache.npz prefix

array: str | None

file in the cache holding it, if it has one of its own

color: str
property snr_key: str
specsrbench.methods.METHODS: tuple[Method, ...] = (Method(key='LR', label='Cubic (LR)', array='x_low.npy', color='deeppink'), Method(key='Wiener', label='Wiener', array='wiener_cache.npy', color='tomato'), Method(key='Tikhonov', label='Tikhonov', array='tikhonov_cache.npy', color='forestgreen'), Method(key='TV', label='TV', array='tv_cache.npy', color='teal'), Method(key='RL', label='R-L', array='rl_cache.npy', color='steelblue'), Method(key='Sparse', label='Sparse', array='sparse_cache.npy', color='goldenrod'), Method(key='MF', label='Wiener + MF', array='mf_cache.npy', color='darkorchid'), Method(key='SR2', label='ML (SR2)', array=None, color='darkorange'), Method(key='HR', label='HR target', array='x_high.npy', color='black'))

Fixed display order, and the order every bar chart and panel grid uses: baseline -> linear -> non-linear/regularised -> line-list-aware -> learned, with the reference last.

specsrbench.methods.registry(label_overrides=None, color_overrides=None, include_hr=True)[source]

The method table, keyed by canonical name, with per-figure overrides.

Overrides are given by canonical key, so a figure that renames LR to LR (cubic) cannot accidentally rename it to something the cache has never heard of – the key it looks arrays up by does not change.

Parameters:
Return type:

dict[str, Method]

specsrbench.methods.labels(reg)[source]
Parameters:

reg (dict[str, Method])

Return type:

list[str]

specsrbench.methods.colors(reg)[source]
Parameters:

reg (dict[str, Method])

Return type:

list[str]

specsrbench.methods.LINES: tuple[tuple[str, str, float], ...] = (('Halpha', 'H$\\alpha$', 0.6563), ('OIII5007', '[O III] $\\lambda$5007', 0.5007), ('Hbeta', 'H$\\beta$', 0.4861), ('OII3727', '[O II] $\\lambda$3727', 0.3727))

(cache key, display label, rest wavelength in um) for the four lines the paper measures. The order is the one every per-line panel row uses.

specsrbench.methods.line_keys()[source]
Return type:

list[str]