Commit 3d8a5253 authored by Maxime Rey's avatar Maxime Rey
Browse files

Bugfix: was checking incorectly if timesteps were lists.

parent 26a32b63
......@@ -127,7 +127,7 @@ def PDF(what2plot, genpath, folders, timesteps, labels, weight=None, density=Tru
labels=['']
if (not isinstance(folders,list)):
folders=[folders]
if (not isinstance(timesteps,list)):
if isinstance(timesteps,float) or isinstance(timesteps,int):
timesteps=[timesteps]
fig, ax = plt.subplots(nrows=1, ncols=1, figsize=(10,6))
......@@ -268,7 +268,7 @@ def plot_phase_diag(genpath, folders, timesteps, var_str='H', cgm_gas=False, no_
folders=['']
if (not isinstance(folders,list)):
folders=[folders]
if (not isinstance(timesteps,list)) and (not isinstance(timesteps, np.ndarray)):
if isinstance(timesteps,float) or isinstance(timesteps,int):
timesteps=[timesteps]
if not isinstance(folders,(list,np.ndarray)):
......@@ -2523,7 +2523,7 @@ def plot_cgm_time(genpath, folders, labels, timesteps, shape="no_rebloch",factor
folders=[folders]
# If only one timestep input, takes all from the third one.
if isinstance(timesteps,int):
if isinstance(timesteps,float) or isinstance(timesteps,int):
timesteps=np.linspace(3,timesteps,timesteps-2,dtype=int) # All timesteps from the first
pc2cm = 3.086e18
......@@ -2552,7 +2552,7 @@ def plot_cgm_time(genpath, folders, labels, timesteps, shape="no_rebloch",factor
# cgm_vol_arr.append(cgm_vol/(pc2cm*1e3)**3 / V_200 # [V_cgm/V_200]
cgm_vol_arr.append(cgm_vol/(pc2cm*1e3)**3) # [kpc^3]
if info['is_cosmo']:
times.append(cosmo.age(1/info['aexp']-1).value) # [Gyrs]
times.append(cosmo.age(1/info['aexp']-1).value) # [Gyr]
mass_cgm.append(sum(mass[cgm])*g2Msun / ras.get_m200(RamsesDir,timestep)) # [Msun/M200]
else:
times.append(info['time_myr']*1e-3)
......@@ -2573,7 +2573,7 @@ def plot_cgm_time(genpath, folders, labels, timesteps, shape="no_rebloch",factor
ax.set_ylim(ylims)
if info['is_cosmo']:
if isinstance(timesteps,int):
if isinstance(timesteps,float) or isinstance(timesteps,int):
info = ras.extract_info(timesteps, RamsesDir, saveinfile=True)
else:
info = ras.extract_info(timesteps[0], RamsesDir, saveinfile=True)
......
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