convergence in `rtn.get_equilb_ne()`
Closed this issue · 3 comments
Hello
I'm not sure why I'm getting this error after updating fake_spectra
with the current master branch. This tells the fixed point convergence is not being achieved. I am using the TREECOOL_ep_2018p
. Anyone has encountered something similar ?
Thanks,
Mahdi
Traceback (most recent call last):
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/spectra.py", line 874, in get_tau
self._really_load_array((elem, ion, line), self.tau, "tau")
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/spectra.py", line 356, in _really_load_array
if np.size(array[key]) > 1:
KeyError: ('H', 1, 1215)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "parallel_spectra.py", line 59, in <module>
get_spec(i=args.i, savefile=args.savefile, folder=args.folder, res=args.res, numlos=args.numlos, snap=args.snap)
File "parallel_spectra.py", line 39, in get_spec
rr.get_tau("H",1,1215)
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/spectra.py", line 877, in get_tau
tau = self.compute_spectra(elem, ion, line, True)
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/spectra.py", line 805, in compute_spectra
result = self._interpolate_single_file(0, elem, ion, ll, get_tau, load_all_data_first=arepo)
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/spectra.py", line 495, in _interpolate_single_file
(pos, vel, elem_den, temp, hh, amumass) = self._read_particle_data(nsegment, elem, ion, get_tau)
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/spectra.py", line 577, in _read_particle_data
temp = self.gasprop.get_temp(0, segment=fn).astype(np.float32)
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/ratenetworkspectra.py", line 41, in get_temp
temp[ii2] = self.rates.get_temp(density[ii2], ienergy[ii2])
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/rate_network.py", line 88, in get_temp
ne = self.get_equilib_ne(density, ienergy, helium)
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/rate_network.py", line 143, in get_equilib_ne
nebynh = fixed_point(rooted, nh, args=(nh, ienergy),xtol=self.converge)
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/rate_network.py", line 736, in fixed_point
return _fixed_point_helper(func, x0, args, xtol, maxiter, use_accel)
File "/home/mqezlou/.conda/envs/python3.6/lib/python3.6/site-packages/fake_spectra/rate_network.py", line 690, in _fixed_point_helper
raise RuntimeError(msg)
RuntimeError: Failed to converge after 500 iterations, value is [0.05904008 0.9603431 ]
Can you check whether this still happens with the last release version? This is a common way for bugs to manifest!
Can you check whether this still happens with the last release version? This is a common way for bugs to manifest!
Thank you Simeon. I checked with the pip
version, the error still pops op.
I found the commit which generates the error, this e7b5e48
So, the new get_temp in ratenetworkspectra
doesn't work properly. Comparing it to the original get_temp() in abstractsnapshot.py
, no difference strikes my eyes.
@sbird Was this commit crucial ? i.e. Was the old get_temp
not accurate ?