Skip to content

Commit

Permalink
Fixed docstring examples
Browse files Browse the repository at this point in the history
Signed-off-by: tgwoodcock <[email protected]>
  • Loading branch information
tgwoodcock committed Dec 10, 2024
1 parent 07ed838 commit 67e8df8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions src/kikuchipy/_utils/_detector_coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def get_coordinate_conversions(gnomonic_bounds: np.ndarray, bounds: np.ndarray)
>>> import numpy as np
>>> import kikuchipy as kp
>>> from kp._utils._detector_coordinates import get_coordinate_conversions
>>> from kikuchipy._utils._detector_coordinates import get_coordinate_conversions
>>> det = kp.detectors.EBSDDetector(
... shape=(60, 60),
... pc=np.ones((10, 20, 3)) * (0.421, 0.779, 0.505),
Expand Down Expand Up @@ -190,7 +190,7 @@ def convert_coordinates(
>>> import numpy as np
>>> import kikuchipy as kp
>>> from kp._utils._detector_coordinates import (get_coordinate_conversions, convert_coordinates)
>>> from kikuchipy._utils._detector_coordinates import (get_coordinate_conversions, convert_coordinates)
>>> s = kp.data.nickel_ebsd_small()
>>> det = s.detector
>>> det.navigation_shape
Expand All @@ -207,7 +207,7 @@ def convert_coordinates(
>>> import numpy as np
>>> import kikuchipy as kp
>>> from kp._utils._detector_coordinates import (get_coordinate_conversions, convert_coordinates)
>>> from kikuchipy._utils._detector_coordinates import (get_coordinate_conversions, convert_coordinates)
>>> s = kp.data.nickel_ebsd_small()
>>> det = s.detector
>>> det.navigation_shape
Expand All @@ -224,7 +224,7 @@ def convert_coordinates(
>>> import numpy as np
>>> import kikuchipy as kp
>>> from kp._utils._detector_coordinates import (get_coordinate_conversions, convert_coordinates)
>>> from kikuchipy._utils._detector_coordinates import (get_coordinate_conversions, convert_coordinates)
>>> s = kp.data.nickel_ebsd_small()
>>> det = s.detector
>>> det.navigation_shape
Expand All @@ -241,7 +241,7 @@ def convert_coordinates(
>>> import numpy as np
>>> import kikuchipy as kp
>>> from kp._utils._detector_coordinates import (get_coordinate_conversions, convert_coordinates)
>>> from kikuchipy._utils._detector_coordinates import (get_coordinate_conversions, convert_coordinates)
>>> s = kp.data.nickel_ebsd_small()
>>> det = s.detector
>>> det.navigation_shape
Expand Down
14 changes: 7 additions & 7 deletions src/kikuchipy/detectors/ebsd_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class EBSDDetector:
... sample_tilt=70,
... )
>>> det
EBSDDetector(shape=(60, 60), pc=(0.421, 0.221, 0.505), sample_tilt=70.0, tilt=5.0, azimuthal=0.0, binning=8.0, px_size=70.0 um)
EBSDDetector(shape=(60, 60), pc=(0.421, 0.221, 0.505), sample_tilt=70.0, tilt=5.0, azimuthal=0.0, twist=0.0, binning=8.0, px_size=70.0 um)
>>> det.navigation_shape
(10, 20)
>>> det.bounds
Expand Down Expand Up @@ -689,11 +689,11 @@ def convert_detector_coordinates(
array([[[ 0.36223464, 0.00664684],
[ 0.35762801, -0.00304659],
[ 0.35361398, -0.00042112]],
<BLANKLINE>
[[ 0.36432453, 0.00973461],
[ 0.35219231, 0.00567801],
[ 0.34417285, 0.00404584]],
<BLANKLINE>
[[ 0.36296371, 0.00072557],
[ 0.34447751, 0.00538137],
[ 0.36136688, 0.00180754]]])
Expand Down Expand Up @@ -743,9 +743,9 @@ def crop(self, extent: tuple[int, int, int, int] | list[int]) -> EBSDDetector:
>>> import kikuchipy as kp
>>> det = kp.detectors.EBSDDetector((6, 6), pc=[3 / 6, 2 / 6, 0.5])
>>> det
EBSDDetector(shape=(6, 6), pc=(0.5, 0.333, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=1.0, px_size=1.0 um)
EBSDDetector(shape=(6, 6), pc=(0.5, 0.333, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, twist=0.0, binning=1.0, px_size=1.0 um)
>>> det.crop((1, 5, 2, 6))
EBSDDetector(shape=(4, 4), pc=(0.25, 0.25, 0.75), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=1.0, px_size=1.0 um)
EBSDDetector(shape=(4, 4), pc=(0.25, 0.25, 0.75), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, twist=0.0, binning=1.0, px_size=1.0 um)
Plot a cropped detector with the PC on a cropped pattern
Expand Down Expand Up @@ -1681,12 +1681,12 @@ def plot_pc(
... shape=(480, 640), pc=(0.4, 0.3, 0.5), px_size=70, sample_tilt=70
... )
>>> det0
EBSDDetector(shape=(480, 640), pc=(0.4, 0.3, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=1.0, px_size=70.0 um)
EBSDDetector(shape=(480, 640), pc=(0.4, 0.3, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, twist=0.0, binning=1.0, px_size=70.0 um)
>>> det = det0.extrapolate_pc(
... pc_indices=[0, 0], navigation_shape=(5, 10), step_sizes=(20, 20)
... )
>>> det
EBSDDetector(shape=(480, 640), pc=(0.398, 0.299, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=1.0, px_size=70.0 um)
EBSDDetector(shape=(480, 640), pc=(0.398, 0.299, 0.5), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, twist=0.0, binning=1.0, px_size=70.0 um)
Plot PC values in maps
Expand Down
2 changes: 1 addition & 1 deletion src/kikuchipy/signals/ebsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ class EBSD(KikuchipySignal2D):
>>> s
<EBSD, title: patterns Scan 1, dimensions: (3, 3|60, 60)>
>>> s.detector
EBSDDetector(shape=(60, 60), pc=(0.425, 0.213, 0.501), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, binning=8.0, px_size=1.0 um)
EBSDDetector(shape=(60, 60), pc=(0.425, 0.213, 0.501), sample_tilt=70.0, tilt=0.0, azimuthal=0.0, twist=0.0, binning=8.0, px_size=1.0 um)
>>> s.static_background
array([[84, 87, 90, ..., 27, 29, 30],
[87, 90, 93, ..., 27, 28, 30],
Expand Down

0 comments on commit 67e8df8

Please sign in to comment.