parser.add_argument('--field', '-f', help='Field to plot', default='PO2') parser.add_argument('--probeName', '-p', help='Name of the probe to plot') parser.add_argument('--from_time', type=float, help='Time from which to plot results', default=0.0) figOptions = FigureOptions(parser) args = parser.parse_args() fieldName = args.field probeName = args.probeName from_time = args.from_time figOptions.parseOptions(args) figOptions.applyOptions() probes = loadProbes('domain', probeName, fieldName) EAT_dict = extractEATs('domain', probes, 0) f, (ax1, ax2) = plt.subplots(1, 2, sharey=True) plt.sca(ax1) # set current axes plotType = 'minMaxTissue' # plotType = 'minMax' plotProbeMinMax(EAT_dict, None, from_time, plotType) ax1.set_xlim([0.15, 0.6]) plt.sca(ax2) # set current axes fileName = 'flow_hematocrit_EAT.csv' csv_dict = readPO2CSV(fileName, delimiter=',') plotAveragedBar(csv_dict) figOptions.adjustAxes() figOptions.setGrid()
# convert to numpy arrays for key in return_dict.keys(): return_dict[key] = np.asarray(return_dict[key]) return return_dict if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--field', '-f', help='Field to plot', default='PO2') parser.add_argument('--probeName', '-p', help='Name of the probe directory', default='probeMidstreamPO2') parser.add_argument('--from_time', type=float, help='Time from which to plot EATs', default=0.0) args = parser.parse_args() fieldName = args.field probeName = args.probeName from_time = args.from_time probes = loadProbes('.', probeName, fieldName) minMaxDict = extractProbeMinMax('.', probes, 2, from_time) print 'Averaged minimum PO2: %g' % np.mean(minMaxDict['PO2_min']) print 'Averaged maximum PO2: %g' % np.mean(minMaxDict['PO2_max'])
figOptions = FigureOptions(parser) args = parser.parse_args() time = args.time from_time = args.from_time figOptions.parseOptions(args) figOptions.applyOptions() f, (ax1, ax2) = plt.subplots(1,2, sharey=True) plt.sca(ax1) # set current axes plotPO2ProfileEulerian('.', time) plt.sca(ax2) # set current axes probeNames = probeUtils.probeNames('.', suffix='PO2') fieldName = 'PO2' probes = [loadProbes('.', probeName, fieldName) for probeName in probeNames] EAT_dicts = [extractEATs('.', probe, 0) for probe in probes] plotCompareProbes(EAT_dicts, probes, from_time) ax2.set_ylabel('') figOptions.adjustAxes() figOptions.setGrid() # put (a) and (b) at the top left corner of each plot ax1.annotate(r'$(a)$', xy=(0.03, 0.91), xycoords='axes fraction') ax2.annotate(r'$(b)$', xy=(0.03, 0.91), xycoords='axes fraction') plotName = 'PO2XProfilesAndCompareProbes' figOptions.saveFig(plotName)