def binISSDataFile(data_filename, format_filename, data_block_size_filename=None): """ This function is a shell that perform all the defined binning process to a data file generated by iSS program. Here data_filename gives the main data file, format_filename gives the format of the data file (see formatter), and data_block_size_filename is the control file that is used to devide data into blocks. """ # generate block-related non-reusable bin processes if data_block_size_filename: # define blockBin objects (they are not re-usable: each binProcess should use a different blockBin object) # blockSizes = [float(aLine) for aLine in file(data_block_size_filename)] blockSizes = numpy.loadtxt(data_block_size_filename) generateBlocks = binUtilities.BlockBin(blockSizes) # define particle counting bin process (within certain pT range specified in particle_count_pT_range_filename) countParticleNumberInPTRange = binUtilities.BinProcess( generateBlocks, countNumberInPTRangeAction) countParticleNumberInPTRange.saveTo = count_particle_number_in_pT_range # get data format raw_format = assignmentFormat.assignmentExprStream2IndexDict( open(format_filename)) # call binDataStream function to finish the binning binUtilities.binDataStream(open(data_filename), raw_format, useBinProcesses)
def binISSDataFile(data_filename, format_filename, data_block_size_filename=None): """ This function is a shell that perform all the defined binning process to a data file generated by iSS program. Here data_filename gives the main data file, format_filename gives the format of the data file (see formatter), and data_block_size_filename is the control file that is used to devide data into blocks. """ # generate block-related non-reusable bin processes if data_block_size_filename: # define blockBin objects (they are not re-usable: each binProcess should use a different blockBin object) # blockSizes = [float(aLine) for aLine in file(data_block_size_filename)] blockSizes = numpy.loadtxt(data_block_size_filename) generateBlocks = binUtilities.BlockBin(blockSizes) # define particle counting bin process (within certain pT range specified in particle_count_pT_range_filename) countParticleNumberInPTRange = binUtilities.BinProcess(generateBlocks, countNumberInPTRangeAction) countParticleNumberInPTRange.saveTo = count_particle_number_in_pT_range # fillin the to-use binProcess list useBinProcesses = [] if use_bin_processes["calculate differential flow"]: useBinProcesses.extend([differentialFlow]) if use_bin_processes["calculate integrated flow"]: useBinProcesses.extend([integratedFlow]) if use_bin_processes["count particles in pT range"]: useBinProcesses.extend([countParticleNumberInPTRange]) # get data format raw_format = assignmentFormat.assignmentExprStream2IndexDict(open(format_filename)) # call binDataStream function to finish the binning binUtilities.binDataStream(open(data_filename), raw_format, useBinProcesses)
def binISSDataFileSimple(data_filename, format_filename, useBinProcesses): """ Simpler version of binISSDataFile """ # get data format raw_format = assignmentFormat.assignmentExprStream2IndexDict(open(format_filename)) # call binDataStream function to finish the binning binUtilities.binDataStream(open(data_filename), raw_format, useBinProcesses)
def binISSDataFileSimple(data_filename, format_filename, useBinProcesses): """ Simpler version of binISSDataFile """ # get data format raw_format = assignmentFormat.assignmentExprStream2IndexDict( open(format_filename)) # call binDataStream function to finish the binning binUtilities.binDataStream(open(data_filename), raw_format, useBinProcesses)
import runR import assignmentFormat import binUtilities import freeStreaming sample_filename = argv[1] sample_format_filename = argv[2] #sample_filename = "/home/qiu/Downloads/fancy_movie/results/samples_211.dat" #sample_format_filename = "/home/qiu/Downloads/fancy_movie/results/samples_format.dat" ordered_streaming_filename = "results/streaming_particle2d.dat" streaming_format_filename = "results/streaming_particle2d_format.dat" from parameters_freeStreaming import time_interval, starting_time, endding_time, coordinate_boundary sample_format_dict = assignmentFormat.assignmentExprStream2IndexDict( file(sample_format_filename)) streaming_format_dict = freeStreaming.freeStreaming2d( file(sample_filename), sample_format_dict, file(ordered_streaming_filename, "w"), starting_time=starting_time, endding_time=endding_time, time_interval=time_interval, coordinate_boundary=coordinate_boundary) streaming_format_file = file(streaming_format_filename, "w") for aTerm in assignmentFormat.dict2AssignmentExprList(streaming_format_dict): streaming_format_file.write(aTerm + "\n") streaming_format_file.close()
print("Usage: freeStreamingShell.py sample_file sample_format_file") exit(-1) import assignmentFormat import freeStreaming sample_filename = argv[1] sample_format_filename = argv[2] #sample_filename = "/home/qiu/Downloads/fancy_movie/results/samples_211.dat" #sample_format_filename = "/home/qiu/Downloads/fancy_movie/results/samples_format.dat" ordered_streaming_filename = "results/streaming_particle3d.dat" streaming_format_filename = "results/streaming_particle3d_format.dat" from parameters_freeStreaming import time_interval, starting_time, particle_endding_time, coordinate_xy_boundary, coordinate_z_boundary sample_format_dict = assignmentFormat.assignmentExprStream2IndexDict(file(sample_format_filename)) streaming_format_dict = freeStreaming.freeStreaming3d( file(sample_filename), sample_format_dict, file(ordered_streaming_filename, "w"), starting_time=starting_time, endding_time=particle_endding_time, time_interval=time_interval, coordinate_xy_boundary=coordinate_xy_boundary, coordinate_z_boundary=coordinate_z_boundary, ) streaming_format_file = file(streaming_format_filename,"w") for aTerm in assignmentFormat.dict2AssignmentExprList(streaming_format_dict): streaming_format_file.write(aTerm + "\n") streaming_format_file.close()