I noticed the following error when using the resume_from_similar_file() function in ultranest:
Traceback (most recent call last):
File "/u/home/a/abhimat/research/2023_S2-36_analysis/phitter_fits/202411_3/fit_un_2_Kbb_HeII_only_RVs/run_un_fit.py", line 391, in <module>
sampler = ultranest.ReactiveNestedSampler(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/u/home/a/abhimat/.conda/envs/phoebe_py38/lib/python3.12/site-packages/ultranest/integrator.py", line 1219, in __init__
resume_from_similar_file(
File "/u/home/a/abhimat/.conda/envs/phoebe_py38/lib/python3.12/site-packages/ultranest/integrator.py", line 342, in resume_from_similar_file
main_iterator2.passing_node(node2, active_nodes2)
File "/u/home/a/abhimat/.conda/envs/phoebe_py38/lib/python3.12/site-packages/ultranest/netiter.py", line 536, in passing_node
self.H = exp(wi - logZnew) * Li + exp(self.logZ - logZnew) * (self.H + self.logZ) - logZnew
~~~~~~~^~~~~~~~~~~
TypeError: unsupported operand type(s) for +: 'NoneType' and 'float'
Upon investigating this issue, It appears to stem from this particular line
|
self.H = exp(wi - logZnew) * Li + exp(self.logZ - logZnew) * (self.H + self.logZ) - logZnew |
and how the information variable (self.H) appears to be getting initialized in both the SingleCounter and MultiCounter classes, as None in SingleCounter and an array of NaNs in MultiCounter:
|
def reset(self): |
|
"""Reset counters and integration.""" |
|
self.logweights = [] |
|
self.H = None |
|
self.logZ = -np.inf |
|
self.logZerr = np.inf |
|
self.logVolremaining = 0 |
|
self.i = 0 |
|
self.fraction_remaining = np.inf |
|
self.Lmax = -np.inf |
|
def reset(self, nentries): |
|
"""Reset counters/integrator. |
|
|
|
Parameters |
|
---------- |
|
nentries: int |
|
number of iterators |
|
""" |
|
self.logweights = [] |
|
self.istail = [] |
|
self.logZ = -np.inf |
|
self.logZerr = np.inf |
|
self.all_H = -np.nan * np.ones(nentries) |
|
self.all_logZ = -np.inf * np.ones(nentries) |
|
self.all_logVolremaining = np.zeros(nentries) |
|
self.logVolremaining = 0.0 |
|
self.Lmax = -np.inf |
|
|
|
self.all_logZremain = np.inf * np.ones(nentries) |
|
self.logZremainMax = np.inf |
|
self.logZremain = np.inf |
|
self.remainder_ratio = 1.0 |
|
self.remainder_fraction = 1.0 |
|
|
|
self.insertion_order_accumulator.reset() |
|
self.insertion_order_runs = [] |
Am I correct in initializing self.H = 0? Upon trying it for my use case, it appears to fix the issue.
Just wanted to double check about the initial value before submitting a pull request with the fix, thank you!
I noticed the following error when using the
resume_from_similar_file()function in ultranest:Upon investigating this issue, It appears to stem from this particular line
UltraNest/ultranest/netiter.py
Line 536 in fbde672
and how the information variable (
self.H) appears to be getting initialized in both the SingleCounter and MultiCounter classes, asNonein SingleCounter and an array of NaNs in MultiCounter:UltraNest/ultranest/netiter.py
Lines 483 to 492 in fbde672
UltraNest/ultranest/netiter.py
Lines 630 to 655 in fbde672
Am I correct in initializing
self.H = 0? Upon trying it for my use case, it appears to fix the issue.Just wanted to double check about the initial value before submitting a pull request with the fix, thank you!