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

SK_SN binary conversion #41

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
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
33 changes: 33 additions & 0 deletions gcn_classic_to_json/notices/SK_SN/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import numpy as np

from ... import utils


def parse(bin):
bin[10] # Unused. According to Docs:'4 bytes for the future'.
bin[12] # Unused. According to Docs:'4 bytes for the future'.
bin[17] # Unused. According to Docs:'4 bytes for the future'.
bin[
19
] # Intentionally Omitted. Defined as miscellaneous bits, but does not have any information.
bin[22:39] # Unused. According to Docs:'68 bytes for the future'.

trig_id_bits = np.flip(np.unpackbits(bin[18:19].view(dtype="u1")))

return {
"mission": "Super-Kamiokande",
"alert_type": "initial",
"alert_tense": "test" if trig_id_bits[1] else "current",
"messenger": "Neutrino",
"id": [bin[4]],
"trigger_time": utils.datetime_to_iso8601(bin[5], bin[6]),
"ra": bin[7] * 1e-4,
"dec": bin[8] * 1e-4,
"ra_dec_error": bin[15] * 1e-4,
"ra_dec_error_68": bin[11] * 1e-4,
"ra_dec_error_95": bin[16] * 1e-4,
"n_events": bin[9],
"collection_duration": bin[21] * 1e-4,
"energy_limit": bin[20] * 1e-1,
"distance_range": [bin[13] * 1e-5, bin[14] * 1e-5],
}
22 changes: 22 additions & 0 deletions gcn_classic_to_json/notices/SK_SN/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"mission": "Super-Kamiokande",
"alert_type": "initial",
"alert_tense": "test",
"messenger": "Neutrino",
"id": [
10063
],
"trigger_time": "2024-05-31T23:05:35.570Z",
"ra": 270.8199,
"dec": 31.46,
"ra_dec_error": 0.91,
"ra_dec_error_68": 0.64,
"ra_dec_error_95": 1.04,
"n_events": 64176,
"collection_duration": 10.0,
"energy_limit": 7000.0,
"distance_range": [
0.00216,
0.0029500000000000004
]
}
Loading