Instrument models
ConstantGain
¶
Bases: GainModel
A scalar gain factor, independent of energy.
The factor lives as :attr:factor (an nnx.Param). Its prior is provided
via the unified prior dict under the key "instrument.gain.factor"
(shared across instrumented obs) or "instrument.gain.factor[*]" /
"instrument.gain.factor[obs_name]" (per-obs).
Source code in src/jaxspec/model/instrument.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
ConstantShift
¶
Bases: ShiftModel
An additive energy shift, constant across the spectrum.
The offset lives as :attr:offset (an nnx.Param). Its prior is provided
via the unified prior dict under the key "instrument.shift.offset"
(shared) or "instrument.shift.offset[*]" / "instrument.shift.offset[obs_name]"
(per-obs).
Source code in src/jaxspec/model/instrument.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 | |
GainModel
¶
Bases: Module
Generic gain model. __call__(energies) returns the per-energy gain factor.
Source code in src/jaxspec/model/instrument.py
23 24 25 26 27 | |
InstrumentModel
¶
Bases: Module
Per-observation instrument response.
Pass as a dict to :class:~jaxspec.fit.BayesianModel::
BayesianModel(
spectral_model, prior, observations,
instrument_model={
"PN": None, # explicit reference
"MOS1": InstrumentModel(gain=ConstantGain(), shift=ConstantShift()),
"MOS2": InstrumentModel(gain=ConstantGain(), shift=ConstantShift()),
},
)
None entries (or simply omitting an observation) apply the identity
fold (transfer_matrix @ flux) — useful for the reference instrument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gain
|
GainModel | None
|
Optional :class: |
None
|
shift
|
ShiftModel | None
|
Optional :class: |
None
|
Source code in src/jaxspec/model/instrument.py
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
apply_gain(flux, energies)
¶
Multiply flux (or each branch in a pytree) by :attr:gain's factor.
Source code in src/jaxspec/model/instrument.py
120 121 122 123 124 125 | |
apply_shift(energies)
¶
Apply :attr:shift to energies and clip away non-positive values.
Source code in src/jaxspec/model/instrument.py
114 115 116 117 118 | |
default_prior(observation, obs_name)
¶
Return data-dependent default priors scoped to this obs.
Mirrors :meth:~jaxspec.model.background.BackgroundModel.default_prior:
subclasses (e.g. pileup models with per-obs dead-time / grade-fraction
parameters) override this to inject [obs_name]-scoped defaults.
User prior entries override these defaults.
Source code in src/jaxspec/model/instrument.py
104 105 106 107 108 109 110 111 112 | |
fold(spectrum, cache, eval_energies=None)
¶
Fold the input spectrum (or branches of a pytree) into the instrument using the pre-computed transfer matrix.
Source code in src/jaxspec/model/instrument.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
ShiftModel
¶
Bases: Module
Generic shift model. __call__(energies) returns shifted energies.
Source code in src/jaxspec/model/instrument.py
46 47 48 49 50 | |