Skip to content

Commit 4f9bcff

Browse files
authored
Merge pull request #2 from jsdodge/dev
PICUP Faculty Commons submission, v0.2
2 parents 126a726 + 8620fa8 commit 4f9bcff

24 files changed

+2055
-1266
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,10 @@ import-file-test.ipynb
2323
**/Untitled.ipynb
2424
student_feedback
2525
**/www.itl.nist.gov/
26-
mindevfit.eps
26+
mindevfit.eps
27+
pendulum.csv
28+
resistance_notebook.pdf
29+
resistance_report.pdf
30+
**/picup/**
31+
**/scratch/**
32+
**/pdfs/**

LICENSE-TEXT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-nd/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
1+
Data analysis with Python © 2019 by J. Steven Dodge is licensed under CC BY 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/

README.md

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,46 @@
1+
[![GitHub release (with filter)](https://img.shields.io/github/v/release/jsdodge/data-analysis-python?style=social&label=data-analysis-python)](https://github.com/jsdodge/data-analysis-python)
12
# Data analysis with Python
23

34
This repository contains instructional materials for learning data analysis for applications in the physical sciences. They are in the form of [Jupyter](https://jupyter-notebook.readthedocs.io/en/latest/) notebooks using the [Python](https://docs.python.org/3/tutorial/index.html) programming language. A suitable textbook to accompany these materials is [*Measurements and their Uncertainties*](https://www.oupcanada.com/catalog/9780199566334.html), by Hughes and Hase.
45

5-
These materials are a work in progress and I welcome feedback at [[email protected]](mailto:[email protected]).
6-
76
![Curve-fitting, XKCD](https://imgs.xkcd.com/comics/curve_fitting.png)
87

98
Image credit: *Curve-fitting*, by [XKCD](https://xkcd.com/2048/)
109

1110
## How to use these materials
1211
You should be able to read, run, and modify the notebooks in this repository following any one of the following methods.
1312

14-
If you are an SFU student, you will probably want to use Syzygy, which you can sign in to with your SFU Computing Account. [Syzygy](https://sfu.syzygy.ca/) is a cloud-based Jupyter notebook server hosted by the [Digital Research Alliance of Canada](https://alliancecan.ca/en). To upload the notebooks into your SFU Syzygy account:
15-
* Use this [link](https://sfu.syzygy.ca/jupyter/hub/user-redirect/git-pull?repo=https://github.com/jsdodge/data-analysis-python.git&branch=main), which should upload the contents of all the folders in the PHYS 233 repository directly to your syzygy account. Syzygy will prompt you to log in if you are not already logged in. You can also use this link to upload changes to the notebooks that occur during the course.
16-
* Or download the folder as a .zip file, unpack it into a folder, and upload the files to sfu.syzygy.ca.
13+
### Syzygy
14+
[![Static Badge](https://img.shields.io/badge/Open_in-SyZyGy-orange)](https://sfu.syzygy.ca/jupyter/hub/user-redirect/git-pull?repo=https%3A%2F%2Fgithub.com%2Fjsdodge%2Fdata-analysis-python.git&urlpath=lab%2Ftree%2Fdata-analysis-python.git%2F&branch=main)
15+
16+
If you are an SFU student, you will probably want to use Syzygy, which you can sign in to with your SFU Computing Account. [Syzygy](https://sfu.syzygy.ca/) is a cloud-based [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/) server hosted by the [Digital Research Alliance of Canada](https://alliancecan.ca/en). Select the icon above to pull the notebooks into your SFU Syzygy account. Syzygy will prompt you to log in if you are not already logged in. You can also use this link to upload changes to the notebooks that occur during the course. You may also upload files to Syzygy from a local desktop computer.
1717

1818
Within the Syzygy interface, open the `.ipynb` notebook files in the `notebooks` directory to read the documentation and run the code.
1919

20-
Or you can copy the repository to your personal computer, install the [Anaconda Python distribution](https://www.anaconda.com/download), and open the notebooks with the Jupyter notebook service in Anaconda Navigator.
20+
### Anaconda
21+
If you prefer to work with the notebooks locally on your personal computer, install the [Anaconda Python distribution](https://www.anaconda.com/download), download the notebooks from [GitHub](https://github.com/jsdodge/data-analysis-python), and open the notebooks with the [JupyterLab](https://jupyterlab.readthedocs.io/en/stable/) application in [Anaconda Navigator](https://docs.anaconda.com/free/navigator/overview/#nav-home-page-overview).
22+
23+
### Google Colab
24+
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/jsdodge/data-analysis-python/blob/main/)
25+
26+
Select the icon above to open the notebooks in the [Google Colab](https://colab.research.google.com) service.
27+
28+
29+
### Binder
30+
[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/jsdodge/data-analysis-python/main)
31+
32+
Select the icon above to run the notebooks in the free, open-source [Binder](https://mybinder.readthedocs.io/en/latest/) service. Note that it can take a while to initialize this environment.
33+
34+
## How to give feedback
35+
[![GitHub issues](https://img.shields.io/github/issues/jsdodge/data-analysis-python?logo=GitHub)
36+
](https://github.com/jsdodge/data-analysis-python/issues)
2137

22-
Or you can copy the notebooks into the [Google Colab](https://colab.research.google.com) service.
38+
The most reliable way to report an issue or suggest an improvement is by opening an [issue](https://github.com/jsdodge/data-analysis-python/issues) on GitHub.
2339

40+
You can also email me at [[email protected]](mailto:[email protected]).
2441

2542
## About
26-
These materials were written and tested in Python 3.7, including the [NumPy](https://docs.scipy.org/doc/numpy/reference/index.html) (1.17), [matplotlib](https://matplotlib.org/users/index.html) (3.1), and [SciPy](https://docs.scipy.org/doc/scipy/reference/tutorial/index.html) (1.3) packages. There are many more packages available for doing data analysis in Python, but these three include everything a practicing physicist needs to get started.
43+
These materials have been tested in Python 3.10, including the [NumPy](https://numpy.org/doc/stable/reference/index.html) (1.23), [matplotlib](https://matplotlib.org/users/index.html) (3.7), and [SciPy](https://docs.scipy.org/doc/scipy/reference/tutorial/index.html) (1.10) packages. There are many more packages available for doing data analysis in Python, but these three include everything a practicing physicist needs to get started.
2744

2845
## License
29-
The notebook text is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. See more at [Creative Commons](https://creativecommons.org/licenses/by-nc-nd/4.0/). The notebook code is open source under the [MIT License](https://opensource.org/licenses/MIT).
46+
The notebook text is licensed under CC BY 4.0. See more at [Creative Commons](https://creativecommons.org/licenses/by/4.0/). The notebook code is open source under the [MIT License](https://opensource.org/licenses/MIT).

__about__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = "0.1"

environment.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
# conda env create -f environment.yml
33
name: pydata
44
channels:
5-
- defaults
5+
- conda-forge
66
dependencies:
77
- jupyter
88
- jupyterlab
9-
- matplotlib
9+
- matplotlib=3.7
1010
- notebook
11-
- numpy
12-
- python
13-
- scipy
11+
- numpy=1.23
12+
- python=3.10
13+
- scipy=1.10

notebooks/0.0-Introduction-to-Python.ipynb

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
{
1717
"cell_type": "markdown",
1818
"metadata": {
19-
"slideshow": {
20-
"slide_type": "slide"
21-
},
2219
"pycharm": {
2320
"name": "#%% md\n"
21+
},
22+
"slideshow": {
23+
"slide_type": "slide"
2424
}
2525
},
2626
"source": [
@@ -44,17 +44,17 @@
4444
},
4545
"source": [
4646
"## Resources\n",
47-
"For more information, please consult the SFU Physics Department's [Computation Physics Website](https://www.sfu.ca/physics/computation.html) and the [Python Tutorial](https://docs.python.org/3/tutorial/)."
47+
"See the Jupyter [documentation](https://docs.jupyter.org/en/latest/) for more information about Jupyter notebooks."
4848
]
4949
},
5050
{
5151
"cell_type": "markdown",
5252
"metadata": {
53-
"slideshow": {
54-
"slide_type": "slide"
55-
},
5653
"pycharm": {
5754
"name": "#%% md\n"
55+
},
56+
"slideshow": {
57+
"slide_type": "slide"
5858
}
5959
},
6060
"source": [
@@ -65,11 +65,11 @@
6565
"cell_type": "code",
6666
"execution_count": null,
6767
"metadata": {
68-
"slideshow": {
69-
"slide_type": "-"
70-
},
7168
"pycharm": {
7269
"name": "#%%\n"
70+
},
71+
"slideshow": {
72+
"slide_type": "-"
7373
}
7474
},
7575
"outputs": [],
@@ -155,18 +155,18 @@
155155
"outputs": [],
156156
"source": [
157157
"# In Python ** is used to calculate powers.\n",
158-
"print(5 ** 2)\n",
159-
"print(9 ** 0.5)"
158+
"print(5**2)\n",
159+
"print(9**0.5)"
160160
]
161161
},
162162
{
163163
"cell_type": "markdown",
164164
"metadata": {
165-
"slideshow": {
166-
"slide_type": "slide"
167-
},
168165
"pycharm": {
169166
"name": "#%% md\n"
167+
},
168+
"slideshow": {
169+
"slide_type": "slide"
170170
}
171171
},
172172
"source": [
@@ -178,11 +178,11 @@
178178
"cell_type": "code",
179179
"execution_count": null,
180180
"metadata": {
181-
"slideshow": {
182-
"slide_type": "-"
183-
},
184181
"pycharm": {
185182
"name": "#%%\n"
183+
},
184+
"slideshow": {
185+
"slide_type": "-"
186186
}
187187
},
188188
"outputs": [],
@@ -196,15 +196,15 @@
196196
{
197197
"cell_type": "markdown",
198198
"metadata": {
199-
"slideshow": {
200-
"slide_type": "subslide"
201-
},
202199
"pycharm": {
203200
"name": "#%% md\n"
201+
},
202+
"slideshow": {
203+
"slide_type": "subslide"
204204
}
205205
},
206206
"source": [
207-
"In Python each variable has a type. You can return the varible's type by using the funtion type().\n"
207+
"In Python each variable has a type. You can return the variable's type by using the funtion [`type`](https://docs.python.org/3/library/functions.html#type).\n"
208208
]
209209
},
210210
{
@@ -290,11 +290,11 @@
290290
{
291291
"cell_type": "markdown",
292292
"metadata": {
293-
"slideshow": {
294-
"slide_type": "subslide"
295-
},
296293
"pycharm": {
297294
"name": "#%% md\n"
295+
},
296+
"slideshow": {
297+
"slide_type": "subslide"
298298
}
299299
},
300300
"source": [
@@ -312,19 +312,19 @@
312312
},
313313
"outputs": [],
314314
"source": [
315-
"# Use '' to define a string\n",
316-
"a = 'Mercury'\n",
317-
"\n",
318315
"# Use \"\" to define a string\n",
319-
"b = \"Venus\"\n",
316+
"a = \"Mercury\"\n",
317+
"\n",
318+
"# Use '' to define a string\n",
319+
"b = 'Venus'\n",
320320
"\n",
321321
"# If the string contains ' you can use \"\" to define it\n",
322-
"c = \"Ceres isn't a planet \"\n",
322+
"c = \"Ceres isn't a planet\"\n",
323323
"\n",
324324
"print(a)\n",
325325
"print(b)\n",
326326
"print(c)\n",
327-
"print('c is type: ', type(c))\n"
327+
"print(\"c is type: \", type(c))"
328328
]
329329
},
330330
{
@@ -339,8 +339,8 @@
339339
"source": [
340340
"# You can join (concatenate) strings using the '+' symbol\n",
341341
"\n",
342-
"a = 'Nep'\n",
343-
"b = 'tune'\n",
342+
"a = \"Nep\"\n",
343+
"b = \"tune\"\n",
344344
"\n",
345345
"c = a + b\n",
346346
"print(c)"
@@ -349,11 +349,11 @@
349349
{
350350
"cell_type": "markdown",
351351
"metadata": {
352-
"slideshow": {
353-
"slide_type": "slide"
354-
},
355352
"pycharm": {
356353
"name": "#%% md\n"
354+
},
355+
"slideshow": {
356+
"slide_type": "slide"
357357
}
358358
},
359359
"source": [
@@ -394,7 +394,7 @@
394394
"# A list may be composed of different variable types,\n",
395395
"# including other lists.\n",
396396
"\n",
397-
"my_list = [1, 2, 'a', 5, [1, 4, 7]]\n",
397+
"my_list = [1, 2, \"a\", 5, [1, 4, 7]]\n",
398398
"print(my_list)"
399399
]
400400
},
@@ -411,7 +411,7 @@
411411
"# The '+' operation acts on lists by joining them.\n",
412412
"\n",
413413
"a = [1, 2, 4]\n",
414-
"b = ['a', 'b', 'c']\n",
414+
"b = [\"a\", \"b\", \"c\"]\n",
415415
"c = a + b\n",
416416
"print(c)"
417417
]
@@ -525,11 +525,11 @@
525525
"outputs": [],
526526
"source": [
527527
"# We can select a range of indices by separating the start\n",
528-
"# and stop index with a colon, a[start:stop]. This is called the slice operator. \n",
528+
"# and stop index with a colon, a[start:stop]. This is called the slice operator.\n",
529529
"# This will return all elements beginning with the 'start' index and\n",
530530
"# ending with the largest index that is below 'stop'.\n",
531-
"# If you omit the first index (before the colon), the \n",
532-
"# slice starts at the beginning of the string. If you omit the second \n",
531+
"# If you omit the first index (before the colon), the\n",
532+
"# slice starts at the beginning of the string. If you omit the second\n",
533533
"# index, the slice goes to the end of the string.\n",
534534
"print(a[0:3])"
535535
]
@@ -544,8 +544,8 @@
544544
},
545545
"outputs": [],
546546
"source": [
547-
"# If you omit the first index (before the colon), the \n",
548-
"# slice starts at the beginning of the string. \n",
547+
"# If you omit the first index (before the colon), the\n",
548+
"# slice starts at the beginning of the string.\n",
549549
"print(a[:3])"
550550
]
551551
},
@@ -612,15 +612,15 @@
612612
"source": [
613613
"# Indexing also works with strings. The string is then considered as a list of characters.\n",
614614
"\n",
615-
"a = 'Kuiper belt'\n",
615+
"a = \"Kuiper belt\"\n",
616616
"\n",
617617
"# Print the first letter\n",
618618
"print(a[0])\n",
619619
"\n",
620620
"# Print the third letter\n",
621621
"print(a[2])\n",
622622
"\n",
623-
"# Print a section \n",
623+
"# Print a section\n",
624624
"print(a[2:5])\n",
625625
"print(a[7:])\n",
626626
"print(a[:6])\n",
@@ -651,9 +651,9 @@
651651
"\n",
652652
"* [The Python Tutorial](https://docs.python.org/3/tutorial/).\n",
653653
"\n",
654-
"* [SciPy User Guide](https://docs.scipy.org/doc/scipy/reference/tutorial/index.html).\n",
654+
"* [SciPy User Guide](https://docs.scipy.org/doc/scipy/tutorial/index.html).\n",
655655
"\n",
656-
"* [NumPy User Guide](https://docs.scipy.org/doc/numpy/user/index.html#user).\n",
656+
"* [NumPy User Guide](https://numpy.org/doc/stable/user/index.html#user).\n",
657657
"\n",
658658
"* Guido van Rossum, Barry Warsaw, and Nick Coghlan, [PEP 8 -- Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008). The standard style guide for Python code.\n"
659659
]
@@ -667,13 +667,13 @@
667667
},
668668
"source": [
669669
"##### About this notebook\n",
670-
"© J. Steven Dodge, 2019. The notebook text is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. See more at [Creative Commons](https://creativecommons.org/licenses/by-nc-nd/4.0/). The notebook code is open source under the [MIT License](https://opensource.org/licenses/MIT)."
670+
"© J. Steven Dodge, 2019. The notebook text is licensed under CC BY 4.0. See more at [Creative Commons](https://creativecommons.org/licenses/by/4.0/). The notebook code is open source under the [MIT License](https://opensource.org/licenses/MIT)."
671671
]
672672
}
673673
],
674674
"metadata": {
675675
"kernelspec": {
676-
"display_name": "Python 3",
676+
"display_name": "Python 3 (ipykernel)",
677677
"language": "python",
678678
"name": "python3"
679679
},
@@ -687,7 +687,7 @@
687687
"name": "python",
688688
"nbconvert_exporter": "python",
689689
"pygments_lexer": "ipython3",
690-
"version": "3.9.5"
690+
"version": "3.11.3"
691691
}
692692
},
693693
"nbformat": 4,

0 commit comments

Comments
 (0)