black without mortimer

This commit is contained in:
Noe Brucy
2022-11-28 18:01:18 +01:00
parent 7548ef7e0a
commit fa396178c6
14 changed files with 371 additions and 304 deletions
+4 -5
View File
@@ -6,7 +6,7 @@ import aplpy
def make_images(im, wt, M, meanim, label):
""" show the Gaussian and coherent part of the image """
"""show the Gaussian and coherent part of the image"""
total = np.sum(wt[:M, :, :], axis=0).real + meanim
coherent = np.sum(wt[M : 2 * M, :, :], axis=0).real + meanim
@@ -52,7 +52,7 @@ def make_images(im, wt, M, meanim, label):
def scale_images(thingy, M, label, scale=14, mode="wt"):
""" visualize wt or S11a for a specific scale. Remark S11a = wt^2"""
"""visualize wt or S11a for a specific scale. Remark S11a = wt^2"""
total = thingy[scale, :, :].real
coherent = thingy[M + scale, :, :].real
Gaussian = thingy[2 * M + scale, :, :].real
@@ -93,7 +93,7 @@ def scale_images(thingy, M, label, scale=14, mode="wt"):
def plot_each_scale(S11a, wav_k, q, label, coherent=False, reso=1):
""" plot histogram at a certain scale """
"""plot histogram at a certain scale"""
nsize = len(S11a[0, 0, :])
M = len(q)
for scl in range(0, M):
@@ -237,7 +237,7 @@ def load_results(label):
def analyse_sim(im, load=False, scale_image=False):
""" Do the MnGseg analysis """
"""Do the MnGseg analysis"""
meanim = np.mean(im)
imzm = im - meanim
M = nb_scale(im.shape)
@@ -264,7 +264,6 @@ def analyse_sim(im, load=False, scale_image=False):
# make images of the Gaussian and coherent part
make_images(im, wt, M, meanim, label)
if scale_image:
# (optional) make the image for each scale
for s in range(fit_min, fit_max + 1):
+3 -13
View File
@@ -13,7 +13,6 @@ import pymses.utils.misc
import tables as T
from numpy.fft import fftn, ifft
from pymses.analysis import Camera, ScalarOperator, cube3d
import os
__generator__ = "pspec.py"
__version__ = "0.2"
@@ -62,8 +61,6 @@ def degrade_cube(cube, lvl, integrate=False):
return cube_new
def calc_k(n, nbinsk, nbig, dkbig, dim=3, saxis=2):
"""Make cubes containing the wave vectors, a list of bins and the
associated normalization factors
@@ -433,9 +430,7 @@ parser = argparse.ArgumentParser(
parser.add_argument(
"repo", help="RAMSES output repository", type=str, default=".", nargs="?"
)
parser.add_argument(
"iouts", help="output numbers", type=int, default=[1], nargs="+"
)
parser.add_argument("iouts", help="output numbers", type=int, default=[1], nargs="+")
parser.add_argument(
"outfile",
help="output file format (see below for fields)",
@@ -525,12 +520,7 @@ def main(arg):
read_lvl = None
if True:
# Load output ------------------------------------------------------------------
# If ratarmount was used
if os.path.exists(f"{self.path}/output_{self.num:05}/output_{self.num:05}"):
path = f"{arg.repo}/output_{self.num:05}"
else:
path = arg.repo
ro = pymses.RamsesOutput(path, iout, order=arg.order)
ro = pymses.RamsesOutput(arg.repo, iout, order=arg.order)
if arg.magnetic:
amr = ro.amr_source(["rho", "vel", "Bl", "Br"])
else:
@@ -576,7 +566,7 @@ def main(arg):
]
cam = Camera(
center=[0.5, 0.5, 0.5], #arg.center,
center=[0.5, 0.5, 0.5], # arg.center,
line_of_sight_axis="z",
region_size=[arg.size, arg.size],
distance=arg.size / 2.0,