Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Type Error in Stage 5 Lightcurve Fitting #708

Open
2 tasks done
lheinke opened this issue Oct 29, 2024 · 3 comments
Open
2 tasks done

[Bug]: Type Error in Stage 5 Lightcurve Fitting #708

lheinke opened this issue Oct 29, 2024 · 3 comments
Assignees
Labels
bug Something isn't working LC Fit MIRI

Comments

@lheinke
Copy link

lheinke commented Oct 29, 2024

FAQ check

  • Yes, I checked the FAQ and my question has not been addressed.

Instrument

Light curve fitting (Stages 4-6)

What happened?

I have encountered the type error below when trying to fit MIRI LRS transit lightcurves with Eureka! Stages 1-4 were reduced using Eureka! as well. My naive first guess would be that the parameters from the EPF file are not parsed correctly for some reason.

Error traceback output

WARNING: There are 4 metadata save files in the folder: /home/lheinke/JWST/Reduction/Stage4/
  Using the metadata file inside: /home/lheinke/JWST/Reduction/Stage4/S4_2024-10-29_jwst_run3/ap5_bg11/
  and will consider aperture ranges listed there. If this metadata file is not a part
  of the run you intended, please provide a more precise folder for the metadata file.
Finished loading parameters from /home/lheinke/JWST/Reduction/Stage4/S4_2024-10-29_jwst_run3/ap5_bg11//S4_jwst_ap5_bg11_LCData.h5

Starting Stage 5: Light Curve Fitting

Input directory: /home/lheinke/JWST/Reduction/Stage4/S4_2024-10-29_jwst_run3/ap5_bg11/
Output directory: /home/lheinke/JWST/Reduction/Stage5/S5_2024-10-29_jwst_run12/ap5_bg11/
Copying S5 control file
Copying S5 parameter control file

Starting Fit of White-light Light Curve

=========================
Starting dynesty fit.
<class 'numpy.str_'> <class 'numpy.float64'> <class 'numpy.float64'>
Traceback (most recent call last):
  File "/home/lheinke/JWST/Reduction/run_eureka.py", line 29, in <module>
    meta = s5.fitlc(eventlabel, ecf_path=ecf_path)
  File "/home/lheinke/.local/envs/eureka_1.0/lib/python3.10/site-packages/eureka/S5_lightcurve_fitting/s5_fit.py", line 289, in fitlc
    meta, params = fit_channel(meta, time, flux, 0, flux_err,
  File "/home/lheinke/.local/envs/eureka_1.0/lib/python3.10/site-packages/eureka/S5_lightcurve_fitting/s5_fit.py", line 964, in fit_channel
    lc_model.fit(model, meta, log, fitter='dynesty')
  File "/home/lheinke/.local/envs/eureka_1.0/lib/python3.10/site-packages/eureka/S5_lightcurve_fitting/lightcurve.py", line 181, in fit
    fit_model = self.fitter_func(self, model, meta, log, **kwargs)
  File "/home/lheinke/.local/envs/eureka_1.0/lib/python3.10/site-packages/eureka/S5_lightcurve_fitting/fitters.py", line 856, in dynestyfitter
    start_lnprob = lnprob(freepars, lc, model, prior1, prior2, priortype,
  File "/home/lheinke/.local/envs/eureka_1.0/lib/python3.10/site-packages/eureka/S5_lightcurve_fitting/likelihood.py", line 205, in lnprob
    lp = lnprior(theta, prior1, prior2, priortype, freenames)
  File "/home/lheinke/.local/envs/eureka_1.0/lib/python3.10/site-packages/eureka/S5_lightcurve_fitting/likelihood.py", line 137, in lnprior
    if (priortype[i] == 'U' and np.logical_or(theta[i] < prior1[i],
TypeError: '>' not supported between instances of 'numpy.ndarray' and 'numpy.str_'

What operating system are you using?

Ubuntu 20.04.6 LTS

What version of Python are you running?

Python 3.10.14

What Python packages do you have installed?

# Name                    Version                   Build  Channel
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
alabaster                 1.0.0                    pypi_0    pypi
asciitree                 0.3.3                    pypi_0    pypi
asdf                      3.5.0                    pypi_0    pypi
asdf-astropy              0.6.1                    pypi_0    pypi
asdf-coordinates-schemas  0.3.0                    pypi_0    pypi
asdf-standard             1.1.1                    pypi_0    pypi
asdf-transform-schemas    0.5.0                    pypi_0    pypi
asdf-wcs-schemas          0.4.0                    pypi_0    pypi
asteval                   1.0.5                    pypi_0    pypi
astraeus                  0.3                      pypi_0    pypi
astropy                   6.1.4                    pypi_0    pypi
astropy-healpix           1.0.3                    pypi_0    pypi
astropy-iers-data         0.2024.10.28.0.34.7          pypi_0    pypi
astroquery                0.4.7                    pypi_0    pypi
astroscrappy              1.2.0                    pypi_0    pypi
asttokens                 2.4.1                    pypi_0    pypi
attrs                     24.2.0                   pypi_0    pypi
babel                     2.16.0                   pypi_0    pypi
backports-tarfile         1.2.0                    pypi_0    pypi
batman-package            2.4.9                    pypi_0    pypi
bayesicfitting            3.2.1                    pypi_0    pypi
beautifulsoup4            4.12.3                   pypi_0    pypi
bokeh                     2.4.3                    pypi_0    pypi
bottleneck                1.4.2                    pypi_0    pypi
bzip2                     1.0.8                h4bc722e_7    conda-forge
ca-certificates           2024.8.30            hbcca054_0    conda-forge
ccdproc                   2.4.2                    pypi_0    pypi
celerite2                 0.3.2                    pypi_0    pypi
certifi                   2024.8.30                pypi_0    pypi
cffi                      1.17.1                   pypi_0    pypi
cftime                    1.6.4.post1              pypi_0    pypi
charset-normalizer        3.4.0                    pypi_0    pypi
click                     8.1.7                    pypi_0    pypi
cloudpickle               3.1.0                    pypi_0    pypi
contourpy                 1.3.0                    pypi_0    pypi
corner                    2.2.2                    pypi_0    pypi
crds                      11.18.4                  pypi_0    pypi
cryptography              43.0.3                   pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
dask                      2024.10.0                pypi_0    pypi
decorator                 5.1.1                    pypi_0    pypi
dill                      0.3.9                    pypi_0    pypi
docutils                  0.21.2                   pypi_0    pypi
drizzle                   2.0.0                    pypi_0    pypi
dynesty                   2.1.4                    pypi_0    pypi
emcee                     3.1.6                    pypi_0    pypi
eureka                    1.0                      pypi_0    pypi
exceptiongroup            1.2.2                    pypi_0    pypi
executing                 2.1.0                    pypi_0    pypi
exotic-ld                 3.2.0                    pypi_0    pypi
fasteners                 0.19                     pypi_0    pypi
filelock                  3.16.1                   pypi_0    pypi
fleck                     1.1.2                    pypi_0    pypi
fonttools                 4.54.1                   pypi_0    pypi
fsspec                    2024.10.0                pypi_0    pypi
future                    1.0.0                    pypi_0    pypi
george                    0.4.3                    pypi_0    pypi
gwcs                      0.21.0                   pypi_0    pypi
h5netcdf                  1.4.0                    pypi_0    pypi
h5py                      3.12.1                   pypi_0    pypi
html5lib                  1.1                      pypi_0    pypi
idna                      3.10                     pypi_0    pypi
imageio                   2.36.0                   pypi_0    pypi
imagesize                 1.4.1                    pypi_0    pypi
importlib-metadata        8.5.0                    pypi_0    pypi
iniconfig                 2.0.0                    pypi_0    pypi
ipython                   8.29.0                   pypi_0    pypi
jaraco-classes            3.4.0                    pypi_0    pypi
jaraco-context            6.0.1                    pypi_0    pypi
jaraco-functools          4.1.0                    pypi_0    pypi
jedi                      0.19.1                   pypi_0    pypi
jeepney                   0.8.0                    pypi_0    pypi
jinja2                    3.1.4                    pypi_0    pypi
jmespath                  1.0.1                    pypi_0    pypi
jsonschema                4.23.0                   pypi_0    pypi
jsonschema-specifications 2024.10.1                pypi_0    pypi
jwst                      1.15.1                   pypi_0    pypi
keyring                   25.5.0                   pypi_0    pypi
kiwisolver                1.4.7                    pypi_0    pypi
lazy-loader               0.4                      pypi_0    pypi
ld_impl_linux-64          2.43                 h712a8e2_2    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc                    14.2.0               h77fa898_1    conda-forge
libgcc-ng                 14.2.0               h69a702a_1    conda-forge
libgomp                   14.2.0               h77fa898_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libsqlite                 3.47.0               hadc24fc_0    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libzlib                   1.3.1                hb9d3cd8_2    conda-forge
lmfit                     1.3.2                    pypi_0    pypi
locket                    1.0.0                    pypi_0    pypi
markupsafe                3.0.2                    pypi_0    pypi
matplotlib                3.9.2                    pypi_0    pypi
matplotlib-inline         0.1.7                    pypi_0    pypi
mc3                       3.2.0                    pypi_0    pypi
more-itertools            10.5.0                   pypi_0    pypi
ncurses                   6.5                  he02047a_1    conda-forge
netcdf4                   1.6.5                    pypi_0    pypi
networkx                  3.4.2                    pypi_0    pypi
numcodecs                 0.13.1                   pypi_0    pypi
numpy                     1.24.4                   pypi_0    pypi
numpydoc                  1.8.0                    pypi_0    pypi
opencv-python-headless    4.10.0.84                pypi_0    pypi
openssl                   3.3.2                hb9d3cd8_0    conda-forge
packaging                 24.1                     pypi_0    pypi
pandas                    2.2.3                    pypi_0    pypi
parsley                   1.3                      pypi_0    pypi
parso                     0.8.4                    pypi_0    pypi
partd                     1.4.2                    pypi_0    pypi
pexpect                   4.9.0                    pypi_0    pypi
photutils                 2.0.2                    pypi_0    pypi
pillow                    11.0.0                   pypi_0    pypi
pip                       24.2               pyh8b19718_1    conda-forge
pluggy                    1.5.0                    pypi_0    pypi
poppy                     1.1.1                    pypi_0    pypi
prompt-toolkit            3.0.48                   pypi_0    pypi
psutil                    6.1.0                    pypi_0    pypi
ptyprocess                0.7.0                    pypi_0    pypi
pure-eval                 0.2.3                    pypi_0    pypi
pycparser                 2.22                     pypi_0    pypi
pyerfa                    2.0.1.4                  pypi_0    pypi
pygments                  2.18.0                   pypi_0    pypi
pyparsing                 3.2.0                    pypi_0    pypi
pysynphot                 2.0.0                    pypi_0    pypi
pytest                    8.3.3                    pypi_0    pypi
python                    3.10.14         hd12c33a_0_cpython    conda-forge
python-dateutil           2.9.0.post0              pypi_0    pypi
pytz                      2024.2                   pypi_0    pypi
pyvo                      1.5.3                    pypi_0    pypi
pyyaml                    6.0.2                    pypi_0    pypi
readline                  8.2                  h8228510_1    conda-forge
referencing               0.35.1                   pypi_0    pypi
reproject                 0.14.0                   pypi_0    pypi
requests                  2.32.3                   pypi_0    pypi
rpds-py                   0.20.0                   pypi_0    pypi
scikit-image              0.24.0                   pypi_0    pypi
scipy                     1.14.1                   pypi_0    pypi
secretstorage             3.3.3                    pypi_0    pypi
semantic-version          2.10.0                   pypi_0    pypi
setuptools                75.1.0             pyhd8ed1ab_0    conda-forge
setuptools-scm            8.1.0                    pypi_0    pypi
shapely                   2.0.6                    pypi_0    pypi
six                       1.16.0                   pypi_0    pypi
snowballstemmer           2.2.0                    pypi_0    pypi
soupsieve                 2.6                      pypi_0    pypi
spherical-geometry        1.3.2                    pypi_0    pypi
sphinx                    8.1.3                    pypi_0    pypi
sphinxcontrib-applehelp   2.0.0                    pypi_0    pypi
sphinxcontrib-devhelp     2.0.0                    pypi_0    pypi
sphinxcontrib-htmlhelp    2.1.0                    pypi_0    pypi
sphinxcontrib-jsmath      1.0.1                    pypi_0    pypi
sphinxcontrib-qthelp      2.0.0                    pypi_0    pypi
sphinxcontrib-serializinghtml 2.0.0                    pypi_0    pypi
stack-data                0.6.3                    pypi_0    pypi
stcal                     1.7.3                    pypi_0    pypi
stdatamodels              2.0.0                    pypi_0    pypi
stpipe                    0.6.0                    pypi_0    pypi
stsci-image               2.3.9                    pypi_0    pypi
stsci-imagestats          1.8.3                    pypi_0    pypi
stsci-stimage             0.2.9                    pypi_0    pypi
svo-filters               0.4.4                    pypi_0    pypi
synphot                   1.4.0                    pypi_0    pypi
tabulate                  0.9.0                    pypi_0    pypi
tifffile                  2024.9.20                pypi_0    pypi
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tomli                     2.0.2                    pypi_0    pypi
toolz                     1.0.0                    pypi_0    pypi
tornado                   6.4.1                    pypi_0    pypi
tqdm                      4.66.6                   pypi_0    pypi
traitlets                 5.14.3                   pypi_0    pypi
tweakwcs                  0.8.9                    pypi_0    pypi
typing-extensions         4.12.2                   pypi_0    pypi
tzdata                    2024.2                   pypi_0    pypi
uncertainties             3.2.2                    pypi_0    pypi
urllib3                   2.2.3                    pypi_0    pypi
wcwidth                   0.2.13                   pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
wheel                     0.44.0             pyhd8ed1ab_0    conda-forge
wiimatch                  0.3.2                    pypi_0    pypi
xarray                    2024.10.0                pypi_0    pypi
xz                        5.2.6                h166bdaf_0    conda-forge
zarr                      2.18.3                   pypi_0    pypi
zipp                      3.20.2                   pypi_0    pypi

Code of Conduct

  • I agree to follow this project's Code of Conduct
@taylorbell57
Copy link
Collaborator

Can you please copy-paste the contents of your EPF file into a comment on this Issue so that I can better evaluate what's going on?

@lheinke
Copy link
Author

lheinke commented Oct 29, 2024

Sure, here you go:

# Stage 5 Fit Parameters Documentation: https://eurekadocs.readthedocs.io/en/latest/ecf.html#stage-5-fit-parameters

# Name       Value         Free?          PriorPar1    PriorPar2    PriorType
# "Free?" can be free, fixed, white_free, white_fixed, shared, or independent
# PriorType can be U (Uniform), LU (Log Uniform), or N (Normal).
# If U/LU, PriorPar1 and PriorPar2 represent upper and lower limits of the parameter/log(the parameter).
# If N, PriorPar1 is the mean and PriorPar2 is the standard deviation of a Gaussian prior.
#-------------------------------------------------------------------------------------------------------
# ------------------
# ** Transit/eclipse parameters **
# ------------------

rp           0.13401        'free'         0            0.5          U

# ------------------
# ** Orbital parameters **
# ------------------

per          2.10345       'fixed'
t0           2410345.03146  'white_free'    2410345.03146   0.05         N
time_offset  0.0            'fixed'
inc          87.167         'white_free'    87.167          0.05         N
ars          9.086          'white_free'    9.086           0.1          N
ecc          0.0            'fixed'         0               1            U
w            90.            'fixed'         0               180          U

# t_secondary  0.25           'free'             0.25         0.05         N
# Rs           0.12           'fixed'

# ----------------------
# ** Sinusoid_pc Phase Curve Parameters **
# ----------------------
# AmpCos1      0.4           'free'         0            1            U
# AmpSin1      0.01          'free'         -1           1            U
# AmpCos2      0.01          'free'         -1           1            U
# AmpSin2      0.01          'free'         -1           1            U
# ----------------------
# ** POET_pc Phase Curve Parameters **
# ----------------------
# cos1_amp     0.4           'free'         0            1            U
# cos1_off     0.00          'free'         -180         180          U
# cos2_amp     0.1           'free'         0            1            U
# cos2_off     0.00          'free'         0            180          U
# ----------------------
# ** quasilambert_pc Phase Curve Parameters **
# ----------------------
# quasi_gamma  4             'free'         2            40           U
# quasi_offset 0             'free'         -90          90           U

# -------------------------
# ** Limb darkening parameters **
# For BATMAN, choose limb_dark from ['uniform', 'linear', 'quadratic', 'kipping2013', 'squareroot', 'logarithmic', 'exponential','3-parameter', '4-parameter']
# For POET, choose limb_dark from ['uniform', 'linear', 'quadratic', '4-parameter']
# When using generated limb-darkening coefficients from exotic-ld or spam, choose from ['linear', 'quadratic', '3-parameter', '4-parameter'] and set their state to 'fixed' or use `recenter_ld_prior`.
# -------------------------
limb_dark   'kipping2013'   'free' #'quadratic'   'white_free'
u1          0.2             'free'          0           1           U
u2          0.2             'free'          0           1           U

# -------------------------
# ** Stellar variability parameters **
# A modified Lorentzian model can be used to fit stellar flares
# A damped oscillator model can be used to fit quasi-periodic pulsations
# -------------------------
# lor_amp_lhs     0.03    'free'          0            0.1            U
# lor_amp_rhs     0.03    'free'          0            0.1            U
# lor_hwhm_lhs    0       'fixed'         0            0.1            U
# lor_hwhm_rhs    1e-5    'free'          0            0.1            U
# lor_t0          0.3163  'free'          0.3160       0.3166         U
# lor_power       0.7     'free'          0.1          2              U

# osc_amp         0.0003  'free'          0            0.01           U
# osc_amp_decay   1       'free'          0            20             U
# osc_per         0.03    'free'          0            0.1            U
# osc_per_decay   0.      'fixed'         0            10             U
# osc_t0          0.3163  'fixed'         0            1              U
# osc_t1          0.3163  'free'          0.3          0.4            U

# ------------------
# ** Star Spot parameters **
# Each spot needs rad, lat, lon. See docs for details!
# For fleck: can only have one spot contrast (spotcon), spotnpts is the number of temporal points to evaluate at (~200-500)
# For starry: assign one spotcon per spot (spotcon, spotcon1, etc), spotnpts is the ydeg of the star map (~30)
# ------------------
# spotstari    90       'fixed'
# spotrot      100      'fixed'
# spotnpts     300      'independent'

# spotcon      0.9      'free'          0         1       U  # Should be between 0 and 1
# spotrad      0.2      'free'          0         1       U  # Should be between 0 and 1
# spotlat      0        'free'          -90       90      U  # Should be between -90 and 90
# spotlon      0        'free'          -90       90      U  # Should be between -90 and 90 to be on observer-facing hemisphere

# spotcon1     0.95     'free'          0         1       U  # Only use for starry! fleck cannot have different contrasts for each spot
# spotrad1     0.1      'free'          0         1       U  # Should be between 0 and 1
# spotlat1     10       'free'          -90       90      U  # Should be between -90 and 90
# spotlon1     45       'free'          -90       90      U  # Should be between -90 and 90 to be on observer-facing hemisphere

# --------------------
# ** Systematic variables **
# Polynomial model variables (c0--c9 for 0th--3rd order polynomials in time); Fitting at least c0 is very strongly recommended!
# Exponential ramp model variables (r0--r1 for one exponential ramp, r2--r3 for a second exponential ramp)
# GP model parameters (A, m for the first kernel; A1, m1 for the second kernel; etc.) in log scale
# Step-function model variables (step# and steptime# for step-function model #; e.g. step0 and steptime0)
# Drift model variables (xpos, ypos, xwidth, ywidth)
# --------------------
c0          1.015           'free'          1           0.05        N
c1          0               'free'          0           0.01        N
# A           -15             'free'          -25         0           U
# m           -4              'free'          -7          0           U

# -----------
# ** White noise **
# Use scatter_mult to fit a multiplier to the expected noise level from Stage 3 (recommended)
# Use scatter_ppm to fit the noise level in ppm
# -----------
scatter_mult 1.1            'free'         0.8          10           U

@taylorbell57
Copy link
Collaborator

Ah, I believe the issue is that you have:

limb_dark   'kipping2013'   'free'

All 'free' parameters must be numerical values that the code will fit for - you should instead set this to be 'independent'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working LC Fit MIRI
Projects
None yet
Development

No branches or pull requests

5 participants