@@ -113,7 +113,7 @@ def makemasses(i, j, k):
113113 center = center ,
114114 data_source = source ,
115115 )
116- img = prj .frb .data [( "gas" , "density" ) ]
116+ img = prj .frb .data ["gas" , "density" ]
117117 if weighted :
118118 expected_out = np .zeros (
119119 (
@@ -240,7 +240,7 @@ def makemasses(i, j, k):
240240 buff_size = (outgridsize ,) * 2 ,
241241 center = (_center , "cm" ),
242242 )
243- img = slc .frb .data [( "gas" , "density" ) ]
243+ img = slc .frb .data ["gas" , "density" ]
244244
245245 # center is same in non-projection coords
246246 if axis == 0 :
@@ -272,9 +272,9 @@ def makemasses(i, j, k):
272272 ad = ds .all_data ()
273273 sphcoords = np .array (
274274 [
275- (ad [( "gas" , "x" ) ]).to ("cm" ),
276- (ad [( "gas" , "y" ) ]).to ("cm" ),
277- (ad [( "gas" , "z" ) ]).to ("cm" ),
275+ (ad ["gas" , "x" ]).to ("cm" ),
276+ (ad ["gas" , "y" ]).to ("cm" ),
277+ (ad ["gas" , "z" ]).to ("cm" ),
278278 ]
279279 ).T
280280 # print("sphcoords:")
@@ -289,15 +289,12 @@ def makemasses(i, j, k):
289289 )
290290 # print("dists <= 1:")
291291 # print(dists <= 1)
292- sml = (ad [( "gas" , "smoothing_length" ) ]).to ("cm" )
292+ sml = (ad ["gas" , "smoothing_length" ]).to ("cm" )
293293 normkern = cubicspline_python (dists / sml .v [np .newaxis , :])
294- sphcontr = normkern / sml [np .newaxis , :] ** 3 * ad [( "gas" , "mass" ) ]
294+ sphcontr = normkern / sml [np .newaxis , :] ** 3 * ad ["gas" , "mass" ]
295295 contsum = np .sum (sphcontr , axis = 1 )
296296 sphweights = (
297- normkern
298- / sml [np .newaxis , :] ** 3
299- * ad [("gas" , "mass" )]
300- / ad [("gas" , "density" )]
297+ normkern / sml [np .newaxis , :] ** 3 * ad ["gas" , "mass" ] / ad ["gas" , "density" ]
301298 )
302299 weights = np .sum (sphweights , axis = 1 )
303300 nzeromask = np .logical_not (weights == 0 )
@@ -406,7 +403,7 @@ def makemasses(i, j, k):
406403 center = (_center , "cm" ),
407404 north_vector = e2dir ,
408405 )
409- img = slc .frb .data [( "gas" , "density" ) ]
406+ img = slc .frb .data ["gas" , "density" ]
410407
411408 # center is same in x/y (e3dir/e2dir)
412409 gridcenx = (
@@ -434,9 +431,9 @@ def makemasses(i, j, k):
434431 ad = ds .all_data ()
435432 sphcoords = np .array (
436433 [
437- (ad [( "gas" , "x" ) ]).to ("cm" ),
438- (ad [( "gas" , "y" ) ]).to ("cm" ),
439- (ad [( "gas" , "z" ) ]).to ("cm" ),
434+ (ad ["gas" , "x" ]).to ("cm" ),
435+ (ad ["gas" , "y" ]).to ("cm" ),
436+ (ad ["gas" , "z" ]).to ("cm" ),
440437 ]
441438 ).T
442439 dists = distancematrix (
@@ -445,15 +442,12 @@ def makemasses(i, j, k):
445442 periodic = (periodic ,) * 3 ,
446443 periods = np .array ([3.0 , 3.0 , 3.0 ]),
447444 )
448- sml = (ad [( "gas" , "smoothing_length" ) ]).to ("cm" )
445+ sml = (ad ["gas" , "smoothing_length" ]).to ("cm" )
449446 normkern = cubicspline_python (dists / sml .v [np .newaxis , :])
450- sphcontr = normkern / sml [np .newaxis , :] ** 3 * ad [( "gas" , "mass" ) ]
447+ sphcontr = normkern / sml [np .newaxis , :] ** 3 * ad ["gas" , "mass" ]
451448 contsum = np .sum (sphcontr , axis = 1 )
452449 sphweights = (
453- normkern
454- / sml [np .newaxis , :] ** 3
455- * ad [("gas" , "mass" )]
456- / ad [("gas" , "density" )]
450+ normkern / sml [np .newaxis , :] ** 3 * ad ["gas" , "mass" ] / ad ["gas" , "density" ]
457451 )
458452 weights = np .sum (sphweights , axis = 1 )
459453 nzeromask = np .logical_not (weights == 0 )
@@ -509,9 +503,9 @@ def test_sph_grid(
509503 ad = ds .all_data ()
510504 sphcoords = np .array (
511505 [
512- (ad [( "gas" , "x" ) ]).to ("cm" ),
513- (ad [( "gas" , "y" ) ]).to ("cm" ),
514- (ad [( "gas" , "z" ) ]).to ("cm" ),
506+ (ad ["gas" , "x" ]).to ("cm" ),
507+ (ad ["gas" , "y" ]).to ("cm" ),
508+ (ad ["gas" , "z" ]).to ("cm" ),
515509 ]
516510 ).T
517511 gridx , gridy , gridz = np .meshgrid (xcens , ycens , zcens , indexing = "ij" )
@@ -522,15 +516,12 @@ def test_sph_grid(
522516 gridcoords = np .array ([gridx , gridy , gridz ]).T
523517 periods = bbox [:, 1 ] - bbox [:, 0 ]
524518 dists = distancematrix (gridcoords , sphcoords , periodic = periodic , periods = periods )
525- sml = (ad [( "gas" , "smoothing_length" ) ]).to ("cm" )
519+ sml = (ad ["gas" , "smoothing_length" ]).to ("cm" )
526520 normkern = cubicspline_python (dists / sml .v [np .newaxis , :])
527- sphcontr = normkern / sml [np .newaxis , :] ** 3 * ad [( "gas" , "mass" ) ]
521+ sphcontr = normkern / sml [np .newaxis , :] ** 3 * ad ["gas" , "mass" ]
528522 contsum = np .sum (sphcontr , axis = 1 )
529523 sphweights = (
530- normkern
531- / sml [np .newaxis , :] ** 3
532- * ad [("gas" , "mass" )]
533- / ad [("gas" , "density" )]
524+ normkern / sml [np .newaxis , :] ** 3 * ad ["gas" , "mass" ] / ad ["gas" , "density" ]
534525 )
535526 weights = np .sum (sphweights , axis = 1 )
536527 nzeromask = np .logical_not (weights == 0 )
0 commit comments