Skip to content

Atmosphere pair interpolation fails when using the ATLAS12 grid #2

@KameronGausling

Description

@KameronGausling

When fitting spectra using the ATLAS12 atmosphere grid, the following error occurs:

/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/data_structure.py:102: RuntimeWarning:

invalid value encountered in cast

Now fitting spectrum of HIP3093
INFO - Don't forget to cite your sources. Use sme.citation()
INFO - Fitting Spectrum with Parameters: teff,logg,feh,vmac,vrad,abund Si,abund Ca,abund Ti
Traceback (most recent call last):
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/analysis_scripts/run_analysis.py", line 33, in
sme_3093 = run_analysis(names[1], sme_3093, plot = 'no')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/analysis_scripts/analysis_scripts.py", line 281, in run_analysis
sme = solve(sme, fitparams)
^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/solve.py", line 789, in solve
return solver.solve(sme, param_names, segments, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/solve.py", line 729, in solve
res = least_squares(
^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/pysme/lib/python3.11/site-packages/scipy/optimize/_lsq/least_squares.py", line 859, in least_squares
J0 = jac(x0, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/solve.py", line 258, in _jacobian
g = approx_derivative(
^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/pysme/lib/python3.11/site-packages/scipy/optimize/_numdiff.py", line 505, in approx_derivative
return _dense_difference(fun_wrapped, x0, f0, h,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/anaconda3/envs/pysme/lib/python3.11/site-packages/scipy/optimize/_numdiff.py", line 576, in _dense_difference
df = fun(x) - f0
^^^^^^
File "/opt/anaconda3/envs/pysme/lib/python3.11/site-packages/scipy/optimize/_numdiff.py", line 456, in fun_wrapped
f = np.atleast_1d(fun(x, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/solve.py", line 181, in _residuals
result = self.synthesizer.synthesize_spectrum(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/synthesize.py", line 562, in synthesize_spectrum
sme = self.get_atmosphere(sme)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/synthesize.py", line 89, in get_atmosphere
atmo = self.atmosphere_interpolator.interp_atmo_grid(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/atmosphere/interpolation.py", line 95, in interp_atmo_grid
atmo = self.interpolate_corner_models(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/atmosphere/interpolation.py", line 812, in interpolate_corner_models
atmo[i][j] = interpolate(m0, m1, monh, "monh", itop=itop)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/atmosphere/interpolation.py", line 805, in interpolate
return self.interp_atmo_pair(m0, m1, pfrac, interpvar=interp, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/System/Volumes/Data/Network/stars/projects/kam_mac/SME/src/pysme/atmosphere/interpolation.py", line 360, in interp_atmo_pair
(depth1 >= min(depth2[igd]) + ipar[0])
~~~~~~^^^^^
IndexError: boolean index did not match indexed array along dimension 0; dimension is 63 but corresponding boolean dimension is 71

note: This issue does not occur with the MARCS12 atmosphere grid. This error also does not occur during every iteration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions