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

Added basic function to plot maps with minimal needs and settings (useful when...

Added basic function to plot maps with minimal needs and settings (useful when output 1 and no halo exists).
parent 5030369d
......@@ -82,4 +82,36 @@ def compute_aout(dt=10, z_init=15, nbins=10, zmin=None, checktimes=False):
if checktimes:
for a in aout: # If you want to check
print((cosmo.age(1/a-1)).to(u.Myr))
return aout
\ No newline at end of file
return aout
def minimalmap():
""" Plot whatever quickly with this."""
from minirats.utils.py import cellutils as cu
from ratatouille import readNsave as ras
import matplotlib.pyplot as plt
import numpy as np
timestep=1
RamsesDir = '1_cheap_runs/9_Agertz_code_menml256/'
info = ras.extract_info(timestep, RamsesDir, saveinfile=False)
center_plot = np.array([0.5,0.5,0.5])
radius = 0.5
readRT=False
idens = 1
ivx = 2
ivy = 3
ivz = 4
ipre = info['iP']+1
ixHII = info['iIons']+1
ixHeII = info['iIons']+2
ixHeIII = info['iIons']+3
iZ = info['iZ']+1
cells2load = [idens,ipre,ivx,ivy,ivz,ixHII,ixHeII,ixHeIII,iZ]
ncells = cu.py_cell_utils.count_cells(RamsesDir,timestep,-1,center_plot, radius)
cells,cell_pos,cell_l = cu.py_cell_utils.read_cells_hydro(RamsesDir,timestep,-1,ncells,cells2load,center_plot, radius,readRT)
lmax = cell_l.max()
nx,ny = cu.py_cell_utils.get_map_nxny(lmax,0,1,0,1)
map2plot,_ = cu.py_cell_utils.make_map_new(lmax,True,0,1,0,1,0,1,cell_l,np.ones_like(cells[:,-1]),cell_pos[:,0],cell_pos[:,1],cell_pos[:,2],cell_l,nx,ny)
im = plt.imshow(map2plot.T,interpolation='nearest',origin='lower',norm=None, extent=(0,1,0,1))
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