{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Feature Engineering" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Morphology Features" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from vitalDSP.filtering.signal_filtering import SignalFiltering\n", "import numpy as np\n", "from plotly import graph_objects as go\n", "import plotly.io as pio\n", "pio.renderers.default = \"sphinx_gallery\"\n", "# pio.renderers.default = \"plotly_mimetype\" # or \"plotly_mimetype\"\n", "# from IPython.display import display, HTML\n", "# display(HTML(''))\n", "import os\n", "from vitalDSP.notebooks import load_sample_ecg_small, plot_trace\n", "from vitalDSP.feature_engineering.morphology_features import PhysiologicalFeatureExtractor,\\\n", " PreprocessConfig\n", "\n", "fs = 128\n", "signal_col, date_col = load_sample_ecg_small()\n", "signal_col = np.array(signal_col)\n", "\n", "preprocess_config = PreprocessConfig(\n", " filter_type=\"butterworth\",\n", " lowcut=0.5,\n", " highcut=5,\n", " order=4,\n", " # noise_reduction_method=\"wavelet\"\n", ")\n", "extractor = PhysiologicalFeatureExtractor(signal_col, fs=fs)\n", "features = extractor.extract_features(signal_type=\"ECG\", preprocess_config=preprocess_config)\n", "print(\"Features extracted successfully:\")\n", "print(features)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "wearables", "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.9.17" } }, "nbformat": 4, "nbformat_minor": 2 }