Skip to content

Commit 924615e

Browse files
chore: apply formatting and doc updates from recookiecut
1 parent 8325d65 commit 924615e

9 files changed

+46
-54
lines changed

.github/workflows/build-wheel-release-upload.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
push:
66
tags:
7-
- '*' # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml
7+
- "*" # Trigger on all tags initially, but tag and release privilege are verified in _build-wheel-release-upload.yml
88

99
jobs:
1010
release:

.github/workflows/check-news-item.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Check for News
33
on:
44
pull_request_target:
55
branches:
6-
- main
6+
- main
77

88
jobs:
99
check-news-item:

.github/workflows/matrix-and-codecov-on-merge-to-main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
2424
python-version: ["3.11", "3.12", "3.13"]
2525
env:
26-
LATEST_PYTHON_VERSION: "3.13"
26+
LATEST_PYTHON_VERSION: "3.13"
2727
steps:
2828
- name: Check out diffpy.labpdfproc
2929
uses: actions/checkout@v4

.github/workflows/tests-on-pr.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ jobs:
3939
pip install gooey
4040
python -m pip install . --no-deps
4141
42-
4342
- name: Validate diffpy.labpdfproc
4443
run: |
4544
pytest --cov

src/diffpy/labpdfproc/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
16-
"""Tools for processing x-ray powder diffraction data
17-
from laboratory sources."""
15+
"""Tools for processing x-ray powder diffraction data from laboratory
16+
sources."""
1817

1918
# package version
2019
from diffpy.labpdfproc.version import __version__

src/diffpy/labpdfproc/functions.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ def __init__(
4040
self._get_grid_points()
4141

4242
def _get_grid_points(self):
43-
"""Given a radius and a grid size,
44-
return a grid of points to uniformly sample that circle."""
43+
"""Given a radius and a grid size, return a grid of points to uniformly
44+
sample that circle."""
4545
xs = np.linspace(-self.radius, self.radius, self.npoints)
4646
ys = np.linspace(-self.radius, self.radius, self.npoints)
4747
self.grid = {
@@ -50,8 +50,8 @@ def _get_grid_points(self):
5050
self.total_points_in_grid = len(self.grid)
5151

5252
def _get_entry_exit_coordinates(self, coordinate, angle):
53-
"""Get the coordinates where the beam enters and leaves the circle
54-
for a given angle and grid point.
53+
"""Get the coordinates where the beam enters and leaves the circle for
54+
a given angle and grid point.
5555
5656
It is calculated in the following way:
5757
For the entry coordinate,
@@ -108,9 +108,8 @@ def _get_entry_exit_coordinates(self, coordinate, angle):
108108
return entry_point, exit_point
109109

110110
def _get_path_length(self, grid_point, angle):
111-
"""Return the path length of
112-
a horizontal line entering the circle at the same height
113-
to the grid point then exiting at angle.
111+
"""Return the path length of a horizontal line entering the circle at
112+
the same height to the grid point then exiting at angle.
114113
115114
Parameters
116115
----------
@@ -137,8 +136,8 @@ def _get_path_length(self, grid_point, angle):
137136
return total_distance, primary_distance, secondary_distance
138137

139138
def set_distances_at_angle(self, angle):
140-
"""Given an angle, set the distances from the grid points
141-
to the entry and exit coordinates.
139+
"""Given an angle, set the distances from the grid points to the entry
140+
and exit coordinates.
142141
143142
Parameters
144143
----------
@@ -171,9 +170,11 @@ def set_muls_at_angle(self, angle):
171170

172171

173172
def _cve_brute_force(input_pattern, mud):
174-
"""Compute cve for the given mud on a global grid
175-
using the brute-force method.
176-
Assume mu=mud/2, given that the same mu*D yields the same cve and D/2=1.
173+
"""Compute cve for the given mud on a global grid using the brute-force
174+
method.
175+
176+
Assume mu=mud/2, given that the same mu*D yields the same cve and
177+
D/2=1.
177178
"""
178179
mu_sample_invmm = mud / 2
179180
abs_correction = Gridded_circle(
@@ -201,10 +202,8 @@ def _cve_brute_force(input_pattern, mud):
201202

202203

203204
def _cve_polynomial_interpolation(input_pattern, mud):
204-
"""Compute cve using polynomial interpolation method,
205-
default to brute-force computation if mu*D is
206-
out of the range (0.5 to 7).
207-
"""
205+
"""Compute cve using polynomial interpolation method, default to brute-
206+
force computation if mu*D is out of the range (0.5 to 7)."""
208207
if mud > 7 or mud < 0.5:
209208
warnings.warn(
210209
f"Input mu*D = {mud} is out of the acceptable range "
@@ -287,8 +286,8 @@ def compute_cve(
287286

288287

289288
def apply_corr(input_pattern, absorption_correction):
290-
"""Apply absorption correction to the given diffraction object
291-
with the correction diffraction object.
289+
"""Apply absorption correction to the given diffraction object with the
290+
correction diffraction object.
292291
293292
Parameters
294293
----------

src/diffpy/labpdfproc/tools.py

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,9 @@ def _expand_user_input(args):
114114

115115

116116
def set_input_lists(args):
117-
"""Set input directory and files.
118-
It takes cli inputs, checks if they are files or directories
119-
and creates a list of files to be processed
120-
which is stored in the args Namespace.
117+
"""Set input directory and files. It takes cli inputs, checks if they are
118+
files or directories and creates a list of files to be processed which is
119+
stored in the args Namespace.
121120
122121
Parameters
123122
----------
@@ -278,8 +277,8 @@ def set_wavelength(args):
278277

279278

280279
def set_xtype(args):
281-
"""Set the xtype based on the given input arguments,
282-
raise an error if xtype is not one of {*XQUANTITIES, }.
280+
"""Set the xtype based on the given input arguments, raise an error if
281+
xtype is not one of {*XQUANTITIES, }.
283282
284283
Parameters
285284
----------
@@ -334,8 +333,8 @@ def _parse_theoretical_input(input_str):
334333

335334

336335
def _set_theoretical_mud_from_density(args):
337-
"""Theoretical estimation of mu*D from
338-
sample composition, energy, and sample mass density."""
336+
"""Theoretical estimation of mu*D from sample composition, energy, and
337+
sample mass density."""
339338
sample_composition, energy, sample_mass_density = _parse_theoretical_input(
340339
args.theoretical_from_density
341340
)
@@ -351,8 +350,8 @@ def _set_theoretical_mud_from_density(args):
351350

352351

353352
def _set_theoretical_mud_from_packing(args):
354-
"""Theoretical estimation of mu*D from
355-
sample composition, energy, and packing fraction."""
353+
"""Theoretical estimation of mu*D from sample composition, energy, and
354+
packing fraction."""
356355
sample_composition, energy, packing_fraction = _parse_theoretical_input(
357356
args.theoretical_from_packing
358357
)
@@ -404,8 +403,8 @@ def _load_key_value_pair(s):
404403

405404

406405
def load_user_metadata(args):
407-
"""Load user metadata into args,
408-
raise ValueError if it is in incorrect format.
406+
"""Load user metadata into args, raise ValueError if it is in incorrect
407+
format.
409408
410409
Parameters
411410
----------
@@ -444,10 +443,9 @@ def load_user_metadata(args):
444443

445444

446445
def load_user_info(args):
447-
"""Load user info into args.
448-
If none is provided, call check_and_build_global_config function
449-
from diffpy.utils to prompt the user for inputs.
450-
Otherwise, call get_user_info with the provided arguments.
446+
"""Load user info into args. If none is provided, call
447+
check_and_build_global_config function from diffpy.utils to prompt the user
448+
for inputs. Otherwise, call get_user_info with the provided arguments.
451449
452450
Parameters
453451
----------
@@ -474,8 +472,8 @@ def load_user_info(args):
474472

475473

476474
def load_package_info(args):
477-
"""Load diffpy.labpdfproc package name and version into args
478-
using get_package_info function from diffpy.utils.
475+
"""Load diffpy.labpdfproc package name and version into args using
476+
get_package_info function from diffpy.utils.
479477
480478
Parameters
481479
----------
@@ -494,10 +492,9 @@ def load_package_info(args):
494492

495493

496494
def preprocessing_args(args):
497-
"""Perform preprocessing on the provided args.
498-
The process includes loading package and user information,
499-
setting input, output, wavelength, anode type, xtype, mu*D,
500-
and loading user metadata.
495+
"""Perform preprocessing on the provided args. The process includes loading
496+
package and user information, setting input, output, wavelength, anode
497+
type, xtype, mu*D, and loading user metadata.
501498
502499
Parameters
503500
----------
@@ -521,8 +518,8 @@ def preprocessing_args(args):
521518

522519

523520
def load_metadata(args, filepath):
524-
"""Load the relevant metadata from args
525-
to write into the header of the output files.
521+
"""Load the relevant metadata from args to write into the header of the
522+
output files.
526523
527524
Parameters
528525
----------

src/diffpy/labpdfproc/version.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See LICENSE.rst for license information.
1313
#
1414
##############################################################################
15-
1615
"""Definition of __version__."""
1716

1817
# We do not use the other three variables, but can be added back if needed.

tests/test_version.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
"""Unit tests for __version__.py
2-
"""
1+
"""Unit tests for __version__.py."""
32

43
import diffpy.labpdfproc
54

65

76
def test_package_version():
8-
"""Ensure the package version is defined
9-
and not set to the initial placeholder."""
7+
"""Ensure the package version is defined and not set to the initial
8+
placeholder."""
109
assert hasattr(diffpy.labpdfproc, "__version__")
1110
assert diffpy.labpdfproc.__version__ != "0.0.0"

0 commit comments

Comments
 (0)