├── requirements-dev.txt ├── CODE_OF_CONDUCT.md ├── .gitignore ├── CONTRIBUTING.md ├── templates └── index.tpl ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE │ └── new-tutorial.yml ├── scripts ├── pre-process.py └── execute-convert.py ├── resources └── keywords.md ├── _config.yml ├── .pre-commit-config.yaml ├── LICENSE ├── README.md └── images └── logo.svg /requirements-dev.txt: -------------------------------------------------------------------------------- 1 | jupyter-book>=1.0.4,<2.0 2 | pre-commit 3 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | As part of Astropy, the tutorials community members should abide by the [Astropy Project Code of Conduct](http://www.astropy.org/code_of_conduct.html). 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .ipynb_checkpoints/ 2 | _build/ 3 | IPython-* 4 | *.fits* 5 | *.gz 6 | *.pdf 7 | *.jpg 8 | *.pyc 9 | *.tex 10 | exec*.ipynb 11 | .python-version 12 | .DS_Store 13 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | We welcome both new tutorials covering astronomy-related concepts and improvements to existing tutorials. Please see the [contributing guide](https://learn.astropy.org/contributing) for more information on how to contribute. 4 | -------------------------------------------------------------------------------- /templates/index.tpl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Astropy tutorials 6 | 7 | 8 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | - [ ] Check the box to confirm that you are familiar with the [contributing guidelines](https://learn.astropy.org/contributing/) and/or indicate (check the box) that you are familiar with our contributing workflow. 2 | - [ ] Confirm that any contributed tutorials contain a complete Introduction which includes an Author list, Learning Goals, Keywords, Companion Content (if applicable), and a Summary. 3 | - [ ] Check the box to confirm that you are familiar with the Astropy community [code of conduct](https://github.com/astropy/astropy/blob/main/CODE_OF_CONDUCT.md) and you agree to follow the CoC. 4 | -------------------------------------------------------------------------------- /scripts/pre-process.py: -------------------------------------------------------------------------------- 1 | import yaml 2 | 3 | with open("AUTHORS.md", "r") as f: 4 | authors = f.read().replace("\n", " ").strip(" ") 5 | 6 | with open("metadata.yml", "r") as f: 7 | meta = yaml.load(f, Loader=yaml.SafeLoader) 8 | 9 | # populate _config with tutorial-specific metadata 10 | with open("astropy-tutorials/_config.yml") as f: 11 | cfg = yaml.load(f, Loader=yaml.SafeLoader) 12 | 13 | cfg["title"] = meta["title"] 14 | cfg["author"] = authors 15 | # cfg["repository"]["url"] = f"https://github.com/astropy-learn/{meta['source']}" 16 | cfg["sphinx"]["config"]["html_theme_options"]["repository_url"] = ( 17 | f"https://github.com/astropy-learn/{meta['source']}" 18 | ) 19 | 20 | # save populated '_config.yml' in the target repo 21 | with open("_config.yml", "w") as f: 22 | cfg = yaml.dump(cfg, stream=f, default_flow_style=False, sort_keys=False) 23 | 24 | # for use by subsequent github actions job 25 | print(meta["slug"]) 26 | -------------------------------------------------------------------------------- /resources/keywords.md: -------------------------------------------------------------------------------- 1 | # Astropy package keywords 2 | astroquery 3 | coordinates 4 | astroplan 5 | reproject 6 | table 7 | spectral cube 8 | aplpy 9 | imexam 10 | specutils 11 | photutils 12 | wcs 13 | units 14 | time 15 | synphot 16 | dust extinction 17 | modeling 18 | convolution 19 | gala 20 | vo conesearch 21 | 22 | # Python package keywords 23 | matplotlib 24 | numpy 25 | scipy 26 | dask 27 | 28 | # Task keywords 29 | contour plots 30 | data cubes 31 | FITS 32 | image analysis 33 | image manipulation 34 | model fitting 35 | file input/output 36 | histogram 37 | error bars 38 | OOP 39 | scatter plots 40 | spectroscopy 41 | time series 42 | units 43 | Vizier 44 | photometry 45 | colorbar 46 | LaTeX 47 | modular code 48 | Simbad 49 | scalebar 50 | pv diagram 51 | 52 | # Science keywords 53 | astrodynamics 54 | stellar photometry 55 | stellar physics 56 | radio astronomy 57 | astrostatistics 58 | x-ray astronomy 59 | galactic astronomy 60 | galaxy dynamics 61 | stellar evolution 62 | physics 63 | observational astronomy 64 | astrometry 65 | extinction 66 | polarimetry 67 | IR and optical astronomy 68 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | title: 2 | author: 3 | logo: logo.svg 4 | execute: 5 | execute_notebooks: force 6 | # repository: 7 | # url: 8 | # branch: main 9 | # html: 10 | # use_repository_button: true 11 | # use_issues_button: true 12 | # use_edit_page_button: true 13 | # home_page_in_navbar: true 14 | # analytics: 15 | # google_analytics_id: "G-ZBXC3EFGGJ" 16 | # launch_buttons: 17 | # notebook_interface: jupyterlab 18 | # thebe: true 19 | sphinx: 20 | config: 21 | html_show_copyright: false 22 | nb_execution_raise_on_error: true # raise error if a notebook cell fails to execute 23 | nb_execution_timeout: 600 # max time [s] to wait for a cell to execute; raises error if exceeded 24 | html_theme_options: 25 | use_repository_button: true 26 | use_issues_button: true 27 | use_edit_page_button: true 28 | analytics: 29 | google_analytics_id: "G-ZBXC3EFGGJ" 30 | launch_buttons: 31 | notebook_interface: jupyterlab 32 | thebe: true 33 | repository_url: 34 | repository_branch: main 35 | logo: 36 | link: "https://learn.astropy.org" 37 | alt_text: "Learn Astropy" 38 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | # See https://pre-commit.com for more information 2 | # See https://pre-commit.com/hooks.html for more hooks 3 | 4 | ci: 5 | autoupdate_commit_msg: "chore: update pre-commit hooks" 6 | autofix_commit_msg: "style: pre-commit fixes" 7 | autofix_prs: true 8 | 9 | repos: 10 | - repo: https://github.com/astral-sh/ruff-pre-commit 11 | rev: "v0.12.1" 12 | hooks: 13 | - id: ruff 14 | types_or: [python, pyi, jupyter] 15 | args: [--fix, --show-fixes] 16 | - id: ruff-format 17 | types_or: [python, pyi, jupyter] 18 | 19 | - repo: https://github.com/pre-commit/pre-commit-hooks 20 | rev: v5.0.0 21 | hooks: 22 | - id: trailing-whitespace 23 | exclude: '.*\.fits$' 24 | - id: end-of-file-fixer 25 | exclude_types: [csv] 26 | exclude: '.*\.fits$' 27 | - id: check-yaml 28 | # prevent addition of (presumably data) files >= 10 MB 29 | # (for such files, see https://learn.astropy.org/contributing/how-to-contribute) 30 | - id: check-added-large-files 31 | args: ["--maxkb=10000"] 32 | 33 | - repo: https://github.com/kynan/nbstripout 34 | rev: 0.8.1 35 | hooks: 36 | - id: nbstripout 37 | args: ["--extra-keys=metadata.kernelspec metadata.language_info.version metadata.toc"] 38 | -------------------------------------------------------------------------------- /scripts/execute-convert.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import sys 3 | import glob 4 | 5 | slug = sys.argv[1] 6 | 7 | 8 | def run_command(command, verbose=1): 9 | try: 10 | result = subprocess.run(command, check=True, capture_output=True, text=True) 11 | except subprocess.CalledProcessError as e: 12 | print(f"Error building book: {e.stderr}") 13 | sys.exit(1) 14 | if verbose > 0: 15 | print(f"Output: {result.stdout}") 16 | return result 17 | 18 | 19 | notebooks = glob.glob("*.ipynb") 20 | if len(notebooks) > 1: 21 | print("More than one .ipynb notebook found --> assuming this is a book") 22 | 23 | # build book 24 | command = [ 25 | "jb", 26 | "build", 27 | "--config", 28 | "_config.yml", 29 | "--toc", 30 | "_toc.yml", 31 | ".", 32 | ] 33 | run_command(command) 34 | 35 | # copy build outputs to 'html' dir 36 | command = ["cp", "-r", "_build/html", "html"] 37 | run_command(command) 38 | 39 | else: 40 | # build single notebook 41 | command = [ 42 | "jb", 43 | "build", 44 | "--config", 45 | "_config.yml", 46 | f"{slug}.ipynb", 47 | ] 48 | run_command(command) 49 | 50 | # copy build outputs to 'html' dir 51 | command = ["cp", "-r", f"_build/_page/{slug}/html", "html"] 52 | run_command(command) 53 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2019–2022, The Astropy Project 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | 1. Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | 2. Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | 3. Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new-tutorial.yml: -------------------------------------------------------------------------------- 1 | name: Tutorial submission 2 | description: Submit a tutorial or set of tutorials to Astropy Learn. 3 | title: "[New tutorial]: " 4 | labels: ["content-new", "needs-content-review"] 5 | body: 6 | - type: markdown 7 | attributes: 8 | value: | 9 | Please complete all of the below information to submit a tutorial or set of tutorials. Thanks in advance for your contribution to Astropy Learn! 10 | - type: input 11 | id: tutorial-title 12 | attributes: 13 | label: Tutorial title 14 | validations: 15 | required: true 16 | - type: textarea 17 | id: authors 18 | attributes: 19 | label: Tutorial authors 20 | description: Include author names, GitHub usernames and ORCID IDs 21 | validations: 22 | required: true 23 | - type: textarea 24 | id: requirements 25 | attributes: 26 | label: Notebook requirements 27 | description: Python packages required to run the notebook(s) 28 | validations: 29 | required: true 30 | - type: textarea 31 | id: description 32 | attributes: 33 | label: Description 34 | description: Provide a summary of the tutorial. 35 | validations: 36 | required: true 37 | - type: textarea 38 | id: ancillary-files 39 | attributes: 40 | label: Attach files 41 | description: Attach the tutorial notebook(s) and any necessary ancillary files (e.g., data files) needed to run them. Note anything about the files that is not clear from the filenames here. 42 | validations: 43 | required: true 44 | - type: textarea 45 | id: index-content 46 | attributes: 47 | label: Book summary (if multiple notebooks) 48 | description: If you are submitting a set of thematically linked tutorials (called a 'book'), please provide a paragraph summarizing all of the notebooks, making clear their sequential order. 49 | validations: 50 | required: false 51 | - type: checkboxes 52 | id: check-citation 53 | attributes: 54 | label: Citation 55 | description: Check here if you would like the tutorial to be made citable via an upload to [Zenodo](https://zenodo.org/). (If so, be sure to include the authors' ORCID IDs above.) 56 | options: 57 | - label: Yes, I would like the tutorial to be made citable via Zenodo. 58 | required: false 59 | - type: checkboxes 60 | id: check-intro 61 | attributes: 62 | label: Introduction format 63 | description: The tutorial(s) contain a complete Introduction cell that includes the tutorial title, author list, learning goals, keywords, companion content if relevant, and a summary - following the format in the [contributing guidelines](https://learn.astropy.org/contributing/). 64 | options: 65 | - label: I confirm. 66 | required: true 67 | - type: checkboxes 68 | id: check-guidelines 69 | attributes: 70 | label: Contribution guidelines 71 | description: I am familiar with the Learn Astropy [contributing guidelines](https://learn.astropy.org/contributing/). 72 | options: 73 | - label: I confirm. 74 | required: true 75 | - type: checkboxes 76 | id: check-coc 77 | attributes: 78 | label: Code of Conduct 79 | description: I am familiar with the Astropy community [code of conduct](https://github.com/astropy/astropy/blob/main/CODE_OF_CONDUCT.md) and agree to follow it. 80 | options: 81 | - label: I confirm. 82 | required: true 83 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Astropy Tutorials 2 | 3 | This repo is used for discussion of topics relating to Learn Astropy, but not specific to a single tutorial. Please open an issue to raise a topic. If you would instead like to raise an issue about a specific tutorial, please do so in that tutorial's `tutorial--*` respository. If you would like to contribute a new tutorial, see the [contribution guide](https://learn.astropy.org/contributing/). 4 | 5 | For developers, this repo also contains scripts and resources used across all tutorials - see the [dev guide](https://github.com/astropy-learn/dev-guide). 6 | 7 | ## Site infrastructure status 8 | - learn-astropy [![Deploy](https://github.com/astropy-learn/learn-astropy/actions/workflows/deploy.yaml/badge.svg)](https://github.com/astropy-learn/learn-astropy/actions/workflows/deploy.yaml) 9 | - learn-astropy-librarian [![CI](https://github.com/astropy-learn/learn-astropy-librarian/actions/workflows/ci.yaml/badge.svg)](https://github.com/astropy-learn/learn-astropy-librarian/actions/workflows/ci.yaml) 10 | 11 | ## Tutorials build status 12 | - astropy-coordinates [![Build notebook](https://github.com/astropy-learn/tutorial--astropy-coordinates/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--astropy-coordinates/actions/workflows/build.yml) 13 | - astropy-modeling [![Build notebook](https://github.com/astropy-learn/tutorial--astropy-modeling/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--astropy-modeling/actions/workflows/build.yml) 14 | - color-excess [![Build notebook](https://github.com/astropy-learn/tutorial--color-excess/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--color-excess/actions/workflows/build.yml) 15 | - FITS-cubes [![Build notebook](https://github.com/astropy-learn/tutorial--FITS-cubes/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--FITS-cubes/actions/workflows/build.yml) 16 | - FITS-header [![Build notebook](https://github.com/astropy-learn/tutorial--FITS-header/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--FITS-header/actions/workflows/build.yml) 17 | - FITS-images [![Build notebook](https://github.com/astropy-learn/tutorial--FITS-images/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--FITS-images/actions/workflows/build.yml) 18 | - FITS-tables [![Build notebook](https://github.com/astropy-learn/tutorial--FITS-tables/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--FITS-tables/actions/workflows/build.yml) 19 | - gaia-galactic-orbits [![Build notebook](https://github.com/astropy-learn/tutorial--gaia-galactic-orbits/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--gaia-galactic-orbits/actions/workflows/build.yml) 20 | - gaia-visualization [![Build notebook](https://github.com/astropy-learn/tutorial--gaia-visualization/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--gaia-visualization/actions/workflows/build.yml) 21 | - plot-catalog [![Build notebook](https://github.com/astropy-learn/tutorial--plot-catalog/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--plot-catalog/actions/workflows/build.yml) 22 | - position-velocity-diagrams [![Build notebook](https://github.com/astropy-learn/tutorial--position-velocity-diagrams/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--position-velocity-diagrams/actions/workflows/build.yml) 23 | - quantities [![Build notebook](https://github.com/astropy-learn/tutorial--quantities/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--quantities/actions/workflows/build.yml) 24 | - redshift-plot [![Build notebook](https://github.com/astropy-learn/tutorial--redshift-plot/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--redshift-plot/actions/workflows/build.yml) 25 | - spectral-cube-reprojection [![Build notebook](https://github.com/astropy-learn/tutorial--spectral-cube-reprojection/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--spectral-cube-reprojection/actions/workflows/build.yml) 26 | - spectroscopic-data-reduction-basics [![Build notebook](https://github.com/astropy-learn/tutorial--spectroscopic-data-reduction-basics/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--spectroscopic-data-reduction-basics/actions/workflows/build.yml) 27 | - synthetic-images [![Build notebook](https://github.com/astropy-learn/tutorial--synthetic-images/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--synthetic-images/actions/workflows/build.yml) 28 | - units-and-integration [![Build notebook](https://github.com/astropy-learn/tutorial--units-and-integration/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--units-and-integration/actions/workflows/build.yml) 29 | - UVES [![Build notebook](https://github.com/astropy-learn/tutorial--UVES/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--UVES/actions/workflows/build.yml) 30 | - vo [![Build notebook](https://github.com/astropy-learn/tutorial--vo/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--vo/actions/workflows/build.yml) 31 | - wcs-celestial-coordinates [![Build notebook](https://github.com/astropy-learn/tutorial--wcs-celestial-coordinates/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--wcs-celestial-coordinates/actions/workflows/build.yml) 32 | - working-with-large-FITS-files [![Build notebook](https://github.com/astropy-learn/tutorial--working-with-large-FITS-files/actions/workflows/build.yml/badge.svg)](https://github.com/astropy-learn/tutorial--working-with-large-FITS-files/actions/workflows/build.yml) 33 | -------------------------------------------------------------------------------- /images/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 18 | 20 | 22 | 26 | 30 | 31 | 34 | 38 | 39 | 41 | 45 | 49 | 50 | 55 | 61 | 66 | 71 | 75 | 76 | 86 | 87 | 93 | 98 | 103 | 107 | 108 | 118 | 119 | 129 | 130 | 156 | 158 | 159 | 161 | image/svg+xml 162 | 164 | 165 | 166 | 167 | 168 | 173 | 177 | 187 | 200 | 208 | 214 | 217 | 222 | 227 | 232 | 233 | 239 | 252 | 253 | 257 | 258 | 259 | --------------------------------------------------------------------------------