str(config.diagnostic_phase)) > 0 else pi / 2 # Handle the output directory config.outdir = os.path.expanduser( config.outdir) if len(config.outdir) > 0 else thisdir # make sure the sim keyword is list if isinstance(config.simulation_keywords, str): config.simulation_keywords = [config.simulation_keywords] # for simkey in config.simulation_keywords: # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ # # Find the NR Simulation # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ # alert('Finding simulation with keyword %s' % green(simkey), heading=True) sce = scsearch(keyword=simkey, verbose=True) if len(sce) > 1: error( 'More than one simulation has been found for this keyowrd. Please refine your jeyword so that this is not the case.' ) else: sce = sce[-1] # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ # # Create directories for I/O # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ # alert('Create directories for I/O', heading=True) # Base directory for output basedir = osjoin(config.outdir, sce.simname + '/') # Cofiguration and source files: mkdir and copy files config_dir = basedir
f.attrs['rot_X1'] = X1_along_z f.attrs['rot_X2'] = X2_along_z f.attrs['eta'] = obj.eta f.create_dataset("times", data=new_times) f.create_dataset("psi4", data=psi4_data) f.create_dataset("strain", data=strain_data) if __name__ =="__main__": # explicit list of sims from EZH sims = ['q1a04t30_dPm2_T_96_552', 'q1a04t60_dPm1_T_96_552', 'q1a04t90_dP0_T_96_552', 'q1a04t120_dP0_T_96_552', 'q1a04t150_dP0_T_96_552', 'q1a08t30dPm25_T_96_408', 'q1a08t60dPm1.5_T_96_408', 'q1a08t90dPm1_T_96_408', 'q1a08t120dP0_T_96_408', 'q1a08t150dP0_T_96_408', 'q2a04t30dPm2_T_96_408', 'q2a04t60dPm1_T_96_408', 'q2a04t90dPm1_T_96_408', 'q2a04t120_T_96_408', 'q2a04t150_T_96_408', 'q2_a10_a28_ph0_th30', 'q2_a10_a28_ph0_th60', 'q2_a10_a28_ph0_th90', 'q2_a10_a28_ph0_th120', 'q2_a10_a28_ph0_th150', 'q4a04t30_T_96_360', 'q4a04t60dPm1.5D_T_96_360', 'q4a04t90_T_96_360', 'q4a04t120dP0D_T_96_360', 'q4a04t150_T_96_360', 'q4a08t30dPm5p5dRm47_T_96_360', 'q4a08t60dPm3dRm250_T_96_384', 'q4a08t90dPm1D_T_96_384', 'q4a08t120dP1_T_96_360', 'q4a08t150_T_96_360', 'q8a04t30dPm3_T_96_360', 'q8a04t60D_dPm1', 'q8a04t90dP0_T_96_360', 'q8a04t120dPp1_T_96_360', 'q8a04t150dP9_T_96_360', 'q8a08t30dPm9.35_r0.5_T_96_360', 'q8a08t60Ditm45dr075_96_360', 'q8a08t90dP0_T_96_384', 'q8a08t120dP2_r03_T_96_360', 'q8a08t150dP2_T_120_480'] # Search for simulations # A = scsearch(q=[3.9,8.1], institute='bam', verbose=True) A = scsearch(institute='bam', verbose=True, precessing=True) lmax=2 gwylm_verbose=False verbose=True output_dir='data' npts=5000 my_makedir(output_dir) for obj in A: if obj.simname in sims: if "ASJmodified" not in obj.metadata_file_location: print("\n\n saving {}\n\n".format(obj.simname)) save_data(screnty_ob=obj, output_dir=output_dir, lmax=lmax, gwylm_verbose=gwylm_verbose, verbose=verbose, npts=npts) else: print("\n\n skipping {}".format(obj.simname))
# from nrutils import alert, nr2h5, scsearch, gwylm, alert from nrutils.tools.unit.conversion import * # this_script = 'nr2h5_example' # HACK = False # Search for simulations: Use the CFUIB high resolution base case alert( 'Finding NR simulation catalog objects for realted HDF5 creation. This script is specialized to work with BAM data.', this_script) A = scsearch(keyword='dirac', verbose=True, notkeyword='uib') # base_96 # q1.2_dc2dcp2 # q1.2_dc1dc2 # Extraction radius found using the "r" parameter in the realted config file for bam runs as well as a mapping of this to the actual extration radius as given by the bbh metadata files. alert( 'Manually defining extration radius to use for cropping of NR data. This is realted to the extration parameter in the institute' 's config file, and allows the calculation of the retarded time, t_retarded = t + extraction_radius', this_script) extraction_radius = 140 # alert( 'Load and crop all waveforms. Waveforms will start at the after_junkradiation_time noted in the .bbh metadata', this_script) for a in A: # Convert a single simulation into a waveform object with desired multipoles
# from os.path import dirname, basename, isdir, realpath from numpy import array, ones, pi from os import system system('clear') # one could also use: from nrutils import * from nrutils import scbuild, scsearch, gwylm # Build the simulation catalog using the cofig files # scbuild() # Search for simulations # A = scsearch(institute='sxs',nonspinning=True,q=[1,10],verbose=True,unique=True) # A = scsearch(precessing=True,q=[1,1.5],verbose=True,unique=True) A = scsearch(keyword="base_96", unique=True, verbose=True) # Convert a single simulation into a waveform object with desired multipoles y = gwylm(scentry_obj=A[0], lm=[2, 1], dt=0.4, verbose=True) # # Plot time domain strain # y.plot(kind='strain') # plot time domain psi4 y.plot(kind='psi4', show=True) # # plot frequency domain strain and show all current plots # y.plot(kind='strain',show=True,domain='freq')
# Handle diagnostic values config.diagnostic_inclination = eval(str(config.diagnostic_inclination).lower()) if len(str(config.diagnostic_inclination))>0 else pi/2 config.diagnostic_phase = eval(str(config.diagnostic_phase).lower()) if len(str(config.diagnostic_phase))>0 else pi/2 # Handle the output directory config.outdir = os.path.expanduser(config.outdir) if len(config.outdir)>0 else thisdir # make sure the sim keyword is list if isinstance(config.simulation_keywords,str): config.simulation_keywords = [config.simulation_keywords] # for simkey in config.simulation_keywords: # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ # # Find the NR Simulation # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ # alert('Finding simulation with keyword %s'%green(simkey),heading=True) sce = scsearch( keyword=simkey, verbose=True ) if len(sce)>1: error('More than one simulation has been found for this keyowrd. Please refine your jeyword so that this is not the case.') else: sce = sce[-1] # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ # # Create directories for I/O # -~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ # alert('Create directories for I/O',heading=True) # Base directory for output basedir = osjoin(config.outdir,sce.simname+'/') # Cofiguration and source files: mkdir and copy files config_dir = basedir mkdir(config_dir,verbose=True)
lmax = 5 # outdir = '~/Desktop/mollweide_frames/' mkdir(outdir, verbose=True) # kind = 'strain' #--~--~--~--~--~--~--~--~--~--~--~--~--~--~--~--# # Main Flow #--~--~--~--~--~--~--~--~--~--~--~--~--~--~--~--# # Find sim alert('Finding a simulation ...', header=True) A = scsearch(keyword='base_96')[0] # A = scsearch(q=[10,20],keyword='hr',verbose=True,institute='gt')[0] # framedir = join(outdir, A.simname) + '/' mkdir(framedir, verbose=True) # Load data alert('Loading simulation data', header=True) y = gwylm(A, lmax=lmax, verbose=True, clean=True) # t = y.lm[2, 2]['strain'].t frame_times = t[range(0, len(t), 10)] # Use information from gwylm's waveform characerization algorithms to determine start and end times of tinterest
lmax = 5 # outdir = '~/Desktop/mollweide_frames/' mkdir(outdir,verbose=True) # kind = 'strain' #--~--~--~--~--~--~--~--~--~--~--~--~--~--~--~--# # Main Flow #--~--~--~--~--~--~--~--~--~--~--~--~--~--~--~--# # Find sim alert('Finding a simulation ...',header=True) A = scsearch(keyword='base_96')[0] # A = scsearch(q=[10,20],keyword='hr',verbose=True,institute='gt')[0] # framedir = join(outdir,A.simname)+'/' mkdir(framedir,verbose=True) # Load data alert('Loading simulation data',header=True) y = gwylm(A,lmax=lmax,verbose=True,clean=True) # t = y.lm[2,2]['strain'].t frame_times = t[ range(0,len(t),10) ] # Use information from gwylm's waveform characerization algorithms to determine start and end times of tinterest
# from os.path import dirname, basename, isdir, realpath from numpy import array,ones,pi from os import system system('clear') # one could also use: from nrutils import * from nrutils import scbuild,scsearch,gwylm # Build the simulation catalog using the cofig files # scbuild() # Search for simulations # A = scsearch(institute='sxs',nonspinning=True,q=[1,10],verbose=True,unique=True) # A = scsearch(precessing=True,q=[1,1.5],verbose=True,unique=True) A = scsearch(keyword="base_96",unique=True,verbose=True) # Convert a single simulation into a waveform object with desired multipoles y = gwylm( scentry_obj = A[0], lm=[2,1], dt=0.4, verbose=True ) # # Plot time domain strain # y.plot(kind='strain') # plot time domain psi4 y.plot(kind='psi4',show=True) # # plot frequency domain strain and show all current plots # y.plot(kind='strain',show=True,domain='freq')
# from nrutils import alert, nr2h5, scsearch, gwylm, alert from nrutils.tools.unit.conversion import * # this_script = 'nr2h5_example' # HACK = False # Search for simulations: Use the CFUIB high resolution base case alert( 'Finding NR simulation catalog objects for realted HDF5 creation. This script is specialized to work with BAM data.', this_script) A = scsearch(keyword='base_96', verbose=True) # base_96 # q1.2_dc2dcp2 # q1.2_dc1dc2 # Extraction radius found using the "r" parameter in the realted config file for bam runs as well as a mapping of this to the actual extration radius as given by the bbh metadata files. alert( 'Manually defining extration radius to use for cropping of NR data. This is realted to the extration parameter in the institute' 's config file, and allows the calculation of the retarded time, t_retarded = t + extraction_radius', this_script) extraction_radius = 140 # alert( 'Load and crop all waveforms. Waveforms will start at the after_junkradiation_time noted in the .bbh metadata', this_script) for a in A: # Convert a single simulation into a waveform object with desired multipoles
# Import needed libs system('clear') # from nrutils import alert,nr2h5,scsearch,gwylm,alert from nrutils.tools.unit.conversion import * # this_script = 'nr2h5_example' # HACK = False # Search for simulations: Use the CFUIB high resolution base case alert('Finding NR simulation catalog objects for realted HDF5 creation. This script is specialized to work with BAM data.',this_script ) A = scsearch(keyword='base_96',verbose=True) # base_96 # q1.2_dc2dcp2 # q1.2_dc1dc2 # Extraction radius found using the "r" parameter in the realted config file for bam runs as well as a mapping of this to the actual extration radius as given by the bbh metadata files. alert('Manually defining extration radius to use for cropping of NR data. This is realted to the extration parameter in the institute''s config file, and allows the calculation of the retarded time, t_retarded = t + extraction_radius',this_script ) extraction_radius = 140 # alert('Load and crop all waveforms. Waveforms will start at the after_junkradiation_time noted in the .bbh metadata',this_script ) for a in A: # Convert a single simulation into a waveform object with desired multipoles y = gwylm( scentry_obj = a, lmax=5, verbose=True, w22 = a.raw_metadata.freq_start_22 ) # Crop initial junk radiation from waveform without smooth windowing to be consistent with the infrastructure's conventions y.clean( method='crop', crop_time=float(a.raw_metadata.after_junkradiation_time)+extraction_radius )