def main(fpath, viscous_on, force_decay, nsampling): cwd = os.getcwd() os.chdir('../build') #call(['cmake', '..']) #call(['make']) ns_str = '%s' % nsampling cmd = ['./main', fpath, viscous_on, force_decay, ns_str] proc = check_output(cmd) fstr = None try: # used in python 2.* from StringIO import StringIO as fstring fstr = fstring(str(proc)) except ImportError: # used in python 3.* #from io import BytesIO as fstring from io import StringIO as fstring fstr = fstring(str(proc, 'utf-8')) particle_lists = pd.read_csv(fstr, sep=' ', header=None, dtype=np.float32, comment='#').values #print('particle list read in') #np.savetxt('mc_particle_list.txt', particle_lists) #print('particle list saved') os.chdir(cwd) plot(fpath, particle_lists, nsampling=nsampling)
def main(fpath, viscous_on, force_decay, nsampling): from subprocess import call, check_output cwd = os.getcwd() os.chdir('../build') call(['cmake', '..']) call(['make']) ns_str = '%s' % nsampling cmd = ['./main', fpath, viscous_on, force_decay, ns_str] proc = check_output(cmd) try: # used in python 2.* from StringIO import StringIO as fstring except ImportError: # used in python 3.* from io import StringIO as fstring #particle_lists = np.genfromtxt(fstring(proc)) particle_lists = pd.read_csv(fstring(proc), sep=' ', header=None, dtype=np.float32, comment='#').values create_figure_matrix(fpath, particle_lists) #from mcspec import mcspec #mcspec(fstring(proc)) os.chdir(cwd)
def main(fpath, viscous_on, force_decay, nsampling): from subprocess import call, check_output cwd = os.getcwd() os.chdir('../build') call(['cmake', '..']) call(['make']) ns_str = '%s'%nsampling cmd = ['./main', fpath, viscous_on, force_decay, ns_str] proc = check_output(cmd) try: # used in python 2.* from StringIO import StringIO as fstring except ImportError: # used in python 3.* from io import StringIO as fstring #particle_lists = np.genfromtxt(fstring(proc)) particle_lists = pd.read_csv(fstring(proc), sep=' ', header=None, dtype=np.float32, comment='#').values print('particle list read in') #np.savetxt('mc_particle_list.txt', particle_lists) print('particle list saved') os.chdir(cwd) plot(fpath, particle_lists, nsampling = nsampling)
def __init__(self, events_str, rapidity_kind='eta', fpath='./'): self.rapidity_col = 4 if rapidity_kind == 'eta': self.rapidity_col = 6 self.events = [ np.genfromtxt(fstring(event)) for event in events_str.split('#finished')[:-1] ] self.num_of_events = len(self.events) print('in mcspec, num of events=', self.num_of_events)
def __parse(self): for cent, headers in self.info.items(): idx = headers['table_id'] base_path = os.path.join(os.getcwd(), 'data/ALICE_pbpb2760_vn_vs_eta/', 'Table%s.csv' % idx) cent_data = {} with open(base_path, 'r') as myfile: data = myfile.read().split('\n\n')[:-1] for idx, vn_type in enumerate(headers['files']): data_str = fstring(data[idx]) cent_data[vn_type] = pd.read_csv(data_str, sep=',', comment='#') self.data[cent] = cent_data
def __init__(self, events_str, rapidity_kind='eta', fpath='./'): self.rapidity_col = 4 if rapidity_kind == 'eta': self.rapidity_col = 6 self.events = [ np.genfromtxt(fstring(event)) for event in events_str.split('#finished')[:-1] ] #self.events = [pd.read_csv(fstring(event), sep=' ', # header=None, dtype=np.float64).values # for event in events_str.split('#finished')[:-1]] self.num_of_events = len(self.events) print('in mcspec, num of events=', self.num_of_events) print(self.events[9999]) self.fpath = fpath
args = parser.parse_args() for eid in range(args.start_id, args.end_id): fpath = os.path.join(args.input_dir, "event%d" % eid) if os.path.exists(os.path.join(fpath, 'vn24_vs_eta.txt')): print("vn24_vs_eta exists") continue cwd = os.getcwd() os.chdir('../build') #call(['cmake', '..']) #call(['make']) try: cmd = ['./main', fpath, 'true', 'true', '500'] proc = check_output(cmd) stio = fstring() stio.write(proc) mc = mcspec(stio.getvalue(), fpath=fpath) mc.vn_vs_eta() #mc.plot_vn_pt() os.chdir(cwd) except: print("event does not have full evolution")