|
@@ -3,12 +3,11 @@ import sys
|
|
|
|
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
|
-from filval.result_set import ResultSet
|
|
|
-from filval.histogram_utils import hist, hist2d, hist_slice, hist_add
|
|
|
-from filval.plotter import (decl_plot, save_plots, hist_plot, hist2d_plot, Plot)
|
|
|
+from uproot import open as root_open
|
|
|
+from matplotboard import decl_fig, render, generate_report
|
|
|
|
|
|
|
|
|
-@decl_plot
|
|
|
+@decl_fig
|
|
|
def plot_residual(rs, var, layer, hit, projection=None, display_layer=True):
|
|
|
r'''
|
|
|
Plots of $\Delta \phi$, $\Delta z$, or $\Delta r$ (vs $\eta$) between RecHit
|
|
@@ -45,7 +44,7 @@ def plot_residual(rs, var, layer, hit, projection=None, display_layer=True):
|
|
|
|
|
|
|
|
|
|
|
|
-@decl_plot
|
|
|
+@decl_fig
|
|
|
def plot_residuals_v_ladder(rs, var, layer):
|
|
|
even, odd = {('phi', 'B1'): (rs.dphi_v_eta_first_hits_in_B1_even_ladder, rs.dphi_v_eta_first_hits_in_B1_odd_ladder),
|
|
|
('phi', 'B2'): (rs.dphi_v_eta_first_hits_in_B2_even_ladder, rs.dphi_v_eta_first_hits_in_B2_odd_ladder),
|
|
@@ -78,7 +77,7 @@ def plot_residuals_v_ladder(rs, var, layer):
|
|
|
plt.legend()
|
|
|
|
|
|
|
|
|
-@decl_plot
|
|
|
+@decl_fig
|
|
|
def sc_extrapolation_first(rs, var, layer, hit, even_odd, log=False, norm=None, cut=None, display_layer=True):
|
|
|
''' Raphael's plots '''
|
|
|
|
|
@@ -145,33 +144,33 @@ def sc_extrapolation_first(rs, var, layer, hit, even_odd, log=False, norm=None,
|
|
|
|
|
|
|
|
|
|
|
|
-def generate_dashboard(plots):
|
|
|
- from jinja2 import Environment, PackageLoader, select_autoescape
|
|
|
- from os.path import join
|
|
|
- from urllib.parse import quote
|
|
|
-
|
|
|
- env = Environment(
|
|
|
- loader=PackageLoader('plots', 'templates'),
|
|
|
- autoescape=select_autoescape(['htm', 'html', 'xml']),
|
|
|
- )
|
|
|
- env.globals.update({'quote': quote,
|
|
|
- 'enumerate': enumerate,
|
|
|
- 'zip': zip,
|
|
|
- })
|
|
|
-
|
|
|
- def render_to_file(template_name, **kwargs):
|
|
|
- with open(join('output', template_name), 'w') as tempout:
|
|
|
- template = env.get_template(template_name)
|
|
|
- tempout.write(template.render(**kwargs))
|
|
|
-
|
|
|
- def get_by_n(l, n=2):
|
|
|
- l = list(l)
|
|
|
- while l:
|
|
|
- yield l[:n]
|
|
|
- l = l[n:]
|
|
|
-
|
|
|
- render_to_file('dashboard.htm', plots=get_by_n(plots, 3),
|
|
|
- outdir="figures/")
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
@@ -292,5 +291,5 @@ if __name__ == '__main__':
|
|
|
|
|
|
|
|
|
|
|
|
- save_plots(plots)
|
|
|
- generate_dashboard(plots)
|
|
|
+ render(plots)
|
|
|
+ generate_report(plots)
|