Skip to content

Refactor test_scale_to function - continue to establish good practices #255

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 8 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions news/pytest-warning.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* No news added

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
8 changes: 4 additions & 4 deletions src/diffpy/utils/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"The supplied input array and wavelength will result in an impossible two-theta. "
"Please check these values and re-instantiate the DiffractionObject with correct values."
)
inf_output_wmsg = (
inf_output_imsg = (
"INFO: The largest output value in the array is infinite. This is allowed, but it will not be plotted."
)

Expand Down Expand Up @@ -135,7 +135,7 @@ def q_to_d(q):
The array of :math:`d` values np.array([ds]).
"""
if 0 in q:
print(inf_output_wmsg)
print(inf_output_imsg)
return 2.0 * np.pi / copy(q)


Expand Down Expand Up @@ -169,7 +169,7 @@ def tth_to_d(tth, wavelength):
d[i] = i
return d
if 0 in q:
warnings.warn(inf_output_wmsg)
print(inf_output_imsg)
return 2.0 * np.pi / copy(q)


Expand All @@ -189,7 +189,7 @@ def d_to_q(d):
The units of q must be reciprocal of the units of wavelength.
"""
if 0 in d:
warnings.warn(inf_output_wmsg)
print(inf_output_imsg)
return 2.0 * np.pi / copy(d)


Expand Down
Loading
Loading