jaxspec 0.1.4__py3-none-any.whl → 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,6 @@ from numpyro.distributions import Poisson
10
10
  from tinygp import GaussianProcess, kernels
11
11
 
12
12
  from .._fit._build_model import build_prior, forward_model
13
- from ..util.typing import PriorDictModel
14
13
  from .abc import SpectralModel
15
14
 
16
15
 
@@ -138,14 +137,14 @@ class GaussianProcessBackground(BackgroundModel):
138
137
  return count_rate
139
138
 
140
139
 
141
- class SpectralBackgroundModel(BackgroundModel):
140
+ class SpectralModelBackground(BackgroundModel):
142
141
  def __init__(self, spectral_model: "SpectralModel", prior_distributions, sparse=False):
143
142
  self.spectral_model = spectral_model
144
- self.prior = PriorDictModel.from_dict(prior_distributions).nested_dict
143
+ self.prior = prior_distributions
145
144
  self.sparse = sparse
146
145
 
147
146
  def numpyro_model(self, observation, name: str = "", observed=True):
148
- params = build_prior(self.prior, prefix=f"_bkg_{name}")
147
+ params = build_prior(self.prior, prefix=f"_bkg_{name}_")
149
148
  bkg_model = jax.jit(
150
149
  lambda par: forward_model(self.spectral_model, par, observation, sparse=self.sparse)
151
150
  )
@@ -1,16 +1,31 @@
1
1
  from __future__ import annotations
2
2
 
3
- import haiku as hk
3
+ import flax.nnx as nnx
4
4
  import jax.numpy as jnp
5
5
  import numpy as np
6
6
 
7
7
  from astropy.table import Table
8
- from haiku.initializers import Constant as HaikuConstant
9
8
 
10
9
  from ..util.online_storage import table_manager
11
10
  from .abc import MultiplicativeComponent
12
11
 
13
12
 
13
+ class MultiplicativeConstant(MultiplicativeComponent):
14
+ r"""
15
+ A multiplicative constant
16
+
17
+ !!! abstract "Parameters"
18
+ * $K$ (`norm`) $\left[\text{dimensionless}\right]$: The multiplicative constant.
19
+
20
+ """
21
+
22
+ def __init__(self):
23
+ self.norm = nnx.Param(1.0)
24
+
25
+ def factor(self, energy):
26
+ return self.norm
27
+
28
+
14
29
  class Expfac(MultiplicativeComponent):
15
30
  r"""
16
31
  An exponential modification of a spectrum.
@@ -20,19 +35,20 @@ class Expfac(MultiplicativeComponent):
20
35
  \text{if $E>E_c$}\\1 & \text{if $E<E_c$}\end{cases}
21
36
  $$
22
37
 
23
- ??? abstract "Parameters"
24
- * $A$ : Amplitude of the modification $\left[\text{dimensionless}\right]$
25
- * $f$ : Exponential factor $\left[\text{keV}^{-1}\right]$
26
- * $E_c$ : Start energy of modification $\left[\text{keV}\right]$
38
+ !!! abstract "Parameters"
39
+ * $A$ (`A`) $\left[\text{dimensionless}\right]$ : Amplitude of the modification
40
+ * $f$ (`f`) $\left[\text{keV}^{-1}\right]$ : Exponential factor
41
+ * $E_c$ (`E_c`) $\left[\text{keV}\right]$: Start energy of modification
27
42
 
28
43
  """
29
44
 
30
- def continuum(self, energy):
31
- amplitude = hk.get_parameter("A", [], float, init=HaikuConstant(1))
32
- factor = hk.get_parameter("f", [], float, init=HaikuConstant(1))
33
- pivot = hk.get_parameter("E_c", [], float, init=HaikuConstant(1))
45
+ def __init__(self):
46
+ self.A = nnx.Param(1.0)
47
+ self.f = nnx.Param(1.0)
48
+ self.E_c = nnx.Param(1.0)
34
49
 
35
- return jnp.where(energy >= pivot, 1.0 + amplitude * jnp.exp(-factor * energy), 1.0)
50
+ def factor(self, energy):
51
+ return jnp.where(energy >= self.E_c, 1.0 + self.A * jnp.exp(-self.f * energy), 1.0)
36
52
 
37
53
 
38
54
  class Tbabs(MultiplicativeComponent):
@@ -45,49 +61,47 @@ class Tbabs(MultiplicativeComponent):
45
61
  \mathcal{M}(E) = \exp^{-N_{\text{H}}\sigma(E)}
46
62
  $$
47
63
 
48
- ??? abstract "Parameters"
49
- * $N_{\text{H}}$ : Equivalent hydrogen column density
50
- $\left[\frac{\text{atoms}~10^{22}}{\text{cm}^2}\right]$
64
+ !!! abstract "Parameters"
65
+ * $N_{\text{H}}$ (`nh`) $\left[\frac{\text{atoms}~10^{22}}{\text{cm}^2}\right]$ : Equivalent hydrogen column density
66
+
51
67
 
52
68
  !!! note
53
69
  Abundances and cross-sections $\sigma$ can be found in Wilms et al. (2000).
54
70
 
55
71
  """
56
72
 
57
- def __init__(self, *args, **kwargs):
58
- super().__init__(*args, **kwargs)
73
+ def __init__(self):
59
74
  table = Table.read(table_manager.fetch("xsect_tbabs_wilm.fits"))
60
- self.energy = jnp.asarray(np.array(table["ENERGY"]), dtype=np.float64)
61
- self.sigma = jnp.asarray(np.array(table["SIGMA"]), dtype=np.float64)
75
+ self.energy = nnx.Variable(np.asarray(table["ENERGY"], dtype=np.float64))
76
+ self.sigma = nnx.Variable(np.asarray(table["SIGMA"], dtype=np.float64))
77
+ self.nh = nnx.Param(1.0)
62
78
 
63
- def continuum(self, energy):
64
- nh = hk.get_parameter("N_H", [], float, init=HaikuConstant(1))
79
+ def factor(self, energy):
65
80
  sigma = jnp.interp(energy, self.energy, self.sigma, left=1e9, right=0.0)
66
81
 
67
- return jnp.exp(-nh * sigma)
82
+ return jnp.exp(-self.nh * sigma)
68
83
 
69
84
 
70
85
  class Phabs(MultiplicativeComponent):
71
86
  r"""
72
87
  A photoelectric absorption model.
73
88
 
74
- ??? abstract "Parameters"
75
- * $N_{\text{H}}$ : Equivalent hydrogen column density
76
- $\left[\frac{\text{atoms}~10^{22}}{\text{cm}^2}\right]$
89
+ !!! abstract "Parameters"
90
+ * $N_{\text{H}}$ (`nh`) $\left[\frac{\text{atoms}~10^{22}}{\text{cm}^2}\right]$ : Equivalent hydrogen column density
91
+
77
92
 
78
93
  """
79
94
 
80
- def __init__(self, *args, **kwargs):
81
- super().__init__(*args, **kwargs)
95
+ def __init__(self):
82
96
  table = Table.read(table_manager.fetch("xsect_phabs_aspl.fits"))
83
- self.energy = jnp.asarray(np.array(table["ENERGY"]), dtype=np.float64)
84
- self.sigma = jnp.asarray(np.array(table["SIGMA"]), dtype=np.float64)
97
+ self.energy = nnx.Variable(np.asarray(table["ENERGY"], dtype=np.float64))
98
+ self.sigma = nnx.Variable(np.asarray(table["SIGMA"], dtype=np.float64))
99
+ self.nh = nnx.Param(1.0)
85
100
 
86
- def continuum(self, energy):
87
- nh = hk.get_parameter("N_H", [], float, init=HaikuConstant(1))
88
- sigma = jnp.interp(energy, self.energy, self.sigma, left=jnp.inf, right=0.0)
101
+ def factor(self, energy):
102
+ sigma = jnp.interp(energy, self.energy, self.sigma, left=1e9, right=0.0)
89
103
 
90
- return jnp.exp(-nh * sigma)
104
+ return jnp.exp(-self.nh * sigma)
91
105
 
92
106
 
93
107
  class Wabs(MultiplicativeComponent):
@@ -95,22 +109,19 @@ class Wabs(MultiplicativeComponent):
95
109
  A photo-electric absorption using Wisconsin (Morrison & McCammon 1983) cross-sections.
96
110
 
97
111
  ??? abstract "Parameters"
98
- * $N_{\text{H}}$ : Equivalent hydrogen column density
99
- $\left[\frac{\text{atoms}~10^{22}}{\text{cm}^2}\right]$
100
-
112
+ * $N_{\text{H}}$ (`nh`) $\left[\frac{\text{atoms}~10^{22}}{\text{cm}^2}\right]$ : Equivalent hydrogen column density
101
113
  """
102
114
 
103
- def __init__(self, *args, **kwargs):
104
- super().__init__(*args, **kwargs)
115
+ def __init__(self):
105
116
  table = Table.read(table_manager.fetch("xsect_wabs_angr.fits"))
106
- self.energy = jnp.asarray(np.array(table["ENERGY"]), dtype=np.float64)
107
- self.sigma = jnp.asarray(np.array(table["SIGMA"]), dtype=np.float64)
117
+ self.energy = nnx.Variable(np.asarray(table["ENERGY"], dtype=np.float64))
118
+ self.sigma = nnx.Variable(np.asarray(table["SIGMA"], dtype=np.float64))
119
+ self.nh = nnx.Param(1.0)
108
120
 
109
- def continuum(self, energy):
110
- nh = hk.get_parameter("N_H", [], float, init=HaikuConstant(1))
121
+ def factor(self, energy):
111
122
  sigma = jnp.interp(energy, self.energy, self.sigma, left=1e9, right=0.0)
112
123
 
113
- return jnp.exp(-nh * sigma)
124
+ return jnp.exp(-self.nh * sigma)
114
125
 
115
126
 
116
127
  class Gabs(MultiplicativeComponent):
@@ -122,23 +133,26 @@ class Gabs(MultiplicativeComponent):
122
133
  \left( -\frac{\left(E-E_0\right)^2}{2 \sigma^2} \right) \right)
123
134
  $$
124
135
 
125
- ??? abstract "Parameters"
126
- * $\tau$ : Absorption strength $\left[\text{dimensionless}\right]$
127
- * $\sigma$ : Absorption width $\left[\text{keV}\right]$
128
- * $E_0$ : Absorption center $\left[\text{keV}\right]$
136
+ !!! abstract "Parameters"
137
+ * $\tau$ (`tau`) $\left[\text{dimensionless}\right]$ : Absorption strength
138
+ * $\sigma$ (`sigma`) $\left[\text{keV}\right]$ : Absorption width
139
+ * $E_0$ (`E0`) $\left[\text{keV}\right]$ : Absorption center
129
140
 
130
141
  !!! note
131
142
  The optical depth at line center is $\tau/(\sqrt{2 \pi} \sigma)$.
132
143
 
133
144
  """
134
145
 
135
- def continuum(self, energy):
136
- tau = hk.get_parameter("tau", [], float, init=HaikuConstant(1))
137
- sigma = hk.get_parameter("sigma", [], float, init=HaikuConstant(1))
138
- center = hk.get_parameter("E_0", [], float, init=HaikuConstant(1))
146
+ def __init__(self):
147
+ self.tau = nnx.Param(1.0)
148
+ self.sigma = nnx.Param(1.0)
149
+ self.E0 = nnx.Param(1.0)
139
150
 
151
+ def factor(self, energy):
140
152
  return jnp.exp(
141
- -tau / (jnp.sqrt(2 * jnp.pi) * sigma) * jnp.exp(-0.5 * ((energy - center) / sigma) ** 2)
153
+ -self.tau
154
+ / (jnp.sqrt(2 * jnp.pi) * self.sigma)
155
+ * jnp.exp(-0.5 * ((energy - self.E0) / self.sigma) ** 2)
142
156
  )
143
157
 
144
158
 
@@ -151,16 +165,17 @@ class Highecut(MultiplicativeComponent):
151
165
  \left( \frac{E_c - E}{E_f} \right)& \text{if $E > E_c$}\\ 1 & \text{if $E < E_c$}\end{cases}
152
166
  $$
153
167
 
154
- ??? abstract "Parameters"
155
- * $E_c$ : Cutoff energy $\left[\text{keV}\right]$
156
- * $E_f$ : Folding energy $\left[\text{keV}\right]$
168
+ !!! abstract "Parameters"
169
+ * $E_c$ (`Ec`) $\left[\text{keV}\right]$ : Cutoff energy
170
+ * $E_f$ (`Ef`) $\left[\text{keV}\right]$ : Folding energy
157
171
  """
158
172
 
159
- def continuum(self, energy):
160
- cutoff = hk.get_parameter("E_c", [], float, init=HaikuConstant(1))
161
- folding = hk.get_parameter("E_f", [], float, init=HaikuConstant(1))
173
+ def __init__(self):
174
+ self.Ec = nnx.Param(1.0)
175
+ self.Ef = nnx.Param(1.0)
162
176
 
163
- return jnp.where(energy <= cutoff, 1.0, jnp.exp((cutoff - energy) / folding))
177
+ def factor(self, energy):
178
+ return jnp.where(energy <= self.Ec, 1.0, jnp.exp((self.Ec - energy) / self.Ef))
164
179
 
165
180
 
166
181
  class Zedge(MultiplicativeComponent):
@@ -172,18 +187,21 @@ class Zedge(MultiplicativeComponent):
172
187
  & \text{if $E > E_c$}\\ 1 & \text{if $E < E_c$}\end{cases}
173
188
  $$
174
189
 
175
- ??? abstract "Parameters"
176
- * $E_c$ : Threshold energy
177
- * $E_f$ : Absorption depth at the threshold
178
- * $z$ : Redshift [dimensionless]
190
+ !!! abstract "Parameters"
191
+ * $E_c$ (`Ec`) $\left[\text{keV}\right]$ : Threshold energy
192
+ * $D$ (`D`) $\left[\text{dimensionless}\right]$ : Absorption depth at the threshold
193
+ * $z$ (`z`) $\left[\text{dimensionless}\right]$ : Redshift
179
194
  """
180
195
 
181
- def continuum(self, energy):
182
- E_c = hk.get_parameter("E_c", [], float, init=HaikuConstant(1))
183
- D = hk.get_parameter("D", [], float, init=HaikuConstant(1))
184
- z = hk.get_parameter("z", [], float, init=HaikuConstant(0))
196
+ def __init__(self):
197
+ self.Ec = nnx.Param(1.0)
198
+ self.D = nnx.Param(1.0)
199
+ self.z = nnx.Param(0.0)
185
200
 
186
- return jnp.where(energy <= E_c, 1.0, jnp.exp(-D * (energy * (1 + z) / E_c) ** 3))
201
+ def factor(self, energy):
202
+ return jnp.where(
203
+ energy <= self.Ec, 1.0, jnp.exp(-self.D * (energy * (1 + self.z) / self.Ec) ** 3)
204
+ )
187
205
 
188
206
 
189
207
  class Tbpcf(MultiplicativeComponent):
@@ -194,28 +212,25 @@ class Tbpcf(MultiplicativeComponent):
194
212
  \mathcal{M}(E) = f \exp^{-N_{\text{H}}\sigma(E)} + (1-f)
195
213
  $$
196
214
 
197
- ??? abstract "Parameters"
198
- * $N_{\text{H}}$ : Equivalent hydrogen column density
199
- $\left[\frac{\text{atoms}~10^{22}}{\text{cm}^2}\right]$
200
- * $f$ : Partial covering fraction, ranges between 0 and 1 [dimensionless]
215
+ !!! abstract "Parameters"
216
+ * $N_{\text{H}}$ (`nh`) $\left[\frac{\text{atoms}~10^{22}}{\text{cm}^2}\right]$ : Equivalent hydrogen column density
217
+ * $f$ (`f`) $\left[\text{dimensionless}\right]$ : Partial covering fraction, ranges between 0 and 1
201
218
 
202
219
  !!! note
203
220
  Abundances and cross-sections $\sigma$ can be found in Wilms et al. (2000).
204
221
 
205
222
  """
206
223
 
207
- def __init__(self, *args, **kwargs):
208
- super().__init__(*args, **kwargs)
224
+ def __init__(self):
209
225
  table = Table.read(table_manager.fetch("xsect_tbabs_wilm.fits"))
210
- self.energy = jnp.asarray(np.array(table["ENERGY"]), dtype=np.float64)
211
- self.sigma = jnp.asarray(np.array(table["SIGMA"]), dtype=np.float64)
226
+ self.energy = nnx.Variable(np.asarray(table["ENERGY"], dtype=np.float64))
227
+ self.sigma = nnx.Variable(np.asarray(table["SIGMA"], dtype=np.float64))
228
+ self.nh = nnx.Param(1.0)
229
+ self.f = nnx.Param(0.2)
212
230
 
213
- def continuum(self, energy):
214
- nh = hk.get_parameter("N_H", [], float, init=HaikuConstant(1))
215
- f = hk.get_parameter("f", [], float, init=HaikuConstant(0.2))
231
+ def factor(self, energy):
216
232
  sigma = jnp.interp(energy, self.energy, self.sigma, left=1e9, right=0.0)
217
-
218
- return f * jnp.exp(-nh * sigma) + (1 - f)
233
+ return self.f * jnp.exp(-self.nh * sigma) + (1.0 - self.f)
219
234
 
220
235
 
221
236
  class FDcut(MultiplicativeComponent):
@@ -227,12 +242,13 @@ class FDcut(MultiplicativeComponent):
227
242
  $$
228
243
 
229
244
  ??? abstract "Parameters"
230
- * $E_c$ : Cutoff energy $\left[\text{keV}\right]$
231
- * $E_f$ : Folding energy $\left[\text{keV}\right]$
245
+ * $E_c$ (`Ec`) $\left[\text{keV}\right]$ : Cutoff energy
246
+ * $E_f$ (`Ef`) $\left[\text{keV}\right]$ : Folding energy
232
247
  """
233
248
 
234
- def continuum(self, energy):
235
- cutoff = hk.get_parameter("E_c", [], init=HaikuConstant(1))
236
- folding = hk.get_parameter("E_f", [], init=HaikuConstant(1))
249
+ def __init__(self):
250
+ self.Ec = nnx.Param(1.0)
251
+ self.Ef = nnx.Param(3.0)
237
252
 
238
- return (1 + jnp.exp((energy - cutoff) / folding)) ** -1
253
+ def factor(self, energy):
254
+ return (1 + jnp.exp((energy - self.Ec) / self.Ef)) ** -1
jaxspec/scripts/debug.py CHANGED
@@ -8,4 +8,4 @@ def debug_info():
8
8
 
9
9
  # Cimer CamilleTheBest pour l'idée
10
10
  print(watermark())
11
- print(watermark(packages="jaxspec,jax,jaxlib,numpyro,haiku,numpy,scipy"))
11
+ print(watermark(packages="jaxspec,jax,jaxlib,numpyro,flax,numpy,scipy"))
jaxspec/util/__init__.py CHANGED
@@ -1,45 +0,0 @@
1
- from collections.abc import Callable
2
- from contextlib import contextmanager
3
- from time import perf_counter
4
-
5
- import haiku as hk
6
-
7
- from jax.random import PRNGKey, split
8
-
9
-
10
- @contextmanager
11
- def catchtime(desc="Task", print_time=True) -> Callable[[], float]:
12
- """
13
- Context manager to measure time taken by a task.
14
-
15
- Parameters
16
- ----------
17
- desc (str): Description of the task.
18
- print_time (bool): Whether to print the time taken by the task.
19
-
20
- Returns
21
- -------
22
- Callable[[], float]: Function to get the time taken by the task.
23
- """
24
-
25
- t1 = t2 = perf_counter()
26
- yield lambda: t2 - t1
27
- t2 = perf_counter()
28
- if print_time:
29
- print(f"{desc}: {t2 - t1:.3f} seconds")
30
-
31
-
32
- def sample_prior(dict_of_prior, key=PRNGKey(0), flat_parameters=False):
33
- """
34
- Sample the prior distribution from a dict of distributions
35
- """
36
-
37
- parameters = dict(hk.data_structures.to_haiku_dict(dict_of_prior))
38
- parameters_flat = {}
39
-
40
- for m, n, distribution in hk.data_structures.traverse(dict_of_prior):
41
- key, subkey = split(key)
42
- parameters[m][n] = distribution.sample(subkey)
43
- parameters_flat[m + "_" + n] = distribution.sample(subkey)
44
-
45
- return parameters if not flat_parameters else parameters_flat
jaxspec/util/misc.py ADDED
@@ -0,0 +1,25 @@
1
+ from collections.abc import Callable
2
+ from contextlib import contextmanager
3
+ from time import perf_counter
4
+
5
+
6
+ @contextmanager
7
+ def catchtime(desc="Task", print_time=True) -> Callable[[], float]:
8
+ """
9
+ Context manager to measure time taken by a task.
10
+
11
+ Parameters
12
+ ----------
13
+ desc (str): Description of the task.
14
+ print_time (bool): Whether to print the time taken by the task.
15
+
16
+ Returns:
17
+ -------
18
+ Callable[[], float]: Function to get the time taken by the task.
19
+ """
20
+
21
+ t1 = t2 = perf_counter()
22
+ yield lambda: t2 - t1
23
+ t2 = perf_counter()
24
+ if print_time:
25
+ print(f"{desc}: {t2 - t1:.3f} seconds")
jaxspec/util/typing.py CHANGED
@@ -1,68 +1,5 @@
1
- from typing import Any
2
-
3
1
  import numpyro.distributions as dist
4
2
 
5
- from jax import numpy as jnp
6
3
  from jax.typing import ArrayLike
7
- from pydantic import BaseModel, field_validator
8
4
 
9
5
  PriorDictType = dict[str, dict[str, dist.Distribution | ArrayLike]]
10
-
11
-
12
- def is_flat_dict(input_data: dict[str, Any]) -> bool:
13
- """
14
- Check if the input data is a flat dictionary with string keys and non-dictionary values.
15
- """
16
- return all(isinstance(k, str) and not isinstance(v, dict) for k, v in input_data.items())
17
-
18
-
19
- class PriorDictModel(BaseModel):
20
- """
21
- Pydantic model for a nested dictionary of NumPyro distributions or JAX arrays.
22
- The top level keys are strings, and the values are dictionaries with string keys and values that are either
23
- NumPyro distributions or JAX arrays (or convertible to JAX arrays).
24
- """
25
-
26
- nested_dict: PriorDictType
27
-
28
- class Config: # noqa D106
29
- arbitrary_types_allowed = True
30
-
31
- @classmethod
32
- def from_dict(cls, input_prior: dict[str, Any]):
33
- if is_flat_dict(input_prior):
34
- nested_dict = {}
35
-
36
- for key, obj in input_prior.items():
37
- component, component_number, *parameter = key.split("_")
38
-
39
- sub_dict = nested_dict.get(f"{component}_{component_number}", {})
40
- sub_dict["_".join(parameter)] = obj
41
-
42
- nested_dict[f"{component}_{component_number}"] = sub_dict
43
-
44
- return cls(nested_dict=nested_dict)
45
-
46
- return cls(nested_dict=input_prior)
47
-
48
- @field_validator("nested_dict", mode="before")
49
- def check_and_cast_nested_dict(cls, value: dict[str, Any]):
50
- if not isinstance(value, dict):
51
- raise ValueError("The top level must be a dictionary")
52
-
53
- for key, inner_dict in value.items():
54
- if not isinstance(inner_dict, dict):
55
- raise ValueError(f'The value for key "{key}" must be a dictionary')
56
-
57
- for inner_key, obj in inner_dict.items():
58
- if not isinstance(obj, dist.Distribution):
59
- try:
60
- # Attempt to cast to JAX array
61
- value[key][inner_key] = jnp.array(obj, dtype=float)
62
-
63
- except Exception as e:
64
- raise ValueError(
65
- f'The value for key "{inner_key}" in {key} be a NumPyro '
66
- f"distribution or castable to JAX array. Error: {e}"
67
- )
68
- return value
@@ -1,43 +1,42 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: jaxspec
3
- Version: 0.1.4
3
+ Version: 0.2.1
4
4
  Summary: jaxspec is a bayesian spectral fitting library for X-ray astronomy.
5
- Home-page: https://github.com/renecotyfanboy/jaxspec
6
5
  License: MIT
7
6
  Author: sdupourque
8
7
  Author-email: sdupourque@irap.omp.eu
9
- Requires-Python: >=3.10,<3.12
8
+ Requires-Python: >=3.10,<3.13
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Programming Language :: Python :: 3
12
11
  Classifier: Programming Language :: Python :: 3.10
13
12
  Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
14
  Requires-Dist: arviz (>=0.17.1,<0.21.0)
15
15
  Requires-Dist: astropy (>=6.0.0,<7.0.0)
16
+ Requires-Dist: catppuccin (>=2.3.4,<3.0.0)
16
17
  Requires-Dist: chainconsumer (>=1.1.2,<2.0.0)
17
18
  Requires-Dist: cmasher (>=1.6.3,<2.0.0)
18
- Requires-Dist: dm-haiku (>=0.0.12,<0.0.13)
19
- Requires-Dist: gpjax (>=0.8.0,<0.9.0)
19
+ Requires-Dist: flax (>=0.10.1,<0.11.0)
20
20
  Requires-Dist: interpax (>=0.3.3,<0.4.0)
21
- Requires-Dist: jax (>=0.4.33,<0.5.0)
22
- Requires-Dist: jaxlib (>=0.4.30,<0.5.0)
23
- Requires-Dist: jaxns (<2.6)
21
+ Requires-Dist: jax (>=0.5.0,<0.6.0)
22
+ Requires-Dist: jaxns (>=2.6.7,<3.0.0)
24
23
  Requires-Dist: jaxopt (>=0.8.1,<0.9.0)
25
24
  Requires-Dist: matplotlib (>=3.8.0,<4.0.0)
26
- Requires-Dist: mendeleev (>=0.15,<0.19)
25
+ Requires-Dist: mendeleev (>=0.15,<0.20)
27
26
  Requires-Dist: networkx (>=3.1,<4.0)
28
27
  Requires-Dist: numpy (<2.0.0)
29
- Requires-Dist: numpyro (>=0.15.3,<0.16.0)
30
- Requires-Dist: optimistix (>=0.0.7,<0.0.10)
28
+ Requires-Dist: numpyro (>=0.16.1,<0.17.0)
29
+ Requires-Dist: optimistix (>=0.0.7,<0.0.11)
31
30
  Requires-Dist: pandas (>=2.2.0,<3.0.0)
32
31
  Requires-Dist: pooch (>=1.8.2,<2.0.0)
33
- Requires-Dist: pyzmq (<27)
34
32
  Requires-Dist: scipy (<1.15)
35
33
  Requires-Dist: seaborn (>=0.13.1,<0.14.0)
36
34
  Requires-Dist: simpleeval (>=0.9.13,<1.1.0)
37
- Requires-Dist: sparse (>=0.15.1,<0.16.0)
35
+ Requires-Dist: sparse (>=0.15.4,<0.16.0)
38
36
  Requires-Dist: tinygp (>=0.3.0,<0.4.0)
39
37
  Requires-Dist: watermark (>=2.4.3,<3.0.0)
40
38
  Project-URL: Documentation, https://jaxspec.readthedocs.io/en/latest/
39
+ Project-URL: Homepage, https://github.com/renecotyfanboy/jaxspec
41
40
  Description-Content-Type: text/markdown
42
41
 
43
42
  <p align="center">
@@ -0,0 +1,34 @@
1
+ jaxspec/__init__.py,sha256=Sbn02lX6Y-zNXk17N8dec22c5jeypiS0LkHmGfz7lWA,126
2
+ jaxspec/_fit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ jaxspec/_fit/_build_model.py,sha256=NgLobtysyhCoiRguAazYGRIpG75iW-pG0Ss_hQGuCT4,2019
4
+ jaxspec/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ jaxspec/analysis/_plot.py,sha256=1VbWentCLHR8XzM3jZtGyppbQRFWnChNztrwpZ2reA4,6185
6
+ jaxspec/analysis/compare.py,sha256=g2UFhmR9Zt-7cz5gQFOB6lXuklXB3yTyUvjTypOzoSY,725
7
+ jaxspec/analysis/results.py,sha256=0y10mnaTdmHJUV2h-xfKrAm6PE4S_Qscexknn3oClwo,25115
8
+ jaxspec/data/__init__.py,sha256=aantcYKC9kZFvaE-V2SIwSuLhIld17Kjrd9CIUu___Y,415
9
+ jaxspec/data/instrument.py,sha256=RDiG_LkucvnF2XE_ghTFME6d_2YirgQUcEY0gEle6dk,4775
10
+ jaxspec/data/obsconf.py,sha256=r0deDgzpfKJZFMeiKQYUnkqQEmoDYTzl3eQFjb5xYjo,10263
11
+ jaxspec/data/observation.py,sha256=dfb-hJFpeSPMS52oNmQl39CB9GD_MK1gG9vHlQXhhwU,7741
12
+ jaxspec/data/ogip.py,sha256=57lfUgvMhM4j5tdfnOmwLI0ehx09pG7SvJx6VNIJFHE,9543
13
+ jaxspec/data/util.py,sha256=FnIqrnwm29WsFV3FayeLXpjJDS10FcZ613B3SzGQCTk,9331
14
+ jaxspec/fit.py,sha256=gO0H8CR76WP7lrG2X-Z3HLMndOSkCulzrp2jll1b4ow,24337
15
+ jaxspec/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ jaxspec/model/_graph_util.py,sha256=hPvHYmAxb7P3nyIecaZ7RqWOjwcZ1WvUByt_yNANiaY,4552
17
+ jaxspec/model/abc.py,sha256=sHaFKOGfpD1ocXKlzEMdsmGLluikmBSmX8FAu7duFMQ,15489
18
+ jaxspec/model/additive.py,sha256=Weipp5mrk-MrcPJdttBjR2mu5OHteV3BSo5Greq53I0,20208
19
+ jaxspec/model/background.py,sha256=INRuuHIYgfu2E1a8Ddqpr_gF1wnhPtOpciWCteZfVVg,7687
20
+ jaxspec/model/list.py,sha256=0RPAoscVz_zM1CWdx_Gd5wfrQWV5Nv4Kd4bSXu2ayUA,860
21
+ jaxspec/model/multiplicative.py,sha256=5LHBAXCV9EQO1BGm1HzAI56dqjVbafBdV8Eq7_qXdbM,7890
22
+ jaxspec/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
+ jaxspec/scripts/debug.py,sha256=qhyDtX4G5UdChmTLCM-5Wti4XZU-sU5S-wDb6TZjrvM,292
24
+ jaxspec/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
+ jaxspec/util/abundance.py,sha256=fsC313taIlGzQsZNwbYsJupDWm7ZbqzGhY66Ku394Mw,8546
26
+ jaxspec/util/integrate.py,sha256=_Ax_knpC7d4et2-QFkOUzVtNeQLX1-cwLvm-FRBxYcw,4505
27
+ jaxspec/util/misc.py,sha256=O3qorCL1Y2X1BS2jdd36C1eDHK9QDXTSOr9kj3uqcJo,654
28
+ jaxspec/util/online_storage.py,sha256=vm56RfcbFKpkRVfr0bXO7J9aQxuBq-I_oEgA26YIhCo,2469
29
+ jaxspec/util/typing.py,sha256=ZQM_l68qyYnIBZPz_1mKvwPMx64jvVBD8Uj6bx9sHv0,140
30
+ jaxspec-0.2.1.dist-info/LICENSE.md,sha256=2q5XoWzddts5IqzIcgYYMOL21puU3MfO8gvT3Ype1eQ,1073
31
+ jaxspec-0.2.1.dist-info/METADATA,sha256=quIPdNWupFboPuiQqRQRMWHBy0TFrTwrpCkOAYNUWaM,4462
32
+ jaxspec-0.2.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
33
+ jaxspec-0.2.1.dist-info/entry_points.txt,sha256=kzLG2mGlCWITRn4Q6zKG_idx-_RKAncvA0DMNYTgHAg,71
34
+ jaxspec-0.2.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.9.1
2
+ Generator: poetry-core 2.0.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
jaxspec/data/grouping.py DELETED
@@ -1,23 +0,0 @@
1
- import numpy as np
2
- from .observation import Observation
3
-
4
-
5
- def constant_rebin(obs: Observation, downfactor: int):
6
- """
7
- Create a grouping matrix for constant rebinning of the data.
8
-
9
- Parameters:
10
- obs: Observation object.
11
- downfactor: Downfactor for the rebinning.
12
-
13
- Returns:
14
- A grouping matrix.
15
- """
16
- n_channels = len(obs.pha.channel)
17
- n_bins = n_channels // downfactor + 1 * (n_channels % downfactor != 0)
18
- grouping = np.zeros((n_bins, n_channels), dtype=bool)
19
-
20
- for i in range(n_bins):
21
- grouping[i, i * downfactor : (i + 1) * downfactor] = True
22
-
23
- return grouping
@@ -1,33 +0,0 @@
1
- jaxspec/__init__.py,sha256=Sbn02lX6Y-zNXk17N8dec22c5jeypiS0LkHmGfz7lWA,126
2
- jaxspec/_fit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
- jaxspec/_fit/_build_model.py,sha256=MvMgg0pzN-LuRz-5tw7GQ2WT3Go9r4rC4Y9MtzioCvs,4645
4
- jaxspec/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
- jaxspec/analysis/_plot.py,sha256=C4XljmuzQz8xQur_jQddgInrBDmKgTn0eugSreLoD5k,862
6
- jaxspec/analysis/compare.py,sha256=g2UFhmR9Zt-7cz5gQFOB6lXuklXB3yTyUvjTypOzoSY,725
7
- jaxspec/analysis/results.py,sha256=apUy30N1hxswDnxA5w2d71C3EonKhU9m7Rsl0nI0UkA,28298
8
- jaxspec/data/__init__.py,sha256=aantcYKC9kZFvaE-V2SIwSuLhIld17Kjrd9CIUu___Y,415
9
- jaxspec/data/grouping.py,sha256=hhgBt-voiH0DDSyePacaIGsaMnrYbJM_-ZeU66keC7I,622
10
- jaxspec/data/instrument.py,sha256=0pSf1p82g7syDMmKm13eVbYih-Veiq5DnwsyZe6_b4g,3890
11
- jaxspec/data/obsconf.py,sha256=gv14sL6azK2avRiMCWuTbyLBPulzm4PwvoLY6iWPEVE,9833
12
- jaxspec/data/observation.py,sha256=oM2QcEYnnTyzw1WeuT6Wn-3GaFbbrdIbXGzoZKINJ8Q,7104
13
- jaxspec/data/ogip.py,sha256=sv9p00qHS5pzw61pzWyyF0nV-E-RXySdSFK2tUavokA,9545
14
- jaxspec/data/util.py,sha256=SKx9VgC9CL1Wler80FYqc3DiHsnAq1ulDioLzTjrVBE,9554
15
- jaxspec/fit.py,sha256=1wvflKoCVbnnMePAsI0EwvwmsqdbXF8bo50l3pZ_qRM,22968
16
- jaxspec/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
17
- jaxspec/model/abc.py,sha256=wbzpKYB2sB-qdP1B0YaUw7VHEYeTegeDhaoJ1EHPWaQ,20924
18
- jaxspec/model/additive.py,sha256=wjY2wL3Io3F45GJpz-UB8xYVnA-W1OFBnZMbj5pWPbQ,22449
19
- jaxspec/model/background.py,sha256=9gk6WdlaYytzB6ie9cllEYOQZs05A9QZCXp-gH-bPn0,7765
20
- jaxspec/model/list.py,sha256=0RPAoscVz_zM1CWdx_Gd5wfrQWV5Nv4Kd4bSXu2ayUA,860
21
- jaxspec/model/multiplicative.py,sha256=GCQ6JRz92QqbzDBFwWxGZ9SUqTJZQpD7B6ji9VEFXWo,8135
22
- jaxspec/scripts/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
23
- jaxspec/scripts/debug.py,sha256=RIRykBW_kzt8__PhOohQn2xtDW6oAz49E8rmuR5ewAU,293
24
- jaxspec/util/__init__.py,sha256=vKurfp7p2hxHptJjXhXqFAXAikAGXAqISMJUqPeiGTw,1259
25
- jaxspec/util/abundance.py,sha256=fsC313taIlGzQsZNwbYsJupDWm7ZbqzGhY66Ku394Mw,8546
26
- jaxspec/util/integrate.py,sha256=_Ax_knpC7d4et2-QFkOUzVtNeQLX1-cwLvm-FRBxYcw,4505
27
- jaxspec/util/online_storage.py,sha256=vm56RfcbFKpkRVfr0bXO7J9aQxuBq-I_oEgA26YIhCo,2469
28
- jaxspec/util/typing.py,sha256=8qK1aJlsqTcVKjYN-BxsDx20BTwtnS-wMw6Bdurpm-o,2459
29
- jaxspec-0.1.4.dist-info/LICENSE.md,sha256=2q5XoWzddts5IqzIcgYYMOL21puU3MfO8gvT3Ype1eQ,1073
30
- jaxspec-0.1.4.dist-info/METADATA,sha256=z-k8NXwz_PKDffLgdxlAu0OPUT0Vy0jig8ystiFwKOs,4456
31
- jaxspec-0.1.4.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
32
- jaxspec-0.1.4.dist-info/entry_points.txt,sha256=kzLG2mGlCWITRn4Q6zKG_idx-_RKAncvA0DMNYTgHAg,71
33
- jaxspec-0.1.4.dist-info/RECORD,,