lag_energy_spectrum¶
LagEnergySpectrum
¶
Compute the time lag as a function of energy between two sets of light curves or GP models.
This class accepts lists of LightCurve objects or trained GaussianProcess models, one per energy bin. If the inputs are GP models, the most recently generated samples will be used automatically. If no samples are found, 1000 realizations will be generated on a 1000-point grid.
Each light curve pair (one per energy bin) is used to compute a single lag by integrating the cross-spectrum over a specified frequency range. This yields one lag per energy bin, forming the lag-energy spectrum.
A positive lag means that the time series in lcs_or_models1
is lagging behind
the common reference band lcs_or_models2
.
Coherence values are also computed for each energy bin to assess correlation strength, and noise bias correction can be applied to the coherence before estimating uncertainties.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lcs_or_models1
|
list of LightCurve or GaussianProcess
|
First set of inputs, one per energy bin. |
required |
lcs_or_models2
|
list of LightCurve or GaussianProcess
|
Input light curve or trained GP model for shared reference band. List will typically contain a single object, except for the case of a broad reference band where each object is a model trained for the (reference band - band of interest). |
required |
fmin
|
float
|
Minimum frequency to include when integrating. |
required |
fmax
|
float
|
Maximum frequency to include when integrating. |
required |
bin_edges
|
array - like
|
Edges of the energy bins corresponding to the light curves. |
[]
|
subtract_coh_bias
|
bool
|
Whether to subtract the coherence noise bias before estimating lag uncertainties. |
True
|
subtract_from_ref
|
(bool, optional)
|
Whether to subtract each band of interest from the common reference band. Use to remove shared variability when the reference band is a broad band that includes each of the bands of interest.
|
False
|
Attributes:
Name | Type | Description |
---|---|---|
energies |
array - like
|
Mean energy of each bin. |
energy_widths |
array - like
|
Half-width of each energy bin. |
lags |
array - like
|
Integrated time lag per energy bin. |
lag_errors |
array - like
|
Uncertainties (1 sigma) in each lag value. |
cohs |
array - like
|
Coherence values per energy bin. |
coh_errors |
array - like
|
Uncertainties (1 sigma) in the coherence values. |
Source code in stela_toolkit/lag_energy_spectrum.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 |
|
compute_lag_spectrum(subtract_coh_bias, subtract_from_ref)
¶
Compute the lag and coherence for each energy bin.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
subtract_coh_bias
|
bool
|
Whether to subtract Poisson noise bias from the coherence. |
required |
subtract_from_ref
|
(bool, optional)
|
Whether to subtract each band of interest from the common reference band. Use to remove shared variability when the reference band is a broad band that includes each of the bands of interest. |
required |
Returns:
Name | Type | Description |
---|---|---|
lags |
list
|
List of integrated lags for each bin. |
lag_errors |
list
|
List of lag uncertainties. |
cohs |
list
|
List of mean coherence values. |
coh_errors |
list
|
List of coherence uncertainties. |
Source code in stela_toolkit/lag_energy_spectrum.py
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 151 |
|
count_frequencies_in_bins(fmin=None, fmax=None, num_bins=None, bin_type=None, bin_edges=[])
¶
Counts the number of frequencies in each frequency bin. Wrapper method to use FrequencyBinning.count_frequencies_in_bins with class attributes.
Source code in stela_toolkit/lag_energy_spectrum.py
198 199 200 201 202 203 204 205 206 |
|
plot(energies=None, energy_widths=None, lags=None, lag_errors=None, cohs=None, coh_errors=None, **kwargs)
¶
Plot the lag-energy spectrum and associated coherence values.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**kwargs
|
dict
|
Keyword arguments for customizing the plot (e.g., xlabel, xscale, yscale). |
{}
|
Source code in stela_toolkit/lag_energy_spectrum.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
|