{ "nbformat": 4, "nbformat_minor": 0, "metadata": { "colab": { "name": "enDAQ-Python-Quick-Start.ipynb", "provenance": [], "collapsed_sections": [], "toc_visible": true }, "kernelspec": { "name": "python3", "display_name": "Python 3" }, "language_info": { "name": "python" } }, "cells": [ { "cell_type": "code", "execution_count": null, "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "ai4iXgA7v9B3", "outputId": "70aa031b-c56c-4750-eed4-44ad9e9866fc" }, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ " Installing build dependencies ... \u001B[?25l\u001B[?25hdone\n", " Getting requirements to build wheel ... \u001B[?25l\u001B[?25hdone\n", " Preparing wheel metadata ... \u001B[?25l\u001B[?25hdone\n", "\u001B[K |████████████████████████████████| 63 kB 1.1 MB/s \n", "\u001B[K |████████████████████████████████| 93 kB 879 kB/s \n", "\u001B[K |████████████████████████████████| 38.1 MB 1.3 MB/s \n", "\u001B[K |████████████████████████████████| 83 kB 1.2 MB/s \n", "\u001B[?25h Building wheel for endaq (PEP 517) ... \u001B[?25l\u001B[?25hdone\n", "\u001B[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n", "google-colab 1.0.0 requires requests~=2.23.0, but you have requests 2.27.1 which is incompatible.\n", "datascience 0.10.6 requires folium==0.2.1, but you have folium 0.8.3 which is incompatible.\n", "albumentations 0.1.12 requires imgaug<0.2.7,>=0.2.5, but you have imgaug 0.2.9 which is incompatible.\u001B[0m\n" ] } ], "source": [ "!pip install -q git+https://github.com/MideTechnology/endaq-python.git@development\n", "exit() #forces a restart, it will make Colab crash - that is okay! just go on to run all the cells below\n", " #Note that this is only needed in colab and not if running locally" ] }, { "cell_type": "markdown", "source": [ "# Quick Start Guide\n", "\n", "## Introduction\n", "This example script will use the enDAQ Python library to do the following:\n", "\n", "* Load open-source libraries\n", "* Load data directly from an IDE file recorded from an enDAQ sensor\n", " * Provide meta data about the sensor which recorded the data\n", " * Summary the contents of the file as a table of all sensor channels\n", " * Summarize all data in a dashboard\n", "* Get the accelerometer data\n", " * Apply a high pass filter\n", " * Plot the full time history\n", " * Plot the time history around the peak\n", " * Plot the time history in a specific time range\n", "* Shock & Vibration Analysis\n", " * Linear PSD\n", " * Octave spaced PSD\n", " * FFT\n", " * Shock response spectrum\n", "\n" ], "metadata": { "id": "2yLrZ1qpwWQi" } }, { "cell_type": "markdown", "source": [ "## Load Libraries" ], "metadata": { "id": "w1FzP7qQxp2W" } }, { "cell_type": "code", "source": [ "import endaq\n", "\n", "endaq.plot.utilities.set_theme('endaq_light')\n", "\n", "import plotly.express as px\n", "import pandas as pd\n", "import numpy as np\n", "import scipy" ], "metadata": { "id": "31QXc4iSwUrY" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "## Load Data\n", "\n", "Using the [endaq.ide.get_doc function](https://docs.endaq.com/en/development/endaq/ide.html#endaq.ide.get_doc), load in the contents of an IDE file. Note that this doesn't load all data into memory yet." ], "metadata": { "id": "LergWzEMxdRw" } }, { "cell_type": "code", "source": [ "doc = endaq.ide.get_doc('https://info.endaq.com/hubfs/data/Mining-Hammer/LOC__3__DAQ41551_11_01_02.ide')" ], "metadata": { "id": "N4cWY6Eux1MA" }, "execution_count": null, "outputs": [] }, { "cell_type": "markdown", "source": [ "### Display meta data" ], "metadata": { "id": "FpowMKFyxzJl" } }, { "cell_type": "code", "source": [ "print(f\"Serial Number: {doc.recorderInfo['RecorderSerial']}\")\n", "print(f\"Part Number: {doc.recorderInfo['PartNumber']}\")\n", "print(f\"Recording Finished at {pd.to_datetime(doc.lastUtcTime,unit='s')}\")" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/" }, "id": "SubLdBG8yQQo", "outputId": "4f87e5ad-0ca1-4618-f98c-9e44374ac4ca" }, "execution_count": null, "outputs": [ { "output_type": "stream", "name": "stdout", "text": [ "Serial Number: 9680\n", "Part Number: S3-E2000D40\n", "Recording Finished at 2021-03-25 03:32:32\n" ] } ] }, { "cell_type": "markdown", "source": [ "### Table of file contents\n", "This uses the function [endaq.ide.get_channel_table](https://docs.endaq.com/en/development/endaq/ide.html#endaq.ide.get_channel_table)." ], "metadata": { "id": "iNgnSQzLzVfG" } }, { "cell_type": "code", "source": [ "endaq.ide.get_channel_table(doc)" ], "metadata": { "colab": { "base_uri": "https://localhost:8080/", "height": 394 }, "id": "9W2HaZKsy2VE", "outputId": "cb8d72fa-4856-4cbc-af7b-33f7c55e8b2f" }, "execution_count": null, "outputs": [ { "output_type": "execute_result", "data": { "text/html": [ "\n", "
| \n", " | channel | \n", "name | \n", "type | \n", "units | \n", "start | \n", "end | \n", "duration | \n", "samples | \n", "rate | \n", "
|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "8.0 | \n", "X (2000g) | \n", "Acceleration | \n", "g | \n", "34:01.0868 | \n", "34:15.0561 | \n", "00:13.0693 | \n", "273867 | \n", "20000.07 Hz | \n", "
| 1 | \n", "8.1 | \n", "Y (2000g) | \n", "Acceleration | \n", "g | \n", "34:01.0868 | \n", "34:15.0561 | \n", "00:13.0693 | \n", "273867 | \n", "20000.07 Hz | \n", "
| 2 | \n", "8.2 | \n", "Z (2000g) | \n", "Acceleration | \n", "g | \n", "34:01.0868 | \n", "34:15.0561 | \n", "00:13.0693 | \n", "273867 | \n", "20000.07 Hz | \n", "
| 3 | \n", "80.0 | \n", "X (40g) | \n", "Acceleration | \n", "g | \n", "34:01.0717 | \n", "34:15.0531 | \n", "00:13.0814 | \n", "55510 | \n", "4018.33 Hz | \n", "
| 4 | \n", "80.1 | \n", "Y (40g) | \n", "Acceleration | \n", "g | \n", "34:01.0717 | \n", "34:15.0531 | \n", "00:13.0814 | \n", "55510 | \n", "4018.33 Hz | \n", "
| 5 | \n", "80.2 | \n", "Z (40g) | \n", "Acceleration | \n", "g | \n", "34:01.0717 | \n", "34:15.0531 | \n", "00:13.0814 | \n", "55510 | \n", "4018.33 Hz | \n", "
| 6 | \n", "36.0 | \n", "Pressure/Temperature:00 | \n", "Pressure | \n", "Pa | \n", "33:47.0105 | \n", "34:12.0130 | \n", "00:25.0025 | \n", "26 | \n", "1.04 Hz | \n", "
| 7 | \n", "36.1 | \n", "Pressure/Temperature:01 | \n", "Temperature | \n", "°C | \n", "33:47.0105 | \n", "34:12.0130 | \n", "00:25.0025 | \n", "26 | \n", "1.04 Hz | \n", "
| 8 | \n", "47.0 | \n", "X | \n", "Rotation | \n", "dps | \n", "34:00.0947 | \n", "34:14.0633 | \n", "00:13.0685 | \n", "2765 | \n", "202.04 Hz | \n", "
| 9 | \n", "47.1 | \n", "Y | \n", "Rotation | \n", "dps | \n", "34:00.0947 | \n", "34:14.0633 | \n", "00:13.0685 | \n", "2765 | \n", "202.04 Hz | \n", "
| 10 | \n", "47.2 | \n", "Z | \n", "Rotation | \n", "dps | \n", "34:00.0947 | \n", "34:14.0633 | \n", "00:13.0685 | \n", "2765 | \n", "202.04 Hz | \n", "
| \n", " | X (2000g) | \n", "Y (2000g) | \n", "Z (2000g) | \n", "
|---|---|---|---|
| timestamp | \n", "\n", " | \n", " | \n", " |
| 2041.868560 | \n", "-24.046861 | \n", "14.828584 | \n", "-9.588154 | \n", "
| 2041.868610 | \n", "-7.205801 | \n", "14.828584 | \n", "-11.630245 | \n", "
| 2041.868660 | \n", "14.496595 | \n", "19.594306 | \n", "20.532687 | \n", "
| 2041.868710 | \n", "55.123480 | \n", "13.240010 | \n", "77.541059 | \n", "
| 2041.868760 | \n", "83.944262 | \n", "1.766976 | \n", "84.518203 | \n", "
| ... | \n", "... | \n", "... | \n", "... | \n", "
| 2055.561659 | \n", "50.956620 | \n", "13.946043 | \n", "5.387179 | \n", "
| 2055.561709 | \n", "62.068247 | \n", "14.828584 | \n", "7.939793 | \n", "
| 2055.561759 | \n", "40.713089 | \n", "14.828584 | \n", "5.217005 | \n", "
| 2055.561809 | \n", "2.864111 | \n", "6.709206 | \n", "3.855611 | \n", "
| 2055.561859 | \n", "-21.616192 | \n", "-9.176533 | \n", "3.004740 | \n", "
273867 rows × 3 columns
\n", "