def __init__(self, number, snapshot_dir = None, output_loc = None, snapshot_loc = None): # Output File number = '%03d' % number self.f1 = "outfile" + number + ".hdf5" if output_loc is not None: self.f1 = output_loc + "/" + self.f1 # Snapshot Directory if snapshot_dir is None: snapshot_dir = "snap" + number if snapshot_loc is not None: snapshot_dir = snapshot_loc + "/" + snapshot_dir self.snapshot_dir = snapshot_dir # Updates Here ps.set_snapshot_dir(snapshot_dir) # Updates Elsewhere # Bodies self.bodies = ps.parse_file(self.f1) # Simulation Info self.read_info_file() # Time self.times = quantities.AdaptingVectorQuantity() # Initialize States self.init_states() self.num_snapshots = len(self.times) self.save_star_separation() # Sorted Bodies + Keys (Change this to particle sets instead) self.unbound = np.zeros(len(self.times), dtype = np.ndarray) # These are arrays of Particle sets self.central = np.zeros(len(self.times), dtype = np.ndarray) self.passing = np.zeros(len(self.times), dtype = np.ndarray) self.both = np.zeros(len(self.times), dtype = np.ndarray) self.tmp_mask = np.zeros(len(self.times)) # for before the mask is applied self.mask = np.zeros(len(self.times)) # 1 indicates 'sorting' has occured at particular timestep # This mask needs to be incorporated into functions using sorted sets # For instance, the self.times array will need to be restricted to masked values ################# DO NOT MODIFY THE MASK DIRECTLY!!!!!! (switch to private?) ################ # Restore Sorts print " *** Restoring *** " self.restore() # Misc self.tmp_movie_dir = "tmp_movies_for_factory"
def __init__(self, number, snapshot_base=None, output_base=None, location=None, count=6, iter_num=None, grand=[]): # Output File if count == 3: number = '%03d' % int(number) # Old Format else: number = '%06d' % int( number ) # New Format (will fail if count = 4 or 5, which is bad) # Check if part of a suite if iter_num is not None: number += "_%02d" % int( iter_num) ##### This formatting will be added soon ##### if output_base is None: self.f1 = "outfile" + number + ".hdf5" else: self.f1 = "" + output_base + number + ".hdf5" # Snapshot Directory if snapshot_base is None: snapshot_dir = "sim" + number else: snapshot_dir = "" + snapshot_base + number if location is not None: snapshot_dir = location + "/" + snapshot_dir ## assume this is the directory for everything ## self.snapshot_dir = snapshot_dir # Updates Here ps.set_snapshot_dir(snapshot_dir) # Updates Elsewhere # Check if Encompassing Suite if (len(grand) > 0): # If the output print "Grand Output File", self.f1 if (os.path.exists(self.snapshot_dir) and os.path.exists(self.f1)): pass else: ps.mkdir(self.snapshot_dir) # initialize base directory # (1) Merge Output Files self.merge_output_files( number, snapshot_base, output_base, location, count, grand) ####### not implemented yet ####### # (2) Merge Info Files (.txt and .p) ^^^ self.snapshot_dir = snapshot_dir # Updates Here ps.set_snapshot_dir( snapshot_dir ) # Updates Elsewhere <<<<---- NOTE: IT WAS RESET!!!!!! # Bodies self.bodies = ps.parse_file(self.f1) # Simulation Info self.read_info_file() # Time self.times = quantities.AdaptingVectorQuantity() # Initialize States self.init_states() self.num_snapshots = len(self.times) self.save_star_separation() # Sorted Bodies + Keys (Change this to particle sets instead) self.unbound = np.zeros(len( self.times), dtype=np.ndarray) # These are arrays of Particle sets self.central = np.zeros(len(self.times), dtype=np.ndarray) self.passing = np.zeros(len(self.times), dtype=np.ndarray) self.both = np.zeros(len(self.times), dtype=np.ndarray) self.tmp_mask = np.zeros(len( self.times)) # for before the mask is applied self.mask = np.zeros( len(self.times )) # 1 indicates 'sorting' has occured at particular timestep # This mask needs to be incorporated into functions using sorted sets # For instance, the self.times array will need to be restricted to masked values ################# DO NOT MODIFY THE MASK DIRECTLY!!!!!! (switch to private?) ################ # Restore Sorts print " *** Restoring *** " self.restore() # Misc self.tmp_movie_dir = "tmp_movies_for_factory"
def __init__(self, number, snapshot_base = None, output_base = None, location = None, count = 6, iter_num = None, grand = []): # Output File if count == 3: number = '%03d' % int(number) # Old Format else: number = '%06d' % int(number) # New Format (will fail if count = 4 or 5, which is bad) # Check if part of a suite if iter_num is not None: number += "_%02d" % int(iter_num) ##### This formatting will be added soon ##### if output_base is None: self.f1 = "outfile" + number + ".hdf5" else: self.f1 = "" + output_base + number + ".hdf5" # Snapshot Directory if snapshot_base is None: snapshot_dir = "sim" + number else: snapshot_dir = "" + snapshot_base + number if location is not None: snapshot_dir = location + "/" + snapshot_dir ## assume this is the directory for everything ## self.snapshot_dir = snapshot_dir # Updates Here ps.set_snapshot_dir(snapshot_dir) # Updates Elsewhere # Check if Encompassing Suite if (len(grand) > 0): # If the output print "Grand Output File", self.f1 if (os.path.exists(self.snapshot_dir) and os.path.exists(self.f1)): pass else: ps.mkdir(self.snapshot_dir) # initialize base directory # (1) Merge Output Files self.merge_output_files(number, snapshot_base, output_base, location, count, grand) ####### not implemented yet ####### # (2) Merge Info Files (.txt and .p) ^^^ self.snapshot_dir = snapshot_dir # Updates Here ps.set_snapshot_dir(snapshot_dir) # Updates Elsewhere <<<<---- NOTE: IT WAS RESET!!!!!! # Bodies self.bodies = ps.parse_file(self.f1) # Simulation Info self.read_info_file() # Time self.times = quantities.AdaptingVectorQuantity() # Initialize States self.init_states() self.num_snapshots = len(self.times) self.save_star_separation() # Sorted Bodies + Keys (Change this to particle sets instead) self.unbound = np.zeros(len(self.times), dtype = np.ndarray) # These are arrays of Particle sets self.central = np.zeros(len(self.times), dtype = np.ndarray) self.passing = np.zeros(len(self.times), dtype = np.ndarray) self.both = np.zeros(len(self.times), dtype = np.ndarray) self.tmp_mask = np.zeros(len(self.times)) # for before the mask is applied self.mask = np.zeros(len(self.times)) # 1 indicates 'sorting' has occured at particular timestep # This mask needs to be incorporated into functions using sorted sets # For instance, the self.times array will need to be restricted to masked values ################# DO NOT MODIFY THE MASK DIRECTLY!!!!!! (switch to private?) ################ # Restore Sorts print " *** Restoring *** " self.restore() # Misc self.tmp_movie_dir = "tmp_movies_for_factory"