Skip to content

Commit fc0606b

Browse files
authored
Update example.py
example compatible with the new version
1 parent 0ac8c1a commit fc0606b

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

example.py

+6-14
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
# Number of samples to be generated
1414
N = 10000
15-
saveplot = False
16-
showplot = True
15+
saveplot = True
16+
showplot = False
1717

1818
if not os.path.exists('./examples') and saveplot:
1919
os.makedirs('./examples')
@@ -65,24 +65,16 @@
6565
lm = kllr_model(kernel_type = 'gaussian', kernel_width = 0.2)
6666

6767
# Compute regression parameters
68-
x, y_exp, intercept_exp, slope_exp, scatter_exp = lm.fit(df['x'], df['y1'], xrange=[2, 8], nbins=11)
68+
x, y_exp, intercept_exp, slope_exp, scatter_exp, _, _ = lm.fit(df['x'], df['y1'], xrange=[2, 8], bins=11)
6969

7070
# Generate and save fiducial analyses plots
71-
data, ax = Plot_Fit(df, 'x', 'y1', show_data=True, kernel_width = 0.4)
72-
data, ax = Plot_Fit(df, 'x', 'y2', show_data=True, kernel_width = 0.4, ax = ax)
71+
data, ax = Plot_Fit_Summary(df, 'x', 'y1', show_data=True, kernel_width = 0.4)
72+
data, ax = Plot_Fit_Summary(df, 'x', 'y2', show_data=True, kernel_width = 0.4, ax = ax)
7373
if saveplot: plt.savefig("./examples/Fit.pdf", bbox_inches='tight')
7474

75-
data, ax = Plot_Fit_Split(df, 'x', 'y1', 'y3', split_mode = 'Residuals', split_bins=3, kernel_width = 0.4)
75+
data, ax = Plot_Fit_Summary_Split(df, 'x', 'y1', 'y3', split_mode = 'Residuals', split_bins=3, kernel_width = 0.4)
7676
if saveplot: plt.savefig("./examples/Fit_split.pdf", bbox_inches='tight')
7777

78-
data, ax = Plot_Fit_Params(df, 'x', 'y1', xlog=False, kernel_width = 0.4)
79-
data, ax = Plot_Fit_Params(df, 'x', 'y2', xlog=False, kernel_width = 0.4, ax=ax)
80-
data, ax = Plot_Fit_Params(df, 'x', 'y3', xlog=False, kernel_width = 0.4, ax=ax)
81-
if saveplot: plt.savefig("./examples/Fit_Params.pdf", bbox_inches='tight')
82-
83-
data, ax = Plot_Fit_Params_Split(df, 'x', 'y1', 'y3', split_bins = 2, split_mode = 'Residuals', kernel_width = 0.4)
84-
if saveplot: plt.savefig("./examples/Fit_Params_Split.pdf", bbox_inches='tight')
85-
8678
ax = Plot_Cov_Corr_Matrix(df, 'x', ['y1', 'y2', 'y3'], Output_mode = 'corr', kernel_width = 0.4)
8779
if saveplot: plt.savefig("./examples/Corr_Matrix.pdf", bbox_inches='tight')
8880

0 commit comments

Comments
 (0)