help="tdisrupt in Gyr") parser.add_option("--tind", dest='tind', default=None, type='int', help="index of timpact chunk") return parser parser = get_options() options, args = parser.parse_args() ########setup timpact chunks prog, pot, sigv, tvo = GMC_util.set_prog_potential(options.chain_ind) print("td=%.2f" % options.td) def parse_times(times, age, ro, vo): if 'sampling' in times: nsam = int(times.split('sampling')[0]) return [ float(ti) / bovy_conversion.time_in_Gyr(vo, ro) for ti in numpy.arange(1, nsam + 1) / (nsam + 1.) * age ] return [ float(ti) / bovy_conversion.time_in_Gyr(vo, ro) for ti in times.split(',') ]
apar = numpy.arange(0., 2.0, 0.01) parser = get_options() options, args = parser.parse_args() for ii in range(20): with open( 'Pal5_{}_on_128impact_Plummer_td{}_Mmin105_chainind_{}_seedind{}.pkl' .format(options.nsam, options.td, options.chain_ind, ii), 'rb') as savefile: #sdf_smooth=pickle.load(savefile,encoding='latin1') sdf_pepper = pickle.load(savefile, encoding='latin1') sdf_smooth = GMC_util.make_nondefault_pal5stream(options.chain_ind, td=options.td) a = apar[options.ind] dens_unp = sdf_smooth._density_par(a) omega_unp = sdf_smooth.meanOmega(a, oned=True) densOmega = sdf_pepper._densityAndOmega_par_approx(a) fo = open( 'dens_Omega/densOmega_{}_on_128_Plummer_td{}_chainind{}_seedind{}_Mmin105_{}.dat' .format(options.nsam, options.td, options.chain_ind, ii, options.ind), 'w') fo.write('#apar dens_unp dens omega_unp omega' + '\n') fo.write( str(a) + ' ' + str(dens_unp) + ' ' + str(densOmega[0]) + ' ' + str(omega_unp) + ' ' + str(densOmega[1]))
return parser parser= get_options() options,args= parser.parse_args() print (options.td,options.nsam,options.npart) #np.random.seed(options.rand_seed) Mmin=float(options.Mmin) sample_low='pkl_files/gd1pepper_Plummer_td{}_128sampling_MW2014.pkl'.format(options.td) timpact,apar,x_stream,y_stream,z_stream,vx_stream,vy_stream,vz_stream=GMC_util.aparxv_GD1_stream_from_multiple_pkl(pot=MWPotential2014,sampling=options.nsam, npart=options.npart,td=options.td) impactMC_ind,M_mc,rs_mc,v_mc,impactb,impact_angle,tmin=GMC_util.compute_impact_parameters_GMC(timpact,apar,x_stream,y_stream,z_stream, pot=MWPotential2014,sampling_low_file=sample_low,Mmin=Mmin,td=options.td, rand_rotate=True) #load the lower timpact pkl file with open(sample_low,'rb') as savefile: sdf_pepper= pickle.load(savefile,encoding='latin1') sdf_pepper.set_impacts(impactb=impactb,subhalovel=v_mc,impact_angle=impact_angle,timpact=tmin,rs=rs_mc,GM=M_mc) pepperfilename='GD1_{}_on_128impact_Plummer_td{}_Mmin105_MW2014_{}.pkl'.format(options.nsam,options.td,options.ind) save_pickles(pepperfilename,sdf_pepper)
vo=220. def get_options(): usage = "usage: %prog [options]" parser = OptionParser(usage=usage) parser.add_option("--ind",dest='ind',default=None, type='int', help="index of apar") return parser parser= get_options() options,args= parser.parse_args() timpact,apar,x_stream,y_stream,z_stream,_,_,_=GMC_util.aparxv_stream_from_pkl(sampling=4096,nchunks=64) impactMC_ind,M_mc,rs_mc,v_mc,impactb,impact_angle,tmin=GMC_util.compute_impact_parameters(timpact,apar,x_stream,y_stream,z_stream,nchunks=64,sampling_low=128,imp_fac=5.,Mmin=10**5.,rand_rotate=True) #load the lower timpact pkl file with open('pkl_files/pal5pepper_128sampling_Plummer_MW2014.pkl','rb') as savefile: sdf_pepper= pickle.load(savefile,encoding='latin1') sdf_smooth= pal5_util.setup_pal5model() sdf_pepper.set_impacts(impactb=impactb,subhalovel=v_mc,impact_angle=impact_angle,timpact=tmin,rs=rs_mc,GM=M_mc) pepperfilename='Pal5_4096_on_128impact_Plummer_Mmin105_MC_rand_rotate_{}.pkl'.format(options.ind) save_pickles(pepperfilename,sdf_pepper)