Ejemplo n.º 1
0
Reference = Reference_All.loc[start_time:end_time]
Reference = Reference.resample(interval).mean()

#%%
# hybrid model performance metrics
Reference_hybrid_calibrated = hybrid_function(rf, mlr_model, Reference,
                                              'Reference')
Reference_hybrid_calibrated = Reference_hybrid_calibrated.sort_index()

residuals = Augusta.PM2_5 - Reference_hybrid_calibrated.PM2_5_corrected
print('calibrated residuals stdev = ', residuals.std())
Reference_hybrid_calibrated['Augusta'] = Augusta.PM2_5
#%%
linear_plot(
    Reference_hybrid_calibrated.Augusta,
    Reference_hybrid_calibrated.PM2_5_corrected,
    Reference_hybrid_calibrated.Augusta,
    Reference_hybrid_calibrated.PM2_5_corrected, 'Clarity Reference',
    1)  # used for plotting the corrected data with 1 equation for each region
#linear_plot(audubon.ref_value, audubon.indoor_corrected, audubon.ref_value, audubon.indoor,'audubon', 1, residuals_check = 1, residuals = audubon.prediction_residuals)
#%%
# Limit of detection

print('Paccar')
lod(Paccar, Augusta, threshold)
print('Reference')
lod_reference = lod(Reference, Augusta, threshold)
#%%

# just used for testing what impact removing values below the lod has on the calibrations
Reference = Reference[Reference['PM2_5'] > lod_reference]
#%%
Ejemplo n.º 2
0
    "/Users/matthew/Desktop/data/calibration/Clarity_batch_2_scatter_pad_resample.png"
)

export_png(
    p16,
    filename=
    "/Users/matthew/Desktop/data/calibration/Clarity_batch_2_residuals_and_predictions_1.png"
)
export_png(
    p22,
    filename=
    "/Users/matthew/Desktop/data/calibration/Clarity_batch_2_residuals_and_predictions_2.png"
)

#%%
#def linear_plot(x,y,x_winter,y_winter,unit_name,n_lines,**kwargs):
linear_plot(Grant.Ref_PM2_5, Grant.PM2_5, Grant.Ref_PM2_5, Grant.Predictions,
            'Grant', 1)
#%%
linear_plot(Jefferson.Ref_PM2_5, Jefferson.PM2_5, Jefferson.Ref_PM2_5,
            Jefferson.Predictions, 'Jefferson', 1)
#%%
linear_plot(Adams.Ref_PM2_5, Adams.PM2_5, Adams.Ref_PM2_5, Adams.Predictions,
            'Adams', 1)
#%%
linear_plot(Sheridan.Ref_PM2_5, Sheridan.PM2_5, Sheridan.Ref_PM2_5,
            Sheridan.Predictions, 'Sheridan', 1)
#%%
linear_plot(Stevens.Ref_PM2_5, Stevens.PM2_5, Stevens.Ref_PM2_5,
            Stevens.Predictions, 'Stevens', 1)
Ejemplo n.º 3
0
export_png(p4,
           filename='/Users/matthew/Desktop/monroe_neph_bscat/combined_cal.png'
           )  #'_unshifted_uncertainty_2''

tab4 = Panel(child=p4, title="Combined Browne Calibrated Data")

tabs = Tabs(tabs=[tab1, tab2, tab3, tab4])

show(tabs)

#%%
# if want to plot a single linear regression through the combined data, need to change the inputs to the calibration df and don't
# add in the second set of data (ie normally have high cal and winter cal df's input into the function)

linear_plot(high_calibration_df.ref_avg, high_calibration_df.Audubon,
            winter_calibration_df.ref_avg, winter_calibration_df.Audubon,
            'Audubon', 2)

#%%
linear_plot(high_calibration_df.ref_avg, high_calibration_df.Adams,
            winter_calibration_df.ref_avg, winter_calibration_df.Adams,
            'Adams', 2)
#%%
linear_plot(high_calibration_df.ref_avg, high_calibration_df.Balboa,
            winter_calibration_df.ref_avg, winter_calibration_df.Balboa,
            'Balboa', 2)
#%%
linear_plot(high_calibration_df.ref_avg, high_calibration_df.Browne,
            winter_calibration_df.ref_avg, winter_calibration_df.Browne,
            'Browne', 2)
#%%
Ejemplo n.º 4
0
        color='gold',
        line_width=2,
        muted_color='gold',
        muted_alpha=0.2)

p1.legend.click_policy = "mute"

tab1 = Panel(child=p1, title="Smoke Event Raw PM 2.5")

tabs = Tabs(tabs=[tab1])

show(tabs)

#%%

linear_plot(calibration_df.ref_avg, calibration_df.Audubon, 'Audubon')
#%%
linear_plot(calibration_df.ref_avg, calibration_df.Adams, 'Adams')
#%%
linear_plot(calibration_df.ref_avg, calibration_df.Balboa, 'Balboa')
#%%
linear_plot(calibration_df.ref_avg, calibration_df.Browne, 'Browne')
#%%
linear_plot(calibration_df.ref_avg, calibration_df.Grant, 'Grant')
#%%
linear_plot(calibration_df.ref_avg, calibration_df.Jefferson, 'Jefferson')
#%%
linear_plot(calibration_df.ref_avg, calibration_df.Lidgerwood, 'Lidgerwood')
#%%
linear_plot(calibration_df.ref_avg, calibration_df.Regal, 'Regal')
#%%
Ejemplo n.º 5
0
    "/Users/matthew/Desktop/data/calibration/Clarity_batch_1_scatter_mean_resample.png"
)
export_png(
    p16,
    filename=
    "/Users/matthew/Desktop/data/calibration/Clarity_batch_1_residuals_and_predictions_1.png"
)
export_png(
    p22,
    filename=
    "/Users/matthew/Desktop/data/calibration/Clarity_batch_1_residuals_and_predictions_2.png"
)

#%%

#def linear_plot(x,y,x_winter,y_winter,unit_name,n_lines,**kwargs):
linear_plot(Audubon.Ref_PM2_5, Audubon.Predictions, Audubon.Ref_PM2_5,
            Audubon.Predictions, 'Audubon', 1)
#%%
linear_plot(Balboa.Ref_PM2_5, Balboa.Predictions, Balboa.Ref_PM2_5,
            Balboa.Predictions, 'Balboa', 1)
#%%
linear_plot(Browne.Ref_PM2_5, Browne.Predictions, Browne.Ref_PM2_5,
            Browne.Predictions, 'Browne', 1)
#%%
linear_plot(Lidgerwood.Ref_PM2_5, Lidgerwood.Predictions, Lidgerwood.Ref_PM2_5,
            Lidgerwood.Predictions, 'Lidgerwood', 1)
#%%
linear_plot(Regal.Ref_PM2_5, Regal.Predictions, Regal.Ref_PM2_5,
            Regal.Predictions, 'Regal', 1)