-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added notebook showing finding harp event bitmasks
- Loading branch information
1 parent
f8349c0
commit 38d46c1
Showing
1 changed file
with
123 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\"\"\"Jupyter settings and Imports\"\"\"\n", | ||
"\n", | ||
"%load_ext autoreload\n", | ||
"%autoreload 2\n", | ||
"\n", | ||
"from pathlib import Path\n", | ||
"\n", | ||
"import aeon.io.api as api\n", | ||
"from aeon.io import reader" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 44, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"data:\n", | ||
" beambreak\n", | ||
"time \n", | ||
"2023-06-21 10:01:16.633728027 34\n", | ||
"2023-06-21 10:01:16.649184227 32\n", | ||
"2023-06-21 10:01:28.314400196 34\n", | ||
"2023-06-21 10:01:28.331103802 32\n", | ||
"2023-06-21 10:01:38.428864002 34\n", | ||
"... ...\n", | ||
"2023-06-21 11:16:43.647552013 32\n", | ||
"2023-06-21 11:16:43.655648232 34\n", | ||
"2023-06-21 11:16:43.674079895 32\n", | ||
"2023-06-21 11:21:40.381728172 34\n", | ||
"2023-06-21 11:21:40.397024155 32\n", | ||
"\n", | ||
"[196 rows x 1 columns]\n", | ||
"\n", | ||
"\n", | ||
"bitmask:\n", | ||
" 34\n", | ||
"\n", | ||
"\n", | ||
"stream_data:\n", | ||
" event\n", | ||
"time \n", | ||
"2023-06-21 10:01:16.633728027 beambreak\n", | ||
"2023-06-21 10:01:28.314400196 beambreak\n", | ||
"2023-06-21 10:01:38.428864002 beambreak\n", | ||
"2023-06-21 10:01:53.453343868 beambreak\n", | ||
"2023-06-21 10:04:14.685791969 beambreak\n", | ||
"... ...\n", | ||
"2023-06-21 11:15:20.406752110 beambreak\n", | ||
"2023-06-21 11:16:24.036767960 beambreak\n", | ||
"2023-06-21 11:16:43.625472069 beambreak\n", | ||
"2023-06-21 11:16:43.655648232 beambreak\n", | ||
"2023-06-21 11:21:40.381728172 beambreak\n", | ||
"\n", | ||
"[98 rows x 1 columns]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"\"\"\"How to find the bitmask associated with any harp stream event and create a new reader: \n", | ||
"example with patch beambreak\"\"\"\n", | ||
"\n", | ||
"# Ensure you have the pattern of the stream (look at the filename), and the expected event name\n", | ||
"pattern = \"Patch1_32*\"\n", | ||
"event_name = \"beambreak\"\n", | ||
"# Set the reader for the stream\n", | ||
"harp_reader = reader.Harp(pattern=pattern, columns=[event_name])\n", | ||
"# Set the root dir and a time range in which you know the stream acquired data\n", | ||
"root = Path(\"/ceph/aeon/aeon/data/raw/AEON3/presocial0.1\")\n", | ||
"start = pd.Timestamp(\"2023-06-21 10:00:00\")\n", | ||
"end = pd.Timestamp(\"2023-06-21 12:00:10\")\n", | ||
"# Get the bitmask as the first value of the loaded stream\n", | ||
"data = api.load(root, harp_reader, start=start, end=end)\n", | ||
"bitmask = data.iloc[0, 0]\n", | ||
"new_reader = reader.BitmaskEvent(pattern, bitmask, event_name)\n", | ||
"stream_data = api.load(root, new_reader, start=start, end=end)\n", | ||
"\n", | ||
"print(f\"data:\\n {data}\\n\\n\")\n", | ||
"print(f\"bitmask:\\n {bitmask}\\n\\n\")\n", | ||
"print(f\"stream_data:\\n {stream_data}\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "aeon", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.4" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |