API Reference
Core
InjectionConfig
Bases: BaseModel
Configuration for waveform injection source.
Source code in src/pythiabns/core/config.py
21 22 23 24 25 26 27 28 29 | |
JobMatrix
Bases: BaseModel
Configuration for expanding into multiple simulations.
Source code in src/pythiabns/core/config.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |
SimulationConfig
Bases: BaseModel
Configuration for a single simulation run.
Source code in src/pythiabns/core/config.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
Registry
Generic registry for models, relations, etc. supporting metadata and variants.
Source code in src/pythiabns/core/registry.py
7 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 | |
get(name, **filters)
Get object by name, optionally filtering by metadata. Example: get("lorentzian", nfreqs=3)
Source code in src/pythiabns/core/registry.py
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 | |
register(name, **metadata)
Decorator to register a class or function with optional metadata.
Source code in src/pythiabns/core/registry.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
generate_plots(result, config, outdir)
Generate plots based on configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
bilby.core.result.Result object |
required | |
config
|
PlottingConfig object |
required | |
outdir
|
Path
|
Path to output directory |
required |
Source code in src/pythiabns/core/plotting.py
7 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 | |
plot_waveform_posterior(result, waveform_generator, descriptors, outdir, n_samples=100)
Plot the waveform posterior against injection/data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
result
|
Bilby Result |
required | |
waveform_generator
|
Initiailized WaveformGenerator |
required | |
descriptors
|
Dictionary of {'label': [list of ifos]} or similar to know what to plot? Actually, usually we plot strain vs time/freq. |
required | |
outdir
|
Output path |
required |
Source code in src/pythiabns/core/plotting.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | |
Models
EmpiricalRelation
Bases: ABC
Abstract base class for universal relations.
Source code in src/pythiabns/models/relations.py
14 15 16 17 18 19 20 21 22 | |
predict(m1, m2, eos_name)
abstractmethod
Predict f_peak and potentially other properties.
Source code in src/pythiabns/models/relations.py
17 18 19 20 21 22 | |
WaveformModel
Bases: Protocol
Protocol that all waveform models must adhere to.
Source code in src/pythiabns/models/interface.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
__call__(frequency_array, **params)
Generate waveform polarizations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequency_array
|
ndarray
|
Array of frequencies in Hz. |
required |
**params
|
float
|
Model parameters (masses, spins, etc). |
{}
|
Returns:
| Type | Description |
|---|---|
dict[str, ndarray]
|
Dict containing 'plus' and 'cross' keys with complex strain arrays. |
Source code in src/pythiabns/models/interface.py
10 11 12 13 14 15 16 17 18 19 20 21 | |
Inference
PriorFactory
Factory to generate bilby PriorDicts based on configuration.
Source code in src/pythiabns/inference/priors.py
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 | |
PostMergerLikelihood
Bases: GravitationalWaveTransient
Likelihood class for Post-Merger PE. Inherits from GravitationalWaveTransient to use standard detector response logic.
Source code in src/pythiabns/inference/likelihood.py
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
Samplers
BilbyPocomcPrior
Wrapper to make bilby priors compatible with PocoMC Prior interface.
Source code in src/pythiabns/inference/samplers/pocomc.py
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 | |
PocoMCWrapper
Wrapper for PocoMC sampler.
Source code in src/pythiabns/inference/samplers/pocomc.py
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 | |
ZeusWrapper
Wrapper for zeus sampler.
Source code in src/pythiabns/inference/samplers/zeus.py
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 | |
NumPyroWrapper
Wrapper for NumPyro sampler.
Source code in src/pythiabns/inference/samplers/numpyro_sampler.py
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 | |
BlackJAXWrapper
Wrapper for BlackJAX sampler.
Source code in src/pythiabns/inference/samplers/blackjax_sampler.py
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 | |
TempestWrapper
Wrapper for tempest sampler.
Source code in src/pythiabns/inference/samplers/tempest.py
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 | |
Detectors
DetectorNetwork
Wrapper around bilby InterferometerList.
Source code in src/pythiabns/detectors/network.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 | |
inject_signal(waveform_generator, parameters)
Inject signal into detectors.
Source code in src/pythiabns/detectors/network.py
47 48 49 | |
Data Utils
NumericalWaveform
Class to handle loading and processing of NR waveforms.
Source code in src/pythiabns/data_utils/nr.py
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 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
get_post_merger(inplace=True)
Crop to post-merger signal.
Source code in src/pythiabns/data_utils/nr.py
205 206 207 208 209 210 211 212 213 214 215 216 217 | |