Add pdf for coldens

This commit is contained in:
Noe Brucy
2019-05-13 16:03:46 +02:00
parent 7b3793cff6
commit db17181fea
2 changed files with 373 additions and 67 deletions
+46 -8
View File
@@ -57,17 +57,36 @@ parser.add_argument(
help="plot evolution of quantities over time",
action="store_true",
)
parser.add_argument(
"--pdf", help="plot pdf of fluctuations of column density", action="store_true"
)
parser.add_argument(
"--fft", help="use quick and dirty fft rendering", action="store_true"
)
parser.add_argument("--level", help="plot levels", action="store_true")
parser.add_argument("--cpu", help="plot cpu", action="store_true")
parser.add_argument(
"-ms",
"--mapsize",
help="size of the maps created in he map mode (in pixel)",
type=int,
default=1024,
)
parser.add_argument(
"--nb_bin", help="Number of bins for azimuthal averages", type=int, default=50
)
parser.add_argument(
"--binning",
help="Kind of binning (logarithmic or linear)",
choices=["log", "lin"],
default="log",
)
parser.add_argument(
"--rad_ext", help="Value of the highest bin", type=float, default=1.0
)
parser.add_argument(
"-x", help="x position of the central point", type=float, default=1.0
)
@@ -125,13 +144,15 @@ for run in runs:
while not success:
try:
maps_disk = None
if args.maps:
dp.make_image_disk(
print("[{}, {}] computing maps".format(run, i))
maps_disk = dp.make_image_disk(
path_in,
i,
path_out=path_out,
tag=run,
map_size=1024,
map_size=args.mapsize,
force=args.force_redo,
level=args.level,
cpu=args.cpu,
@@ -139,17 +160,22 @@ for run in runs:
fft=args.fft,
interactive=args.interactive,
)
if args.disk or args.compare or args.evolution:
print("[{}, {}] maps computed".format(run, i))
if args.disk:
print("[{}, {}] computing disk props".format(run, i))
dp.disk_prop(
path_in,
i,
path_out=path_out,
rad_ext=1,
nb_bin=args.nb_bin,
binning=args.binning,
rad_ext=args.rad_ext,
force=args.force_redo,
pos_star=np.array([args.x, args.y, args.z]),
)
print("[{}, {}] disk_props computed".format(run, i))
if args.disk:
print("[{}, {}] plotting disk props".format(run, i))
dp.plot_disk_prop(
path_out,
i,
@@ -157,14 +183,26 @@ for run in runs:
force=args.force_redo,
interactive=args.interactive,
)
print("[{}, {}] disk props plotted".format(run, i))
if args.pdf:
print("[{}, {}] computing pdf".format(run, i))
dp.disk_pdf(
path_out,
i,
maps_disk,
pos_star=np.array([args.x, args.y, args.z]),
force=args.force_redo,
tag=run,
interactive=args.interactive,
)
print("[{}, {}] pdf computed".format(run, i))
success = True
except ValueError:
except ValueError as e:
print(e)
if args.watch and failures < args.allowed_failures:
failures = failures + 1
print(
"Unable to proceed for run {} \
output {}. Trying again in {} s ({} \
tries remaining)".format(
"Unable to proceed for run {} output {}. Trying again in {} s ({} tries remaining)".format(
run, i, args.waiting_time, args.allowed_failures - failures
)
)