Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 11 additions & 13 deletions notebooks/AnalysisExamples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "667810f9",
"id": "fc7be361",
"metadata": {},
"source": [
"<!-- parity-note -->\n",
Expand All @@ -15,7 +15,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1f210963",
"id": "45d93add",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -34,15 +34,13 @@
"matplotlib.use(\"Agg\")\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from scipy.io import loadmat\n",
"\n",
"from nstat import Analysis, Covariate, nspikeTrain\n",
"from nstat.data_manager import ensure_example_data\n",
"from nstat.glm import fit_poisson_glm\n",
"from nstat.notebook_data import load_glm_data_for_notebook\n",
"from nstat.notebook_figures import FigureTracker\n",
"\n",
"DATA_DIR = ensure_example_data(download=True)\n",
"GLM_DATA = loadmat(DATA_DIR / \"glm_data.mat\", squeeze_me=True, struct_as_record=False)\n",
"GLM_DATA = load_glm_data_for_notebook()\n",
"OUTPUT_ROOT = REPO_ROOT / \"output\" / \"notebook_images\"\n",
"__tracker = FigureTracker(topic=\"AnalysisExamples\", output_root=OUTPUT_ROOT, expected_count=4)\n",
"\n",
Expand Down Expand Up @@ -79,7 +77,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "401a35e2",
"id": "3c621348",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -91,7 +89,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "501a6470",
"id": "c1d9b5e4",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -115,7 +113,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "ee81820c",
"id": "b5f3a818",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -133,7 +131,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "1056f293",
"id": "396cb183",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -152,7 +150,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "98e73438",
"id": "49d54a88",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -177,7 +175,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "46235a71",
"id": "8b700118",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -197,7 +195,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a5a09608",
"id": "9bd202c8",
"metadata": {},
"outputs": [],
"source": [
Expand Down
28 changes: 13 additions & 15 deletions notebooks/AnalysisExamples2.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "4acc696f",
"id": "2468a9e7",
"metadata": {},
"source": [
"<!-- parity-note -->\n",
Expand All @@ -15,7 +15,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "06139fcd",
"id": "5e1d1998",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -34,15 +34,13 @@
"matplotlib.use(\"Agg\")\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from scipy.io import loadmat\n",
"\n",
"from nstat import Analysis, ConfigColl, CovColl, Covariate, FitResSummary, Trial, TrialConfig, nspikeTrain, nstColl\n",
"from nstat.data_manager import ensure_example_data\n",
"from nstat.glm import fit_poisson_glm\n",
"from nstat.notebook_data import load_glm_data_for_notebook\n",
"from nstat.notebook_figures import FigureTracker\n",
"\n",
"DATA_DIR = ensure_example_data(download=True)\n",
"GLM_DATA = loadmat(DATA_DIR / \"glm_data.mat\", squeeze_me=True, struct_as_record=False)\n",
"GLM_DATA = load_glm_data_for_notebook()\n",
"OUTPUT_ROOT = REPO_ROOT / \"output\" / \"notebook_images\"\n",
"__tracker = FigureTracker(topic=\"AnalysisExamples2\", output_root=OUTPUT_ROOT, expected_count=5)\n",
"\n",
Expand Down Expand Up @@ -75,7 +73,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "dec86050",
"id": "45dc365a",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -87,7 +85,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d1533de9",
"id": "2a9182fe",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -98,7 +96,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "e35b302e",
"id": "126391f1",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -114,7 +112,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "8ec23b9f",
"id": "8aaea418",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -132,7 +130,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d2d28f3d",
"id": "d17e023e",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -151,7 +149,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0a79790c",
"id": "4ab39635",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -165,7 +163,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "cf575ee5",
"id": "db6c7107",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -188,7 +186,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "fd4cd7e9",
"id": "5a1dbe4c",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -209,7 +207,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "d9198965",
"id": "85a9d741",
"metadata": {},
"outputs": [],
"source": [
Expand Down
19 changes: 1 addition & 18 deletions notebooks/ConfigCollExamples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,17 @@
"matplotlib.use(\"Agg\")\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from scipy.io import loadmat\n",
"\n",
"from nstat.data_manager import ensure_example_data\n",
"from nstat.notebook_figures import FigureTracker\n",
"\n",
"np.random.seed(0)\n",
"DATA_DIR = ensure_example_data(download=True)\n",
"OUTPUT_ROOT = REPO_ROOT / \"output\" / \"notebook_images\"\n",
"__tracker = FigureTracker(topic='ConfigCollExamples', output_root=OUTPUT_ROOT, expected_count=0)\n",
"\n",
"def _load_example_globals(name: str) -> dict[str, object]:\n",
" candidates = [\n",
" Path(name),\n",
" DATA_DIR / name,\n",
" DATA_DIR / \"mEPSCs\" / name,\n",
" DATA_DIR / \"Place Cells\" / name,\n",
" DATA_DIR / \"Explicit Stimulus\" / name,\n",
" ]\n",
" for path in candidates:\n",
" if path.exists():\n",
" data = loadmat(path)\n",
" return {k: v for k, v in data.items() if not k.startswith(\"__\")}\n",
" return {}\n",
"\n",
"# SECTION 0: Section 0\n",
"# ConfigColl Examples\n",
"# tcObj=TrialConfig(covMask,sampleRate, history,minTime,maxTime)\n",
"__tracker.finalize()"
"__tracker.finalize()\n"
]
}
],
Expand Down
19 changes: 1 addition & 18 deletions notebooks/CovariateExamples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,33 +22,16 @@
"matplotlib.use(\"Agg\")\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"from scipy.io import loadmat\n",
"\n",
"from nstat.data_manager import ensure_example_data\n",
"from nstat.notebook_figures import FigureTracker\n",
"\n",
"np.random.seed(0)\n",
"DATA_DIR = ensure_example_data(download=True)\n",
"OUTPUT_ROOT = REPO_ROOT / \"output\" / \"notebook_images\"\n",
"__tracker = FigureTracker(topic='CovariateExamples', output_root=OUTPUT_ROOT, expected_count=2)\n",
"\n",
"def _load_example_globals(name: str) -> dict[str, object]:\n",
" candidates = [\n",
" Path(name),\n",
" DATA_DIR / name,\n",
" DATA_DIR / \"mEPSCs\" / name,\n",
" DATA_DIR / \"Place Cells\" / name,\n",
" DATA_DIR / \"Explicit Stimulus\" / name,\n",
" ]\n",
" for path in candidates:\n",
" if path.exists():\n",
" data = loadmat(path)\n",
" return {k: v for k, v in data.items() if not k.startswith(\"__\")}\n",
" return {}\n",
"\n",
"# SECTION 0: Section 0\n",
"# Test the Cov class\n",
"# Covariates are just like signals with a mean and a standard deviation They have two representations, the default (original representation) and a zero-mean representation"
"# Covariates are just like signals with a mean and a standard deviation They have two representations, the default (original representation) and a zero-mean representation\n"
]
},
{
Expand Down
26 changes: 13 additions & 13 deletions notebooks/ExplicitStimulusWhiskerData.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
"cells": [
{
"cell_type": "markdown",
"id": "1978cb81",
"id": "8b8aa493",
"metadata": {},
"source": [
"<!-- parity-note -->\n",
"## MATLAB Parity Note\n",
"- Source MATLAB helpfile: `ExplicitStimulusWhiskerData.mlx`\n",
"- Fidelity status: `high_fidelity`\n",
"- Remaining justified differences: The notebook now reproduces the dataset-backed lag search, stimulus-effect, and history-effect workflow with real figures; exact KS traces and coefficient values still vary modestly from MATLAB because the Python GLM backend and plotting defaults are different."
"- Remaining justified differences: The notebook now reproduces the dataset-backed lag search, stimulus-effect, and history-effect workflow with real figures; exact KS traces and coefficient values still vary modestly from MATLAB because the Python GLM backend and plotting defaults are different.\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9787cf60",
"id": "dbf8e486",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -35,12 +35,12 @@
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"from nstat.data_manager import ensure_example_data\n",
"from nstat.notebook_data import notebook_example_data_dir\n",
"from nstat.notebook_figures import FigureTracker\n",
"from nstat.paper_examples_full import run_experiment2\n",
"\n",
"np.random.seed(0)\n",
"DATA_DIR = ensure_example_data(download=True)\n",
"DATA_DIR = notebook_example_data_dir(allow_synthetic=True)\n",
"OUTPUT_ROOT = REPO_ROOT / \"output\" / \"notebook_images\"\n",
"__tracker = FigureTracker(topic='ExplicitStimulusWhiskerData', output_root=OUTPUT_ROOT, expected_count=9)\n",
"\n",
Expand Down Expand Up @@ -83,7 +83,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "a60a7a6d",
"id": "e296bd4d",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -106,7 +106,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "862db342",
"id": "6a18af75",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -134,7 +134,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "98d686d5",
"id": "fd207a34",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -149,7 +149,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "2b5d9da0",
"id": "2afb535d",
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -170,7 +170,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "4a033d5c",
"id": "7a48f375",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -198,7 +198,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "0a73d5e1",
"id": "043ef33a",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -230,7 +230,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "5aa18805",
"id": "d66ac872",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -290,4 +290,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
Loading