Skip to content

Commit ed904cd

Browse files
author
GitHub Actions
committed
Updated source files for modified notebooks
1 parent 8d0a649 commit ed904cd

1 file changed

Lines changed: 27 additions & 36 deletions

File tree

src/tutorials/He3-Background-Characterization.md

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@ jupyter:
1111
name: python3
1212
---
1313

14+
<!-- #region id="a6fb405c-18f7-4224-9ec8-24f0a5c3c825" -->
1415
<a href="https://colab.research.google.com/github/project-ida/arpa-e-experiments/blob/neutrons-background-2/tutorials/He3-Background-Characterization.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://nbviewer.org/github/project-ida/arpa-e-experiments/blob/neutrons-background-2/tutorials/He3-Background-Characterization.ipynb" target="_parent"><img src="https://nbviewer.org/static/img/nav_logo.svg" alt="Open In nbviewer" width="100"/></a>
15-
16-
```python id="Rjxll-Sdchar"
17-
18-
```
16+
<!-- #endregion -->
1917

2018
<!-- #region id="_WZ7vK7sctla" -->
2119
# Helium-3 Detector Background Characterization
@@ -37,7 +35,7 @@ Our goal is to characterize the background radiation detected by the Helium-3 ne
3735

3836
<!-- #endregion -->
3937

40-
```python colab={"base_uri": "https://localhost:8080/"} id="PxFHoPsndN0t" outputId="fea91b93-d5c9-4342-bc69-3eb4a22e6ec6"
38+
```python colab={"base_uri": "https://localhost:8080/"} id="PxFHoPsndN0t" outputId="19ead881-1d66-42e9-ac2a-a0c2cf481193"
4139
# RUN THIS IF YOU ARE USING GOOGLE COLAB
4240
import sys
4341
import os
@@ -55,8 +53,6 @@ import matplotlib.pyplot as plt
5553
import scipy.stats as stats
5654
from scipy.stats import norm
5755
from scipy.stats import poisson
58-
59-
import ipywidgets as widgets
6056
from IPython.display import display
6157

6258
from IPython.display import Image
@@ -109,7 +105,7 @@ he3_all = he3_all.sort_index()
109105
Now that we have collected the raw data (i.e. electric signal history) that interests us, let us have a look at the measured neutron and gamma counts.
110106
<!-- #endregion -->
111107

112-
```python colab={"base_uri": "https://localhost:8080/", "height": 463} id="bUOQ2fYdd712" outputId="6decf25e-d690-4483-ea8e-6240dd4ee76b"
108+
```python colab={"base_uri": "https://localhost:8080/", "height": 463} id="bUOQ2fYdd712" outputId="21c11446-99c1-413f-c816-eac991ffd815"
113109
plt.figure(figsize=(8, 4))
114110
plt.plot(he3_all['Counts ch50-1000'])
115111
plt.xlabel('Time')
@@ -120,11 +116,11 @@ plt.show()
120116
# plt.savefig("He3-counts-dec.png", dpi=600)
121117
```
122118

123-
```python colab={"base_uri": "https://localhost:8080/", "height": 335} id="7HJkR9hpexLK" outputId="dc599529-5ba8-4b34-c772-6c0848d53898"
119+
```python colab={"base_uri": "https://localhost:8080/", "height": 335} id="7HJkR9hpexLK" outputId="492f7102-c7da-4208-aa2b-840c10dc23b8"
124120
he3_all['Counts ch50-1000'].describe()
125121
```
126122

127-
```python colab={"base_uri": "https://localhost:8080/", "height": 564} id="3BWIPYvwexio" outputId="67de1e10-e136-46c1-d4b3-c1a00eca54d5"
123+
```python colab={"base_uri": "https://localhost:8080/", "height": 564} id="3BWIPYvwexio" outputId="86bc66d5-0087-4c28-cda1-011d516b5e8c"
128124
# Ensure the index is datetime
129125
he3_all.index = pd.to_datetime(he3_all.index)
130126

@@ -150,10 +146,10 @@ plt.show()
150146
```
151147

152148
<!-- #region id="zxgDMmwGfr8K" -->
153-
From the plot above, it is unclear whether the background ditribution corresponds to a Poisson ditribution with a large $\lambda$ or a Gaussian distribution. Let us begin by attempting to fit the data to a Poisson distribution.
149+
From the plot above, it is unclear whether the background ditribution corresponds to a Poisson distribution with a large $\lambda$ or a Gaussian distribution. Let us begin by attempting to fit the data to a Poisson distribution.
154150
<!-- #endregion -->
155151

156-
```python id="RX4TIdihhA8K"
152+
```python id="RX4TIdihhA8K" outputId="83670190-27d9-412d-ade9-5af8874239a5" colab={"base_uri": "https://localhost:8080/"}
157153
he3_all.index = pd.to_datetime(he3_all.index)
158154

159155
grouped_by_day = he3_all.groupby(he3_all.index.date)
@@ -205,16 +201,14 @@ def plot_with_z_band(Z):
205201
plt.grid(True)
206202
plt.tight_layout()
207203
plt.show()
204+
```
208205

209-
# Create Z-score slider
210-
z_slider = widgets.IntSlider(value=3, min=1, max=5, step=1, description='Z-score:', continuous_update=False)
211-
212-
# Interactive output
213-
interactive_plot = widgets.interactive_output(plot_with_z_band, {'Z': z_slider})
214-
215-
# Display
216-
display(z_slider, interactive_plot)
206+
<!-- #region id="IVdhMt1xSXWj" -->
207+
The code above gives us a function to plot a histogram of He-3 counts along with a normal fit and a $Z\cdot \sigma$ band. Feel free o play around with the value of Z below to observe its effects on which counts are considered in our model
208+
<!-- #endregion -->
217209

210+
```python id="geSAupq1SUn7" outputId="aff83bbe-0489-40f8-d2c0-38c4a10a20de" colab={"base_uri": "https://localhost:8080/", "height": 601}
211+
plot_with_z_band(Z=3)
218212
```
219213

220214
```python id="g7WTO2_DiOss"
@@ -276,14 +270,14 @@ def plot_histogram_with_z(Z):
276270
plt.grid(True)
277271
plt.tight_layout()
278272
plt.show()
273+
```
279274

280-
# Z-score slider
281-
z_slider = widgets.IntSlider(value=3, min=1, max=5, step=1, description='Z-score:', continuous_update=False)
282-
283-
# Display
284-
interactive_plot = widgets.interactive_output(plot_histogram_with_z, {'Z': z_slider})
285-
display(z_slider, interactive_plot)
275+
<!-- #region id="RzasFIgwSsca" -->
276+
Similarly to above, feel free to play around with different values of $Z$ below. The only difference here is that we are considering a POisson fit to our background.
277+
<!-- #endregion -->
286278

279+
```python id="6eiTTDaISryL" outputId="35e56bb0-5119-47a3-a028-b191715fade0" colab={"base_uri": "https://localhost:8080/", "height": 601}
280+
plot_histogram_with_z(Z=3)
287281
```
288282

289283
<!-- #region id="3zUTAdVujXne" -->
@@ -320,19 +314,16 @@ def plot_he3_outliers(Z):
320314
plt.grid(True)
321315
plt.tight_layout()
322316
plt.show()
317+
```
323318

324-
# Create the Z-score slider
325-
z_slider_he3 = widgets.IntSlider(value=3, min=1, max=10, step=1,
326-
description='Z-score:', continuous_update=False)
327-
328-
# Connect slider to plotting function
329-
interactive_plot_he3 = widgets.interactive_output(plot_he3_outliers, {'Z': z_slider_he3})
330-
331-
# Display slider and plot
332-
display(z_slider_he3, interactive_plot_he3)
319+
<!-- #region id="b81Pk6pBS93C" -->
320+
The different alues of $Z$ will lead to different considerations of what counts are "outliers". Again, feel free to play around with the different values of Z to observe the effect on our counting. The standard, as discussed above, will be $Z=3$.
321+
<!-- #endregion -->
333322

323+
```python id="m9WCJBdMjrwb" outputId="0fe8314e-f14d-4443-f149-79738041060f" colab={"base_uri": "https://localhost:8080/", "height": 363}
324+
plot_he3_outliers(Z=3)
334325
```
335326

336-
```python id="m9WCJBdMjrwb"
327+
```python id="OcA2eerVTPVC"
337328

338329
```

0 commit comments

Comments
 (0)