Weighting Schemes#

demregpy.dn2dem() supports three weighting modes via gloci, dem_norm0, and the default self-normalized path. See Regularised Inversion for the inversion itself and demregpy (demregpy) for full signatures.

Default: Self-Normalized Weighting#

When neither dem_norm0 nor gloci is specified, dn2dem runs a two-pass solve: the first pass estimates a DEM shape which is then used as the constraint weighting for the second pass.

Use it by simply passing no weighting, like this:

dem, edem, elogt, chisq, dn_reg = dn2dem(
    dn_in,
    edn_in,
    trmatrix,
    tresp_logt,
    temps,
)

EM Loci Weighting#

A loci curve for a given filter is the maximum emission measure at each temperature consistent with the observed count in that filter:

\[\mathrm{EM}(T) = \frac{\mathrm{DN}}{R(T)}\]

where \(R(T)\) is the filter response. The minimum envelope across all channels gives the tightest upper bound on the DEM from the data alone.

If you pass gloci=1, the inversion uses this minimum envelope as the weighting.

For example,

dem, edem, elogt, chisq, dn_reg = dn2dem(
    dn_in,
    edn_in,
    trmatrix,
    tresp_logt,
    temps,
    gloci=1,
)

or,

dem, edem, elogt, chisq, dn_reg = dn2dem(
    dn_in,
    edn_in,
    trmatrix,
    tresp_logt,
    temps,
    gloci=[1, 1, 0, 0, 1, 1],
)

Here the weighting comes from selected EM loci curves.

User-Supplied Weighting#

Pass a DEM-shaped weighting curve via dem_norm0. Only the relative shape matters, not the absolute scale.

Use it like this:

dem_weight = dem_guess / dem_guess.max()

dem, edem, elogt, chisq, dn_reg = dn2dem(
    dn_in,
    edn_in,
    trmatrix,
    tresp_logt,
    temps,
    dem_norm0=dem_weight,
)

Here the weighting comes from the supplied shape. A log-normal curve, a DEM from a previous solve, or a DEM from a different instrument are all reasonable choices.

A scalar (nt,) array broadcasts across all pixels; alternatively, pass an array matching the output DEM shape (e.g. (nx, ny, nt)) for per-pixel weighting.

See Also#

The following gallery examples show the same ideas in runnable form:

  • examples/synthetic/plot_synthetic_weighting_modes.py

  • examples/synthetic/plot_synthetic_emd_modes.py

  • examples/aia/plot_aia_single_pixel.py