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

Error in User Guide 1 #44

Closed
geraintpalmer opened this issue Sep 26, 2022 · 3 comments
Closed

Error in User Guide 1 #44

geraintpalmer opened this issue Sep 26, 2022 · 3 comments

Comments

@geraintpalmer
Copy link

HI @Jacks0nJ I am one of the reviewers for the JOSS paper.

Working through User Guide 1 (https://pyfpt.readthedocs.io/en/latest/User_guide1.html), the following raises an error:

>>> gaussian_pdf = fpt.analytics.gaussian_pdf(V, V_dif, V_ddif, phi_in, phi_end)
>>> plt.errorbar(bin_centres, heights, yerr=errors, fmt=".", ms=7,
...              label='{0}'.format(r'Importance Sample'))
>>> plt.plot(bin_centres, gaussian_pdf(bin_centres),
...          label='{0}'.format('Gaussian'), color='k')
>>> # Need to use log scale to see data in the far tail
>>> plt.yscale('log')
>>> plt.xlabel(r'$\mathcal{N}$')
>>> plt.ylabel(r'$P(\mathcal{N})$')
>>> plt.legend()

Similarly with the Edgeworth series.

This is because the following doesn't work as bin_centres is a list:

>>> gaussian_pdf(bin_centres)

This is fixed by:

>>> [gaussian_pdf(b) for b in bin_centres]

or by:

>>> import numpy as np
>>> gaussian_pdf(np.array(bin_centres))
@Jacks0nJ
Copy link
Owner

Hi @geraintpalmer,
Thanks for going though it.
I'll update the guides to fix this mistake soon (I must have changed to numpy arrays but accidently deleted that cell).

@Jacks0nJ
Copy link
Owner

Hi @geraintpalmer
Apologies but I'm struggling to reproduce this error, as while bin_centres is a list, it is converted to a numpy array in cell 7, just below where the list is generated. This conversion to numpy arrays is not done in the "multi-dimensional" branch, but please ignore this branch as it is a work in progress.

Please do let me know if the error persists.

@geraintpalmer
Copy link
Author

Sorry, I don't know how I missed half that cell when working through the tutorial!

Thanks for the reply :)

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

2 participants