Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ultralytics Code Refactor https://ultralytics.com/actions #18

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<br>
<img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320">
<a href="https://ultralytics.com" target="_blank"><img src="https://raw.githubusercontent.com/ultralytics/assets/main/logo/Ultralytics_Logotype_Original.svg" width="320" alt="Ultralytics logo"></a>

# πŸš€ Introduction

Expand Down Expand Up @@ -84,7 +84,7 @@ For bug reports, feature requests, and contributions, head to [GitHub Issues](ht
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
<a href="https://www.tiktok.com/@ultralytics"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-tiktok.png" width="3%" alt="Ultralytics TikTok"></a>
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
<a href="https://www.instagram.com/ultralytics/"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-instagram.png" width="3%" alt="Ultralytics Instagram"></a>
<a href="https://ultralytics.com/bilibili"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-bilibili.png" width="3%" alt="Ultralytics Instagram"></a>
<img src="https://github.com/ultralytics/assets/raw/main/social/logo-transparent.png" width="3%" alt="space">
<a href="https://ultralytics.com/discord"><img src="https://github.com/ultralytics/assets/raw/main/social/logo-social-discord.png" width="3%" alt="Ultralytics Discord"></a>
</div>
9 changes: 6 additions & 3 deletions test_singles.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@


def exp1(x, a, b, c):
# f(x) = a*exp(b*x)+c
"""Compute the exponential function f(x) = a*exp(b*x) + c for input array x."""
return a * np.exp(b * x) + c


def calibrate_energy(x):
# convert energy from samples to keV using known calibration points px, py
"""Convert energy from samples to keV using known calibration points and an exponential fitting function."""
px = np.array([0.0, 150, 173, 207]) # samples
py = np.array([0.0, 334, 511, 1274]) # keV (344 keV compton edge)

Expand All @@ -29,6 +29,9 @@ def calibrate_energy(x):


def test_singles(file="my_data_singles.txt"):
"""Tests single events data from a file, calibrates energy, identifies 511 keV candidates, and generates diagnostic
plots.
"""
x = np.loadtxt(file)
t, e, ch = x.transpose() # time (ps), energy (samples), channel
print("Read %s, %g events recorded over %gs" % (file, x.shape[0], (t.max() - t.min()) / 1e12))
Expand Down Expand Up @@ -58,7 +61,7 @@ def test_singles(file="my_data_singles.txt"):


def plots(x, e0, ecal, dt, efit_label):
# matplotlib plots
"""Generate and save various matplotlib and seaborn plots for given energy and time data arrays."""
# fig, ax = plt.subplots(2, 3, figsize=(9, 6))
# ax = ax.ravel()
# ax[0].hist(e0, np.linspace(0, 300, 300))
Expand Down