File size: 39,099 Bytes
fb17822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c0a9877
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fb17822
c0a9877
 
 
 
 
 
 
 
 
fb17822
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
#!/usr/bin/env python3
"""
Statement cleaner, natural question rewriter, and astronomy-specific metadata enricher
for UnsolvedAstronomy v1.0.0.
"""
import hashlib
import re

TRAILING_BAD_WORDS = {
    "a", "an", "the", "of", "in", "on", "at", "to", "for", "with", "by", "from",
    "into", "during", "including", "until", "against", "among", "throughout",
    "despite", "towards", "upon", "concerning", "about", "over", "through",
    "under", "between", "within", "without", "across", "beyond", "near", "around",
    "after", "before", "since", "while", "where", "when", "that", "which", "who",
    "whom", "whose", "whether", "if", "and", "or", "nor", "but", "yet", "so",
    "as", "than", "via", "per", "vs", "versus", "using", "based", "toward",
}

CATEGORY_DOMAIN_METADATA = {
    1: {
        "object_classes": ["cosmic_background", "early_universe", "large_scale_structure"],
        "scales": ["cosmological_horizon", "gpc", "10_to_100_mpc"],
        "wavelengths": ["cmb_mm_submm", "optical", "near_ir", "radio_cm_m_lowfreq"],
        "epochs": [{"name": "inflation_and_recombination", "redshift_min": 1100.0, "redshift_max": None, "lookback_time_gyr_min": 13.78, "lookback_time_gyr_max": 13.8}],
        "facilities": ["Planck", "JWST", "DESI", "Simons Observatory", "CMB-S4", "SKA-Low", "Euclid"],
        "observables": ["CMB temperature and E/B-mode polarization power spectra C_l^TT, C_l^EE, C_l^BB", "Baryon acoustic oscillation distance ratios D_M(z)/r_d and D_H(z)/r_d", "Redshifted 21 cm brightness temperature fluctuations delta T_b(k, z)"],
        "inferred": ["Primordial scalar/tensor power spectrum parameters (A_s, n_s, r, f_NL)", "Comoving sound horizon r_d and Hubble expansion rate H(z)", "Neutral hydrogen fraction x_HI(z) and ionizing photon escape fraction f_esc"],
        "selection_effects": ["Cosmic variance at low multipoles l < 30", "Lyman-alpha line-of-sight damping-wing absorption bias at z > 7"],
        "systematics": ["Galactic polarized thermal dust and synchrotron foreground subtraction residuals", "Cepheid/TRGB photometric crowding and metallicity zero-point calibration"],
        "degeneracies": ["Sound horizon r_d vs late-time dark energy equation of state w(z)", "Optical depth tau_reio vs primordial scalar amplitude A_s"],
        "background": "Relativistic cosmological perturbation theory, Boltzmann hierarchy radiative transfer, CMB polarization and spectral distortions, and Bayesian cosmological parameter inference.",
    },
    2: {
        "object_classes": ["dark_sector", "galaxy", "large_scale_structure"],
        "scales": ["kpc", "mpc", "gpc"],
        "wavelengths": ["optical", "near_ir", "gravitational_wave", "x_ray"],
        "epochs": [{"name": "late_time_acceleration_and_halo_assembly", "redshift_min": 0.0, "redshift_max": 3.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 11.5}],
        "facilities": ["Vera C. Rubin Observatory LSST", "Euclid", "DESI", "Nancy Grace Roman Space Telescope", "HST", "JWST", "Chandra"],
        "observables": ["Weak lensing cosmic shear two-point correlation functions xi_+(theta), xi_-(theta)", "Strong gravitational lens image positions, time delays, and flux-ratio anomalies", "Dwarf galaxy stellar line-of-sight velocity dispersions and H I rotation curves"],
        "inferred": ["Subhalo mass function dN/dM_sub and dark matter self-interaction cross section sigma/m", "Dark energy equation-of-state parameters (w_0, w_a) and linear growth rate f*sigma_8(z)", "Gravitational slip parameter eta = Phi/Psi and primordial black hole mass fraction f_PBH"],
        "selection_effects": ["Surface-brightness selection bias against ultra-diffuse and low-luminosity halos", "Magnification bias and spectroscopic redshift completeness in lensing samples"],
        "systematics": ["Photometric redshift outlier tails and shear multiplicative calibration bias m", "Baryonic feedback and intrinsic galaxy alignment contamination in weak lensing"],
        "degeneracies": ["Baryonic supernova/AGN feedback core creation vs self-interacting or fuzzy dark matter", "Modified gravity scale-dependent growth vs massive neutrino free-streaming"],
        "background": "Dark matter halo dynamics, weak and strong gravitational lensing formalism, modified gravity screening theories, and dark energy equation-of-state phenomenology.",
    },
    3: {
        "object_classes": ["large_scale_structure", "intergalactic_medium", "circumgalactic_medium", "galaxy_cluster"],
        "scales": ["kpc", "mpc", "10_to_100_mpc"],
        "wavelengths": ["uv", "optical", "x_ray", "cmb_mm_submm", "radio_cm_m_lowfreq"],
        "epochs": [{"name": "cosmic_noon_to_present", "redshift_min": 0.0, "redshift_max": 5.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 12.6}],
        "facilities": ["DESI", "XRISM", "eROSITA", "ACT", "SPT-3G", "LOFAR", "SKA", "HST/COS", "Keck/HIRES"],
        "observables": ["Quasar absorption optical depth tau_Ly-alpha(z) and metal doublet equivalent widths (O VI, Mg II, C IV)", "X-ray intracluster bremsstrahlung surface brightness, Fe XXV/XXVI line widths, and thermal/kinetic SZ decrements", "Extragalactic Faraday rotation measure grids RM and fast radio burst dispersion measures DM(z)"],
        "inferred": ["IGM temperature-density relation T_0, gamma and multiphase CGM baryon/metal mass fractions", "Galaxy cluster hydrostatic mass bias (1 - b) and turbulent velocity dispersion", "Intergalactic magnetic field strength B_IGM and coherence scale lambda_B"],
        "selection_effects": ["X-ray surface-brightness selection favoring cool-core relaxed galaxy clusters", "Quasar sightline pencil-beam sampling variance across multiphase CGM filaments"],
        "systematics": ["Photoionization modeling uncertainties and UV background spectral slope assumptions", "ICM temperature inhomogeneities, clumping factor C, and non-equilibrium ionization"],
        "degeneracies": ["Non-thermal cosmic-ray/magnetic pressure support vs true cluster halo mass", "Outflow metallicity vs ambient CGM mixing fraction along absorption sightlines"],
        "background": "Cosmological hydrodynamics, radiative cooling and photoionization equilibrium, X-ray and Sunyaev-Zel'dovich cluster physics, and Lyman-alpha forest statistics.",
    },
    4: {
        "object_classes": ["galaxy", "agn_quasar", "compact_object"],
        "scales": ["pc", "kpc", "mpc"],
        "wavelengths": ["near_ir", "mid_ir", "optical", "mm_submm", "x_ray", "radio_cm_m_lowfreq"],
        "epochs": [{"name": "first_galaxies_through_cosmic_noon", "redshift_min": 0.0, "redshift_max": 14.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 13.5}],
        "facilities": ["JWST", "ALMA", "Chandra", "VLT/MUSE", "SDSS/BOSS", "Event Horizon Telescope", "Euclid", "VLA"],
        "observables": ["Rest-frame UV/optical nebular emission line ratios ([O III], H-beta, N III], C IV) and broad Balmer line widths", "Submillimeter CO/C+ molecular kinematics and far-IR dust continuum spectral energy distributions", "X-ray Fe K-alpha reflection spectra, ultrafast outflow absorption troughs, and VLBI jet proper motions"],
        "inferred": ["Supermassive black hole mass M_BH, Eddington ratio lambda_Edd, and seed formation channel", "Stellar mass M_*, star formation rate SFR, gas depletion timescale, and outflow mass-loading factor eta", "Dark matter fraction f_DM(r) and baryonic feedback coupling efficiency"],
        "selection_effects": ["Flux-limited Eddington bias favoring luminous quasars and UV-bright starbursts at z > 7", "Dust obscuration bias in rest-frame UV selections of massive galaxies"],
        "systematics": ["Broad-line region virial factor f_BLR geometric uncertainty and single-epoch M_BH calibration", "Stellar initial mass function and dust attenuation law assumptions in SED fitting"],
        "degeneracies": ["Dust-reddened AGN continuum vs compact starburst emission in high-z Little Red Dots", "Preventive halo heating vs ejective gas removal in galaxy quenching"],
        "background": "Galaxy formation and evolution, active galactic nucleus accretion and feedback physics, stellar population synthesis, and galactic dynamics.",
    },
    5: {
        "object_classes": ["milky_way_component", "stellar_population", "galaxy", "dark_sector"],
        "scales": ["pc", "kpc"],
        "wavelengths": ["optical", "near_ir", "radio_cm_m_lowfreq", "gamma_ray", "x_ray"],
        "epochs": [{"name": "milky_way_assembly_history", "redshift_min": 0.0, "redshift_max": 4.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 12.2}],
        "facilities": ["Gaia", "SDSS-V", "APOGEE", "GALAH", "WEAVE", "4MOST", "DESI-MWS", "Vera C. Rubin Observatory", "Fermi-LAT"],
        "observables": ["Six-dimensional stellar phase-space coordinates (parallax, proper motion, radial velocity) from Gaia", "High-resolution stellar photospheric elemental abundances ([Fe/H], [alpha/Fe], r- and s-process ratios)", "Cold stellar stream track density profiles, velocity dispersions, and off-stream spurs"],
        "inferred": ["Milky Way gravitational potential Phi(R, z), dark halo triaxiality, and total virial mass M_200", "Accretion history of disrupted progenitor dwarfs (Gaia-Sausage-Enceladus, Sagittarius, Kraken)", "Inner dark matter density slope d ln rho / d ln r in Local Group dwarf spheroidals"],
        "selection_effects": ["Three-dimensional interstellar dust extinction in the Galactic plane and inner bulge", "Binary star orbital motion inflating apparent velocity dispersions in ultra-faint dwarfs"],
        "systematics": ["Non-LTE and 3D convective photospheric abundance corrections across giant and dwarf stars", "Gaia parallax zero-point spatial variations and crowding in globular cluster cores"],
        "degeneracies": ["Orbital velocity anisotropy beta(r) vs inner dark matter cusp/core density profile", "Secular radial migration vs merger-induced heating in the Galactic disk"],
        "background": "Galactic dynamics, action-angle phase-space modeling, stellar nucleosynthesis and chemical evolution, and Local Group near-field cosmology.",
    },
    6: {
        "object_classes": ["interstellar_medium", "dust_and_ice", "star"],
        "scales": ["au", "pc", "kpc"],
        "wavelengths": ["mm_submm", "far_ir", "mid_ir", "radio_cm_m_lowfreq", "uv"],
        "epochs": [{"name": "present_day_and_galactic_ism", "redshift_min": 0.0, "redshift_max": 2.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 10.4}],
        "facilities": ["ALMA", "JWST", "NOEMA", "VLA", "ngVLA", "GBT", "Herschel", "SOFIA"],
        "observables": ["Millimeter rotational molecular line spectra (CO, N2H+, HCN, HCO+, CH3OH, COMs) and Zeeman splitting", "Submillimeter polarized thermal dust continuum emission and mid-IR ice absorption bands", "Optical/NIR diffuse interstellar absorption band profiles and PAH mid-IR emission features"],
        "inferred": ["Magnetic field strength B, mass-to-flux ratio mu_Phi, and sonic Mach number M_s in molecular cores", "Star formation efficiency per free-fall time epsilon_ff and core/stellar initial mass function", "Gas-phase and grain-surface reaction rates, deuteration fractions, and dust grain size distributions"],
        "selection_effects": ["Interferometric spatial filtering of extended diffuse emission in molecular clouds", "Excitation temperature and critical density biases across molecular line tracers"],
        "systematics": ["CO-to-H2 conversion factor X_CO and dust opacity spectral index beta variations", "Molecular freeze-out onto cold dust grains in high-density prestellar cores"],
        "degeneracies": ["Dust temperature gradients vs column density structure along the line of sight", "Grain-surface radical recombination vs gas-phase ion-molecule synthesis of COMs"],
        "background": "Magnetohydrodynamic interstellar turbulence, radiative transfer in molecular lines and dust continuum, star formation physics, and astrochemical reaction networks.",
    },
    7: {
        "object_classes": ["star", "stellar_population", "transient"],
        "scales": ["1000km_to_rsun", "au", "pc"],
        "wavelengths": ["optical", "uv", "near_ir", "mid_ir", "x_ray"],
        "epochs": [{"name": "stellar_evolution_across_metallicity", "redshift_min": 0.0, "redshift_max": 3.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 11.5}],
        "facilities": ["Kepler", "TESS", "PLATO", "Gaia", "HST", "JWST", "VLT/GRAVITY", "ZTF", "Rubin LSST"],
        "observables": ["Asteroseismic p-mode and mixed g-mode frequency splittings Delta nu and Delta Pi_1", "Detached eclipsing binary dynamical masses, radii, and apsidal motion rates", "Ultraviolet P Cygni wind line profiles, pre-supernova archival progenitor photometry, and multi-epoch neutrino/light curves"],
        "inferred": ["Internal rotation profile Omega(r), convective core overshooting alpha_ov, and angular momentum diffusivity", "Mass-loss rate dM/dt, wind clumping factor f_cl, and common-envelope ejection efficiency alpha_CE", "Core compactness parameter xi_2.5 and core-collapse explodability threshold"],
        "selection_effects": ["Malmquist and binary mass-ratio selection biases in spectroscopic binary surveys", "Circumstellar dust obscuration of evolved red supergiants and AGB stars"],
        "systematics": ["Radiative opacity tables (Fe/Ni bump) and 12C(alpha, gamma)16O nuclear reaction rate uncertainties", "1D mixing-length theory approximations for 3D turbulent convection and wind clumping"],
        "degeneracies": ["Stellar age vs helium abundance Y and convective core overshooting in main-sequence turnoffs", "Single-star wind stripping vs binary Roche-lobe overflow in Wolf-Rayet and stripped-envelope progenitors"],
        "background": "Stellar structure and evolution, asteroseismology, radiation-driven stellar winds, binary interaction and common-envelope hydrodynamics, and core-collapse supernova physics.",
    },
    8: {
        "object_classes": ["compact_object", "star", "nonthermal_particle"],
        "scales": ["km_to_1000km", "1000km_to_rsun", "au"],
        "wavelengths": ["x_ray", "radio_cm_m_lowfreq", "gamma_ray", "gravitational_wave", "optical"],
        "epochs": [{"name": "compact_object_populations", "redshift_min": 0.0, "redshift_max": 1.5, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 9.3}],
        "facilities": ["NICER", "IXPE", "XRISM", "Chandra", "XMM-Newton", "NuSTAR", "Fermi-LAT", "FAST", "MeerKAT", "LIGO-Virgo-KAGRA"],
        "observables": ["Energy-resolved X-ray pulse profiles, relativistic Fe K-alpha reflection spectra, and X-ray linear polarization degree/angle", "High-precision radio pulsar times of arrival (TOAs), dispersion/rotation measures, and glitch spin-up steps", "Binary neutron star gravitational-wave tidal deformability Lambda_tilde and white dwarf optical/UV spectra"],
        "inferred": ["Cold supranuclear dense matter pressure-density relation P(epsilon), neutron star radius R_1.4, and maximum mass M_TOV", "Black hole dimensionless spin a_*, coronal geometry, and accretion disk viscosity/wind mass loss", "Magnetar crustal/magnetospheric magnetic field topology and coherent radio emission mechanism"],
        "selection_effects": ["Radio pulsar beaming fraction and dispersion/scattering selection against Galactic Center pulsars", "X-ray transient duty-cycle and inclination selection biases in black hole binaries"],
        "systematics": ["Neutron star hydrogen/helium/carbon atmosphere beaming models and distance uncertainties", "Accretion disk inner-edge truncation radius vs relativistic reflection continuum modeling"],
        "degeneracies": ["Quark-matter phase transition vs hyperon softening in neutron star mass-radius curves", "Black hole spin a_* vs disk inclination i and coronal height in X-ray reflection fits"],
        "background": "General relativistic compact objects, supranuclear dense matter equations of state, pulsar magnetospheric electrodynamics, and black hole accretion disk/jet magnetohydrodynamics.",
    },
    9: {
        "object_classes": ["transient", "compact_object", "galaxy"],
        "scales": ["km_to_1000km", "au", "pc", "gpc"],
        "wavelengths": ["gravitational_wave", "radio_cm_m_lowfreq", "optical", "x_ray", "gamma_ray", "near_ir"],
        "epochs": [{"name": "time_domain_and_multimessenger_universe", "redshift_min": 0.0, "redshift_max": 6.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 12.8}],
        "facilities": ["LIGO-Virgo-KAGRA", "CHIME/FRB", "DSA-110", "ASKAP", "NANOGrav/EPTA/PPTA/IPTA", "Vera C. Rubin Observatory", "Swift", "Fermi-GBM", "JWST"],
        "observables": ["Gravitational-wave strain waveforms h(t), chirp masses M_c, effective spins chi_eff, and PTA Hellings-Downs spatial correlations", "Millisecond radio burst dynamic spectra I(nu, t), polarization angle swings, dispersion measures DM, and scintillation timescales", "Multi-band transient light curves, nebular/photospheric spectra, and late-time radio/X-ray afterglows"],
        "inferred": ["Compact binary formation channels (isolated binary evolution vs dynamical cluster/AGN assembly)", "Fast radio burst emission radius (magnetosphere vs relativistic shock) and progenitor repetition rate", "R-process lanthanide mass fraction M_ej, v_ej in kilonovae and debris circularization efficiency in TDEs"],
        "selection_effects": ["Gravitational-wave detector horizon volume scaling (~M_c^15/6) favoring high-mass mergers", "Fluence threshold and dispersion smearing against high-DM or broad-pulse fast radio bursts"],
        "systematics": ["Numerical relativity waveform higher-multipole and eccentric-orbit modeling systematics", "Host-galaxy vs Milky Way halo dispersion measure partitioning along FRB sightlines"],
        "degeneracies": ["Eccentric dynamical capture vs spin-precessing quasi-circular inspiral in short GW signals", "Magnetar central engine spin-down vs circumstellar shock interaction in superluminous supernovae"],
        "background": "Time-domain astrophysics, gravitational-wave data analysis and source astrophysics, coherent radiative processes in magnetars/FRBs, and relativistic blast-wave hydrodynamics.",
    },
    10: {
        "object_classes": ["nonthermal_particle", "compact_object", "agn_quasar", "galaxy"],
        "scales": ["au", "pc", "kpc", "mpc"],
        "wavelengths": ["cosmic_ray", "neutrino", "gamma_ray", "x_ray", "radio_cm_m_lowfreq"],
        "epochs": [{"name": "nonthermal_and_high_energy_universe", "redshift_min": 0.0, "redshift_max": 4.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 12.2}],
        "facilities": ["Pierre Auger Observatory", "Telescope Array", "IceCube", "KM3NeT", "LHAASO", "CTA", "HAWC", "Fermi-LAT", "AMS-02"],
        "observables": ["Ultra-high-energy cosmic-ray energy spectrum J(E), depth of shower maximum <X_max>, and arrival direction multipoles", "High-energy astrophysical neutrino flavor ratios, energy spectrum E^-gamma, and directional point-source excesses", "GeV-PeV gamma-ray spectra, extended pulsar halo morphologies, and secondary-to-primary cosmic-ray rigidity ratios (B/C, e+/e-)"],
        "inferred": ["Maximum particle acceleration rigidity R_max and hadronic vs leptonic emission fractions", "Galactic and extragalactic magnetic field deflection angles and cosmic-ray diffusion coefficient D(E)", "Coronal optical depth tau_gamma_gamma and proton-to-electron power ratio in AGN neutrino cores"],
        "selection_effects": ["Greisen-Zatsepin-Kuzmin (GZK) and photo-disintegration horizon limiting UHECR sources above 50 EeV to < 100 Mpc", "Earth absorption at PeV-EeV neutrino energies and atmospheric muon/neutrino background cuts"],
        "systematics": ["Hadronic interaction model uncertainties (EPOS-LHC, Sibyll, QGSJet) in air-shower X_max mass inference", "Galactic interstellar gas column density and diffuse gamma-ray foreground modeling"],
        "degeneracies": ["Intrinsic source spectral cutoff vs propagation photo-disintegration in the UHECR ankle/suppression region", "Inverse-Compton leptonic emission vs neutral-pion decay hadronic gamma-ray emission"],
        "background": "High-energy particle astrophysics, diffusive shock acceleration and relativistic magnetic reconnection, cosmic-ray propagation and magnetohydrodynamic turbulence, and multimessenger neutrino/gamma-ray radiative transfer.",
    },
    11: {
        "object_classes": ["exoplanet", "protoplanetary_disk", "star"],
        "scales": ["km_to_1000km", "1000km_to_rsun", "au"],
        "wavelengths": ["near_ir", "mid_ir", "optical", "mm_submm", "uv"],
        "epochs": [{"name": "protoplanetary_disks_to_mature_systems", "redshift_min": 0.0, "redshift_max": 0.01, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 0.1}],
        "facilities": ["JWST", "ALMA", "TESS", "Kepler", "PLATO", "Ariel", "ELT", "VLT/ESPRESSO", "Nancy Grace Roman Space Telescope"],
        "observables": ["Transit depth spectrum (R_p/R_*)^2(lambda), secondary eclipse thermal emission, and orbital phase curves", "Extreme-precision radial velocity semi-amplitudes K, transit timing variations (TTVs), and Gaia astrometric orbits", "ALMA millimeter dust continuum rings/gaps, polarized scattering, and CO channel-map velocity kinks"],
        "inferred": ["Planetary bulk density rho_p, core-to-envelope mass fraction, and interior equation of state", "Atmospheric elemental abundance ratios (C/O, N/O, metallicity [M/H]), vertical temperature profile T(P), and aerosol deck pressure", "Protoplanetary disk turbulence parameter alpha, dust-to-gas ratio, and embedded protoplanet masses"],
        "selection_effects": ["Geometric transit probability (~R_*/a) and RV semi-amplitude bias strongly favoring close-in planets", "Stellar activity jitter and rotational modulation masking low-mass temperate planet RV signals"],
        "systematics": ["Transit light-source effect (unocculted starspots/faculae) contaminating transmission spectra around M dwarfs", "3D day-night terminator limb asymmetries and molecular line-list opacity uncertainties"],
        "degeneracies": ["High-altitude photochemical haze/cloud deck vs high mean-molecular-weight atmosphere in flat transmission spectra", "Volatile-rich H2O ocean/ice layer vs silicate core + H2/He envelope in sub-Neptune mass-radius diagrams"],
        "background": "Exoplanet detection and characterization, planetary atmospheric radiative-convective transfer and chemistry, interior structure equations of state, and protoplanetary disk gas-dust hydrodynamics.",
    },
    12: {
        "object_classes": ["solar_system_body", "dust_and_ice"],
        "scales": ["sub_km", "km_to_1000km", "au"],
        "wavelengths": ["optical", "near_ir", "mid_ir", "mm_submm", "radio_cm_m_lowfreq", "uv"],
        "epochs": [{"name": "solar_nebula_to_present_solar_system", "redshift_min": 0.0, "redshift_max": 0.0, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 4.567}],
        "facilities": ["Juno", "Europa Clipper", "JUICE", "Dragonfly", "OSIRIS-REx", "Hayabusa2", "Perseverance", "JWST", "Vera C. Rubin Observatory"],
        "observables": ["Spacecraft Doppler gravity harmonics J_2n, tidal Love numbers k_2/h_2, and magnetic induction dipole moments", "Laboratory mass-spectrometric isotopic anomalies (epsilon^54Cr, epsilon^50Ti, Delta^17O, D/H, 15N/14N) in meteorites and returned samples", "Deep wide-field astrometric orbits of trans-Neptunian objects, comets, and interstellar objects"],
        "inferred": ["Giant planet core mass distribution, heavy-element radial gradient, and H-He phase separation depth", "Ice-shell thickness, subsurface ocean salinity, and seafloor hydrothermal heat flux in icy moons", "Early Solar System nebular reservoir separation timescale and giant planet migration history"],
        "selection_effects": ["Ecliptic latitude, perihelion distance, and seasonal longitude-of-perihelion biases in TNO discovery surveys", "Atmospheric entry survival bias against fragile, high-porosity carbonaceous meteoroids"],
        "systematics": ["High-pressure hydrogen-helium-water equation of state and electrical conductivity uncertainties at Mbar pressures", "Radiogenic heating vs rheology-dependent tidal dissipation Q in ice shells and rocky cores"],
        "degeneracies": ["Internal radial density profile vs deep zonal wind flow depth in giant planet gravity harmonics", "Distant planetary perturber vs survey pointing bias or self-gravitating disk instability in extreme TNO orbits"],
        "background": "Planetary geophysics and interior structure, cosmochemistry and meteoritics, orbital dynamics and celestial mechanics, and icy moon oceanography.",
    },
    13: {
        "object_classes": ["exoplanet", "solar_system_body", "interstellar_medium", "star"],
        "scales": ["km_to_1000km", "au", "pc"],
        "wavelengths": ["near_ir", "mid_ir", "uv", "optical", "radio_cm_m_lowfreq"],
        "epochs": [{"name": "prebiotic_to_planetary_biospheres", "redshift_min": 0.0, "redshift_max": 0.05, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 4.5}],
        "facilities": ["JWST", "Habitable Worlds Observatory", "ELT", "LIFE", "Europa Clipper", "Dragonfly", "Breakthrough Listen", "SKA", "MeerKAT"],
        "observables": ["Transmission, thermal emission, and reflected-light spectra spanning UV/optical/IR absorption bands (O2, O3, CH4, CO2, N2O, H2O, CO)", "In-situ or plume mass spectrometry of organic molecular weight distributions, enantiomeric excesses, and stable isotope ratios (delta^13C, delta^15N)", "Wideband high-spectral-resolution radio dynamic spectra (Delta nu ~ 1 Hz) and nanosecond optical pulse searches"],
        "inferred": ["Atmospheric redox disequilibrium Gibbs free energy and surface liquid water stability", "Abiotic photochemical/geochemical vs biological production fluxes of candidate biosignature gases", "Upper bounds on the transmitter duty cycle and prevalence of technological civilizations (EIRP limits)"],
        "selection_effects": ["Target selection bias toward short-period M-dwarf terrestrial planets in transit spectroscopy", "Radio frequency interference (RFI) masking and narrowband Doppler drift-rate search windows"],
        "systematics": ["Stellar XUV spectral energy distribution reconstruction and photochemical reaction rate uncertainties", "Instrument organic background contamination and pyrolysis thermal alteration in in-situ life-detection experiments"],
        "degeneracies": ["Abiotic H2O/CO2 photolysis + H escape or volcanic outgassing vs biological oxygenic photosynthesis / methanogenesis", "Circumstellar debris dust or natural maser emission vs engineered infrared/radio technosignatures"],
        "background": "Astrobiology, planetary climate and atmospheric photochemistry, prebiotic organic chemistry and volatile delivery, biosignature false-positive assessment, and technosignature search methodology.",
    },
    14: {
        "object_classes": ["star", "heliosphere", "solar_system_body"],
        "scales": ["sub_km", "km_to_1000km", "1000km_to_rsun", "au"],
        "wavelengths": ["uv", "x_ray", "optical", "radio_cm_m_lowfreq", "cosmic_ray"],
        "epochs": [{"name": "modern_solar_and_stellar_cycles", "redshift_min": 0.0, "redshift_max": 0.001, "lookback_time_gyr_min": 0.0, "lookback_time_gyr_max": 0.01}],
        "facilities": ["Parker Solar Probe", "Solar Orbiter", "DKIST", "SDO", "IRIS", "Hinode", "STEREO", "IMAP", "TESS"],
        "observables": ["Full-disk and high-resolution spectropolarimetric vector magnetograms B(x, y, t) and helioseismic p-mode travel times", "Extreme-UV and X-ray coronal loop differential emission measures, Doppler velocities, and non-thermal line widths", "In-situ solar wind proton/alpha/electron velocity distribution functions, charge-state ratios, and magnetic field switchbacks"],
        "inferred": ["Coronal heating volumetric dissipation rate Q_heat and reconnection vs wave-turbulence energy flux", "Interior meridional circulation velocity u_theta(r, theta), tachocline shear, and alpha-Omega dynamo quenching", "CME initiation instability threshold and particle acceleration efficiency in reconnecting current sheets"],
        "selection_effects": ["Projection foreshortening and Zeeman saturation near the solar limb and polar regions", "Single-spacecraft trajectory sampling along radial heliospheric cuts"],
        "systematics": ["180-degree azimuth disambiguation and optically thin line-of-sight integration in coronal magnetometry", "Non-equilibrium ionization and kappa-distribution departures from local thermodynamic equilibrium in the corona"],
        "degeneracies": ["High-frequency Alfvén wave turbulent dissipation vs unresolved impulsive nanoflare magnetic reconnection", "Deep interior radiative opacity enhancements vs photospheric 3D non-LTE abundance revisions in the solar abundance problem"],
        "background": "Solar and stellar magnetohydrodynamics, helioseismology and dynamo theory, magnetic reconnection and kinetic plasma turbulence, and heliospheric space physics.",
    },
}


import html

LATEX_TITLE_SUBS = [
    (r"\\['\"]\{?o\}?", "ö"),
    (r"\\['\"]\{?a\}?", "ä"),
    (r"\\['\"]\{?u\}?", "ü"),
    (r"\\'\{?e\}?", "é"),
    (r"\\`\{?e\}?", "è"),
    (r"\\\^\{?i\}?", "î"),
    (r"\\~\{?n\}?", "ñ"),
    (r"\{\\AA\}|\\AA\b", "Å"),
    (r"\\Lambda\s*CDM", "ΛCDM"),
    (r"\\Lambda\b", "Λ"),
    (r"\\Omega\b", "Ω"),
    (r"\\Delta\b", "Δ"),
    (r"\\alpha\b", "α"),
    (r"\\beta\b", "β"),
    (r"\\gamma\b", "γ"),
    (r"\\delta\b", "δ"),
    (r"\\epsilon\b", "ε"),
    (r"\\sigma\b", "σ"),
    (r"\\mu\b", "μ"),
    (r"\\nu\b", "ν"),
    (r"\\tau\b", "τ"),
    (r"\\pi\b", "π"),
    (r"\\rho\b", "ρ"),
    (r"\\odot\b", "sun"),
    (r"\\oplus\b", "Earth"),
    (r"\\sim\b|\\approx\b", "~"),
    (r"\\pm\b", "±"),
    (r"\\times\b", "×"),
    (r"\\leq\b|\\lesssim\b", "<="),
    (r"\\geq\b|\\gtrsim\b", ">="),
    (r"\\(?:rm|mathrm|mathcal|mathbf|mathit|textbf|textit|text|hbox|mbox|bf|it|sc)\b", " "),
]


def clean_paper_title(raw_title: str) -> str:
    t = html.unescape(raw_title or "")
    t = re.sub(r"<[^>]+>", " ", t)
    for pat, rep in LATEX_TITLE_SUBS:
        t = re.sub(pat, rep, t)
    t = re.sub(r"\$([^$]+)\$", r"\1", t)
    t = re.sub(r"\\[a-zA-Z]+\{([^}]*)\}", r"\1", t)
    t = re.sub(r"\\[a-zA-Z]+", " ", t)
    t = re.sub(r"[{}$\\]", "", t)
    t = re.sub(r"\s+", " ", t.strip()).rstrip(".,;:")
    t = re.sub(r"^(?:Abstract|Summary|Addendum|Erratum|Corrigendum|Publisher Correction|Author Correction|Reply|Comment|Response)\s*(?:to|on)?\s*[:\-–—]?\s*", "", t, flags=re.I)
    t = re.sub(r"^['\"“”‘’]+|['\"“”‘’]+$", "", t).strip()
    words = t.split()
    while len(words) > 4 and words[-1].lower().strip(".,;:()[]") in TRAILING_BAD_WORDS:
        words.pop()
    t = " ".join(words).rstrip(".,;:-–—")
    if len(t) > 135:
        cut = t[:132].rsplit(" ", 1)[0]
        w2 = cut.split()
        while len(w2) > 4 and w2[-1].lower().strip(".,;:()[]") in TRAILING_BAD_WORDS:
            w2.pop()
        t = " ".join(w2).rstrip(".,;:-–—")
    return t or "Astronomical System Evolution and Observables"


def strip_latex_to_plain(text: str) -> str:
    s = text or ""
    replacements = [
        (r"\\Lambda\s*CDM", "LambdaCDM"),
        (r"\\odot", "sun"),
        (r"\\oplus", "Earth"),
        (r"\\sim", "~"),
        (r"\\approx", "~"),
        (r"\\propto", " proportional to "),
        (r"\\rightarrow", "->"),
        (r"\\leftarrow", "<-"),
        (r"\\lesssim", "<="),
        (r"\\gtrsim", ">="),
        (r"\\leq", "<="),
        (r"\\geq", ">="),
        (r"\\ll", "<<"),
        (r"\\gg", ">>"),
        (r"\\times", "x"),
        (r"\\pm", "+/-"),
        (r"\\alpha", "alpha"),
        (r"\\beta", "beta"),
        (r"\\gamma", "gamma"),
        (r"\\delta", "delta"),
        (r"\\Delta", "Delta"),
        (r"\\epsilon", "epsilon"),
        (r"\\zeta", "zeta"),
        (r"\\eta", "eta"),
        (r"\\theta", "theta"),
        (r"\\kappa", "kappa"),
        (r"\\sigma", "sigma"),
        (r"\\Omega", "Omega"),
        (r"\\omega", "omega"),
        (r"\\mu", "mu"),
        (r"\\nu", "nu"),
        (r"\\tau", "tau"),
        (r"\\pi", "pi"),
        (r"\\rho", "rho"),
        (r"\\phi", "phi"),
        (r"\\chi", "chi"),
        (r"\\psi", "psi"),
        (r"\\ell", "l"),
        (r"\\lambda", "lambda"),
        (r"\\(?:rm|mathrm|mathcal|mathbf|mathit|textbf|textit|text|hbox|mbox)\b", " "),
    ]
    for pat, rep in replacements:
        s = re.sub(pat, rep, s)
    s = re.sub(r"\$([^$]+)\$", r"\1", s)
    s = re.sub(r"\\[a-zA-Z]+\{([^}]*)\}", r"\1", s)
    s = re.sub(r"\\[a-zA-Z]+", " ", s)
    s = re.sub(r"[{}$\\]", "", s)
    s = re.sub(r"\s+", " ", s).strip()
    return s


def rewrite_natural_question(raw_q: str, clean_title: str, cat_id: int) -> str:
    q = re.sub(r"\s+", " ", (raw_q or "").strip())
    q = re.sub(r"^(?:abstract|summary)\b[:\s\-–—]*", "", q, flags=re.I)
    q = re.sub(r"\?[.?]+", "?", q)
    # Remove any old robotic wrapper if present from cross-linked records
    q = re.sub(r"^What physical mechanism and discriminating observable resolve the open question in [^:]+:\s*", "", q, flags=re.I)
    q = re.sub(r"^How do fundamental physical processes govern [^,]+, given that\s*", "", q, flags=re.I)
    q = re.sub(r"^In the context of [^,]+,\s*", "", q, flags=re.I)
    q = re.sub(r"^(?:abstract|summary)\b[:\s\-–—]*", "", q, flags=re.I)
    q = q.strip().rstrip(".?")

    low = q.lower()
    title_low = clean_title[0].lower() + clean_title[1:] if len(clean_title) > 1 and not clean_title[:2].isupper() else clean_title

    # If already a direct, self-contained question (>= 55 chars) starting with an interrogative
    if any(low.startswith(w) for w in ("how ", "why ", "what ", "which ", "when ", "where ", "can ", "does ", "do ", "is ", "are ", "to what ", "under what ", "by what ")):
        if len(q) < 65 and clean_title.lower()[:20] not in low:
            return f"Regarding {title_low}, {q[0].lower() + q[1:]}?"
        return q[0].upper() + q[1:] + "?"

    # Pattern-based grammatical inversion into natural astronomy research questions
    m = re.match(r"^(?:the\s+)?(origin|nature|mechanism|cause|driver|role|source|fate|evolution|structure|formation|composition)\s+of\s+(.+?)\s+(?:is|are|remains?)\s+(?:still\s+)?(?:poorly understood|unclear|unknown|unresolved|elusive|debated|controversial|open|not well understood|not fully understood|a mystery|a puzzle).*$", q, re.I)
    if m:
        noun, subj = m.group(1).lower(), m.group(2).strip()
        if clean_title.lower()[:18] not in subj.lower() and len(subj) < 45:
            return f"What is the physical {noun} of {subj} in {title_low}, and what multi-wavelength or dynamical observables can resolve it?"
        return f"What is the physical {noun} of {subj}, and what observational diagnostics can discriminate among competing astrophysical models?"

    m2 = re.match(r"^whether\s+(.+?)\s+(?:is|are|remains?)\s+(?:still\s+)?(?:unclear|unknown|debated|controversial|unresolved|open|poorly understood).*$", q, re.I)
    if m2:
        clause = m2.group(1).strip()
        return f"To what extent does observational evidence establish whether {clause} in {title_low}?"

    m3 = re.match(r"^(.+?)\s+(?:is|are|remains?)\s+(?:still\s+)?(?:poorly understood|unclear|unknown|unresolved|elusive|debated|controversial|not well understood|not fully understood|an open question|an open problem|a long-standing puzzle|a mystery).*$", q, re.I)
    if m3:
        subj = m3.group(1).strip()
        subj = re.sub(r"^(?:however|moreover|furthermore|nevertheless|yet|still|while|although),?\s*", "", subj, flags=re.I)
        if len(subj) > 18:
            h = int(hashlib.md5(subj.encode("utf-8")).hexdigest()[:4], 16) % 5
            subj_low = subj[0].lower() + subj[1:] if len(subj) > 1 and not subj[:2].isupper() else subj
            if clean_title.lower()[:18] not in subj_low.lower() and len(subj_low) < 55:
                subj_low = f"{subj_low} in {title_low}"
            if h == 0:
                return f"What physical mechanisms govern {subj_low}, and how can upcoming astronomical observations resolve this open question?"
            elif h == 1:
                return f"How do astrophysical processes determine {subj_low}, and what observables break the underlying model degeneracies?"
            elif h == 2:
                return f"Why does {subj_low} remain unresolved across current observations, and what measurements are needed to constrain it?"
            elif h == 3:
                return f"What observational and theoretical constraints are required to characterize {subj_low}?"
            else:
                return f"Can multi-wavelength or multimessenger observations determine the physical drivers of {subj_low}?"

    # General fallback with varied templates
    q_low = q[0].lower() + q[1:] if len(q) > 1 and not q[:2].isupper() else q
    h = int(hashlib.md5((clean_title + q).encode("utf-8")).hexdigest()[:4], 16) % 5
    if h == 0:
        return f"Regarding {title_low}, what physical mechanisms and observational diagnostics can resolve the open problem that {q_low}?"
    elif h == 1:
        return f"How can astronomical observations and physical modeling of {title_low} resolve the question of why {q_low}?"
    elif h == 2:
        return f"What astrophysical processes govern {title_low} given that {q_low}?"
    elif h == 3:
        return f"In the study of {title_low}, what discriminating observables can determine how {q_low}?"
    else:
        return f"To what extent can current and next-generation astronomical surveys resolve the open question in {title_low} where {q_low}?"


def infer_question_type(stmt: str, subcat: str) -> str:
    low = stmt.lower()
    if any(w in low for w in ("tension", "discrepancy", "conflict", "reconcil", "mismatch", "paradox")):
        return "tension_resolution"
    if any(w in low for w in ("origin of", "seeded", "formed", "where do", "which source", "progenitor", "birth")):
        return "origin"
    if any(w in low for w in ("upper bound", "mass sum", "value of", "fraction of", "cross section", "rate of", "amplitude")):
        return "value_or_bound"
    if any(w in low for w in ("versus", " vs ", "distinguish between", "discriminate between", "or by", "or from")):
        return "model_discrimination"
    if any(w in low for w in ("evolve", "evolution", "across redshift", "demographics", "mass function", "population")):
        return "population_evolution"
    if any(w in low for w in ("what is the nature", "are the", "identity of", "what class of object")):
        return "object_nature"
    if any(w in low for w in ("detect", "characteriz", "observational signature", "measure")):
        return "detection_or_characterization"
    if any(w in low for w in ("systematic", "calibration", "degeneracy", "bias", "inference")):
        return "inference_or_systematics"
    return "mechanism"