{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import numpy as np" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## PyCircStat2 Utility Functions\n", "\n", "`pycircstat2` includes a handful of useful utility functions:\n", "\n", "- [`load_data`](#load-data)\n", "- [`time2float`](#converting-time-string-into-float)\n", "- [`data2rad`](#converting-data-onto-a-circular-scale-in-radian-and-vice-versa)\n", "- [`angrange`](#range)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "### Load Data\n", "\n", "All data sets from Fisher (1993) and Zar (2010; Ch26 and 27), some from Pewsey, et al. (2014) and Mardia (1972) are included in `pycircstat2`, which can be loaded by `load_data` in `pycircstat2.utils`. Meta data of the data set can be printed if `print_meta = True`, or return along with the data set if `return_meta = True`. " ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"Title\": \"B.1 Arrival times at an intensive care unit\",\n", " \"Description\": \"Arrival times on a 24-hour clock of 254 patients at an intnsive care unit, over a period of about 12 months\",\n", " \"Type\": \"Vectors\",\n", " \"Source\": \"Cox & Lewis (1966, pp. 254-5)\",\n", " \"Examples\": \"2.1, 2.3, 2.4, 2.5, 2.6, 2.8, 2.10\",\n", " \"Columns\": {\n", " \"time\": {\n", " \"name\": \"time\",\n", " \"type\": \"vectors\"\n", " }\n", " }\n", "}\n" ] } ], "source": [ "from pycircstat2.utils import load_data\n", "\n", "data, meta = load_data(name='B1', source='fisher', print_meta=True, return_meta=True)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'Title': 'B.1 Arrival times at an intensive care unit',\n", " 'Description': 'Arrival times on a 24-hour clock of 254 patients at an intnsive care unit, over a period of about 12 months',\n", " 'Type': 'Vectors',\n", " 'Source': 'Cox & Lewis (1966, pp. 254-5)',\n", " 'Examples': '2.1, 2.3, 2.4, 2.5, 2.6, 2.8, 2.10',\n", " 'Columns': {'time': {'name': 'time', 'type': 'vectors'}}}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "meta" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | time | \n", "
---|---|
1 | \n", "11:00 | \n", "
2 | \n", "17:00 | \n", "
3 | \n", "23:15 | \n", "