Skip to content

docs: fix the example of using DiffractionObject.get_array_index in the documentation #354

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

Merged
merged 4 commits into from
Jul 25, 2025

Conversation

ycexiao
Copy link
Contributor

@ycexiao ycexiao commented Jul 24, 2025

What problem does this PR address

Fix the examples as mentioned in #352

  • Failed example for DiffractionObject.get_array_index
  • Duplicate code block
  • Failed example for diffpy.utils.transform.d_to_tth
  • Markup not rendered correctlly

Fix the documentation examples.

What should reviewer(s) do

Please check the modified documentation.

example for DiffractionObject.get_array_index
image

Duplicate code block is removed
image

Markup is now rendered correctly
image

Copy link

codecov bot commented Jul 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@7eb9f5c). Learn more about missing BASE report.
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##             main      #354   +/-   ##
========================================
  Coverage        ?   100.00%           
========================================
  Files           ?         9           
  Lines           ?       516           
  Branches        ?         0           
========================================
  Hits            ?       516           
  Misses          ?         0           
  Partials        ?         0           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ycexiao ycexiao marked this pull request as ready for review July 24, 2025 17:57
@ycexiao
Copy link
Contributor Author

ycexiao commented Jul 24, 2025

@sbillinge, it's ready for review.

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.

let's start by writing tests for get_array_index

@ycexiao
Copy link
Contributor Author

ycexiao commented Jul 25, 2025

@sbillinge , this PR only fixes the documentation. I will handle the get_array_index source code in a separate PR.

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.

I will merge, but let's not forget to double check the docs for get_array_index

@@ -180,7 +180,7 @@ For example, attempting to add a diffraction object and a string will raise an e

.. code-block:: python

tth_ninety_index = diff_object1.get_array_index(90, xtype="tth")
tth_ninety_index = diff_object1.get_array_index(xvalue=90, xtype="tth")
Copy link
Contributor

Choose a reason for hiding this comment

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

This will have to be fixed later when we finalize the signature. Let's just remember to do it....

@@ -190,8 +190,8 @@ you can find its closest index for ``q=0.25`` by typing either of the following:
.. code-block:: python

print(do._input_xtype) # remind ourselves which array was input. prints "q" in this case.
index = do.get_array_index(0.25) # no xtype passed, defaults to do._input_xtype, or in this example, q
index = do.get_array_index(0.25, xtype="q") # explicitly choose an xtype to specify a value
index = do.get_array_index(xvalue=0.25) # no xtype passed, defaults to do._input_xtype, or in this example, q
Copy link
Contributor

Choose a reason for hiding this comment

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

same here.

@sbillinge sbillinge merged commit 93bc105 into diffpy:main Jul 25, 2025
5 checks passed
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