Datasets:

Modalities:
Tabular
Text
DOI:
License:
File size: 17,030 Bytes
3cfb647
 
5e4fbf3
 
066d03c
450f6d8
066d03c
450f6d8
066d03c
 
 
 
 
3fb9e62
 
066d03c
 
bd8db2f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
066d03c
 
 
 
 
 
 
 
 
 
 
 
bf476f1
066d03c
 
 
3fb9e62
066d03c
 
 
 
 
bd8db2f
066d03c
 
 
 
3fb9e62
 
066d03c
85c55ca
 
066d03c
85c55ca
bf476f1
85c55ca
 
 
 
 
 
066d03c
 
85c55ca
 
066d03c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85c55ca
 
 
066d03c
 
 
 
 
 
 
85c55ca
 
 
 
 
 
 
 
066d03c
85c55ca
 
 
 
066d03c
85c55ca
 
 
 
066d03c
 
 
 
 
 
3fb9e62
066d03c
 
 
 
 
 
 
 
 
 
 
85c55ca
3fb9e62
 
066d03c
 
 
bd8db2f
 
85c55ca
3fb9e62
 
 
 
 
 
 
 
066d03c
 
 
 
 
 
 
3fb9e62
 
 
 
 
 
bd8db2f
 
 
 
3fb9e62
 
 
bd8db2f
 
3fb9e62
bd8db2f
 
3fb9e62
bd8db2f
 
 
 
 
3fb9e62
bd8db2f
 
 
 
 
 
 
 
 
 
3fb9e62
 
 
bd8db2f
 
 
 
 
 
 
4f6175b
3fb9e62
 
bd8db2f
 
3fb9e62
bd8db2f
3fb9e62
bd8db2f
 
 
 
3fb9e62
 
 
 
 
bd8db2f
3fb9e62
 
 
bd8db2f
3fb9e62
 
 
 
bd8db2f
 
3fb9e62
bd8db2f
 
 
 
 
3fb9e62
 
 
 
 
bd8db2f
 
3fb9e62
 
 
bd8db2f
 
 
 
 
 
 
 
 
3fb9e62
 
 
bd8db2f
 
3fb9e62
 
 
 
 
 
 
 
 
bd8db2f
 
 
 
 
3fb9e62
bd8db2f
3fb9e62
 
 
 
bd8db2f
3fb9e62
 
 
bd8db2f
 
 
 
3fb9e62
 
bd8db2f
 
3fb9e62
 
 
bd8db2f
 
3fb9e62
 
 
 
 
 
 
bd8db2f
 
 
 
3fb9e62
 
 
 
bd8db2f
 
 
 
1
2
3
4
5
6
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
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
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
---
license: cc0-1.0
configs:
  - config_name: observations
    data_files: '*_obs.parquet'
  - config_name: metadata
    data_files: '*_meta.parquet'
  - config_name: epochs
    data_files: '*_epoch.parquet'
---

# Machine Learning Tier

This dataset is a collection of synthetic microlensing light curves designed to accurately represent the yields of microlensing events from the lifetime of the Nancy Grace Roman Space Telescope Galactic Bulge Time Domain Survey. It is intended for the training and benchmarking of machine learning models for microlensing event classification, parameter estimation, and anomaly detection.

The machine learning tier data is provided as a set of normalized tables in Parquet format: **RMDC26_ML_Data_obs.parquet**, **RMDC26_ML_Data_meta.parquet**, and **RMDC26_ML_Data_epoch.parquet**.

## Entity-Relationship Diagram

```
┌───────────────────┐        ┌───────────────────┐        ┌───────────────────┐
│     metadata      │        │   observations    │        │      epochs       │
├───────────────────┤        ├───────────────────┤        ├───────────────────┤
│ event_id (PK)     │◄───────├ event_id (FK)     │    ┌──►│ epoch_id (PK)     │
│ name              │        │ epoch_id (FK) ────┼────┘   │ bjd               │
│ sim_label         │        │ filt              │        │ obs_x             │
│ tE_helio          │        │ flux_uJy          │        │ obs_y             │
│ u0lens1           │        │ flux_err_uJy      │        │ obs_z             │
│ …(physical params)│        │ true_flux_uJy     │        └───────────────────┘
└───────────────────┘        │ saturation_flag   │
                             └───────────────────┘
```

**Relationships:**
- **observations → metadata**: many-to-one on `event_id` (each event has one metadata record)
- **observations → epochs**: many-to-one on `epoch_id` (each epoch has many observations)
- To reconstruct a full lightcurve: join all three tables on `event_id` and `epoch_id`

## Tables

### 1. Observations Table (`_obs.parquet`)
Contains the primary time-series data for all events.

| Column Name | Data Type | Description |
| :--- | :--- | :--- |
| `event_id` | int64 | Unique event identifier. |
| `epoch_id` | int64 | Identifier for the specific observation epoch. |
| `filt` | string | Filter used for the observation. Values: `F087`, `F146`, `F213`. |
| `flux_uJy` | float64 | Measured flux in microjanskys (μJy). |
| `flux_err_uJy` | float64 | Uncertainty in the measured flux in μJy. |
| `true_flux_uJy` | float64 | True flux in microjanskys (μJy). |
| `saturation_flag` | float64 | Saturation flag: 0 = unsaturated, 1 = saturated. |

### 2. Metadata Table (`_meta.parquet`)
Contains the simulated physical parameters and lensing variables for each event.

| Column Name | Data Type | Description |
| :--- | :--- | :--- |
| `name` | string | Unique event identifier (e.g., `RMDC26_XXXXXX`). |
| `event_id` | int64 | Integer ID matching the observations table. |
| `sim_label` | string | Simulation category (e.g., `RMDC26_1S1L_ML`). |
| `SubRun` | float64 | Sub-run identifier. |
| `Field` | float64 | Field identifier. |
| `EventID` | float64 | Event ID. |
| `final_weight` | float64 | Population weight for the event. |
| `ObsGroup_0_chi2` | float64 | For binary events, the $\Delta\chi^2$ between the best-fitting single-lens (PSPL) model and the true simulated model ($\chi^2_{\text{PSPL\_fit}} - \chi^2_{\text{true}}$). For single-source single-lens events, this instead stores the $\Delta\chi^2$ of the true simulated model vs a flat baseline fit ($\chi^2_{\text{flat}} - \chi^2_{\text{true}}$). |
| `is_out_of_season` | boolean | Flag indicating whether the event peak ($t_0$) falls in a seasonal gap (when Roman cannot observe the bulge). |
| `t0lens1` | float64 | Time of closest approach for the primary lens. |
| `tE_ref` | float64 | Einstein timescale (observer reference frame). |
| `tE_helio` | float64 | Einstein timescale (barycentric frame). |
| `u0lens1` | float64 | Impact parameter. |
| `rho` | float64 | Ratio of source radius to the Einstein ring radius. |
| `piE` | float64 | Microlens parallax magnitude. |
| `piEE` | float64 | Parallax-East term. In ecliptic coordinates. |
| `piEN` | float64 | Parallax-North term. In ecliptic coordinates. |
| `piEll` | float64 | Parallax-component parallel to solar acceleration. |
| `piErp` | float64 | Parallax-component perpendicular to solar acceleration. |
| `rE` | float64 | Einstein radius of the primary lens mass (AU). |
| `thetaE` | float64 | Einstein angular radius of the primary lens mass (mas). |
| `ra_deg` | float64 | Event right ascension in degrees. |
| `dec_deg` | float64 | Event declination in degrees. |
| `galactic_l` | float64 | Galactic longitude (degrees). |
| `galactic_b` | float64 | Galactic latitude (degrees). |
| `fs_F146` | float64 | Source flux fraction in F146. |
| `fs_F087` | float64 | Source flux fraction in F087. |
| `fs_F213` | float64 | Source flux fraction in F213. |
| `fs2_F146` | float64 | Second source flux fraction in F146. |
| `fs2_F087` | float64 | Second source flux fraction in F087. |
| `fs2_F213` | float64 | Second source flux fraction in F213. |
| `Lens_F146` | float64 | Lens magnitude in F146. |
| `Lens_F087` | float64 | Lens magnitude in F087. |
| `Lens_F213` | float64 | Lens magnitude in F213. |
| `Source_F146` | float64 | Source magnitude in F146. |
| `Source_F087` | float64 | Source magnitude in F087. |
| `Source_F213` | float64 | Source magnitude in F213. |
| `Source2_F146` | float64 | Second source magnitude in F146. |
| `Source2_F087` | float64 | Second source magnitude in F087. |
| `Source2_F213` | float64 | Second source magnitude in F213. |
| `Source_Is_Binary` | float64 | Flag indicating if the source is binary. |
| `Source_q` | float64 | Mass ratio of the binary source. |
| `Source_combined_logP` | float64 | log period/days of binary source. |
| `Source_total_mass` | float64 | Total mass of binary source (MSun). |
| `Source2_rho` | float64 | Ratio of second source radius to the Einstein ring radius. |
| `Source2_s` | float64 | Projected separation of second source. |
| `Source2_alpha` | float64 | Angle of second source. |
| `Source2_inc` | float64 | Inclination of second source. |
| `Source2_phase` | float64 | Phase of second source. |
| `Planet_mass` | float64 | Mass of the planet (if present). |
| `Planet_q` | float64 | Planet-to-star mass ratio. |
| `Planet_s` | float64 | Projected separation of the planet. |
| `Planet_period` | float64 | Orbital period of the planet (years). |
| `Planet_semimajoraxis` | float64 | Semimajor axis of the planet (AU). |
| `Planet_orbphase` | float64 | Orbital phase of the planet (degrees). |
| `Planet_inclination` | float64 | Inclination of the planet (degrees). |
| `Lens_Mass` | float64 | Mass of the lens (MSun). |
| `Lens_Dist` | float64 | Distance to the lens (kpc). |
| `Lens_Teff` | float64 | Effective temperature of the lens (K). |
| `Lens_logg` | float64 | Surface gravity of the lens (cgs). |
| `Lens_Fe_H` | float64 | Metallicity of the lens. |
| `Source_Mass` | float64 | Mass of the source (MSun). |
| `Source_Dist` | float64 | Distance to the source (kpc). |
| `Source_Teff` | float64 | Effective temperature of the source (K). |
| `Source_logg` | float64 | Surface gravity of the source (cgs). |
| `Source_Fe_H` | float64 | Metallicity of the source. |
| `Source2_Mass` | float64 | Mass of the second source (MSun). |
| `Source2_Dist` | float64 | Distance to the second source (kpc). |
| `Source2_Teff` | float64 | Effective temperature of the second source (K). |
| `Source2_logg` | float64 | Surface gravity of the second source (cgs). |
| `Source2_Fe_H` | float64 | Metallicity of the second source. |
| `extinction_F146` | float64 | Extinction in F146. |
| `extinction_F087` | float64 | Extinction in F087. |
| `extinction_F213` | float64 | Extinction in F213. |

### 3. Epochs Table (`_epoch.parquet`)
Maps each unique observation time (BJD) and corresponding telescope coordinates (X, Y, Z relative to the Solar System Barycenter) to a unique epoch ID.

| Column Name | Data Type | Description |
| :--- | :--- | :--- |
| `epoch_id` | int64 | Unique identifier for the epoch. |
| `bjd` | float64 | Barycentric Julian Date. |
| `obs_x` | float64 | Observatory X-coordinate in AU. |
| `obs_y` | float64 | Observatory Y-coordinate in AU. |
| `obs_z` | float64 | Observatory Z-coordinate in AU. |

## Simulation Details & Disclaimer

**Simulation Engine:** All events have been generated using the **gulls** simulator. More information is available at [gulls-microlensing.github.io](https://gulls-microlensing.github.io/).

**Stellar Populations:** The input stellar population catalogs used for the source and lens stars were generated using **synthpop** ([github.com/synthpop-galaxy/synthpop](https://github.com/synthpop-galaxy/synthpop)).

**Event Complexity:**
- There are three simulations included in this dataset:
    - `RMDC26_1S1L_ML`: Single lens and single source events.
    - `RMDC26_1S2L_ML`: One star - one planet lens and single source events.
    - `RMDC26_2S2L_ML`: One star - one planet lens and potentially binary source events without source orbital motion. 
- Note that not all lenses and sources are necessarily involved in the microlensing event. `ObsGroup_0_chi2` > 160 for events from the binary lens simulations indicates that an anomaly may be present in the light curve. The anomalies may be planetary perturbations and caustic crossings, finite source effects, or parallax effects.

**Representativeness & Weighting:**
- This data set only includes potentially detectable microlensing events where the chi-squared difference between the best fit flat model and the true model is greater than 60, i.e. $$\chi^2_{\text{flat}} - \chi^2_{\text{true}} > 60$$.
- The full set of events is **not directly representative** of the raw astrophysical population due to detection significance cuts and GULLS coordinate transformations (e.g. in `croin` caustic-relative coordinates, the host star $t_0$ and $u_0$ are often transformed far outside of normal ranges or observing seasons, even though the planetary anomaly itself is actively observed in-season).
- To make the dataset more representative of the true underlying Galactic population, you can apply the population weights stored in the **`final_weight`** column directly during training and analysis, or use them to draw a resampled, less biased dataset.
- The **`is_out_of_season`** flag indicates whether the closest approach time of the primary lens (`t0lens1`) falls in a seasonal gap when the Galactic Bulge is unobservable. While the lightcurves of these events still show signature features of the microlensing event, their peak stellar magnification is not covered by observations. As a result, these events might be difficult for machine learning models to classify correctly, and you may want to filter them out depending on your specific modeling goals.


**Dataset Structure:**
- The dataset is split into **observations**, **metadata**, and **epochs**.
- To reconstruct a full lightcurve for an event, join the `obs` table with the `meta` table on `event_id` and the `epoch` table on `epoch_id`.

**Disclaimer:** This dataset is intended for testing and development purposes and should be used with the understanding of the biases inherent in the simulation sampling.

## Sample Light Curves

Here are normalized light curves for 9 sample events from the dataset (3 from each simulation type: 1S1L, 1S2L, 2S2L), colored by filter band. Each filter's flux is divided by its median value (per event) so all bands appear on the same relative scale — the dashed gray line marks the baseline (ratio = 1). The time axis is zoomed to $t_0 \pm 5 \cdot t_E$.

![Sample Light Curves](lightcurves_sample.png)

## Code Examples

The dataset is hosted on Hugging Face as `RGES-PIT/MachineLearning` with three configs: `observations`, `metadata`, and `epochs`. Below are examples for loading and working with the data.

### Prerequisites

To load the metadata and epochs tables directly from Hugging Face, install the `datasets` and `pandas` libraries:

```bash
pip install datasets pandas pyarrow duckdb huggingface_hub
```

Set your Hugging Face access token:

```bash
export HF_TOKEN="hf_your_token_here"
```

### 1. Load the metadata and epochs tables

```python
from datasets import load_dataset
import os

token = os.environ.get("HF_TOKEN")
assert token, "Set HF_TOKEN environment variable first"

dataset_name = "RGES-PIT/MachineLearning"

# Load metadata and epochs tables (which fit easily in RAM)
meta_df = load_dataset(dataset_name, "metadata", split="train", token=token).to_pandas()
epochs_df = load_dataset(dataset_name, "epochs", split="train", token=token).to_pandas()

print(f"Metadata     : {meta_df.shape[0]:,} rows")
print(f"Epochs       : {epochs_df.shape[0]:,} rows")
```

**Expected output:**
```text
Observations : 16,911,983,335 rows
Metadata     : 341,740 rows
Epochs       : 98,974 rows
```

### 2. Reconstruct a single event's lightcurve

Because the observations table is extremely large (~160 GB in total), loading it in full is not recommended for local machines. Instead, we use DuckDB's remote `hf://` protocol to fetch observations for a single event without downloading the entire table:

```python
import duckdb
from huggingface_hub import HfFileSystem
import os

token = os.environ.get("HF_TOKEN")
con = duckdb.connect()
con.register_filesystem(HfFileSystem(token=token))

obs_p = "hf://datasets/RGES-PIT/MachineLearning/RMDC26_ML_Data_obs.parquet"
meta_p = "hf://datasets/RGES-PIT/MachineLearning/RMDC26_ML_Data_meta.parquet"
epoch_p = "hf://datasets/RGES-PIT/MachineLearning/RMDC26_ML_Data_epoch.parquet"

event_id = 3000

# Reconstruct a single event's lightcurve
event_obs = con.execute(f"""
    SELECT 
        o.event_id,
        m.name,
        e.bjd,
        o.filt,
        o.flux_uJy,
        m.tE_helio,
        m.sim_label
    FROM '{obs_p}' o
    JOIN '{epoch_p}' e ON o.epoch_id = e.epoch_id
    JOIN '{meta_p}' m ON o.event_id = m.event_id
    WHERE o.event_id = {event_id}
    ORDER BY e.bjd
""").df()

print(f"Event {event_id}: {event_obs['name'].iloc[0]} ({event_obs['sim_label'].iloc[0]})")
print(f"  {len(event_obs):,} observations")
print(f"  Einstein timescale tE_helio = {abs(event_obs['tE_helio'].iloc[0]):.2f} days")
```

**Expected output:**
```text
Event 3000: RMDC26_003000 (RMDC26_1S1L_ML)
  49,488 observations
  Einstein timescale tE_helio = 3.55 days
```

### 3. Filter events by metadata constraints

You can perform filtering on the metadata table first, and then fetch observations for matched events. To run this efficiently over the network without full-table scans, query observations only for the target event IDs:

```python
from datasets import load_dataset
import os
import duckdb
from huggingface_hub import HfFileSystem

token = os.environ.get("HF_TOKEN")
meta_df = load_dataset("RGES-PIT/MachineLearning", "metadata", split="train", token=token).to_pandas()

# Select low-significance single-lens events (chi2 <= 160)
good_events = meta_df[
    (meta_df["sim_label"] == "RMDC26_1S1L_ML") &
    (meta_df["ObsGroup_0_chi2"] <= 160)
]

print(f"{len(good_events)} events matched filters")

# Query observations count for matched events via DuckDB filter pushdown
con = duckdb.connect()
con.register_filesystem(HfFileSystem(token=token))
obs_p = "hf://datasets/RGES-PIT/MachineLearning/RMDC26_ML_Data_obs.parquet"

event_ids_str = ", ".join(map(str, good_events["event_id"].tolist()))
good_obs_count = con.execute(f"SELECT COUNT(*) FROM '{obs_p}' WHERE event_id IN ({event_ids_str})").fetchone()[0]
print(f"{good_obs_count:,} corresponding observations")
```

**Expected output:**
```text
58307 events matched filters
2,885,496,816 corresponding observations
```

### 4. Sum final_weight per simulation

To verify the population representation or check the total astrophysical weights of each simulation, you can sum the `final_weight` column grouped by simulation label:

```python
# Sum weights and count events per simulation
weights_summary = meta_df.groupby("sim_label").agg(
    total_weight=("final_weight", "sum"),
    event_count=("final_weight", "count")
).reset_index()

print(weights_summary.to_string(index=False))
```

**Expected output:**
```text
     sim_label  total_weight  event_count
RMDC26_1S1L_ML  59492.119963       294728
RMDC26_1S2L_ML   1490.050405        29656
RMDC26_2S2L_ML    789.135800        17356
```