-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
297 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
version: 2 | ||
|
||
build: | ||
os: ubuntu-22.04 | ||
tools: | ||
python: "3.10" | ||
jobs: | ||
pre_build: | ||
# Generate the Sphinx configuration for this Jupyter Book so it builds. | ||
- "jupyter-book config sphinx docs/" | ||
|
||
python: | ||
install: | ||
- method: pip | ||
path: . | ||
extra_requirements: | ||
- sphinx | ||
|
||
sphinx: | ||
builder: html | ||
fail_on_warning: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Book settings | ||
# Learn more at https://jupyterbook.org/customize/config.html | ||
|
||
title: dj-notebook | ||
author: The dj-notebook Community | ||
# logo: logo.png | ||
|
||
# Force re-execution of notebooks on each build. | ||
# See https://jupyterbook.org/content/execute.html | ||
execute: | ||
execute_notebooks: force | ||
|
||
# Define the name of the latex output file for PDF builds | ||
latex: | ||
latex_documents: | ||
targetname: book.tex | ||
|
||
# Add a bibtex file so that we can create citations | ||
bibtex_bibfiles: | ||
- references.bib | ||
|
||
# Information about where the book exists on the web | ||
repository: | ||
url: https://github.com/pydanny/dj-notebook # Online location of your book | ||
path_to_book: docs # Optional path to your book, relative to the repository root | ||
branch: main # Which branch of the repository should be used when creating links (optional) | ||
|
||
# Add GitHub buttons to your book | ||
# See https://jupyterbook.org/customize/config.html#add-a-link-to-your-repository | ||
html: | ||
use_issues_button: true | ||
use_repository_button: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Table of contents | ||
# Learn more at https://jupyterbook.org/customize/toc.html | ||
|
||
format: jb-book | ||
root: intro | ||
chapters: | ||
- file: installation | ||
- file: usage | ||
# - file: markdown-notebooks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Installation | ||
|
||
Use your installation tool of choice, here we use venv and pip: | ||
|
||
```bash | ||
python -m venv venv | ||
source venv/bin/activate | ||
pip install dj-notebook | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# dj-notebook | ||
|
||
A Jupyter notebook with access to objects from the Django ORM is a powerful tool to introspect data and run ad-hoc queries. This works with modern Django and Python 3.9, 3.10, and 3.11. | ||
|
||
## Features | ||
|
||
- Easy ipython notebooks with Django | ||
- Built-in integration with the imported objects from django-extensions | ||
- Inheritance diagrams on any object, including ORM models | ||
|
||
```{tableofcontents} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
jupytext: | ||
formats: md:myst | ||
text_representation: | ||
extension: .md | ||
format_name: myst | ||
format_version: 0.13 | ||
jupytext_version: 1.11.5 | ||
kernelspec: | ||
display_name: Python 3 | ||
language: python | ||
name: python3 | ||
--- | ||
|
||
# Notebooks with MyST Markdown | ||
|
||
Jupyter Book also lets you write text-based notebooks using MyST Markdown. | ||
See [the Notebooks with MyST Markdown documentation](https://jupyterbook.org/file-types/myst-notebooks.html) for more detailed instructions. | ||
This page shows off a notebook written in MyST Markdown. | ||
|
||
## An example cell | ||
|
||
With MyST Markdown, you can define code cells with a directive like so: | ||
|
||
```{code-cell} | ||
print(2 + 2) | ||
``` | ||
|
||
When your book is built, the contents of any `{code-cell}` blocks will be | ||
executed with your default Jupyter kernel, and their outputs will be displayed | ||
in-line with the rest of your content. | ||
|
||
```{seealso} | ||
Jupyter Book uses [Jupytext](https://jupytext.readthedocs.io/en/latest/) to convert text-based files to notebooks, and can support [many other text-based notebook files](https://jupyterbook.org/file-types/jupytext.html). | ||
``` | ||
|
||
## Create a notebook with MyST Markdown | ||
|
||
MyST Markdown notebooks are defined by two things: | ||
|
||
1. YAML metadata that is needed to understand if / how it should convert text files to notebooks (including information about the kernel needed). | ||
See the YAML at the top of this page for example. | ||
2. The presence of `{code-cell}` directives, which will be executed with your book. | ||
|
||
That's all that is needed to get started! | ||
|
||
## Quickly add YAML metadata for MyST Notebooks | ||
|
||
If you have a markdown file and you'd like to quickly add YAML metadata to it, so that Jupyter Book will treat it as a MyST Markdown Notebook, run the following command: | ||
|
||
``` | ||
jupyter-book myst init path/to/markdownfile.md | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--- | ||
--- | ||
@inproceedings{holdgraf_evidence_2014, | ||
address = {Brisbane, Australia, Australia}, | ||
title = {Evidence for {Predictive} {Coding} in {Human} {Auditory} {Cortex}}, | ||
booktitle = {International {Conference} on {Cognitive} {Neuroscience}}, | ||
publisher = {Frontiers in Neuroscience}, | ||
author = {Holdgraf, Christopher Ramsay and de Heer, Wendy and Pasley, Brian N. and Knight, Robert T.}, | ||
year = {2014} | ||
} | ||
|
||
@article{holdgraf_rapid_2016, | ||
title = {Rapid tuning shifts in human auditory cortex enhance speech intelligibility}, | ||
volume = {7}, | ||
issn = {2041-1723}, | ||
url = {http://www.nature.com/doifinder/10.1038/ncomms13654}, | ||
doi = {10.1038/ncomms13654}, | ||
number = {May}, | ||
journal = {Nature Communications}, | ||
author = {Holdgraf, Christopher Ramsay and de Heer, Wendy and Pasley, Brian N. and Rieger, Jochem W. and Crone, Nathan and Lin, Jack J. and Knight, Robert T. and Theunissen, Frédéric E.}, | ||
year = {2016}, | ||
pages = {13654}, | ||
file = {Holdgraf et al. - 2016 - Rapid tuning shifts in human auditory cortex enhance speech intelligibility.pdf:C\:\\Users\\chold\\Zotero\\storage\\MDQP3JWE\\Holdgraf et al. - 2016 - Rapid tuning shifts in human auditory cortex enhance speech intelligibility.pdf:application/pdf} | ||
} | ||
|
||
@inproceedings{holdgraf_portable_2017, | ||
title = {Portable learning environments for hands-on computational instruction using container-and cloud-based technology to teach data science}, | ||
volume = {Part F1287}, | ||
isbn = {978-1-4503-5272-7}, | ||
doi = {10.1145/3093338.3093370}, | ||
abstract = {© 2017 ACM. There is an increasing interest in learning outside of the traditional classroom setting. This is especially true for topics covering computational tools and data science, as both are challenging to incorporate in the standard curriculum. These atypical learning environments offer new opportunities for teaching, particularly when it comes to combining conceptual knowledge with hands-on experience/expertise with methods and skills. Advances in cloud computing and containerized environments provide an attractive opportunity to improve the effciency and ease with which students can learn. This manuscript details recent advances towards using commonly-Available cloud computing services and advanced cyberinfrastructure support for improving the learning experience in bootcamp-style events. We cover the benets (and challenges) of using a server hosted remotely instead of relying on student laptops, discuss the technology that was used in order to make this possible, and give suggestions for how others could implement and improve upon this model for pedagogy and reproducibility.}, | ||
booktitle = {{ACM} {International} {Conference} {Proceeding} {Series}}, | ||
author = {Holdgraf, Christopher Ramsay and Culich, A. and Rokem, A. and Deniz, F. and Alegro, M. and Ushizima, D.}, | ||
year = {2017}, | ||
keywords = {Teaching, Bootcamps, Cloud computing, Data science, Docker, Pedagogy} | ||
} | ||
|
||
@article{holdgraf_encoding_2017, | ||
title = {Encoding and decoding models in cognitive electrophysiology}, | ||
volume = {11}, | ||
issn = {16625137}, | ||
doi = {10.3389/fnsys.2017.00061}, | ||
abstract = {© 2017 Holdgraf, Rieger, Micheli, Martin, Knight and Theunissen. Cognitive neuroscience has seen rapid growth in the size and complexity of data recorded from the human brain as well as in the computational tools available to analyze this data. This data explosion has resulted in an increased use of multivariate, model-based methods for asking neuroscience questions, allowing scientists to investigate multiple hypotheses with a single dataset, to use complex, time-varying stimuli, and to study the human brain under more naturalistic conditions. These tools come in the form of “Encoding” models, in which stimulus features are used to model brain activity, and “Decoding” models, in which neural features are used to generated a stimulus output. Here we review the current state of encoding and decoding models in cognitive electrophysiology and provide a practical guide toward conducting experiments and analyses in this emerging field. Our examples focus on using linear models in the study of human language and audition. We show how to calculate auditory receptive fields from natural sounds as well as how to decode neural recordings to predict speech. The paper aims to be a useful tutorial to these approaches, and a practical introduction to using machine learning and applied statistics to build models of neural activity. The data analytic approaches we discuss may also be applied to other sensory modalities, motor systems, and cognitive systems, and we cover some examples in these areas. In addition, a collection of Jupyter notebooks is publicly available as a complement to the material covered in this paper, providing code examples and tutorials for predictive modeling in python. The aimis to provide a practical understanding of predictivemodeling of human brain data and to propose best-practices in conducting these analyses.}, | ||
journal = {Frontiers in Systems Neuroscience}, | ||
author = {Holdgraf, Christopher Ramsay and Rieger, J.W. and Micheli, C. and Martin, S. and Knight, R.T. and Theunissen, F.E.}, | ||
year = {2017}, | ||
keywords = {Decoding models, Encoding models, Electrocorticography (ECoG), Electrophysiology/evoked potentials, Machine learning applied to neuroscience, Natural stimuli, Predictive modeling, Tutorials} | ||
} | ||
|
||
@book{ruby, | ||
title = {The Ruby Programming Language}, | ||
author = {Flanagan, David and Matsumoto, Yukihiro}, | ||
year = {2008}, | ||
publisher = {O'Reilly Media} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
jupyter-book | ||
matplotlib | ||
numpy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# Usage\n", | ||
"\n", | ||
"Create an ipython notebook in the same directory as `manage.py`. In VSCode,\n", | ||
"simply add a new `.ipynb` file. If using Jupyter Lab, use the `File -> New ->\n", | ||
"Notebook` menu option. \n", | ||
"\n", | ||
"In the first cell type the following:\n", | ||
"\n", | ||
"```python\n", | ||
"\n", | ||
"from dj_notebook import activate\n", | ||
"\n", | ||
"plus = activate(\"DJANGO_SETTINGS_MODULE_VALUE\")\n", | ||
"```\n", | ||
"\n", | ||
"Then, find your project's `manage.py` file and open it. Copy whatever is being set to `DJANGO_SETTINGS_MODULE` as a string argument to `activate` function. \n", | ||
"\n", | ||
"See below for an example that works with dj-notebook's Django test project: " | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": { | ||
"tags": [ | ||
"remove-input" | ||
] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"# Special configuration\n", | ||
"import pathlib\n", | ||
"import sys\n", | ||
"\n", | ||
"# project base\n", | ||
"here = pathlib.Path('.').parent\n", | ||
"KRAKEN_ROOT = (here / \"..\" / \"tests\" / \"django_test_project\").resolve()\n", | ||
"sys.path.insert(0, str(KRAKEN_ROOT))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"\n", | ||
"from dj_notebook import activate\n", | ||
"\n", | ||
"plus = activate(\"book_store.settings\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"<QuerySet []>" | ||
] | ||
}, | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"plus.User.objects.all()" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "dj-notebook", | ||
"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.10.6" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |