Exemple #1
0
import argparse
import matplotlib.pyplot as plt

from HbO2.plot.analytical import PO2DerivativeRatioPlotter
from HbO2.setup.simulationParameters import IOHbO2ParametersAxisymmetric

from plot.figureoptions import FigureOptions

if __name__ == '__main__':

    # parse arguments
    parser = argparse.ArgumentParser()
    figOptions = FigureOptions(parser)

    args = parser.parse_args()
    figOptions.parseOptions(args)
    figOptions.applyOptions()

    simParams = IOHbO2ParametersAxisymmetric('.')

    plotter = PO2DerivativeRatioPlotter(simParams)
    LDValues = [0.35, 0.2, 0.5]
    UValues = [1.2e-3, 2e-3, 0.6e-3]

    fig, axs = plt.subplots(3, 1)
    # fig, axs = plt.subplots(1,3)

    for (ax, LD, U) in zip(axs, LDValues, UValues):
        plotter.kroghSol.LD = LD
        plotter.kroghSol.vRBC = U
        plt.sca(ax)
parser.add_argument('--paramFile',
                    help='Path to parameter study file',
                    default='params.json')
parser.add_argument('--methodName',
                    '-m',
                    help='Name of the plotting method to call')
parser.add_argument('--modelNames',
                    nargs='+',
                    help='Models for which to plot results',
                    default=['krogh', 'simple'])
fig_options = FigureOptions(parser)
args = parser.parse_args()
file_name = args.paramFile
method_name = args.methodName
model_names = args.modelNames
fig_options.parseOptions(args)

fig, axs = plt.subplots(2, 2, sharey=True)
flattened_axs = [ax for sublist in axs for ax in sublist]

for study, ax, text in zip(studies, flattened_axs, annotations):
    path_to_study = os.path.join(path_to_parameter_studies, study)
    path_to_study_param_file = os.path.join(path_to_study, file_name)
    param_study = ParameterStudyFactory().makeParameterStudy(
        path_to_study_param_file)
    settings_dict = load_settings_file(path_to_study)
    postprocessor = ParameterStudyPostProcessor(param_study, settings_dict)
    plotter = DiffusiveInteractionParameterStudyPlotter(
        postprocessor, fig_options, model_names)
    plt.sca(ax)
    getattr(plotter, method_name)()