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

provide info in doc and write an example page #74

Merged
merged 4 commits into from
Aug 30, 2024
Merged

Conversation

Tieqiong
Copy link
Contributor

@Tieqiong Tieqiong commented Aug 26, 2024

Add information on the documentation page.

I moved doc/examples into doc/source/examples and add an example page. I merged Ni_plot_pdf and Ni_calculation because they are mostly the same. I also update pylab plots to pyplot because The use of pylab is discouraged now

Copy link
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see inline comments. The examples send to be mostly the example code copy-pasted into the rst. See if there is an automatic way of doing that, but if not, please redo it to reflect the latest updated code.

doc/source/examples/Ni_calculation.py Outdated Show resolved Hide resolved
doc/source/examples/Ni_refinement.py Outdated Show resolved Hide resolved
@Tieqiong
Copy link
Contributor Author

Please see inline comments. The examples send to be mostly the example code copy-pasted into the rst. See if there is an automatic way of doing that, but if not, please redo it to reflect the latest updated code.

I can write a python code for automating this process, but it's not necessary for this package because examples are kind of short. Ideally we can set a fixed template and conventions for example files and write a python code and put into the release-script repo. It could be helpful for other packages that have long examples

Copy link
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. Please check the examples.rst in the docs. Does it still contain the old code or am I looking at an out of date version?

@Tieqiong
Copy link
Contributor Author

@sbillinge It's the updated version. Also I can make a issue in release script if we want to have the automated example builder.

@sbillinge
Copy link
Contributor

I see this in the example docs but didn't we move away from using pylab?
. We can also plot it using matplotlib::

import matplotlib.pyplot as plt

# obtain list of r-points and corresponding G values
r = P.getR()
G = P.getpdf_fit()

plt.plot(r, G)
pylab.xlabel("r (Å)")
pylab.ylabel("G (Å$^{-2}$)")
pylab.title("x-ray PDF of nickel simulated at Qmax = %g" % qmax)

# display plot window, this must be the last command in the script
pylab.show()

@Tieqiong
Copy link
Contributor Author

I see this in the example docs but didn't we move away from using pylab? . We can also plot it using matplotlib::

import matplotlib.pyplot as plt

# obtain list of r-points and corresponding G values
r = P.getR()
G = P.getpdf_fit()

plt.plot(r, G)
pylab.xlabel("r (Å)")
pylab.ylabel("G (Å$^{-2}$)")
pylab.title("x-ray PDF of nickel simulated at Qmax = %g" % qmax)

# display plot window, this must be the last command in the script
pylab.show()

Yes thanks for the catch! sorry for the oversight

Copy link
Contributor

@sbillinge sbillinge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please could you make sure that the code in the docs works and let me know? I think copy-pasting the working code is maybe the best approach but I leave it up to you.

doc/source/examples.rst Show resolved Hide resolved
@sbillinge sbillinge merged commit 5923fa2 into diffpy:main Aug 30, 2024
2 checks passed
@Tieqiong Tieqiong deleted the doc branch October 2, 2024 13:16
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

Successfully merging this pull request may close these issues.

2 participants