diff --git a/_episodes/04-higgs-search.md b/_episodes/04-higgs-search.md index 881a08b..2ff1c5a 100644 --- a/_episodes/04-higgs-search.md +++ b/_episodes/04-higgs-search.md @@ -177,7 +177,7 @@ ax.hist(branches["data_A"]["m4l"]) {: .output} ![m4lep_histogram_1]({{ page.root }}/fig/m4lep_histogram_1.png) - +> > ## Exercise > > Make the histogram of the variable `m4l` for sample `mc_363490.llll`. @@ -402,7 +402,7 @@ for k in range(0, 3): ~~~ {: .output} -And then make a plot, actually, let's make 2 plots, with matplotlib we can add sub-plots to the figure, then, we will be able to compare the MC distribution without and with weights. +And then make a plot, actually, let's make 2 plots, with matplotlib we can add sub-plots to the figure, then we will be able to compare the MC distribution without and with weights. ```python var_name = "m4l" @@ -410,6 +410,16 @@ units = " [GeV]" ranges = [[80, 170]] bins = 24 ``` +> ##Python Unpacking & Physics Logic +> +> In the code `fig, (ax_1, ax_2) = plt.subplots(1, 2)`, we use 'tuple unpacking'. +> This is a very common pattern in Python when a function returns multiple values. +> Here, `subplots` returns a figure object and an array of axes. We "unpack" them +> into two separate variables, `ax_1` and `ax_2`, so we can plot different +> distributions side-by-side. +{: .callout} + + ```python fig, (ax_1, ax_2) = plt.subplots(1, 2) @@ -497,6 +507,10 @@ ax.legend(fontsize=18, frameon=False) ``` ![m4lep_histogram_5]({{ page.root }}/fig/m4lep_histogram_5.png) + +> + + > ## Exercise > > Modify a bit the previous code to include the ticks and text, in the text and axis labels use latex to achieve the final plot.