In [268]:
# Import libaries and illustris library
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
matplotlib.use('pdf')
import numpy as np
import random
from __future__ import division
%pylab inline
from matplotlib.patches import Polygon
from matplotlib.collections import PolyCollection
import subroutines.volume as vf
import subroutines.plot_functions as plot_functions
%load_ext autoreload
%autoreload 2
rcParams['xtick.direction'] = 'in'
rcParams['ytick.direction'] = 'in'
In [ ]:
In [12]:
halo_file_1 = "/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt"
halo_data_joined_masscut_e9= np.loadtxt(halo_file_1, comments='#', delimiter=',')[:,0:3]/0.7
halo_file_2 = "/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_85_posdata_halo_mass_cutoff.txt"
halo_data_joined_masscut_e9_z1= np.loadtxt(halo_file_2, comments='#', delimiter=',')[:,0:3]/0.7
halo_file_3 = "/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_103_posdata_halo_mass_cutoff.txt"
halo_data_joined_masscut_e9_z050= np.loadtxt(halo_file_3, comments='#', delimiter=',')[:,0:3]/0.7
halo_file_4 = "/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_116_posdata_halo_mass_cutoff.txt"
halo_data_joined_masscut_e9_z025= np.loadtxt(halo_file_4, comments='#', delimiter=',')[:,0:3]/0.7
In [13]:
segs_file_z025 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_116_posdata_halo_mass_cutoff.txt.NDnet_s5.19.up.NDskl.a.segs'
segs_pos_persis_z025 = vf.mask(np.loadtxt(segs_file_z025, comments='#')[:,0:3]/0.7, 0, 75000/0.7, 75000/0.7, 75000/0.7)
In [14]:
crits_file_z025= '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_116_posdata_halo_mass_cutoff.txt.NDnet_c7.5e-06.up.NDskl.a.crits'
crits_pos_persis_z025= vf.mask(np.loadtxt(crits_file_z025, comments='#')[:,0:5], 0, 75000, 75000, 75000)
crits_pos_persis_z025= crits_pos_persis_z025[crits_pos_persis_z025[:,4]>2][:,0:3]/0.7
In [15]:
segs_file_z050 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_103_posdata_halo_mass_cutoff.txt.NDnet_s5.41.up.NDskl.a.segs'
segs_pos_persis_z050 = vf.mask(np.loadtxt(segs_file_z050, comments='#')[:,0:3]/0.7, 0, 75000/0.7, 75000/0.7, 75000/0.7)
In [16]:
crits_file_z050= '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_103_posdata_halo_mass_cutoff.txt.NDnet_c7e-06.up.NDskl.a.crits'
crits_pos_persis_z050= vf.mask(np.loadtxt(crits_file_z050, comments='#')[:,0:5], 0, 75000, 75000, 75000)
crits_pos_persis_z050= crits_pos_persis_z050[crits_pos_persis_z050[:,4]>2][:,0:3]/0.7
In [17]:
segs_file_z1 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_85_posdata_halo_mass_cutoff.txt.NDnet_s5.8.up.NDskl.a.segs'
segs_pos_persis_z1 = vf.mask(np.loadtxt(segs_file_z1, comments='#')[:,0:3]/0.7, 0, 75000/0.7, 75000/0.7, 75000/0.7)
In [18]:
crits_file_z1 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_85_posdata_halo_mass_cutoff.txt.NDnet_c7e-06.up.NDskl.a.crits'
crits_pos_persis_z1 = vf.mask(np.loadtxt(crits_file_z1, comments='#')[:,0:5], 0, 75000, 75000, 75000)
crits_pos_persis_z1 = crits_pos_persis_z1[crits_pos_persis_z1[:,4]>2][:,0:3]/0.7
In [ ]:
In [8]:
#s1.62
#segs_file_0 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_s1.62.up.NDskl.BRK.S1000.a.segs'
#s2.02
segs_file_1 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_s2.02.up.NDskl.BRK.S1000.a.segs'
#s2.6
#segs_file_2 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_s2.6.up.NDskl.BRK.S1000.a.segs'
#s=3.01
#segs_file_3 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_s3.01.up.NDskl.BRK.S1000.a.segs'
#s=3.6
#segs_file_4 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_s3.6.up.NDskl.BRK.S1000.a.segs'
#s=4.07
#segs_file_5 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_s4.07.up.NDskl.BRK.S1000.a.segs'
#segs_pos_persis_0 = np.loadtxt(segs_file_0, comments='#')[:,0:3]/0.7
segs_pos_persis_1 = np.loadtxt(segs_file_1, comments='#')[:,0:3]/0.7
#segs_pos_persis_2 = np.loadtxt(segs_file_2, comments='#')[:,0:3]/0.7
#segs_pos_persis_3 = np.loadtxt(segs_file_3, comments='#')[:,0:3]/0.7
#segs_pos_persis_4 = np.loadtxt(segs_file_4, comments='#')[:,0:3]/0.7
#segs_pos_persis_5 = np.loadtxt(segs_file_5, comments='#')[:,0:3]/0.7
#segs_pos_persis_0 = vf.mask(segs_pos_persis_0, 0, 75000/0.7, 75000/0.7, 75000/0.7)
segs_pos_persis_1 = vf.mask(segs_pos_persis_1, 0, 75000/0.7, 75000/0.7, 75000/0.7)
#segs_pos_persis_2 = vf.mask(segs_pos_persis_2, 0, 75000/0.7, 75000/0.7, 75000/0.7)
#segs_pos_persis_3 = vf.mask(segs_pos_persis_3, 0, 75000/0.7, 75000/0.7, 75000/0.7)
#segs_pos_persis_4 = vf.mask(segs_pos_persis_4, 0, 75000/0.7, 75000/0.7, 75000/0.7)
#segs_pos_persis_5 = vf.mask(segs_pos_persis_5, 0, 75000/0.7, 75000/0.7, 75000/0.7)
In [9]:
#c3.13e-08
#crits_file_0 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_c3.13e-08.up.NDskl.a.crits'
#2.49e-07
#crits_file_1 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_c2.49e-07.up.NDskl.a.crits'
#5.06e-07
crits_file_2 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_c5.07e-07.up.NDskl.a.crits'
#6.96e-07
#crits_file_3 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_c6.96e-07.up.NDskl.a.crits'
#1.07e-06
#crits_file_4 = '/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_posdata_halo_mass_cutoff.txt.NDnet_c1.07e-06.up.NDskl.a.crits'
#crits_pos_persis_0 = np.loadtxt(crits_file_0, comments='#')[:,0:5]
#crits_pos_persis_1 = np.loadtxt(crits_file_1, comments='#')[:,0:5]
crits_pos_persis_2 = np.loadtxt(crits_file_2, comments='#')[:,0:5]
#crits_pos_persis_3 = np.loadtxt(crits_file_3, comments='#')[:,0:5]
#crits_pos_persis_4 = np.loadtxt(crits_file_4, comments='#')[:,0:5]
#crits_pos_persis_0 = vf.mask(crits_pos_persis_0, 0, 75000, 75000, 75000)
#crits_pos_persis_1 = vf.mask(crits_pos_persis_1, 0, 75000, 75000, 75000)
crits_pos_persis_2 = vf.mask(crits_pos_persis_2, 0, 75000, 75000, 75000)
#crits_pos_persis_3 = vf.mask(crits_pos_persis_3, 0, 75000, 75000, 75000)
#crits_pos_persis_4 = vf.mask(crits_pos_persis_4, 0, 75000, 75000, 75000)
#crits_pos_persis_0 = crits_pos_persis_0[crits_pos_persis_0[:,4]>2][:,0:3]/0.7
#crits_pos_persis_1 = crits_pos_persis_1[crits_pos_persis_1[:,4]>2][:,0:3]/0.7
crits_pos_persis_2 = crits_pos_persis_2[crits_pos_persis_2[:,4]>2][:,0:3]/0.7
#crits_pos_persis_3 = crits_pos_persis_3[crits_pos_persis_3[:,4]>2][:,0:3]/0.7
#crits_pos_persis_4 = crits_pos_persis_4[crits_pos_persis_4[:,4]>2][:,0:3]/0.7
In [40]:
dim = 64
steps = (75000/0.7)/dim
vol_mat = np.zeros((dim*dim*dim, 7))
# label each subbox with its coordinates
for i in range(dim):
for j in range(dim):
for k in range(dim):
vol_mat[i+dim*(j)+dim*dim*(k), 0:3] = [steps*i,steps*j,steps*k]
In [ ]:
vol_crits_distances_z1 = vf.distance_function(vol_mat[:,0:3], crits_pos_persis_z1)
In [55]:
vol_segs_distances_z1 = vf.distance_function(vol_mat[:,0:3], segs_pos_persis_z1)
In [79]:
vol_crits_distances_z1_aux = np.zeros((262144,1))
for i in range (0, 262144):
if( (vol_crits_distances_z1[i] < 2000) & (vol_crits_distances_z1[i] > 0)):
vol_crits_distances_z1_aux[i] = 1
vol_frac_z1 = vf.volume_fraction(vol_crits_distances_z1_aux, vol_segs_distances_z1[:,0], 700)
vol_frac_z1
Out[79]:
In [38]:
# use critical point persistance 2 and compute it´s volume fraction
vol_crits_distances_2_v2 = vf.distance_function(vol_mat[:,0:3], crits_pos_persis_2)
crits_count_2 = 0
for i in range (0, vol_mat.shape[0]):
if( (vol_crits_distances_2_v2[i] < 2000.1) & (vol_crits_distances_2_v2[i] > 0)):
crits_count_2 = crits_count_2 +1
vol_frac_criticals_2 = crits_count_2/(vol_mat.shape[0])
In [132]:
vol_segs_distances_0 = vf.distance_function(vol_mat[:,0:3], segs_pos_persis_0)
In [133]:
vol_segs_distances_1 = vf.distance_function(vol_mat[:,0:3], segs_pos_persis_1)
In [134]:
vol_segs_distances_2 = vf.distance_function(vol_mat[:,0:3], segs_pos_persis_2)
In [135]:
vol_segs_distances_3 = vf.distance_function(vol_mat[:,0:3], segs_pos_persis_3)
In [136]:
vol_segs_distances_4 = vf.distance_function(vol_mat[:,0:3], segs_pos_persis_4)
In [137]:
vol_segs_distances_5 = vf.distance_function(vol_mat[:,0:3], segs_pos_persis_5)
Use persistence: 5.07e-07 With a cluster volume fraction: 2.1% (50: 0.021208, 64:0.0218505859375 128: 0.021594524383544922) with 128**3 volumes (6.96e-07 has 0.011754035949707031) with cluster radius 2Mpc
In [323]:
#create matrix of all possible combinations of critical and presistence ratios
segs_pers = [1.62,2.02,2.6,3.01,3.6,4.07]
vol_frac_a = np.zeros((5,15))
for i in range (5):
vol_frac_a[i,0] = segs_pers[i]
vol_frac_a[i,1:3] = vf.volume_fraction(vol_crits_distances_2_v2, eval("vol_segs_distances_"+str(i))[:,0], 200)
vol_frac_a[i,3:5] = vf.volume_fraction(vol_crits_distances_2_v2, eval("vol_segs_distances_"+str(i))[:,0], 300)
vol_frac_a[i,5:7] = vf.volume_fraction(vol_crits_distances_2_v2, eval("vol_segs_distances_"+str(i))[:,0], 400)
vol_frac_a[i,7:9] = vf.volume_fraction(vol_crits_distances_2_v2, eval("vol_segs_distances_"+str(i))[:,0], 500)
vol_frac_a[i,9:11] = vf.volume_fraction(vol_crits_distances_2_v2, eval("vol_segs_distances_"+str(i))[:,0], 600)
vol_frac_a[i,11:13] = vf.volume_fraction(vol_crits_distances_2_v2, eval("vol_segs_distances_"+str(i))[:,0], 800)
vol_frac_a[i,13:15] = vf.volume_fraction(vol_crits_distances_2_v2, eval("vol_segs_distances_"+str(i))[:,0], 1000)
In [1]:
fig, ax = plt.subplots()
coord1 = np.concatenate((vol_frac_a[:,[0,6]],vol_frac_a[::-1,[0,10]]), axis=0)
coord2 = np.concatenate((vol_frac_a[:,[0,4]],vol_frac_a[::-1,[0,12]]), axis=0)
coord3 = np.concatenate((vol_frac_a[:,[0,2]],vol_frac_a[::-1,[0,14]]), axis=0)
coord4 = np.concatenate((vol_frac_a[:,[0,2]],vol_frac_a[::-1,[0,14]]), axis=0)
coord4 = np.concatenate((vol_frac_a[:,[0,8]],vol_frac_a[::-1,[0,8]]), axis=0)
# Make the collection and add it to the plot.
coll = PolyCollection([coord1,coord2,coord3], cmap=mpl.cm.jet, edgecolors=['none','none','none'], facecolors=['blue','cornflowerblue','turquoise'], alpha=0.5)
ax.add_collection(coll)
ax.autoscale_view()
plt.axhline(0.30, color='red', alpha=0.3, linestyle='-')
plt.axhline(0.34, color='red', alpha=0.3, linestyle='-')
plt.axvline(2.02, color='grey', alpha=0.3, linestyle='-')
plt.xlabel('Filament persistence (by Std)')
plt.ylabel('Volume Fraction')
plt.title('Volume fractions of filaments for different persistences \n three ares correspod to filament radii 0.5Mpc, 0.4-0.6Mpc, 0.3-0.8Mpc & 0.2-1.0Mpc')
plt.show()
In [ ]:
For visual projection vvvv
In [47]:
dim = 256
steps = (75000/0.7)/dim
vol_mat_5perc = np.zeros((dim*dim*8, 7))
# label each subbox with its coordinates
for i in range(dim):
for j in range(dim):
for k in range(8):
vol_mat_5perc[i+dim*(j)+dim*dim*(k), 0:3] = [steps*i,steps*j,steps*k]
In [48]:
#create 5% slice
vol_segs_distances_5perc = vf.distance_function(vol_mat_5perc[:,0:3], segs_pos_persis_1[segs_pos_persis_1[:,2]<(75000/(0.7*16))])
vol_crits_distances_5perc = vf.distance_function(vol_mat_5perc[:,0:3], crits_pos_persis_2[crits_pos_persis_2[:,2]<(75000/(0.7*16))])
In [439]:
vol_mat_5perc[:,3] = vol_crits_distances_5perc[:,0]
vol_mat_5perc[:,4] = vol_segs_distances_5perc[:,0]
vol_crits_mask_5p = (vol_mat_5perc[:,3] < 2000) & (vol_mat_5perc[:,3] != -1)
vol_segs_mask_5p = (vol_mat_5perc[:,4] < 700) & (vol_mat_5perc[:,4] != -1)
for i in range (0, vol_mat_5perc.shape[0]):
if (vol_crits_mask_5p[i] == True):
vol_mat_5perc[i,5] = 1
vol_mat_5perc[i,6] = 0
elif(vol_segs_mask_5p[i] == True):
vol_mat_5perc[i,5] = 0
vol_mat_5perc[i,6] = 1
else:
vol_mat_5perc[i,5] = 0
vol_mat_5perc[i,6] = 0
In [19]:
cutoff = (75000)/(0.7*15)
xpos = halo_data_joined_masscut_e9[halo_data_joined_masscut_e9[:,2]<cutoff]
xseg = segs_pos_persis_1[(segs_pos_persis_1[:,2]<cutoff)]
xcrit = crits_pos_persis_2[crits_pos_persis_2[:,2]<cutoff]
xpos_z025 = halo_data_joined_masscut_e9_z025[halo_data_joined_masscut_e9_z025[:,2]<cutoff]
xseg_z025 = segs_pos_persis_z025[(segs_pos_persis_z025[:,2]<cutoff)]
xcrit_z025 = crits_pos_persis_z025[crits_pos_persis_z025[:,2]<cutoff]
xpos_z050 = halo_data_joined_masscut_e9_z050[halo_data_joined_masscut_e9_z050[:,2]<cutoff]
xseg_z050 = segs_pos_persis_z050[(segs_pos_persis_z050[:,2]<cutoff)]
xcrit_z050 = crits_pos_persis_z050[crits_pos_persis_z050[:,2]<cutoff]
xpos_z1 = halo_data_joined_masscut_e9_z1[halo_data_joined_masscut_e9_z1[:,2]<cutoff]
xseg_z1 = segs_pos_persis_z1[(segs_pos_persis_z1[:,2]<cutoff)]
xcrit_z1 = crits_pos_persis_z1[crits_pos_persis_z1[:,2]<cutoff]
In [135]:
grid = matplotlib.gridspec.GridSpec(2,2)
plot_z0 = plt.subplot(grid[0,0])
plot_z025 = plt.subplot(grid[0,1])
plot_z050 = plt.subplot(grid[1,0])
plot_z1 = plt.subplot(grid[1,1])
plot_z0.scatter(xpos[:,0]/1000,xpos[:,1]/1000, marker='.', c='green', edgecolors='green',s=0.3, label='Halo positions')
plot_z0.scatter(xseg[:,0]/1000,xseg[:,1]/1000, marker='.', c='blue', edgecolors='blue', s=150, label='Filaments')
plot_z0.scatter(xcrit[:,0]/1000,xcrit[:,1]/1000, marker='.', c='red', edgecolors='red',s=6000, label='Clusters')
plot_z0.set_xlim([-5, 5+75/0.7]); plot_z0.set_ylim([-5, 5+75/0.7]);
plot_z0.set_xlabel('Mpc');plot_z0.set_ylabel('Mpc');plot_z0.legend(loc='best');
plot_z0.set_title('Classification of halo environments in a slice of 5 Mpc thickness for the 107 Mpc box')
#plot_z0.xaxis.set_ticks(np.arange(0, 111, 5)); plot_z0.yaxis.set_ticks(np.arange(0, 111, 1))
#z =0.25
plot_z025.scatter(xpos_z025[:,0]/1000,xpos_z025[:,1]/1000, marker='.', c='green', edgecolors='green',s=0.3, label='Halo positions')
plot_z025.scatter(xseg_z025[:,0]/1000,xseg_z025[:,1]/1000, marker='.', c='blue', edgecolors='blue', s=150, label='Filaments')
plot_z025.scatter(xcrit_z025[:,0]/1000,xcrit_z025[:,1]/1000, marker='.', c='red', edgecolors='red',s=6000, label='Clusters')
plot_z025.set_xlim([-5, 5+75/0.7]); plot_z025.set_ylim([-5, 5+75/0.7]);
plot_z025.set_xlabel('Mpc');plot_z025.set_ylabel('Mpc');plot_z025.legend(loc='best');
plot_z025.set_title('Classification of halo environments in a slice of 5 Mpc thickness for the 107 Mpc box z=0.25')
# z = 0.50
plot_z050.scatter(xpos_z050[:,0]/1000,xpos_z050[:,1]/1000, marker='.', c='green', edgecolors='green',s=0.3, label='Halo positions')
plot_z050.scatter(xseg_z050[:,0]/1000,xseg_z050[:,1]/1000, marker='.', c='blue', edgecolors='blue', s=150, label='Filaments')
plot_z050.scatter(xcrit_z050[:,0]/1000,xcrit_z050[:,1]/1000, marker='.', c='red', edgecolors='red',s=6000, label='Clusters')
plot_z050.set_xlim([-5, 5+75/0.7]); plot_z050.set_ylim([-5, 5+75/0.7]);
plot_z050.set_xlabel('Mpc');plot_z050.set_ylabel('Mpc');plot_z050.legend(loc='best');
plot_z050.set_title('Classification of halo environments in a slice of 5 Mpc thickness for the 107 Mpc box z=0.5')
#z = 1.0
plot_z1.scatter(xpos_z1[:,0]/1000,xpos_z1[:,1]/1000, marker='.', c='green', edgecolors='green',s=0.3, label='Halo positions')
plot_z1.scatter(xseg_z1[:,0]/1000,xseg_z1[:,1]/1000, marker='.', c='blue', edgecolors='blue', s=150, label='Filaments')
plot_z1.scatter(xcrit_z1[:,0]/1000,xcrit_z1[:,1]/1000, marker='.', c='red', edgecolors='red',s=6000, label='Clusters')
plot_z1.set_xlim([-5, 5+75/0.7]); plot_z1.set_ylim([-5, 5+75/0.7]);
plot_z1.set_xlabel('Mpc');plot_z1.set_ylabel('Mpc');plot_z1.legend(loc='best');
plot_z1.set_title('Classification of halo environments in a slice of 5 Mpc thickness for the 107 Mpc box z=1')
plt.tight_layout()
plt.show()
In [ ]:
In [20]:
z0_colored_halos = np.zeros((xpos.shape[0],4))
z0_colored_halos[:,0:3] = xpos[:,:]
z0_colored_halos[:,3:4] = ((vf.distance_function(xpos, xcrit)>0)*1)
filament_distance_z0 = vf.distance_function(xpos, xseg)
for i in range (0,z0_colored_halos.shape[0]):
if z0_colored_halos[i,3] != 1:
if (filament_distance_z0[i] < 700) & (filament_distance_z0[i] > 0) :
z0_colored_halos[i,3] = 0
else:
z0_colored_halos[i,3] = -1
z025_colored_halos = np.zeros((xpos_z025.shape[0],4))
z025_colored_halos[:,0:3] = xpos_z025[:,:]
z025_colored_halos[:,3:4] = ((vf.distance_function(xpos_z025, xcrit)>0)*1)
filament_distance_z025 = vf.distance_function(xpos_z025, xseg_z025)
for i in range (0,z025_colored_halos.shape[0]):
if z025_colored_halos[i,3] != 1:
if (filament_distance_z025[i] < 700) & (filament_distance_z025[i] > 0) :
z025_colored_halos[i,3] = 0
else:
z025_colored_halos[i,3] = -1
z050_colored_halos = np.zeros((xpos_z050.shape[0],4))
z050_colored_halos[:,0:3] = xpos_z050[:,:]
z050_colored_halos[:,3:4] = ((vf.distance_function(xpos_z050, xcrit)>0)*1)
filament_distance_z050 = vf.distance_function(xpos_z050, xseg_z050)
for i in range (0,z050_colored_halos.shape[0]):
if z050_colored_halos[i,3] != 1:
if (filament_distance_z050[i] < 700) & (filament_distance_z050[i] > 0) :
z050_colored_halos[i,3] = 0
else:
z050_colored_halos[i,3] = -1
z1_colored_halos = np.zeros((xpos_z1.shape[0],4))
z1_colored_halos[:,0:3] = xpos_z1[:,:]
z1_colored_halos[:,3:4] = ((vf.distance_function(xpos_z1, xcrit)>0)*1)
filament_distance_z1 = vf.distance_function(xpos_z1, xseg_z1)
for i in range (0,z1_colored_halos.shape[0]):
if z1_colored_halos[i,3] != 1:
if (filament_distance_z1[i] < 700) & (filament_distance_z1[i] > 0) :
z1_colored_halos[i,3] = 0
else:
z1_colored_halos[i,3] = -1
In [253]:
from matplotlib import gridspec
In [269]:
fig = plt.figure(figsize=(7, 30))
# arrange grid
gs = gridspec.GridSpec(5, 1, height_ratios=[1,1,1,1,128/(75/0.7)])
plot_z0_distr = plt.subplot(gs[4])
plot_z0_color = plt.subplot(gs[3])
plot_z025_color = plt.subplot(gs[2])
plot_z050_color = plt.subplot(gs[1])
plot_z1_color = plt.subplot(gs[0])
# create color map for halo distriubtion
colors = ['green', 'blue', 'red']; levels = [-1,0,1];
cmap, norm = mpl.colors.from_levels_and_colors(levels=levels, colors=colors, extend='max')
# plot scatters
plot_z0_color.scatter(z0_colored_halos[:,0]/1000,z0_colored_halos[:,1]/1000,
c=z0_colored_halos[:,3], s=3, marker='.', edgecolors='none',cmap=cmap, norm=norm)
plot_z025_color.scatter(z025_colored_halos[:,0]/1000,z025_colored_halos[:,1]/1000,
c=z025_colored_halos[:,3], s=3, marker='.', edgecolors='none',cmap=cmap, norm=norm)
plot_z050_color.scatter(z050_colored_halos[:,0]/1000,z050_colored_halos[:,1]/1000,
c=z050_colored_halos[:,3], s=3, marker='.', edgecolors='none',cmap=cmap, norm=norm)
plot_z1_color.scatter(z1_colored_halos[:,0]/1000,z1_colored_halos[:,1]/1000,
c=z1_colored_halos[:,3], s=3, marker='.', edgecolors='none',cmap=cmap, norm=norm)
plot_z0_distr.imshow(pixels,vmin=1,vmax=10, origin='lower')
# add scale bars
plot_z1_color.plot([77,97],[8,8],'black',linewidth=5.0); plot_z1_color.text(78,10, '10 Mpc',fontsize=20, fontweight='bold');
plot_z050_color.plot([82,97],[8,8],'black',linewidth=5.0);
plot_z025_color.plot([84.5,97],[8,8],'black',linewidth=5.0);
plot_z0_color.plot([87,97],[8,8],'black',linewidth=5.0);
plot_z1_color.text(90, 95, 'z=1',fontsize=23, fontweight='bold');plot_z0_color.text(90, 95, 'z=0',fontsize=23, fontweight='bold');
plot_z025_color.text(85, 95, 'z=0.25',fontsize=23, fontweight='bold');plot_z050_color.text(85, 95, 'z=0.50',fontsize=23, fontweight='bold');
plot_z1_color.set_xlim([0, 75/0.7]); plot_z1_color.set_ylim([0, 75/0.7]);
plot_z050_color.set_xlim([0, 75/0.7]); plot_z050_color.set_ylim([0, 75/0.7]);
plot_z025_color.set_xlim([0, 75/0.7]); plot_z025_color.set_ylim([0, 75/0.7]);
plot_z0_color.set_xlim([0, 75/0.7]); plot_z0_color.set_ylim([0, 75/0.7]);
#plot_z0_distr.set_xlim([0, 256]); plot_z0_distr.set_ylim([0, 256]);
plot_z0_distr.yaxis.set_visible(False); plot_z1_color.yaxis.set_visible(False); plot_z050_color.yaxis.set_visible(False); plot_z025_color.yaxis.set_visible(False); plot_z0_color.yaxis.set_visible(False);
plot_z0_distr.xaxis.set_visible(False); plot_z1_color.xaxis.set_visible(False); plot_z050_color.xaxis.set_visible(False); plot_z025_color.xaxis.set_visible(False); plot_z0_color.xaxis.set_visible(False)
plt.tight_layout()
plt.subplots_adjust(hspace=.0, wspace=.0)
plt.show()
fig.savefig('test.pdf', format='pdf')
In [144]:
halo_data_joined = np.loadtxt("/Users/alex/Documents/Research/Astro/vm_shared_folder_v2/il_1_snap_135_halo_data_joined_7Mpc_slice.txt", comments='#', delimiter=',')
In [237]:
r=halo_data_joined[:,0:3]/0.7
m=halo_data_joined[:,3]
pixels=plot_functions.pixelMap(r, m, 256, 75000/0.7)
In [238]:
plt.imshow(pixels,vmin=1,vmax=10, origin='lower')
Out[238]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
In [ ]:
For visual projection ^^^^^
In [151]:
In [ ]:
In [20]:
plt.scatter([50,60,70,90,100,128,256],
[ 0.1184, 0.10972222, 0.10816327, 0.10644719, 0.1061, 0.10886192, 0.107795],
marker='.')
plt.ylim([0,0.15]); plt.xscale('log');
plt.title('Volume fractions of clusters based on the amount of volume elements for a cluster radius of 700kpc')
plt.xlabel('Volume elements (total amount goes from 50**3 to 128**3)')
plt.ylabel('Volume Fraction (%)')
Out[20]:
radius = 700 50: 0.001184 60: 0.0010972222222222223 70: 0.0010816326530612246 90: 0.001064471879286694 100: 0.001061 128: 0.0010886192321777344 256: 0.0010779500007629395 np.array([0.001184 , 0.0010972222222222223 , 00.0010816326530612246, 0.001064471879286694, 0.001061 , 0.0010886192321777344, 0.0010779500007629395])*100
In [ ]: