{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Tutorial 18 - extract_instructions" ], "id": "cd6ce2c14f980f85" }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 0: Setup the project and prepare the data" ], "id": "102dff6ed840c830" }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2026-06-13T20:50:31.232261700Z", "start_time": "2026-06-13T20:50:30.681912600Z" } }, "source": [ "from pathlib import Path\n", "\n", "import pydpeet as eet" ], "id": "79e029b8403acba3", "outputs": [], "execution_count": 1 }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will use \"ERROR\" as the logging style for better readability of the notebook" ], "id": "7464f69370048fea" }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2026-06-13T20:50:31.241621200Z", "start_time": "2026-06-13T20:50:31.232765600Z" } }, "source": "eet.set_logging_style(\"ERROR\")", "id": "913f64d76d31c3ec", "outputs": [], "execution_count": 2 }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2026-06-13T20:50:35.656802100Z", "start_time": "2026-06-13T20:50:31.243686400Z" } }, "source": [ "standardized_data = eet.read(\n", " input_path=str(Path.cwd().parent.parent / \"res\" / \"raw_data_from_cyclers\" / \"Cal_Ageing_Checkup1.xlsx\"),\n", " config=eet.ReadConfig.Neware_8_0_0_516,\n", ")" ], "id": "dca5318f3a5d9058", "outputs": [], "execution_count": 3 }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2026-06-13T20:50:36.175775500Z", "start_time": "2026-06-13T20:50:35.656802100Z" } }, "source": "segmented_data = eet.add_primitive_segments(df=standardized_data, config=eet.PrimitiveConfig.DEFAULT)", "id": "5c64b1e2951fbdbb", "outputs": [], "execution_count": 4 }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Step 1: extract_instructions" ], "id": "307081f795f22896" }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2026-06-13T20:50:36.791655800Z", "start_time": "2026-06-13T20:50:36.175775500Z" } }, "source": [ "instructions = eet.extract_instructions(\n", " df_primitives=segmented_data,\n", ")" ], "id": "8ce09a2468014d4c", "outputs": [], "execution_count": 5 }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2026-06-13T20:50:36.824798100Z", "start_time": "2026-06-13T20:50:36.793192700Z" } }, "source": "len(instructions)", "id": "d1e2f3a4b5c6d7e8", "outputs": [ { "data": { "text/plain": [ "493" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "execution_count": 6 }, { "cell_type": "code", "metadata": { "ExecuteTime": { "end_time": "2026-06-13T20:50:36.837224200Z", "start_time": "2026-06-13T20:50:36.825810100Z" } }, "source": "instructions[:20]", "id": "e1f2a3b4c5d6e7f8", "outputs": [ { "data": { "text/plain": [ "['Charge at 1.440A for 9111.0 seconds',\n", " 'Hold at 4.198V until 0.0A',\n", " 'Discharge at 0.960A until 2.5033V',\n", " 'Hold at 2.500V until 0.0497A',\n", " 'Charge at 0.000A for 59.0 seconds',\n", " 'Charge at 1.438A until 4.2002V',\n", " 'Discharge at 0.300A for 3244.699999999997 seconds',\n", " 'Discharge at 0.960A until 4.1309V',\n", " 'Rest for 359.0 seconds',\n", " 'Discharge at 0.960A until 4.1134V',\n", " 'Rest for 359.0 seconds',\n", " 'Discharge at 0.960A until 4.1003V',\n", " 'Rest for 359.0 seconds',\n", " 'Discharge at 0.960A until 4.0901V',\n", " 'Rest for 359.0 seconds',\n", " 'Discharge at 0.960A until 4.0819V',\n", " 'Rest for 359.0 seconds',\n", " 'Discharge at 0.960A until 4.0751V',\n", " 'Rest for 359.0 seconds',\n", " 'Discharge at 0.960A until 4.0694V']" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "execution_count": 7 } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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" } }, "nbformat": 4, "nbformat_minor": 5 }