Commit d8e591fd authored by Maxime Rey's avatar Maxime Rey
Browse files

Improvement and typofix: had exchanged two values + replaced 'load_regions' by...

Improvement and typofix: had exchanged two values + replaced 'load_regions' by 'factor' as it was before.
parent fcff5f1b
......@@ -43,8 +43,6 @@ Common parameters:
Center and radius considered in [kpc].
center, radius: array of size 3, scalar
Center and radius considered in [kpc].
load_region:
Region loaded in [r200 units].
logscale: boolean
Plots in logscale if set to True and in linear scale otherwise.
vmin, vmax: scalar
......@@ -62,7 +60,7 @@ Common parameters:
###################################################################################################################################
############################################################# Starmap #############################################################
###################################################################################################################################
def starmap(RamsesDir, timestep, zoom=1/0.7, load_region=1, var1='x', var2='y',bins=300, centered=True, vmin=None, vmax=None, imsave=False):
def starmap(RamsesDir, timestep, zoom=1/0.7, factor=1, var1='x', var2='y',bins=300, centered=True, vmin=None, vmax=None, imsave=False):
"""
Returns a map of the stars.
......@@ -92,11 +90,11 @@ def starmap(RamsesDir, timestep, zoom=1/0.7, load_region=1, var1='x', var2='y',b
cu2cm = info['unit_l'] * info['boxlen']
cu2kpc = cu2cm * cm2kpc
center = [cen*cu2kpc for cen in center_cu]
if load_region=='fullbox':
if factor=='fullbox':
rad_plot = 1.1*cu2kpc/zoom
else:
rad_plot = radius_cu*load_region*cu2kpc/zoom
star_mass,star_x,star_y,star_z,_,star_age,_,_,_,_,_ = ras.extract_stars(RamsesDir, timestep, factor=load_region, rmsat=False, saveinfile=True)
rad_plot = radius_cu*factor*cu2kpc/zoom
star_mass,star_x,star_y,star_z,_,star_age,_,_,_,_,_ = ras.extract_stars(RamsesDir, timestep, factor=factor, rmsat=False, saveinfile=True)
if not imsave:
print(RamsesDir.partition('/')[2][2:-1], ' ', timestep, 'z = ', 1/info['aexp']-1)
......@@ -179,7 +177,7 @@ def starmap(RamsesDir, timestep, zoom=1/0.7, load_region=1, var1='x', var2='y',b
###################################################################################################################################
############################################################ Level map ############################################################
###################################################################################################################################
def levelmap(RamsesDir, timestep, zoom=1/0.7, load_region=1, in_pc=False, style='proj', proj='z', \
def levelmap(RamsesDir, timestep, zoom=1/0.7, factor=1, in_pc=False, style='proj', proj='z', \
vmin=None, centered=True, remove_ticks=True, lmax=None, slice_shift=0, imsave=False):
"""
Plot the of map of the resolution level of each cell in parsec or in level units (in_pc variable).
......@@ -196,16 +194,16 @@ def levelmap(RamsesDir, timestep, zoom=1/0.7, load_region=1, in_pc=False, style=
cu2cm = info['unit_l'] * info['boxlen']
cu2kpc = cu2cm / 3.086e21
center_plot = [cen*cu2kpc for cen in center]
if load_region=='fullbox':
if factor=='fullbox':
rad_plot = 1.1*cu2kpc/zoom
else:
rad_plot = radius*load_region*cu2kpc/zoom
rad_plot = radius*factor*cu2kpc/zoom
if not imsave:
print(RamsesDir.partition('/')[2][2:-1], ' ', timestep, 'z = ', 1/info['aexp']-1)
print('\t r200 =', radius*cu2kpc, 'kpc')
_, _, cell_pos, cell_l \
= ras.extract_cells(RamsesDir,timestep,factor=load_region,saveinfile=True,verbose=False)
= ras.extract_cells(RamsesDir,timestep,factor=factor,saveinfile=True,verbose=False)
# convert in cu ∈ [0,1] because make_map wants it
cell_pos_cu = cell_pos / cu2cm
......@@ -289,7 +287,7 @@ def levelmap(RamsesDir, timestep, zoom=1/0.7, load_region=1, in_pc=False, style=
###################################################################################################################################
def qtymap(RamsesDir, timestep, zoom=1, load_region=1/0.7, var_str='nH', wei_str="nH", style='proj', proj='y', is_cbar=True, cbar_top=False, scalebar=True, \
def qtymap(RamsesDir, timestep, zoom=1/0.7, factor=1, var_str='nH', wei_str="nH", style='proj', proj='y', is_cbar=True, cbar_top=False, scalebar=True, \
vmin=None, vmax=None, centered=True, remove_ticks=True, logscale=True, lmax=None, slice_shift = 0, imsave=False):
"""
Plots the map of a var_str weighted by wei_str.
......@@ -308,15 +306,15 @@ def qtymap(RamsesDir, timestep, zoom=1, load_region=1/0.7, var_str='nH', wei_str
cu2cm = info['unit_l'] * info['boxlen']
cu2kpc = cu2cm / 3.086e21
center_plot = [cen*cu2kpc for cen in center]
if load_region=='fullbox':
if factor=='fullbox':
rad_plot = 1.1*cu2kpc/zoom
else:
rad_plot = radius*load_region*cu2kpc/zoom
rad_plot = radius*factor*cu2kpc/zoom
if not imsave:
print(RamsesDir.partition('/')[2][2:-1], ' ', timestep, 'z = ', 1/info['aexp']-1)
print('\t r200 =', radius*cu2kpc, 'kpc')
ncells, cells, cell_pos, cell_l = ras.extract_cells(RamsesDir,timestep,factor=load_region,saveinfile=True,verbose=False)
ncells, cells, cell_pos, cell_l = ras.extract_cells(RamsesDir,timestep,factor=factor,saveinfile=True,verbose=False)
cell_dx, rho, nH, pres, vx, vy, vz, xHII, xHeII, xHeIII, mu, T, mass, Z = cells
# cmap_color = mpl.colors.LinearSegmentedColormap.from_list("", ["k","blue"]) # custom cmap
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment