コード例 #1
0
def draw_survival_curves_and_histograms(calibrated_model_no_drug,
                                        calibrated_model_with_drug):
    """ draws the histograms of average survival time
    :param calibrated_model_no_drug: calibrated model simulated when drug is not available
    :param calibrated_model_with_drug: calibrated model simulated when drug is available
    """

    # get survival curves of both treatments
    survival_curves = [
        calibrated_model_no_drug.multiCohorts.multiCohortOutcomes.
        survivalCurves, calibrated_model_with_drug.multiCohorts.
        multiCohortOutcomes.survivalCurves
    ]

    # graph survival curve
    Path.plot_sets_of_sample_paths(sets_of_sample_paths=survival_curves,
                                   title='Survival curve',
                                   x_label='Simulation time step',
                                   y_label='Number of alive patients',
                                   legends=['No Drug', 'With Drug'],
                                   color_codes=['blue', 'orange'],
                                   transparency=0.25)

    # histograms of average survival times
    set_of_survival_times = [
        calibrated_model_no_drug.multiCohorts.multiCohortOutcomes.
        meanSurvivalTimes, calibrated_model_with_drug.multiCohorts.
        multiCohortOutcomes.meanSurvivalTimes
    ]

    # graph histograms
    Hist.plot_histograms(data_sets=set_of_survival_times,
                         title='Histogram of average patient survival time',
                         x_label='Survival time',
                         y_label='Counts',
                         bin_width=0.5,
                         legends=['No Drug', 'With Drug'],
                         color_codes=['blue', 'orange'],
                         transparency=0.5,
                         x_range=[6, 20])
コード例 #2
0
def plot_survival_curves_and_histograms(multi_cohort_outcomes_mono,
                                        multi_cohort_outcomes_combo):
    """ plot the survival curves and the histograms of survival times
    :param multi_cohort_outcomes_mono: outcomes of a multi-cohort simulated under mono therapy
    :param multi_cohort_outcomes_combo: outcomes of a multi-cohort simulated under combination therapy
    """

    # get survival curves of both treatments
    sets_of_survival_curves = [
        multi_cohort_outcomes_mono.survivalCurves,
        multi_cohort_outcomes_combo.survivalCurves
    ]

    # graph survival curve
    Path.plot_sets_of_sample_paths(
        sets_of_sample_paths=sets_of_survival_curves,
        title='Survival Curves',
        x_label='Simulation Time Step (year)',
        y_label='Number of Patients Alive',
        legends=['Mono Therapy', 'Combination Therapy'],
        transparency=0.4,
        color_codes=['green', 'blue'])

    # histograms of survival times
    set_of_survival_times = [
        multi_cohort_outcomes_mono.meanSurvivalTimes,
        multi_cohort_outcomes_combo.meanSurvivalTimes
    ]

    # graph histograms
    Hist.plot_histograms(data_sets=set_of_survival_times,
                         title='Histograms of Average Patient Survival Time',
                         x_label='Survival Time (year)',
                         y_label='Counts',
                         bin_width=0.25,
                         x_range=[5.25, 17.75],
                         legends=['Mono Therapy', 'Combination Therapy'],
                         color_codes=['green', 'blue'],
                         transparency=0.5)
コード例 #3
0
    title='Plotting a single sample path that is updated in batch',
    x_label='time',
    y_label='observed value',
    legend='Path 3',
    color_code='r')

# plot both paths
Path.plot_sample_paths(sample_paths=[path1, path2],
                       title='Plot two sample paths with different color',
                       x_label='time',
                       y_label='observed value',
                       legends=['Path 1', 'Path 2'],
                       transparency=0.75)

Path.plot_sample_paths(sample_paths=[path1, path2],
                       title='Plot 2 sample paths with the same color',
                       x_label='time',
                       y_label='observed value',
                       legends='Path',
                       transparency=0.5,
                       common_color_code='g')

Path.plot_sets_of_sample_paths(sets_of_sample_paths=[[path1, path2],
                                                     [path3, path4]],
                               title='Plot 2 sets of sample paths',
                               x_label='time',
                               y_label='observed value',
                               legends=['Set 1', 'Set 2'],
                               transparency=0.5,
                               color_codes=['g', 'b'])