Skip to content

Commit 6f4d9e3

Browse files
committed
- Updated all instances of TSDataSet to TSDataGroup in class definitions, methods, and documentation.
- Modified related imports and property references to align with the new naming. - Updated CHANGES.md and Sphinx documentation to reflect the renaming. - Refactored functionality dependent on the `TSDataSet` class without altering behavior.
1 parent 6a6a423 commit 6f4d9e3

File tree

9 files changed

+103
-61
lines changed

9 files changed

+103
-61
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2222

2323
### Changed
2424

25+
- Renamed `TSDataSet` to `TSDataGroup`
26+
2527
### Removed
2628

2729
## [0.18.0] - 2025-02-20
@@ -53,7 +55,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5355

5456
### Changed
5557
- **Transit Mask Renaming:** Renamed the old `ootmask` attribute to `transit_mask` throughout the codebase for clarity. This change affects plotting, normalization, binning, and file I/O.
56-
- **Method Renaming:** Renamed `calculate_ootmask` in the `TSDataSet` class to `mask_transit` to reflect the updated naming convention.
58+
- **Method Renaming:** Renamed `calculate_ootmask` in the `TSDataGroup` class to `mask_transit` to reflect the updated naming convention.
5759
- **Normalization Enhancements:** Updated normalization methods (`normalize_to_poly` and `normalize_to_median`) to utilize the new `transit_mask` and `mask` attributes, improving the reliability of baseline fits.
5860
- **Cropping Flexibility:** Added an `inplace` parameter to both `crop_wavelength` and `crop_time` methods, allowing users to choose between modifying the existing data or returning a new cropped instance.
5961
- **Likelihood Function Update:** Modified the `lnlike_normal` function in `TSLPF` to accept an additional `mask` parameter and process only valid data points during likelihood calculations.

doc/source/api/exoiris.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Constructor
1111
-----------
1212

1313
The `ExoIris` class is initialized by providing a name for the analysis, selecting a limb darkening model, and passing the
14-
spectroscopic light curves as either a `~exoiris.tsdata.TSData` or `~exoiris.tsdata.TSDataSet` object.
14+
spectroscopic light curves as either a `~exoiris.tsdata.TSData` or `~exoiris.tsdata.TSDataGroup` object.
1515
Additional parameters can also be supplied to the initializer to refine the analysis, although these can be set
1616
later if preferred.
1717

doc/source/api/tsdata.rst

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ Data handling
44
=============
55
.. currentmodule:: exoiris.tsdata
66

7-
The spectroscopic light curves are given to ExoIris as a `TSData` (Transmission Spectroscopy Data) or `TSDataSet`
8-
object. `TSData` is a utility class that provides methods for data cleanup, binning, and cropping, while `TSDataSet`
9-
is a container class that can contain many `TSData` objects.
7+
The spectroscopic light curves are given to ExoIris as a `TSData` (Transmission Spectroscopy Data) or `TSDataGroup`
8+
object. `TSData` is a utility class that provides methods for data cleanup, binning, and cropping, and uncertainty
9+
estimation, while `TSDataGroup` is a container class that can hold multiple `TSData` objects and provides aggregate
10+
properties and methods.
1011

1112
Main classes
1213
------------
@@ -15,7 +16,7 @@ Main classes
1516
:toctree: api/
1617

1718
TSData
18-
TSDataSet
19+
TSDataGroup
1920

2021
Data wrangling
2122
--------------
@@ -32,13 +33,22 @@ Data wrangling
3233
TSData.normalize_to_poly
3334
TSData.partition_time
3435

36+
Uncertainty estimation
37+
----------------------
38+
39+
.. autosummary::
40+
:toctree: api/
41+
42+
TSData.estimate_average_uncertainties
43+
3544
Masking
3645
-------
3746

3847
.. autosummary::
3948
:toctree: api/
4049

4150
TSData.mask_transit
51+
TSDataGroup.mask_transit
4252

4353
I/O
4454
---
@@ -48,8 +58,8 @@ I/O
4858

4959
TSData.export_fits
5060
TSData.import_fits
51-
TSDataSet.export_fits
52-
TSDataSet.import_fits
61+
TSDataGroup.export_fits
62+
TSDataGroup.import_fits
5363

5464

5565
Plotting
@@ -60,4 +70,4 @@ Plotting
6070

6171
TSData.plot
6272
TSData.plot_white
63-
TSDataSet.plot
73+
TSDataGroup.plot

exoiris/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# along with this program. If not, see <https://www.gnu.org/licenses/>.
1616

1717
from .exoiris import ExoIris, load_model # noqa
18-
from .tsdata import TSData, TSDataSet # noqa
18+
from .tsdata import TSData, TSDataGroup # noqa
1919
from .binning import Binning # noqa
2020
from .ldtkld import LDTkLD # noqa
2121
from .tslpf import clean_knots # noqa

exoiris/exoiris.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
from uncertainties import UFloat
4242

4343
from .ldtkld import LDTkLD
44-
from .tsdata import TSData, TSDataSet
44+
from .tsdata import TSData, TSDataGroup
4545
from .tslpf import TSLPF
4646
from .wlpf import WhiteLPF
4747

@@ -70,7 +70,7 @@ def load_model(fname: Path | str, name: str | None = None):
7070
If the file format is invalid or does not match the expected format.
7171
"""
7272
with pf.open(fname) as hdul:
73-
data = TSDataSet.import_fits(hdul)
73+
data = TSDataGroup.import_fits(hdul)
7474

7575
if hdul[0].header['LDMODEL'] == 'ldtk':
7676
filters, teff, logg, metal, dataset = pickle.loads(codecs.decode(json.loads(hdul[0].header['LDTKLD']).encode(), "base64"))
@@ -117,7 +117,7 @@ class ExoIris:
117117
"""The core ExoIris class providing tools for exoplanet transit spectroscopy.
118118
"""
119119

120-
def __init__(self, name: str, ldmodel, data: TSDataSet | TSData, nk: int = 50, nldc: int = 10, nthreads: int = 1,
120+
def __init__(self, name: str, ldmodel, data: TSDataGroup | TSData, nk: int = 50, nldc: int = 10, nthreads: int = 1,
121121
tmpars: dict | None = None, noise_model: Literal["white", "fixed_gp", "free_gp"] = 'white',
122122
interpolation: Literal['bspline', 'pchip', 'makima'] = 'bspline'):
123123
"""
@@ -140,7 +140,7 @@ def __init__(self, name: str, ldmodel, data: TSDataSet | TSData, nk: int = 50, n
140140
noise_model
141141
The noise model to use. Should be either "white" for white noise or "fixed_gp" for Gaussian Process.
142142
"""
143-
data = TSDataSet([data]) if isinstance(data, TSData) else data
143+
data = TSDataGroup([data]) if isinstance(data, TSData) else data
144144

145145
for d in data:
146146
if any(~isfinite(d.fluxes[d.mask])):
@@ -161,7 +161,7 @@ def __init__(self, name: str, ldmodel, data: TSDataSet | TSData, nk: int = 50, n
161161
if not ((egs.min() == 0) and (egs.max() + 1 == unique(egs).size)):
162162
raise ValueError("The epoch groups must start from 0 and be consecutive.")
163163

164-
self._tsa: TSLPF = TSLPF(name, ldmodel, data, nk=nk, nldc=nldc, nthreads=nthreads, tmpars=tmpars,
164+
self._tsa: TSLPF = TSLPF(self, name, ldmodel, data, nk=nk, nldc=nldc, nthreads=nthreads, tmpars=tmpars,
165165
noise_model=noise_model, interpolation=interpolation)
166166
self._wa: WhiteLPF | None = None
167167
self.nthreads: int = nthreads
@@ -201,15 +201,15 @@ def set_noise_model(self, noise_model: Literal['white', 'fixed_gp', 'free_gp'])
201201
"""
202202
self._tsa.set_noise_model(noise_model)
203203

204-
def set_data(self, data: TSData | TSDataSet) -> None:
204+
def set_data(self, data: TSData | TSDataGroup) -> None:
205205
"""Set the model data.
206206
207207
Parameters
208208
----------
209209
data
210210
The spectroscopic transit light curve.
211211
"""
212-
data = TSDataSet([data]) if isinstance(data, TSData) else data
212+
data = TSDataGroup([data]) if isinstance(data, TSData) else data
213213
self._tsa.set_data(data)
214214

215215
def set_prior(self, parameter: Literal['radius ratios', 'baselines', 'wn multipliers'] | str,
@@ -334,7 +334,7 @@ def name(self, name: str):
334334
self._tsa.name = name
335335

336336
@property
337-
def data(self) -> TSDataSet:
337+
def data(self) -> TSDataGroup:
338338
"""Analysis data set."""
339339
return self._tsa.data
340340

@@ -516,7 +516,7 @@ def plot_setup(self, figsize: tuple[float, float] | None = None,
516516
if xticks is not None:
517517
ax.set_xticks(xticks, labels=xticks)
518518

519-
setp(ax, yticks=[], xlim=(self.data.wlmin-side_margin, self.data.wlmax+side_margin), xlabel='Wavelength [$\mu$m]')
519+
setp(ax, yticks=[], xlim=(self.data.wlmin-side_margin, self.data.wlmax+side_margin), xlabel=r'Wavelength [$\mu$m]')
520520
ax.set_yticks(concatenate([arange(ndata), arange(ndata+1, ndata+4, 2)])*yshift+0.5*mh, labels=[n.replace("_", " ") for n in self.data.names] + ["Limb darkening knots", "Radius ratio knots"])
521521
return fig
522522

exoiris/ldtkld.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@
2323
from pytransit import LDTkLD as PTLDTkLD
2424
from ldtk import BoxcarFilter
2525

26-
from .tsdata import TSData, TSDataSet
26+
from .tsdata import TSData, TSDataGroup
2727

2828

2929
class LDTkLD(PTLDTkLD):
30-
def __init__(self, data: TSDataSet | TSData,
30+
def __init__(self, data: TSDataGroup | TSData,
3131
teff: tuple[float, float],
3232
logg: tuple[float, float],
3333
metal: tuple[float, float],
3434
cache: str | Path | None = None,
3535
dataset: str = 'vis-lowres') -> None:
3636

37-
data = TSDataSet([data]) if isinstance(data, TSData) else data
37+
data = TSDataGroup([data]) if isinstance(data, TSData) else data
3838
wl_edges = concatenate([array([d._wl_l_edges, d._wl_r_edges]) for d in data], axis=1).T
3939
filters = [BoxcarFilter(f"{0.5*(wla+wlb):08.5f}", wla*1e3, wlb*1e3) for wla, wlb in wl_edges]
4040
super().__init__(filters, teff, logg, metal, cache, dataset)

0 commit comments

Comments
 (0)