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

Key error due to high nbins #528

Open
ashiquelal opened this issue Apr 19, 2024 · 0 comments
Open

Key error due to high nbins #528

ashiquelal opened this issue Apr 19, 2024 · 0 comments

Comments

@ashiquelal
Copy link

Used the Umbrella sampling example with my data. Gave me the following when the nbins where higher than an particular value:

File ~/opt/anaconda3/envs/pymbar/lib/python3.10/site-packages/pymbar/fes.py:1470 in FES._get_fes_histogram(self, x, reference_point, fes_reference, uncertainty_method)
->  bin_label = histogram_data["bin_label"][tuple(l)]
KeyError: (56,)

Can be solved by change the bin_label = histogram_data["bin_label"][tuple(l)]
to (atleast in case 1D)

            try:
                bin_label = histogram_data["bin_label"][tuple(l)]

            except KeyError:
                if np.all(l[0] < bin_label_keys):  # out of key below
                    fx_vals[i] = np.nan
                    dfx_vals[i] = np.nan
                    continue
                if np.all(l[0] >= bin_label_keys): # out of key above
                    fx_vals[i] = np.nan
                    dfx_vals[i] = np.nan
                    continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant