@@ -276,18 +276,19 @@ def fcoords(self):
276276 np .mgrid [0 : 1 : self .nd * 1j , 0 : 1 : self .nd * 1j , 0 : 1 : self .nd * 1j ]
277277 )
278278 if self .flat :
279- fc . shape = (self .nd * self .nd * self .nd , 3 )
279+ fc = fc . reshape (self .nd * self .nd * self .nd , 3 )
280280 else :
281281 fc = fc .transpose ()
282282 return self .ds .arr (fc , units = "code_length" )
283283
284284 @property
285285 def fcoords_vertex (self ):
286- rng = np .random .default_rng ()
287- fc = rng .random ((self .nd , self .nd , self .nd , 8 , 3 ))
288286 if self .flat :
289- fc .shape = (self .nd * self .nd * self .nd , 8 , 3 )
290- return self .ds .arr (fc , units = "code_length" )
287+ shape = (self .nd * self .nd * self .nd , 8 , 3 )
288+ else :
289+ shape = (self .nd , self .nd , self .nd , 8 , 3 )
290+ rng = np .random .default_rng ()
291+ return self .ds .arr (rng .random (shape ), units = "code_length" )
291292
292293 @property
293294 def icoords (self ):
@@ -297,21 +298,23 @@ def icoords(self):
297298 0 : self .nd - 1 : self .nd * 1j ,
298299 ]
299300 if self .flat :
300- ic .shape = (self .nd * self .nd * self .nd , 3 )
301+ return ic .reshape (self .nd * self .nd * self .nd , 3 )
301302 else :
302- ic = ic .transpose ()
303- return ic
303+ return ic .transpose ()
304304
305305 @property
306306 def ires (self ):
307- ir = np .ones (self .nd ** 3 , dtype = "int64" )
308- if not self .flat :
309- ir .shape = (self .nd , self .nd , self .nd )
310- return ir
307+ if self .flat :
308+ shape = (self .nd ** 3 ,)
309+ else :
310+ shape = (self .nd , self .nd , self .nd )
311+ return np .ones (shape , dtype = "int64" )
311312
312313 @property
313314 def fwidth (self ):
314- fw = np .ones ((self .nd ** 3 , 3 ), dtype = "float64" ) / self .nd
315- if not self .flat :
316- fw .shape = (self .nd , self .nd , self .nd , 3 )
315+ if self .flat :
316+ shape = (self .nd ** 3 , 3 )
317+ else :
318+ shape = (self .nd , self .nd , self .nd , 3 )
319+ fw = np .full (shape , 1 / self .nd , dtype = "float64" )
317320 return self .ds .arr (fw , units = "code_length" )
0 commit comments