You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: index.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -106,3 +106,10 @@ Requires moderate computational resources. Run-times may exceed several minutes
106
106
The computational resources required to execute this notebook exceed those provided by standard laptop computers. To execute the notebook, please deploy to a cluster computing environment.
107
107
```
108
108
109
+
Want to Add a Tutorial?
110
+
-----------------------
111
+
112
+
Please visit the [Contributing to User Tutorials](notebooks/contributing_index.md) page to find out how you can add a tutorial.
Here, we provide instructions for setting up an appropriate Python environment and building the SimPEG user tutorials website locally with [MyST](https://mystmd.org/).
5
+
6
+
## Step 1: Cloning the GitHub Repository
7
+
8
+
The URL for the SimPEG user tutorials GitHub repository is: https://github.com/simpeg/user-tutorials/. If using the Git Bash shell:
The Jupyter notebooks containing the tutorials are maintained to run properly using the [latest release of SimPEG](https://github.com/simpeg/simpeg/releases).
18
+
Notebooks may not run correctly if SimPEG is being imported from an earlier release or development branch.
19
+
The [mystmd][install-mystmd] and [nodejs](https://nodejs.org/api/packages.html) are also required to build the website locally.
20
+
21
+
We advise building a Python environment from the `environment.yml` file in the root directory of the repository.
22
+
To create the `simpeg-user-tutorials` environment using conda:
23
+
24
+
```bash
25
+
conda env create -f environment.yml
26
+
```
27
+
28
+
Once built, you can activate using:
29
+
30
+
```bash
31
+
conda activate simpeg-user-tutorials
32
+
```
33
+
34
+
## Step 3: Build and Execution Commands
35
+
36
+
The SimPEG user tutorials are a collection of [Jupyter Notebook](https://jupyter.org/) (and [Markdown](https://www.markdownguide.org/getting-started/)) files,
37
+
which [MyST][mystmd.org] builds into a website. Here, we describe the commands that contributors should be familiar with.
38
+
39
+
:::{important}
40
+
The tutorial notebooks, including their states, are tracked by GitHub. When the SimPEG user tutorials repository was cloned, all notebooks had been run and saved. Therefore, you do not need to rerun all of the notebooks prior to building the website!
41
+
:::
42
+
43
+
### Locally Build and Serve Website
44
+
45
+
The following command will build the website and serve it locally.
46
+
This will allow you to preview the website and observe any changes to notebooks on the fly.
47
+
To locally build and serve the website:
48
+
the website:
49
+
50
+
```bash
51
+
msyt start
52
+
```
53
+
54
+
Next, follow the instructions prompted by the command to launch the local build in your brower.
55
+
56
+
### Build Only
57
+
58
+
The following command will build the website and store the HTML files in
59
+
a new `_build` folder:
60
+
61
+
```bash
62
+
msyt build --html
63
+
```
64
+
65
+
### Clean Cached Builds
66
+
67
+
```bash
68
+
myst clean --all
69
+
```
70
+
71
+
### Rerunning Notebooks
72
+
73
+
When making alterations and rerunning notebooks, we typically do so by launching Jupyter Notebooks:
74
+
75
+
```bash
76
+
jupyter notebook
77
+
```
78
+
79
+
However, we can rerun a notebook and overwrite its output cells in place using `nbconvert`.
For consistency, tutorial notebooks follow strict structure and formatting requirements. Each notebook begins with an introductory section, comprised of several Markdown cells. The contents of the notebook are parsed into sections. Each section contains a Markdown cells, code cells, and plot outputs. For example, see the [3D integral formulation](xref:simpeg#simpeg.potential_fields.gravity.Simulation3DIntegral) tutorial. The structure and formatting requirements for tutorial notebooks are discussed below.
4
+
To ensure quality and consistency, the [Jupyter Notebooks](https://jupyter.org/) containing tutorials must follow strict structure and formatting requirements. The contents of each notebooks must be parsed sensibly into a set of sections. Sufficient explanation and links to API documentation are required when presenting functionality. Each section within a tutorial contains a combination of [Markdown](https://www.markdownguide.org/getting-started/)and coding cells. Our notebooks use the functionality in [MyST Parser](https://myst-parser.readthedocs.io/en/latest/) to augment the contents of Markdown cells. Before moving forward, we advise the contributor to:
5
5
6
-
### Introduction Markdown
6
+
* Be familiar with the structure and formatting that is used by most forward simulation and inversion tutorials. E.g. [3D Forward Simulation of Gravity Anomaly Data](../03-gravity/fwd_gravity_anomaly_3d.ipynb) and [3D Inversion of Gravity Anomaly Data](../03-gravity/inv_gravity_anomaly_3d.ipynb).
7
7
8
-
Every tutorial notebook must provide a thorough introduction.
8
+
* Refer to the Markdown syntax used by [MyST Parser](https://myst-parser.readthedocs.io/en/latest/).
9
9
10
-
#### Cell 1: Title Cell
10
+
* Refer to the [style guide](https://docs.simpeg.xyz/latest/content/getting_started/contributing/code-style.html) for coding cells.
11
11
12
-
The first cell in the notebooks is a Markdown cell containing the title and the author for the tutorial. It is formatted as follows.
12
+
13
+
## Notebook Introduction
14
+
15
+
Every tutorial notebook requires an introduction section. The Markdown cells required for the introduction are described below.
16
+
17
+
### Cell 1: Title Cell
18
+
19
+
The first cell contains the title and the author for the tutorial. It is formatted as follows.
13
20
The title is in quotations. You will need to add yourself as an author in the `myst.yml` file in the root directory of the repository.
14
21
15
22
```
@@ -20,7 +27,7 @@ authors:
20
27
---
21
28
```
22
29
23
-
####Cell 2: Tutorial Difficulty
30
+
### Cell 2: Tutorial Difficulty
24
31
25
32
Here, we indicate whether the notebook contains introductory, intermediate or advanced content. The author is required to choose
26
33
from one of the following [MyST admonitions](https://myst-parser.readthedocs.io/en/latest/syntax/admonitions.html), which is rendered when the webpage is built.
@@ -51,7 +58,7 @@ the user is already an experienced SimPEG user.
51
58
:::
52
59
```
53
60
54
-
####Cell 3: Computational Requirements
61
+
### Cell 3: Computational Requirements
55
62
56
63
Here, we specify the computational requirements to run the notebook. Whereas some notebooks can be run easily on laptop computers, some notebook may need to be exported as Python files and run using cluster computing. The author is required to choose from one of the following [MyST admonitions](https://myst-parser.readthedocs.io/en/latest/syntax/admonitions.html), which is rendered when the webpage is built.
57
64
@@ -80,15 +87,15 @@ to a cluster computing environment.
80
87
:::
81
88
```
82
89
83
-
####Cell 4: Keywords, Summary and Learning Objectives
90
+
### Cell 4: Keywords, Summary and Learning Objectives
84
91
85
-
In this cell, please provide keywords relevant to the notebook. E.g.
92
+
In this cell, the contributor must provide a set of relevant keywords. E.g.
86
93
87
94
```
88
95
**Keywords:** gravity inversion, sparse-norm inversion, integral formulation, tree mesh.
89
96
```
90
97
91
-
Next, summarize the purpose of the tutorial. The summary should be roughly one paragraph. If your tutorial focusses on particular functionality within SimPEG, please link to the API documentation. Please link to tutorials you feel the reader should have already worked through. E.g.
98
+
Next, the contributor must provide a summary of the tutorial. The summary should be roughly one paragraph. If your tutorial focusses on particular functionality within SimPEG, please link to the API documentation. Also, link to tutorials you feel the reader should have already worked through. E.g.
92
99
93
100
```
94
101
**Summary:** Here we invert gravity anomaly data to recover a density contrast model.
@@ -106,7 +113,7 @@ become familiar with functionality explained in the [3D Forward Simulation of Gr
106
113
Anomaly Data](fwd_gravity_anomaly_3d.ipynb) tutorial before working through this one.
107
114
```
108
115
109
-
Finally, provide learning objectives as a bullet list. E.g.
116
+
Finally, the contributor must provide learning objectives using a bullet list. E.g.
110
117
111
118
```
112
119
**Learning Objectives:**
@@ -121,21 +128,68 @@ Finally, provide learning objectives as a bullet list. E.g.
121
128
- How to analyse inversion results.
122
129
```
123
130
124
-
### Formatting Tutorial Sections
131
+
## Import Functionality
132
+
133
+
Following the introduction section, the contributor must import all functionality used by the tutorial and briefly explain the functionality that is most important.
134
+
135
+
### Cell 1: Header and Summary
136
+
137
+
This Markdown cell uses the heading **Import Modules**. For functionality that relates
138
+
directly to the purpose of the tutorial, some context and a link to API documentation
139
+
should be provided. E.g.
140
+
141
+
:::
142
+
## Import Modules
143
+
144
+
Here, we import all of the functionality required to run the notebook for the tutorial
145
+
exercise. All of the functionality specific to simulating gravity data are imported from
146
+
[simpeg.potential_fields.gravity](xref:simpeg#simpeg.potential_fields.gravity). We also
147
+
import some useful utility functions from [simpeg.utils](xref:simpeg#simpeg.utils).
148
+
To simulate gravity data, we need to define our problem geometry on a numerical grid
0 commit comments