# write the joined one join_filename = os.path.join(dir1, "ft_compare_performance.csv") df_perf_diff.to_csv(join_filename, sep=",", index=False) FastTripsLogger.info("Wrote joined performance info to %s" % join_filename) if __name__ == "__main__": if len(sys.argv) != 3: print USAGE print sys.argv sys.exit(2) OUTPUT_DIR1 = sys.argv[1] OUTPUT_DIR2 = sys.argv[2] fasttrips.setupLogging(os.path.join(OUTPUT_DIR1, "ft_compare_info.log"), os.path.join(OUTPUT_DIR1, "ft_compare_debug.log"), logToConsole=True) pd.set_option('display.width', 300) for output_file in [ "ft_output_passengerPaths.txt", "ft_output_passengerTimes.txt", "ft_output_loadProfile.txt" ]: compare_file(OUTPUT_DIR1, OUTPUT_DIR2, output_file) compare_pathset(OUTPUT_DIR1, OUTPUT_DIR2) compare_performance(OUTPUT_DIR1, OUTPUT_DIR2)
elif str(df_diff[col1].dtype) == 'object': status = "%d/%d objects differ" % (len(df_diff.loc[df_diff[coldiff]==True]), len(df_diff)) elif str(df_diff[col1].dtype)[:3] == 'int': status = "Values differ by [% 8.2f,% 8.2f] with %d values differing" % (df_diff[coldiff].min(), df_diff[coldiff].max(), len(df_diff.loc[df_diff[coldiff]!=0])) else: status = "Values differ by [% 8.2f,% 8.2f] with mean % 8.2f" % (df_diff[coldiff].min(), df_diff[coldiff].max(), df_diff[coldiff].mean()) FastTripsLogger.info(" %-20s %s" % (colname, status)) new_cols.extend([col1, col2, coldiff]) # df_diff = df_diff[new_cols] if __name__ == "__main__": if len(sys.argv) != 3: print USAGE print sys.argv sys.exit(2) OUTPUT_DIR1 = sys.argv[1] OUTPUT_DIR2 = sys.argv[2] fasttrips.setupLogging("ft_compare_info.log", "ft_compare_debug.log", logToConsole=True) pandas.set_option('display.width', 300) for output_file in ["ft_output_passengerPaths.dat", "ft_output_passengerTimes.dat", "ft_output_loadProfile.dat"]: compare_file(OUTPUT_DIR1, OUTPUT_DIR2, output_file)
df2.drop([fasttrips.Performance.PERFORMANCE_COLUMN_TIME_LABELING, fasttrips.Performance.PERFORMANCE_COLUMN_TIME_ENUMERATING], axis=1, inplace=True) df_perf_diff = df1.merge(right=df2, how='outer', on=['iteration','trip_list_id_num'], suffixes=('_1','_2')) # write the joined one join_filename = os.path.join(dir1, "ft_compare_performance.csv") df_perf_diff.to_csv(join_filename, sep=",", index=False) FastTripsLogger.info("Wrote joined performance info to %s" % join_filename) if __name__ == "__main__": if len(sys.argv) != 3: print USAGE print sys.argv sys.exit(2) OUTPUT_DIR1 = sys.argv[1] OUTPUT_DIR2 = sys.argv[2] fasttrips.setupLogging(os.path.join(OUTPUT_DIR1, "ft_compare_info.log"), os.path.join(OUTPUT_DIR1, "ft_compare_debug.log"), logToConsole=True) pandas.set_option('display.width', 300) for output_file in ["ft_output_passengerPaths.txt", "ft_output_passengerTimes.txt", "ft_output_loadProfile.txt"]: compare_file(OUTPUT_DIR1, OUTPUT_DIR2, output_file) compare_pathset(OUTPUT_DIR1, OUTPUT_DIR2) compare_performance(OUTPUT_DIR1, OUTPUT_DIR2)
print sys.argv sys.exit(2) INPUT_DIR, subdir = os.path.split(sys.argv[1]) OUTPUT_DIR = sys.argv[2] test_pat = re.compile(r"pax(\d+)_(deterministic|stochastic)_iter(\d+)_(cap\d+|nocap)") if not os.path.exists(OUTPUT_DIR): os.mkdir(OUTPUT_DIR) pandas.set_option('display.width', 300) m = test_pat.match(subdir) print "subdir = [%s]" % subdir if not os.path.exists(os.path.join(OUTPUT_DIR, subdir)): os.mkdir(os.path.join(OUTPUT_DIR, subdir)) fasttrips.setupLogging(os.path.join(OUTPUT_DIR,subdir,"ft_info.log"), os.path.join(OUTPUT_DIR,subdir,"ft_debug.log"), logToConsole=True) ft = fasttrips.FastTrips(os.path.join(INPUT_DIR, subdir)) if m.group(2) == "deterministic": fasttrips.Assignment.ASSIGNMENT_TYPE = fasttrips.Assignment.ASSIGNMENT_TYPE_DET_ASGN elif m.group(2) == "stochastic": fasttrips.Assignment.ASSIGNMENT_TYPE = fasttrips.Assignment.ASSIGNMENT_TYPE_STO_ASGN fasttrips.Assignment.ITERATION_FLAG = int(m.group(3)) if m.group(4) == "nocap": fasttrips.Assignment.CAPACITY_CONSTRAINT = False else: fasttrips.Assignment.CAPACITY_CONSTRAINT = True