Skip to content

Commit

Permalink
Fix remedy_scales to accept ndarray arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
kburns committed Jan 15, 2024
1 parent 161dc7b commit d253239
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dedalus/core/distributor.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import itertools
from collections import OrderedDict
from math import prod
import numbers

from .coords import CoordinateSystem, DirectProduct
from ..tools.array import reshape_vector
Expand Down Expand Up @@ -185,11 +186,12 @@ def remedy_scales(self, scales):
"""Remedy different scale inputs."""
if scales is None:
scales = 1
if not isinstance(scales, (list, tuple)):
scales = [scales] * self.dim
if isinstance(scales, numbers.Number):
scales = (scales,) * self.dim
scales = tuple(scales)
if 0 in scales:
raise ValueError("Scales must be nonzero.")
return tuple(scales)
return scales

def get_transform_object(self, axis):
return self.transforms[axis]
Expand Down

0 comments on commit d253239

Please sign in to comment.