def __init__(self, savefile=None, savefile_only_trackage=None, directory="./", data_template="%s/DD%04d/data%04d", sim_name='sim', plot_directory="./plots_to_sort", out_prefix="", frame_list=None, core_list=None, target_frame=0, fields_from_grid=None, individual_particle_tracks=False, derived=None, do_shift=True, bad_particles=None): #set defaults and/or arguments. self.current_frame = None self.data_template = data_template self.sim_name = sim_name if frame_list is None: frame_list = [] self.frame_list = frame_list if core_list is None: core_list = [] self.core_list = core_list self.directory = directory self.target_frame = target_frame self.out_prefix = out_prefix self.plot_directory = plot_directory if fields_from_grid is None: fields_from_grid = [] self.fields_from_grid = ['density', 'cell_volume'] + fields_from_grid #this is not used. self.individual_particle_tracks = individual_particle_tracks #the track manager. self.tr = None #defaults for things to be set later self.target_indices = {} self.targets = None self.ds = None self.field_values = None self.snaps = defaultdict(dict) # defaultdict(whatev) is a dict, but makes a new (whatev) by default self.ds_list = {} self.all_data = {} if derived is None: derived = [] self.derived = derived self.shift = do_shift if bad_particles is None: bad_particles = defaultdict(list) self.bad_particles = bad_particles if savefile is not None: if not os.path.exists(savefile): print("No such file " + savefile) else: tracks_read_write.load_loop(self, savefile) self.tr.sort_time() if savefile_only_trackage is not None: tracks_read_write.load_trackage_only(self, savefile_only_trackage)
for n, line in enumerate(lines): parts[n] = np.array(line.split(), dtype='int') all_nonzero = parts[:, 0][parts[:, 1] > 0] from importlib import reload import looper reload(looper) import trackage reload(trackage) import tracks_read_write as trw reload(trw) #many1: frame_list = list(range(10,130,10)) + [125] #many1: core_list = [ 120, 10, 308, 41, 44, 110, 1, 65], #frame 120 core 96 core_list = all_nonzero.astype('int') if 'this_looper' not in dir(): directory = '/scratch2/dcollins/Paper19_48/B02/u05-r4-l4-128' this_looper = looper.core_looper( directory=directory, sim_name='u05', out_prefix='test', target_frame=125, frame_list=[1, 100, 120], #[0,1,2]+list(range(10,130,10))+[125], core_list=[], # core_list, fields_from_grid=[ 'x', 'y', 'z', 'velocity_magnitude', 'magnetic_field_strength', 'velocity_divergence' ]) for nfile, fname in enumerate(glob.glob('track_three_to_test*.h5')): trw.load_loop(this_looper, fname)
def load_loop(self, fname="TEST.h5"): tracks_read_write.load_loop(self, fname)