print usage_mesg sys.exit(1) filename_txt = sys.argv[2] if not os.access(filename_txt, os.R_OK): print "%s is not accessible." % filename_txt print usage_mesg sys.exit(1) # If the right number of inputs are provided then run the analysis for both data sets if(len(sys.argv) == 3 ): # Processes file to plot (top layer) filename_txt_plot = sys.argv[1] elementalList_plot = extract_needed_elemental_data(filename_txt_plot) ratiosList_plot = process_elemental_data(elementalList_plot) # Processes file to map (bottom image) filename_txt_map = sys.argv[2] elementalList_map = extract_needed_elemental_data(filename_txt_map) ratiosList_map = process_elemental_data(elementalList_map) # Another good area to adjust configurations. This is the percent of nodes that # must be within +/- the adjust range of a point for it to be added to the heatmap. PERCENT_NEAR = .15 # Turns list into tuple pairs for use in the heatmap function y = 0 tList = [] for x in ratiosList_map[1]:
usage_mesg = "VanKrevelenHeatmap.py <csv file(s)>" # Checks if files are available. filename_csv = sys.argv[1] if not os.access(filename_csv, os.R_OK): print "%s is not accessible." % filename_csv print usage_mesg sys.exit(1) if len(sys.argv) == 2: filename_csv = sys.argv[1] elementalList = extract_needed_elemental_data(filename_csv) ratiosList = process_elemental_data(elementalList) # Another good area to adjust configurations. This is the percent of nodes that # must be within +/- the adjust range of a point for it to be added to the heatmap. PERCENT_NEAR = 0.15 # Turns list into tuple pairs for use in the heatmap function y = 0 tList = [] for x in ratiosList[1]: tHelp = (x, ratiosList[0][y]) tList.append(tHelp) y += 1 filteredtups = []
if not os.access(filename_txt, os.R_OK): print "%s is not accessible." % filename_txt print usage_mesg sys.exit(1) # If two arguments were given if len(sys.argv) == 2: # Assigns filename to the second argument provided in the command prompt filename_txt = sys.argv[1] # Gets complete list of all element counts in all compounds identified elementalList = extract_needed_elemental_data(filename_txt) # Gets complete list of ratios (also contains boolean for presence of nitrogen ratios_list = process_elemental_data(elementalList) # Graphs the data provided and labels axes area = 10.0 fig = plt.figure() fig.suptitle('Van Krevelen Diagram', fontsize=14, fontweight='bold') ax = fig.add_subplot(111) fig.subplots_adjust(top=0.85) plt.xlim(0, 1.8) plt.ylim(0, 3.0) ax.set_xlabel('O:C Ratio') ax.set_ylabel('H:C Ratio')