diff --git a/python/001_coordinates.py b/python/001_coordinates.py index 4d7488efc0857b1b351f2fef1aa9e02971f85502..b3622dba7ac44926fbd1d6e3cabbdbb393b0824c 100644 --- a/python/001_coordinates.py +++ b/python/001_coordinates.py @@ -1,12 +1,36 @@ """ -Adds R.A., Dec., redshift +Adds coordinates in degrees -Planck extinction map values -H14PI extinction values +Equatorial coordinates: Right Ascension, Declination +Galactic coordinates: latitude and longitude +Ecliptic coordinates: latitude and longitude -python3 001_coordinates.py \ -$GIT_VS/data/test_LC/all_1.00000.fits \ -$GIT_VS/data/test_LC/all_1.00000_coordinates.h5 +Redshift in real space and observed space +luminosity distance [cm] + +Foreground map values: +Planck extinction E(B-V) values +H14PI extinction H1 [cm-2] values + +command to run : +python3 001_coordinates.py environmentVAR fileBasename + +arguments : +environmentVAR: environment variable linking to the directory where files are e.g. MD10 +It will then work in the directory : $environmentVAR/hlists/fits/ + +fileBasename: base name of the file e.g. all_1.00000 + +It will find the input file : +$environmentVAR/hlists/fits/${fileBasename}.fits + +And will write outputs in h5 format: +$environmentVAR/hlists/fits/${fileBasename}_coordinates.h5 + +Figures (Optional) +if the variable 'make_figure' is set to True, then figures will be created in the git repo here : +$GIT_AGN_MOCK/figures/$environmentVAR/coordinates/ +It makes relevant histograms and scatter plots for all columns present in the new file. """ print('Adds coordinates') @@ -86,41 +110,41 @@ dL_interpolation = interp1d(z_array, dl_cm) f1 = fits.open(path_2_light_cone) -if f1[1].columns.names[0]=='id': - xn = f1[1].data['x'] - yn = f1[1].data['y'] - zn = f1[1].data['z'] - #print('x', xn.min(), xn.max()) - #print('y', yn.min(), yn.max()) - #print('z', zn.min(), zn.max()) - vxn = f1[1].data['vx'] - vyn = f1[1].data['vy'] - vzn = f1[1].data['vz'] - -else: - if os.path.basename(path_2_light_cone)[:3]=='sat': - hh = 'id pid Mvir Rvir rs scale_of_last_MM vmax x y z vx vy vz M200c M500c b_to_a_500c c_to_a_500c Acc_Rate_1_Tdyn' - header = hh.split() - dc_col= {} - for ii in range(len(header)): - dc_col[header[ii]]='col'+str(ii+1) - - if os.path.basename(path_2_light_cone)[:3]=='all': - hh = 'id Mvir Rvir rs scale_of_last_MM vmax x y z vx vy vz M200c M500c b_to_a_500c c_to_a_500c Acc_Rate_1_Tdyn' - header = hh.split() - dc_col= {} - for ii in range(len(header)): - dc_col[header[ii]]='col'+str(ii+1) - - xn = f1[1].data[dc_col['x']] - yn = f1[1].data[dc_col['y']] - zn = f1[1].data[dc_col['z']] - #print('x', xn.min(), xn.max()) - #print('y', yn.min(), yn.max()) - #print('z', zn.min(), zn.max()) - vxn = f1[1].data[dc_col['vx']] - vyn = f1[1].data[dc_col['vy']] - vzn = f1[1].data[dc_col['vz']] +#if f1[1].columns.names[0]=='id': +xn = f1[1].data['x'] +yn = f1[1].data['y'] +zn = f1[1].data['z'] +#print('x', xn.min(), xn.max()) +#print('y', yn.min(), yn.max()) +#print('z', zn.min(), zn.max()) +vxn = f1[1].data['vx'] +vyn = f1[1].data['vy'] +vzn = f1[1].data['vz'] + +#else: + #if os.path.basename(path_2_light_cone)[:3]=='sat': + #hh = 'id pid Mvir Rvir rs scale_of_last_MM vmax x y z vx vy vz M200c M500c b_to_a_500c c_to_a_500c Acc_Rate_1_Tdyn' + #header = hh.split() + #dc_col= {} + #for ii in range(len(header)): + #dc_col[header[ii]]='col'+str(ii+1) + + #if os.path.basename(path_2_light_cone)[:3]=='all': + #hh = 'id Mvir Rvir rs scale_of_last_MM vmax x y z vx vy vz M200c M500c b_to_a_500c c_to_a_500c Acc_Rate_1_Tdyn' + #header = hh.split() + #dc_col= {} + #for ii in range(len(header)): + #dc_col[header[ii]]='col'+str(ii+1) + + #xn = f1[1].data[dc_col['x']] + #yn = f1[1].data[dc_col['y']] + #zn = f1[1].data[dc_col['z']] + ##print('x', xn.min(), xn.max()) + ##print('y', yn.min(), yn.max()) + ##print('z', zn.min(), zn.max()) + #vxn = f1[1].data[dc_col['vx']] + #vyn = f1[1].data[dc_col['vy']] + #vzn = f1[1].data[dc_col['vz']] f1.close()