You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File "psignifit/psignifit.py", line 393, in psignifitCore
Fit[idx] = result['X1D'][idx][index[idx]]
ValueError: could not broadcast input array from shape (2,) into shape (1,)
Remarks:
It seems that the issue arises in the following part of psignifit.py:
The problem occurs when result['Posterior'].ravel() contains multiple maximum values, causing index to contain unexpected values (in this case, two values).
To work around this issue, I handled the case where index has multiple values by averaging them if they are consecutive.
Proposed Fix:
I modified the following part:
Fit[idx] =result['X1D'][idx][index[idx]]
to:
iflen(index[idx]) >1:
unique_sorted_arr=sorted(set(index[idx]))
expected_sequence=list(range(min(unique_sorted_arr), max(unique_sorted_arr) +1))
ifunique_sorted_arr==expected_sequence:
warnings.warn(f"index has multiple consecutive values: {index[idx]}. The mean value of results is used instead", UserWarning)
Fit[idx] =result['X1D'][idx][index[idx]].mean()
else:
raiseValueError(f"index has multiple non-consecutive values: {index[idx]}.")
else:
Fit[idx] =result['X1D'][idx][index[idx]]
However, I am not fully confident that this fix is universally applicable.
The text was updated successfully, but these errors were encountered:
Bug: An error occurs when fitting a specific array under certain conditions.
Environment:
Description:
An error occurs when running the following program:
Error Code:
Remarks:
It seems that the issue arises in the following part of
psignifit.py
:The problem occurs when
result['Posterior'].ravel()
contains multiple maximum values, causingindex
to contain unexpected values (in this case, two values).To work around this issue, I handled the case where
index
has multiple values by averaging them if they are consecutive.Proposed Fix:
I modified the following part:
to:
However, I am not fully confident that this fix is universally applicable.
The text was updated successfully, but these errors were encountered: