black (still without mortimer)

This commit is contained in:
Noe Brucy
2023-01-30 12:12:14 +01:00
parent 8c3db9b7cb
commit 1a8db42d29
11 changed files with 474 additions and 99 deletions
+3 -3
View File
@@ -99,7 +99,7 @@ def plot_each_scale(S11a, wav_k, q, label, coherent=False, reso=1):
for scl in range(0, M):
plt.figure(figsize=(6, 6))
# determine bins (large scales should have less bins)
nbins = np.int(nsize ** 2.0 * (wav_k[scl] * reso) ** 2.0)
nbins = np.int(nsize**2.0 * (wav_k[scl] * reso) ** 2.0)
nbins = max(9, nbins)
nbins = min(500, nbins)
# calc histogram gaussian component w.r.t. its mean value (easier to compare)
@@ -192,8 +192,8 @@ def plot_components_power_spectrum(
# show resolution limits
# Gaussian part not accurate below levelmin due to the way AMR works
sim_res_eff = 2 ** lvlmin / 10
sim_res_lvl_min = 2 ** lvlmin
sim_res_eff = 2**lvlmin / 10
sim_res_lvl_min = 2**lvlmin
plt.plot(
[sim_res_lvl_min / nsize, sim_res_lvl_min / nsize],
[1e-6, 1e8],
+5 -5
View File
@@ -111,7 +111,7 @@ def calc_k(n, nbinsk, nbig, dkbig, dim=3, saxis=2):
a[saxis] = np.zeros_like(k)
kx, ky, kz = np.meshgrid(a[0], a[1], a[2], indexing="ij")
cube_k = np.sqrt(kx ** 2 + ky ** 2 + kz ** 2)
cube_k = np.sqrt(kx**2 + ky**2 + kz**2)
cubes_k = {"kx": kx, "ky": ky, "kz": kz, "k": cube_k}
@@ -293,7 +293,7 @@ def proj_B(cubes_k, kbins, vec, var="", dim=3, saxis=2, update=False):
vind = tuple(vind)
vec_z = vec_z[vind + (slice(None),)]
vnorm = np.sqrt(np.sum(vec_z ** 2, axis=-1))
vnorm = np.sqrt(np.sum(vec_z**2, axis=-1))
kpar = np.zeros_like(cubes_k["k"])
for i, d in enumerate(["x", "y", "z"]):
@@ -572,7 +572,7 @@ def main(arg):
distance=arg.size / 2.0,
far_cut_depth=arg.size / 2.0,
up_vector="y",
map_max_size=2 ** clvl,
map_max_size=2**clvl,
)
cubes = {}
@@ -584,7 +584,7 @@ def main(arg):
operator = ScalarOperator(cube_vars[i], cube_units[i])
extractor = cube3d.CubeExtractor(amr, operator)
cubes[v] = extractor.process(
cam, cube_size=arg.size, resolution=2 ** clvl
cam, cube_size=arg.size, resolution=2**clvl
).data
else:
h5f = T.open_file("cube.hdf5", "r")
@@ -833,7 +833,7 @@ def main(arg):
print("Compute 2D power spectra")
# 2D power spectra -------------------------------------------------------------
ns = 2 ** clvl
ns = 2**clvl
f = "_%%(i)0%dd" % (np.floor(np.log10(ns)) + 1)
for v in list(pcubes2.keys()):
for i in range(ns):