def runit(simulation_root_dir, network_file_path, sample_file_path, condition, test_sub_name, disconnection_rate = 0.0, drop_rate=0.0, threshold=sys.maxint): network_dir = make_ready_for_one_file_simulation(simulation_root_dir=simulation_root_dir, network_file_path=network_file_path, sample_file_path=sample_file_path, remove_existing_files=False) run_simulation(network_dir=network_dir, condition=condition, test_sub_name=test_sub_name, disconnection_rate=disconnection_rate, drop_rate=drop_rate, threshold=threshold)
def execute(self, sub_name, count): """It executes the simulation count times to average the result""" assert count > 0, "count should be more than 0" results = [] for i in range(count): print "Run %d of %s started" % ((i+1), sub_name) #for sub_name in ["singles", "aggregates"]: #print "Execute %s started" % sub_name run_simulation(network_dir=self.network_dir, condition=self.condition, test_sub_name=sub_name, disconnection_rate=self.disconnection_rate, drop_rate=self.drop_rate, threshold=self.threshold) print "Run %d ended" % (i+1) print "Start analysis of %d run started" % (i+1) d = ReadReports(self.network_dir, condition=self.condition, auto_read=True, use_cache=False) s = GetStatistics(d).run(self.condition, sub_name) print s print "End analysis of %d run started" % (i+1) results.append(s) return MultipleRunAndAnalysis.get_average(results), results