@@ -60,16 +60,16 @@ def __init__(
6060 # we want the local coordinates to start at 0
6161 # otherwise uses provided origin. This is useful for having multiple bounding boxes rela
6262 if global_origin is not None and origin is None :
63- origin = np .zeros (np .array (global_origin ).shape )
63+ origin = np .zeros (np .array (global_origin ).shape , dtype = float )
6464 if global_maximum is not None and global_origin is not None :
65- maximum = np .array (global_maximum ) - np .array (global_origin )
66-
65+ maximum = np .array (global_maximum , dtype = float ) - np .array (global_origin , dtype = float )
66+
6767 if maximum is None and nsteps is not None and step_vector is not None :
6868 maximum = np .array (origin ) + np .array (nsteps ) * np .array (step_vector )
6969 if origin is not None and global_origin is None :
7070 global_origin = np .zeros (3 )
71- self ._origin = np .array (origin )
72- self ._maximum = np .array (maximum )
71+ self ._origin = np .array (origin , dtype = float )
72+ self ._maximum = np .array (maximum , dtype = float )
7373 self .dimensions = dimensions
7474 if self .origin .shape :
7575 if self .origin .shape [0 ] != self .dimensions :
@@ -80,7 +80,10 @@ def __init__(
8080 else :
8181 self .dimensions = dimensions
8282 self ._global_origin = global_origin
83- self .nsteps = np .array ([50 , 50 , 25 ])
83+ if self .origin is not None and self .maximum is not None :
84+ self .nelements = 10_000
85+ else :
86+ self .nsteps = np .array ([50 , 50 , 25 ])
8487 if nsteps is not None :
8588 self .nsteps = np .array (nsteps )
8689 self .name_map = {
@@ -219,6 +222,7 @@ def nelements(self):
219222 int
220223 Total number of elements (product of nsteps)
221224 """
225+
222226 return self .nsteps .prod ()
223227
224228 @property
@@ -230,7 +234,9 @@ def volume(self):
230234 float
231235 Volume of the bounding box
232236 """
233- return np .prod (self .maximum - self .origin )
237+ length = self .maximum - self .origin
238+ length = length .astype (float )
239+ return np .prod (length )
234240
235241 @property
236242 def bb (self ):
0 commit comments