Skip to content

Commit

Permalink
Fix for first bug
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-wilkins committed Dec 7, 2023
1 parent 8edf310 commit 30f8bf0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions sasdata/data_util/averaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ class DirectionalAverage:
def __init__(self,
major_axis: ArrayLike,
minor_axis: ArrayLike,
major_lims: Optional[tuple[float, float]]=None,
minor_lims: Optional[tuple[float, float]]=None,
nbins: int=100):
major_lims: Optional[tuple[float, float]] = None,
minor_lims: Optional[tuple[float, float]] = None,
nbins: int = 100):
"""
Set up direction of averaging, limits on the ROI, & the number of bins.
Expand All @@ -95,8 +95,12 @@ def __init__(self,
raise ValueError(msg)

if not isinstance(nbins, int):
msg = "Parameter 'nbins' must be an integer"
raise TypeError(msg)
# TODO: Make classes that depend on this provide ints, its quite a thing to fix though
try:
nbins = int(nbins)
except:
msg = f"Parameter 'nbins' must should be convertable to an integer via int(), got type {type(nbins)} (={nbins})"
raise TypeError(msg)

self.major_axis = np.asarray(major_axis)
self.minor_axis = np.asarray(minor_axis)
Expand Down Expand Up @@ -685,7 +689,7 @@ def __init__(self, r_min: float, r_max: float, phi_min: float,
"""
super().__init__(r_min=r_min, r_max=r_max,
phi_min=phi_min, phi_max=phi_max)

self.nbins = nbins
self.fold = fold

Expand Down

0 comments on commit 30f8bf0

Please sign in to comment.