{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# SciPy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## What is SciPy" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "SciPy stands for (Sci)entific (Py)thon. It is an open-source Python library that contains modules for scientific computing such as linear algebra, optimization, image/signal processing, statistics, and many more. SciPy uses the NumPy `array` as its base data structure, but also builds upon `Pandas`, `Matplotlib`, and `SymPy`." ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "import numpy as np \n", "import pandas as pd \n", "from allensdk.core.cell_types_cache import CellTypesCache\n", "from allensdk.api.queries.cell_types_api import CellTypesApi\n", "import matplotlib.pyplot as plt\n", "from scipy import stats \n", "from scipy import linalg\n", "ctc = CellTypesCache(manifest_file='cell_types/manifest.json')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We will be demonstrating SciPy using the Allen Cell Types Dataset. We will discuss what this dataset contains and how to navigate through it in a later chapter. " ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | reporter_status | \n", "cell_soma_location | \n", "species | \n", "name | \n", "structure_layer_name | \n", "structure_area_id | \n", "structure_area_abbrev | \n", "transgenic_line | \n", "dendrite_type | \n", "apical | \n", "... | \n", "trough_t_ramp | \n", "trough_t_short_square | \n", "trough_v_long_square | \n", "trough_v_ramp | \n", "trough_v_short_square | \n", "upstroke_downstroke_ratio_long_square | \n", "upstroke_downstroke_ratio_ramp | \n", "upstroke_downstroke_ratio_short_square | \n", "vm_for_sag | \n", "vrest | \n", "
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
id | \n", "\n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " | \n", " |
525011903 | \n", "None | \n", "[273.0, 354.0, 216.0] | \n", "Homo Sapiens | \n", "H16.03.003.01.14.02 | \n", "3 | \n", "12113 | \n", "FroL | \n", "\n", " | spiny | \n", "intact | \n", "... | \n", "4.134987 | \n", "1.375253 | \n", "-53.968754 | \n", "-59.510420 | \n", "-71.197919 | \n", "2.895461 | \n", "2.559876 | \n", "3.099787 | \n", "-88.843758 | \n", "-70.561035 | \n", "
528642047 | \n", "None | \n", "[69.0, 254.0, 96.0] | \n", "Homo Sapiens | \n", "H16.06.009.01.02.06.05 | \n", "5 | \n", "12141 | \n", "MTG | \n", "\n", " | aspiny | \n", "NA | \n", "... | \n", "NaN | \n", "1.051160 | \n", "-67.468758 | \n", "NaN | \n", "-70.875002 | \n", "1.891881 | \n", "NaN | \n", "1.989616 | \n", "-101.000000 | \n", "-69.209610 | \n", "
537256313 | \n", "None | \n", "[322.0, 255.0, 92.0] | \n", "Homo Sapiens | \n", "H16.03.006.01.05.02 | \n", "4 | \n", "12141 | \n", "MTG | \n", "\n", " | spiny | \n", "truncated | \n", "... | \n", "5.694547 | \n", "1.389900 | \n", "-52.125004 | \n", "-51.520836 | \n", "-72.900002 | \n", "3.121182 | \n", "3.464528 | \n", "3.054681 | \n", "-87.531250 | \n", "-72.628105 | \n", "
519832676 | \n", "None | \n", "[79.0, 273.0, 91.0] | \n", "Homo Sapiens | \n", "H16.03.001.01.09.01 | \n", "3 | \n", "12141 | \n", "MTG | \n", "\n", " | spiny | \n", "truncated | \n", "... | \n", "9.962780 | \n", "1.211020 | \n", "-53.875004 | \n", "-52.416668 | \n", "-73.693753 | \n", "4.574865 | \n", "3.817988 | \n", "4.980603 | \n", "-84.218758 | \n", "-72.547661 | \n", "
596020931 | \n", "None | \n", "[66.0, 220.0, 105.0] | \n", "Homo Sapiens | \n", "H17.06.009.11.04.02 | \n", "4 | \n", "12141 | \n", "MTG | \n", "\n", " | aspiny | \n", "NA | \n", "... | \n", "14.667340 | \n", "1.336668 | \n", "-63.593754 | \n", "-63.239583 | \n", "-75.518753 | \n", "1.452890 | \n", "1.441754 | \n", "1.556087 | \n", "-82.531250 | \n", "-74.260269 | \n", "
5 rows × 70 columns
\n", "