ExoIris 0.23.0__py3-none-any.whl → 0.23.2__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.
exoiris/exoiris.py CHANGED
@@ -163,7 +163,7 @@ class ExoIris:
163
163
 
164
164
  def __init__(self, name: str, ldmodel, data: TSDataGroup | TSData, nk: int = 50, nldc: int = 10, nthreads: int = 1,
165
165
  tmpars: dict | None = None, noise_model: Literal["white", "fixed_gp", "free_gp"] = 'white',
166
- interpolation: Literal['nearest', 'linear', 'pchip', 'makima', 'bspline', 'bspline-quadratic'] = 'makima'):
166
+ interpolation: Literal['nearest', 'linear', 'pchip', 'makima', 'bspline', 'bspline-quadratic', 'bspline-cubic'] = 'linear'):
167
167
  """
168
168
  Parameters
169
169
  ----------
@@ -529,6 +529,16 @@ class ExoIris:
529
529
  """
530
530
  self._tsa.set_k_knots(knot_wavelengths)
531
531
 
532
+ def free_radius_ratio_knot_locations(self, knot_ids: list[int] | ndarray) -> None:
533
+ """Add the wavelength locations of chosen radius ratio knots to the model as free parameters.
534
+
535
+ Parameters
536
+ ----------
537
+ knot_ids
538
+ List of radius ratio knot indices to be made free parameters.
539
+ """
540
+ self._tsa.free_k_knot_locations(knot_ids)
541
+
532
542
  def create_dense_radius_ratio_block(self, wlmin: float, wlmax: float) -> None:
533
543
  """Create a block of radius ratio knots using the full data resolution.
534
544
 
exoiris/tslpf.py CHANGED
@@ -40,8 +40,9 @@ from numpy import (
40
40
  dstack,
41
41
  diff,
42
42
  ascontiguousarray,
43
+ nan,
43
44
  )
44
- from numpy.linalg import lstsq
45
+ from numpy.linalg import lstsq, LinAlgError
45
46
  from numpy.random import default_rng
46
47
  from pytransit.lpf.logposteriorfunction import LogPosteriorFunction
47
48
  from pytransit.orbits import as_from_rhop, i_from_ba
@@ -133,11 +134,11 @@ def add_knots(x_new, x_old):
133
134
  return sort(concatenate([x_new, x_old]))
134
135
 
135
136
 
136
- interpolator_choices = ("bspline", "pchip", "makima", "nearest", "linear", "bspline-quadratic")
137
+ interpolator_choices = ("bspline", "pchip", "makima", "nearest", "linear", "bspline-quadratic", "bspline-cubic")
137
138
 
138
139
 
139
- interpolators = {'bspline': ip_bspline, 'bspline-quadratic': ip_bspline_quadratic, 'pchip': ip_pchip,
140
- 'makima': ip_makima, 'nearest': ip_nearest, 'linear': ip_linear}
140
+ interpolators = {'bspline': ip_bspline, 'bspline-cubic': ip_bspline, 'bspline-quadratic': ip_bspline_quadratic,
141
+ 'pchip': ip_pchip, 'makima': ip_makima, 'nearest': ip_nearest, 'linear': ip_linear}
141
142
 
142
143
 
143
144
  def clean_knots(knots, min_distance, lmin=0, lmax=inf):
@@ -181,7 +182,7 @@ def clean_knots(knots, min_distance, lmin=0, lmax=inf):
181
182
  class TSLPF(LogPosteriorFunction):
182
183
  def __init__(self, runner, name: str, ldmodel, data: TSDataGroup, nk: int = 50, nldc: int = 10, nthreads: int = 1,
183
184
  tmpars = None, noise_model: Literal["white", "fixed_gp", "free_gp"] = 'white',
184
- interpolation: Literal['nearest', 'linear', 'pchip', 'makima', 'bspline', 'bspline-quadratic'] = 'makima'):
185
+ interpolation: Literal['nearest', 'linear', 'pchip', 'makima', 'bspline', 'bspline-quadratic', 'bspline-cubic'] = 'linear'):
185
186
  super().__init__(name)
186
187
  self._runner = runner
187
188
  self._original_data: TSDataGroup | None = None
@@ -549,7 +550,14 @@ class TSLPF(LogPosteriorFunction):
549
550
  self._mc_chains = fmcn.reshape([mco.shape[0], mco.shape[1], ndn])
550
551
  self.sampler = None
551
552
 
552
- def set_free_k_knots(self, ids):
553
+ def set_free_k_knots(self, ids: list[int] | ndarray) -> None:
554
+ """Add the wavelength locations of chosen radius ratio knots as free model parameters.
555
+
556
+ Parameters
557
+ ----------
558
+ ids : list of int
559
+ List of radius ratio knot indices to be made free parameters.
560
+ """
553
561
  self.free_k_knot_ids = ids
554
562
 
555
563
  # Remove existing parameter block if one exists
@@ -749,8 +757,11 @@ class TSLPF(LogPosteriorFunction):
749
757
  for i, d in enumerate(self.data):
750
758
  for ipv in range(npv):
751
759
  res = d.fluxes / mtransit[i][ipv]
752
- coeffs = nlstsq(d.covs, res, d.mask, d._wlmask, d._wls_with_nan)
753
- self._baseline_models[i][ipv, :, :] = (d.covs @ coeffs).T
760
+ try:
761
+ coeffs = nlstsq(d.covs, res, d.mask, d._wlmask, d._wls_with_nan)
762
+ self._baseline_models[i][ipv, :, :] = (d.covs @ coeffs).T
763
+ except LinAlgError:
764
+ self._baseline_models[i][ipv, :, :] = nan
754
765
  return self._baseline_models
755
766
 
756
767
  def flux_model(self, pv):
exoiris/wlpf.py CHANGED
@@ -128,7 +128,7 @@ class WhiteLPF(BaseLPF):
128
128
  pv = self._local_minimization.x
129
129
  a = as_from_rhop(pv[1], pv[0])
130
130
  i = i_from_ba(pv[2], a)
131
- t14 = d_from_pkaiews(pv[0], sqrt(pv[4]), a, i, 0., 0., 1, 14)
131
+ t14 = d_from_pkaiews(pv[0], sqrt(pv[self._start_k2]), a, i, 0., 0., 1, 14)
132
132
  return t14
133
133
 
134
134
  def plot(self, axs=None, figsize=None, ncols=2) -> Figure:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ExoIris
3
- Version: 0.23.0
3
+ Version: 0.23.2
4
4
  Summary: Easy and robust exoplanet transmission spectroscopy.
5
5
  Author-email: Hannu Parviainen <hannu@iac.es>
6
6
  License: GPLv3
@@ -1,17 +1,17 @@
1
1
  exoiris/__init__.py,sha256=LU5jAE7_OVPLHFO0UAOGS0e0wuWV6rdSD0Qveet11K8,1147
2
2
  exoiris/binning.py,sha256=-Y9hdK0jZj8DOS82keaprneid2lZ4rCx-keWlKi0LP8,6455
3
3
  exoiris/ephemeris.py,sha256=dthBkJztT5yAP6VnnO7jGvxikboFUQBUGPUfBCFrA3w,1316
4
- exoiris/exoiris.py,sha256=-N0fvkHRIUftkSNXaD1ioWeylG7vAb7gtTWWMQtNdDQ,60956
4
+ exoiris/exoiris.py,sha256=zu-_RP1DvHUjvNNT81PBpsVd8aMrAZ134vBveJ4Z6HA,61355
5
5
  exoiris/ldtkld.py,sha256=7H1r1xail3vSKdsNKorMTqivnRKU9WrOVH-uE4Ky2jM,3495
6
6
  exoiris/loglikelihood.py,sha256=lVm7kMyzy-xxP5VvZMV7kJY3KovbhlEz3u_6O7R6zgI,6309
7
7
  exoiris/spotmodel.py,sha256=9-DxvVzGzxf6AjQfrzZreyJB4Htw0gsIAD3nWl0tQMc,7160
8
8
  exoiris/tsdata.py,sha256=s3R6sByy7Ud26F3TdaRaXNQi-rYeJHnm7XHk2FLd1Go,36622
9
- exoiris/tslpf.py,sha256=iBagXEuTp2vNuH9jpGMXP7Ti5N9Hz0vzchaZpdD5Mr4,33343
9
+ exoiris/tslpf.py,sha256=DcnwuqFNL0ZW9RLWmppJxN6UOlrtdQAzd21ZedfA6Es,33830
10
10
  exoiris/tsmodel.py,sha256=6NaGY48fWHUT_7ti6Ao618PN-LgyoIhfQd8lZQqZ7hU,5160
11
11
  exoiris/util.py,sha256=uNv_c3Kuv1lml8MuDAuyElO4s3f1tRIQ1QMlLaI7Yak,5921
12
- exoiris/wlpf.py,sha256=g6h1cLk2-nKD8u_FzwXNVVGFK4dry8fBr0A70LA5gJw,6281
13
- exoiris-0.23.0.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
- exoiris-0.23.0.dist-info/METADATA,sha256=fiRuio6EYjCval6pR1nV31KdL2wjvlgQxGMyOL743Hc,5084
15
- exoiris-0.23.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
- exoiris-0.23.0.dist-info/top_level.txt,sha256=EoNxT6c5mQDcM0f_LUQB-ETsYg03lNaV3o2L_Yc6-aE,8
17
- exoiris-0.23.0.dist-info/RECORD,,
12
+ exoiris/wlpf.py,sha256=ixEsDXLHSglYOWhJKA87NJPrLWqhEk4DYhn1IaShN8U,6294
13
+ exoiris-0.23.2.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
14
+ exoiris-0.23.2.dist-info/METADATA,sha256=j_sUV7HhzWwtgZpN9PPItE3M4fdJufnsRO1YIRav_U8,5084
15
+ exoiris-0.23.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ exoiris-0.23.2.dist-info/top_level.txt,sha256=EoNxT6c5mQDcM0f_LUQB-ETsYg03lNaV3o2L_Yc6-aE,8
17
+ exoiris-0.23.2.dist-info/RECORD,,