Fast computation of traditional summary statistics for neutrino telescopes
Project description
NT Summary Stats
Fast computation of traditional summary statistics for neutrino telescopes.
Install
pip install nt_summary_stats
Usage
import numpy as np
from nt_summary_stats import compute_summary_stats
# Basic usage
times = np.array([10.0, 15.0, 25.0, 100.0]) # shape: (N,), dtype: float
charges = np.array([1.0, 2.0, 1.5, 0.5]) # shape: (N,), dtype: float
stats = compute_summary_stats(times, charges) # returns: np.ndarray, shape (9,)
print(stats[0]) # total_charge: 5.0
print(stats[3]) # first_pulse_time: 10.0
print(stats[7]) # charge_weighted_mean_time: 26.0
Process Prometheus events:
from nt_summary_stats import process_prometheus_event
# Input: Prometheus event dictionary
event_data = {
'photons': {
'sensor_pos_x': [0.0, 0.0, 100.0], # list[float], length M
'sensor_pos_y': [0.0, 0.0, 0.0], # list[float], length M
'sensor_pos_z': [0.0, 0.0, 50.0], # list[float], length M
'string_id': [1, 1, 2], # list[int], length M
'sensor_id': [1, 1, 1], # list[int], length M
't': [10.0, 15.0, 20.0] # list[float], length M
}
}
# Default: no grouping (uses all hits as-is)
sensor_positions, sensor_stats = process_prometheus_event(event_data)
# Optional: group hits within time windows
sensor_positions, sensor_stats = process_prometheus_event(event_data, grouping_window_ns=2.0)
# sensor_positions: np.ndarray, shape (N_sensors, 3), dtype: float64
# sensor_stats: np.ndarray, shape (N_sensors, 9), dtype: float64
# Arrays are aligned: sensor_positions[i] corresponds to sensor_stats[i]
Process individual sensor data:
from nt_summary_stats import process_sensor_data
# Input: sensor hit data
sensor_times = [10.0, 10.5, 15.0, 100.0] # list[float] or np.ndarray(N,)
sensor_charges = [1.0, 0.5, 2.0, 1.0] # list[float] or np.ndarray(N,), optional
# Default: no grouping (uses all hits as-is)
stats = process_sensor_data(sensor_times, sensor_charges) # returns: np.ndarray, shape (9,)
# Optional: group hits within time windows
stats = process_sensor_data(sensor_times, sensor_charges, grouping_window_ns=2.0)
Summary Statistics
Computes 9 traditional summary statistics for neutrino telescope sensors as described in the IceCube paper. All functions return numpy arrays with statistics in the following order:
stats = compute_summary_stats(times, charges) # shape: (9,)
# Array indices:
stats[0] # total_charge: Total charge collected
stats[1] # charge_100ns: Charge within 100ns of first pulse
stats[2] # charge_500ns: Charge within 500ns of first pulse
stats[3] # first_pulse_time: Time of first pulse
stats[4] # last_pulse_time: Time of last pulse
stats[5] # charge_20_percent_time: Time at which 20% of charge is collected
stats[6] # charge_50_percent_time: Time at which 50% of charge is collected
stats[7] # charge_weighted_mean_time: Charge-weighted mean time
stats[8] # charge_weighted_std_time: Charge-weighted standard deviation
API
compute_summary_stats(times, charges)
Args:
times:np.ndarrayorlist, shape(N,)- pulse arrival times in nscharges:np.ndarrayorlist, shape(N,)- pulse charges
Returns: np.ndarray, shape (9,) - array with 9 summary statistics in order shown above
process_prometheus_event(event_data, grouping_window_ns=None)
Args:
event_data:dictorawkward.Array- Prometheus event data. Supports:- Dictionary with
photonskey containing sensor data - Awkward array with
photonsfield (requiresawkwardpackage) - Direct photon data structure with required fields
- Dictionary with
grouping_window_ns:floatorNone- time window for grouping hits (default: None, no grouping)
Returns: tuple[np.ndarray, np.ndarray]
sensor_positions:np.ndarray, shape(N_sensors, 3)- sensor positionssensor_stats:np.ndarray, shape(N_sensors, 9)- statistics for each sensor (aligned with positions)
process_sensor_data(sensor_times, sensor_charges=None, grouping_window_ns=None)
Args:
sensor_times:np.ndarrayorlist, shape(N,)- hit times for sensorsensor_charges:np.ndarrayorlist, shape(N,)- hit charges (optional, defaults to 1.0)grouping_window_ns:floatorNone- time window for grouping hits (default: None, no grouping)
Returns: np.ndarray, shape (9,) - array with 9 summary statistics in order shown above
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nt_summary_stats-0.1.0.tar.gz.
File metadata
- Download URL: nt_summary_stats-0.1.0.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a2a1f1e8dab9844d9b2e6f109962c6bf3502559a7409ef62860ec3f72850f11
|
|
| MD5 |
db5c4fd79bced465029529eb7c04457a
|
|
| BLAKE2b-256 |
1481c491f0237a9ebc115c36ad5341c7667da480ca9b52d40247284384d4fd15
|
File details
Details for the file nt_summary_stats-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nt_summary_stats-0.1.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
262f14f772a617c9550203263089655b9a738beef96b53638025b95e20343ebf
|
|
| MD5 |
84bad42491c2844161ac477603d9dd50
|
|
| BLAKE2b-256 |
ffabf963c9f276cb2c821942e2e65938f56f3ff200d0fc6466b952bf178d4a40
|