Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
2e31121
Fixing bug in S5 caused by w sometimes being set to None
taylorbell57 Oct 22, 2024
427aefd
Fixing channel number bug for Figs 5307 and 3508
taylorbell57 Oct 24, 2024
f9670a7
Adding some hard-coded priors to fleck parameters to avoid crashes
taylorbell57 Oct 24, 2024
d5061d8
Fixing documentation of HST exponential + polynomial ramp model param…
taylorbell57 Oct 28, 2024
2a36f8e
Setting s3 meta prof_deg to None if not relevant, so code won't crash…
taylorbell57 Oct 29, 2024
64cb759
Setting s4 meta box_width to None if not relevant, so code won't cras…
taylorbell57 Oct 29, 2024
5b24ae9
Improving WFC3 direct image centroiding and reducing duplicated code
taylorbell57 Oct 30, 2024
cdef61f
Ensuring meta.expand is an integer
taylorbell57 Oct 30, 2024
2eef3bd
Adding meta.expand support for WFC3
taylorbell57 Oct 30, 2024
23d827c
Adding jax optional installs
taylorbell57 Oct 30, 2024
5ef3a4d
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 Oct 30, 2024
b5cb239
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 Dec 9, 2024
6054adb
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 Jan 9, 2025
72f12e8
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 May 12, 2025
fb9ef83
Undoing accidental changes
taylorbell57 May 12, 2025
c502335
Merge remote-tracking branch 'origin/s1_background_patches' into jaxo…
taylorbell57 May 12, 2025
9a1f06f
Increasing lower limit on jaxoplanet version
taylorbell57 May 12, 2025
5bb9f4d
Adding first working version of JaxoplanetTransitModel
taylorbell57 May 13, 2025
769cbf1
Adding most of the rest of the jax models
taylorbell57 May 15, 2025
892d427
flake8
taylorbell57 May 15, 2025
7659352
Fixing new S5 non-jax bug found through pytest
taylorbell57 May 15, 2025
2481db4
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 May 15, 2025
7c4241a
Fixing automated testing with new jax optional install
taylorbell57 May 16, 2025
fba2930
Tidying organization of s5_fit model loading
taylorbell57 May 16, 2025
e2ecd07
Adding harmonica.jax support
taylorbell57 May 16, 2025
1236113
Fixing S5 model switching to use fitters instead of transit model
taylorbell57 May 16, 2025
78b56f6
Updating fleck version to that on GitHub
taylorbell57 May 16, 2025
15e767d
Adding the remainder of the jax-compatible models to jax_models
taylorbell57 May 16, 2025
c3b655e
Removing the now fully deprecated PyMC3 code
taylorbell57 May 16, 2025
c1963ef
Adding harmonica_tr starting plot
taylorbell57 May 16, 2025
b545df0
Tidying up jax configuration stuff into the top-level __init__.py file
taylorbell57 May 16, 2025
fa01f3f
Adding numpyro.NUTS sampler support
taylorbell57 May 16, 2025
4f23495
flake8
taylorbell57 May 16, 2025
17ba024
Fixing miri tests to prep for jaxoplanet.starry support
taylorbell57 May 16, 2025
c8cf2b6
Fixing NIRCam tests
taylorbell57 May 17, 2025
7eef3bd
Throwing error from lsqfitter if starting lnprob isn't finite
taylorbell57 May 17, 2025
71d2859
Adding spotstarobl for starry spot obliquity
taylorbell57 May 19, 2025
3498b86
Making sure Rs is fitted for jaxoplanet, and making sure rp>0
taylorbell57 May 19, 2025
2a596bf
Adding JaxoplanetStarryModel for jax eclipses, transits, phase curves…
taylorbell57 May 19, 2025
a1c9abd
Fixing warning in fleck.jax import
taylorbell57 May 19, 2025
2417000
Avoiding unnecessary pmap/crds logs and warnings in base MetaClass fo…
taylorbell57 May 19, 2025
65f8646
Fixing handling of meta.stage
taylorbell57 May 24, 2025
6251c5b
Fixing jax's HarmonicaModel.py
taylorbell57 May 24, 2025
df58518
Simplifying celerite2's kernel
taylorbell57 May 24, 2025
86a5139
Enhancing jax_fitters and AstroModel: Added lnprob logging, improved …
taylorbell57 May 24, 2025
a0fee1b
Adding default time_offset for EPF
taylorbell57 May 30, 2025
8a2fcbf
Adding default interp value to S5MetaClass
taylorbell57 May 30, 2025
f0a86ae
Multi-threading the optimize_wrapper for faster S3 runs
taylorbell57 Jun 2, 2025
65a2211
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 Jun 2, 2025
c6fcde7
Fixing typo in new optspex.optimize outputs
taylorbell57 Jun 2, 2025
b3b2bc3
Fixing default for time_offset in S5's EPF
taylorbell57 Jun 5, 2025
96b789a
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 Aug 27, 2025
08e282f
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 Nov 18, 2025
ea15935
flake8
taylorbell57 Nov 18, 2025
e4554a6
Fixing plot_trace for new eureka.lib.plots setup
taylorbell57 Nov 19, 2025
f37e7a3
Fixing several bugs with non-jax tinygp
taylorbell57 Nov 19, 2025
25975b7
Current working-ish version of numpy GP version with tinygp
taylorbell57 Nov 20, 2025
661855d
Fixing use of masked arrays for non-jax use of tinygp
taylorbell57 Nov 20, 2025
1b88d85
Updating setup.cfg
taylorbell57 Nov 20, 2025
63cd023
Updating Jax-based GPModel.py file
taylorbell57 Nov 20, 2025
4198c22
Switching JaxModel.py to use tinygp instead of celerite2
taylorbell57 Nov 20, 2025
b6c59d4
Further updating installation requirements
taylorbell57 Nov 20, 2025
cd6762f
Making many more jax models functional programming and not object-ori…
taylorbell57 Nov 21, 2025
5959b38
Adding functional JaxoplanetStarryModel code
taylorbell57 Nov 21, 2025
04834b1
Fixing missing arviz requirement in tests
taylorbell57 Nov 26, 2025
a0b08a8
Making all jax-relevant packages default installation requirements
taylorbell57 Nov 26, 2025
05335b7
Updating some docstrings
taylorbell57 Nov 29, 2025
fc9dc8c
Slightly tweaking S5 jax-fitter prints/plots
taylorbell57 Nov 29, 2025
3a6a851
Updating some docstrings
taylorbell57 Nov 29, 2025
f501200
Updating starry and fleck.jax spot models
taylorbell57 Nov 29, 2025
7fa853f
Changing harmonica jax model to be functional instead of oo
taylorbell57 Nov 29, 2025
c35165c
Update package dependencies for compatibility and bug fixes
taylorbell57 Nov 29, 2025
7d851df
Safer handling of masked arrays, and tidying .0 to just .
taylorbell57 Dec 18, 2025
911d50b
Fixing fleck spot parameter names in MIRI test EPF
taylorbell57 Dec 18, 2025
382f904
Safer handling of masked arrays
taylorbell57 Dec 18, 2025
867be2c
Fixing some defaults
taylorbell57 Dec 18, 2025
bb359cb
Adding functional versions for multiple more jax-based models
taylorbell57 Dec 18, 2025
5e1d334
Using some of the jax-based code for non-jax fitters
taylorbell57 Dec 18, 2025
30886ba
Allowing extrapolation <5 µm for MIRI/LRS throughput for LD models
taylorbell57 Dec 19, 2025
dd1ac86
Merge remote-tracking branch 'origin/main' into jaxoplanet
taylorbell57 Jan 6, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pytest_testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y libnetcdf-dev libhdf5-dev
python -m pip install --timeout 60 --retries 5 --upgrade pip
pip install --timeout 60 --retries 5 ".[jwst,hst,test]"
pip install --timeout 60 --retries 5 ".[jwst,hst,test,jax]"
mkdir $HOME/crds_cache
echo "CRDS_PATH=$HOME/crds_cache" >> $GITHUB_ENV
echo "CRDS_SERVER_URL=https://jwst-crds.stsci.edu" >> $GITHUB_ENV
Expand Down
12 changes: 10 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,31 @@ dependencies:
- pandas
- photutils
- pip # required for the pip installs below
- pytest[version='<8.0'] # Upper limit needed to avoid some conflict between pytest, an asdf package, and something in the pymc3 set of installs. Needed for testing
- pytest[version='<8.0'] # Upper limit needed to avoid some conflict between pytest and asdf. Needed for testing
- pytest-cov # Needed for testing
- pytest-doctestplus # Needed for testing
- requests
- scipy[version='>=1.8.0'] # Lower limit needed for scipy.spatial.QhullError
- shapely
- sphinx # Needed for documentation
- sphinx-automodapi # Needed for documentation
- tinygp
- tqdm
- pip:
- arviz>=0.21 # Needed for jaxoplanet
- jax[cpu]>=0.5 # Needed for jaxoplanet
- jaxoplanet>=0.1.0 # Needed for jaxoplanet
- jaxopt>=0.8 # Needed for jaxoplanet
- numpyro>=0.19 # Needed for jaxoplanet
- numpyro_ext>=0.0.4 # Needed for jaxoplanet
- specutils>=1.20 # Needed for jaxoplanet
- astraeus-io
- batman-package
- catwoman>=1.0.16 # Lower limit needed to avoid installation bug
- celerite2 # Needed for GP
- crds
- exotic-ld==3.2.0 # Lower limit needed for updated JWST sensitivity files, upper limit needed for breaking changes
- fleck
- fleck@git+https://github.com/bmorris3/fleck.git@main
- george # Needed for GP
- image_registration@git+https://github.com/keflavich/image_registration@master # Need GitHub version to avoid np.float issue
- jwst==1.20.2
Expand Down
22 changes: 19 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ zip_safe = True
python_requires= >=3.11,<3.14
include_package_data = True
install_requires =
arviz>=0.21
astraeus-io
astropy
astroquery
Expand All @@ -56,24 +57,31 @@ install_requires =
dynesty>1.0 # Lower limit needed for specific arguments
emcee>3.0.0 # Lower limit needed for specific arguments
exotic-ld==3.2.0 # Lower limit needed for updated JWST sensitivity files, upper limit needed for breaking changes
fleck
fleck@git+https://github.com/taylorbell57/fleck.git@main # Fork for fixed jax support and other bug fixes
george # Needed for GP
h5py>=3.7.0 # Lower limit needed to avoid issues with JWST I/O routines
jax[cpu]>=0.5 # Lower limit needed for compatibility with jaxoplanet
jaxoplanet>=0.1.0
jaxopt>=0.8 # Lower limit needed for compatibility with jax>=0.5
lmfit
matplotlib>=3.6 # Lower limit needed for set_layout_engine()
mc3 # Needed for uncertainties in the RMS time-averaging plots in S5
numpy>=1.20.0,<2.0 # numpy 2.0 introduces breaking changes for some packages
numpyro>=0.19 # Lower limit needed for compatibility with jax>=0.5
numpyro_ext>=0.0.4 # Lower limit needed for compatibility with numpyro>=0.19
pandas
pastasoss>=1.2.2
photutils
# planet-harmonica # Currently only supports for python 3.8 -- 3.10
planet-harmonica@git+https://github.com/DavoGrant/harmonica@main
planet-harmonica@git+https://github.com/taylorbell57/harmonica@main # Fork for jax support
requests
scipy>=1.12.0 # Lower limit needed for stcal.ramp_fitting.likely_fit
setuptools_scm>=6.2 # Needed to support pyproject.toml config
shapely
specutils>=1.20 # Lower limit needed for compatibility with jaxoplanet
stdatamodels
svo_filters
tinygp
tqdm


Expand All @@ -100,7 +108,7 @@ docs =
sphinx-rtd-theme>=1.3.0 # Style updates and Sphinx compatibility
test =
flake8
pytest<8.0 # Upper limit due to asdf+pytest incompatibility
pytest<8.0 # Upper limit needed to avoid some conflict between pytest and asdf
pytest-cov
pytest-doctestplus
jupyter =
Expand Down Expand Up @@ -142,6 +150,14 @@ per-file-ignores =
./demos/**/run_*.py:E402
# Need to protect against crashes if jwst not installed
**/test_*.py:E402
# Need to have unused imports in the AstroModel
**/models/AstroModel.py:F401
# Need to modify c compiler settings before importing starry
**/differentiable_models/*.py:E402
# Need to have unused imports in the init file
**/differentiable_models/__init__.py:F401
# Need to modify jax settings before importing celerite2.jax
**/jax_models/JaxModel.py:E402
# Need to protect against crashes if hst packages not installed
**/test_WFC3.py:F401,E402
# Keep the unused numpy so users can pass in numpy values (e.g. np.inf)
Expand Down
11 changes: 8 additions & 3 deletions src/eureka/S3_data_reduction/s3_reduce.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,9 +389,14 @@ def reduce(eventlabel, ecf_path=None, s2_meta=None, input_meta=None):
if not meta.ff_outlier and not meta.skip_bg:
data = inst.flag_bg(data, meta, log)

# Do the background subtraction
data = bg.BGsubtraction(data, meta, log,
m, meta.isplots_S3)
# Do the background subtraction
data = bg.BGsubtraction(data, meta, log,
m, meta.isplots_S3)
else:
data['bg'] = data.flux.copy()
data.bg.values[:] = 0
data.bg.attrs['bg_units'] = \
data.flux.attrs['flux_units']

# Calulate and correct for 2D drift
if hasattr(inst, 'correct_drift2D'):
Expand Down
22 changes: 21 additions & 1 deletion src/eureka/S4_generate_lightcurves/generate_LD.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def exotic_ld(meta, spec, log, white=False):
throughput_wavelengths < 30000)
poly = np.polyfit(throughput_wavelengths[ind_use],
throughput[ind_use], deg=7)
wav_poly = np.linspace(2.733*1e4, throughput_wavelengths[0], 10000)
wav_poly = np.linspace(2.733e4, throughput_wavelengths[0], 10000)
throughput_poly = np.polyval(poly, wav_poly) - 0.015
# Make sure the throughput is always > 0
throughput_poly[throughput_poly < 0] = 0
Expand All @@ -150,6 +150,26 @@ def exotic_ld(meta, spec, log, white=False):
custom_throughput = np.append(throughput_poly, throughput)
old_mode = mode
mode = 'custom'
elif (mode == 'JWST_MIRI_LRS' and
wavelength_range[0][0] > throughput_edges[0]/1e4):
# Extrapolate throughput to the blue edge of the filter if needed
log.writelog("WARNING: Extrapolating ExoTiC-LD throughput file to "
"get closer to the blue edge of the filter.")

# The following polynomial was estimated by TJB on Dec 19, 2025
ind_use = throughput_wavelengths < 100000
poly = np.polyfit(throughput_wavelengths[ind_use],
throughput[ind_use], deg=3)
wav_poly = np.linspace(4e4, throughput_wavelengths[0], 1000)
throughput_poly = np.polyval(poly, wav_poly)
# Make sure the throughput is always > 0
throughput_poly[throughput_poly < 0] = 0
# Prepend extrapolated throughput and then switch to custom
# throughput mode
custom_wavelengths = np.append(wav_poly, throughput_wavelengths)
custom_throughput = np.append(throughput_poly, throughput)
old_mode = mode
mode = 'custom'

if mode == 'custom' and meta.isplots_S4 >= 3:
plots_s4.plot_extrapolated_throughput(meta, throughput_wavelengths,
Expand Down
4 changes: 2 additions & 2 deletions src/eureka/S4_generate_lightcurves/outliers.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ def get_outliers(meta, spec):
optmask = spec.optmask.values[:, iwmin:iwmax]
norm_lcdata, norm_lcerr = util.normalize_spectrum(meta, optspec, opterr,
optmask=optmask)
norm_lcdata = norm_lcdata.filled(np.nan)
norm_lcerr = norm_lcerr.filled(np.nan)
norm_lcdata = np.ma.filled(norm_lcdata, np.nan)
norm_lcerr = np.ma.filled(norm_lcerr, np.nan)

# Compute unbinned LC MAD values, then scale
numx = norm_lcdata.shape[1]
Expand Down
19 changes: 19 additions & 0 deletions src/eureka/S5_lightcurve_fitting/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
"""
Package to fit models to light curve data
"""
# Do some checks here to avoid spamming these warnings
try:
import os
import multiprocessing

# Must come before any import that touches JAX
ncpu = multiprocessing.cpu_count()
os.environ["XLA_FLAGS"] = f"--xla_force_host_platform_device_count={ncpu}"

import jax
jax.config.update("jax_enable_x64", True)
from . import jax_models
from . import jax_lightcurve
except ModuleNotFoundError:
# Don't require that the jax and jaxoplanet packages be installed
# but also don't raise a warning here to avoid excessive spam
pass

from . import fitters
# from . import gradient_fitters
from . import lightcurve
from . import likelihood
from . import limb_darkening_fit
Expand Down
15 changes: 15 additions & 0 deletions src/eureka/S5_lightcurve_fitting/fitters.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,16 @@ def lsqfitter(lc, model, meta, log, calling_function='lsq', **kwargs):
'your initial parameter values are outside of the bounds of its '
'prior.')

# Plot Harmonica string starting point
if 'harmonica_tr' in meta.run_myfuncs and meta.isplots_S5 >= 3:
plots.plot_harmonica_string(lc, model, meta,
fitter=calling_function+'StartingPoint')

if not np.isfinite(start_lnprob):
raise AssertionError(
'The starting lnprob value must be finite. Most likely, one of '
'your priors is outside of its bounds.')

def neg_lnprob(theta, lc, model, prior1, prior2, priortype, freenames):
return -lnprob(theta, lc, model, prior1, prior2, priortype, freenames)
global lsq_t0
Expand Down Expand Up @@ -315,6 +325,11 @@ def emceefitter(lc, model, meta, log, **kwargs):
plots.plot_harmonica_string(lc, model, meta,
fitter='emceeStartingPoint')

# Plot Harmonica string starting point
if 'harmonica_tr' in meta.run_myfuncs and meta.isplots_S5 >= 3:
plots.plot_harmonica_string(lc, model, meta,
fitter='emceeStartingPoint')

# Initialize tread pool
if meta.ncpu > 1:
pool = Pool(meta.ncpu)
Expand Down
Loading
Loading