diff --git a/.gitignore b/.gitignore index 42a77883b..bff0aa0d1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,11 @@ .ipynb_checkpoints/ -html/ -runipy-* +build/ +tutorials/rst-tutorials/ IPython-* -tutorials/*/_run_* -tutorials/*/*.fits -tutorials/*/*.pdf -tutorials/*/*.png +*.fits +*.pdf +*.png +*.jpg *.pyc +*.tex +exec*.ipynb diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..6a20fa6e5 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "astropy_helpers"] + path = astropy_helpers + url = https://github.com/astropy/astropy-helpers.git diff --git a/.rtd-environment.yml b/.rtd-environment.yml new file mode 100644 index 000000000..5425ce182 --- /dev/null +++ b/.rtd-environment.yml @@ -0,0 +1,17 @@ +name: tutorials + +channels: + - astropy + +dependencies: + - python=3.6 + - IPython=6.1.0 + - astropy=2.0 + - astroquery=0.3.6 + - matplotlib=2.0.2 + - numpy=1.13.1 + - scipy=0.19 # needed for coordinates cross-matching + - jupyter=1.0 + - notebook=5.0 + - pip: + - git+https://github.com/jupyter/nbconvert # this is really >=5.4, but at the time of adding this that wasn't yet available diff --git a/.travis.yml b/.travis.yml index 9c3fd1e5a..0167f0896 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,52 @@ language: c -sudo: false - os: - linux +sudo: false + +addons: + apt: + packages: + - graphviz + - texlive-latex-extra + - dvipng + env: global: + - PYTHON_VERSION=3.6 - - SETUP_XVFB=True - - CONDA_ENVIRONMENT=conda-environment.yml - - CONDA_DEPENDENCIES='jupyter notebook ipython runipy' - - GH_REF: github.com/astropy/astropy-tutorials.git - - secure: "NBZlEg//sDYvJikqXESLsx/WA1Nj7fAH2mJfI8ZVMnolvyjJuLdEMxxEYFP8t6U/iieSSrgUkgP94yy5Oq6iJRjj7ThGCdcjgvgWTQCzoQgEVDc5SzdJGyGs30VC+8t7GTobzMe086HX16SJRvsIumqXdmRcJjAdMCyhMUxLoUg=" + - NUMPY_VERSION=stable + - ASTROPY_VERSION=stable + - EVENT_TYPE='pull_request push' + + - CONDA_ENVIRONMENT='conda-environment.yml' + - CONDA_DEPENDENCIES='jupyter ipython' + - CONDA_CHANNELS='astropy-ci-extras astropy' + + # We need to install the master/latest version of nbconvert because it has support for + # allowing exceptions in individual cells: + - PIP_DEPENDENCIES='git+https://github.com/jupyter/nbconvert' + +# matrix: + +# # Don't wait for allowed failures +# fast_finish: true + +# include: + +# - os: linux +# env: SETUP_CMD='test --coverage' install: - - git clone git://github.com/astropy/ci-helpers.git + + - git clone --depth 1 git://github.com/astropy/ci-helpers.git - source ci-helpers/travis/setup_conda.sh script: - - python prepare_deploy.py run - -deploy: - provider: script - script: ./travis_deploy - on: - repo: astropy/astropy-tutorials - branch: master + # - | + # python scripts/convert.py docs/_static/tutorials/ -v + # --output-path=docs/rst-tutorials + # --template=docs/_static/astropy.tpl + - python scripts/convert.py tutorials/notebooks --exec-only -v + diff --git a/DEPLOY.md b/DEPLOY.md deleted file mode 100644 index 5331ddf7f..000000000 --- a/DEPLOY.md +++ /dev/null @@ -1,29 +0,0 @@ -Deploying -========= - -All notebooks in this repository aren't necessarily live. They have to be 'published' in order to appear on the main astropy tutorials web page. To mark a tutorial as published, you must edit the notebook metadata set the published key to `true`. For example, if I wanted to publish the Quantities tutorial, I would edit the notebook metadata for `tutorials/Quantities/Quantities.ipynb` to include a line `"published": true`. - -Once a tutorial is marked as published, the automated deploy script will find the corresponding notebook file, convert it to HTML, and include it in a push to the gh-pages branch of the repository. Only repository admins can deploy because it requires direct commit rights to the main `astropy-tutorials` repository. - -To actually deploy the tutorials, just run the deploy script: - - ./deploy - -and follow the prompts. By default, the script takes the tutorials in the master branch, runs them, converts them to HTML, and pushes to the `gh-pages` branch. __If you have any uncomitted changes in your master branch the deploy script will wipe them!__ - -Test deploy ------------ - -If you'd instead like to test running and converting the notebooks, use the `prepare_deploy.py`script. You can run the notebook files with: - - python prepare_deploy.py run - -and convert them with: - - python prepare_deploy.py convert - -or combine the commands: - - python prepare_deploy.py run convert - -The converted html files will appear in the `html` path. \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..8a3d4158e --- /dev/null +++ b/Makefile @@ -0,0 +1,131 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) tutorials + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " tutorials to convert all tutorials to RST" + +clean: + -rm -rf $(BUILDDIR) + -rm -rf api + -rm -rf generated + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Astropy.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Astropy.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/Astropy" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Astropy" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + make -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + @echo "Run 'python setup.py test' in the root directory to run doctests " \ + @echo "in the documentation." diff --git a/README.md b/README.md deleted file mode 100644 index 33c8c43ee..000000000 --- a/README.md +++ /dev/null @@ -1,29 +0,0 @@ -Tutorials -========= - -This repository contains tutorials for the [Astropy](http://astropy.org) -project (also on [github](https://github.com/astropy/astropy)). - -Running Tutorials ------------------ -The easiest way to get started quickly is to use binder to run the tutorials in your web browser - when this loads, click the "tutorials" folder and you should see all the tutorials: -[![Binder](http://mybinder.org/badge.svg)](https://beta.mybinder.org/v2/gh/astropy/astropy-tutorials/master) - -To run the tutorials *locally*, you need jupyter notebook installed: - - jupyter notebook - -The tutorials are initially empty of any output. You can run them by pressing -"Run All" under the "Cell" menu in the notebook file. - -Dependencies ------------- - -To deploy the notebooks, you will need: - -* IPython -* Astropy -* runipy -* pandoc - -_Note, all except pandoc can be pip installed. To install pandoc, follow the instructions here: http://johnmacfarlane.net/pandoc/installing.html_. diff --git a/README.rst b/README.rst new file mode 100644 index 000000000..e2caa295e --- /dev/null +++ b/README.rst @@ -0,0 +1,32 @@ +Astropy Tutorials +================= + +This repository contains tutorials for the `Astropy `_ +project. These are typically longer-form, more narrative presentations of +functionality in the `Astropy core package +`_ and any `affiliated packages +`_. The tutorials are therefore +different from the `Astropy core package documentation +`_, which presents a more structured and exhaustive +view of the core package. + +To see the tutorials rendered as static web pages, see the `Astropy tutorials +site `_. + +To run the tutorials interactively, you'll need to make sure you have `Jupyter +notebook `_ installed, then clone or download this +repository. The notebook files themselves live in the ``tutorials`` directory +of this repository, organized by the names of the tutorials. + +You can also get started quickly using `Binder `_ to run the tutorials in +your web browser within a remote server: + +.. image:: http://mybinder.org/badge.svg + :target: http://mybinder.org/repo/astropy/astropy-tutorials/docs/tutorials + +Contributing tutorial material +------------------------------ + +Please see the "`For contributors +`_" section +of the tutorials documentation for information on how to get started. diff --git a/astropy_helpers b/astropy_helpers new file mode 160000 index 000000000..aaa450659 --- /dev/null +++ b/astropy_helpers @@ -0,0 +1 @@ +Subproject commit aaa4506595b88d46c2cffe06741e36947bb58a55 diff --git a/conda-environment.yml b/conda-environment.yml index 537ffbc61..ce27cd11b 100644 --- a/conda-environment.yml +++ b/conda-environment.yml @@ -10,3 +10,6 @@ dependencies: - astroquery=0.3.6 - matplotlib=2.0.2 - numpy=1.13.1 + - scipy=0.19 # needed for coordinates cross-matching + - jupyter=1.0 + - notebook=5.0 diff --git a/deploy b/deploy deleted file mode 100755 index f9844faad..000000000 --- a/deploy +++ /dev/null @@ -1,134 +0,0 @@ -#!/bin/bash - -# this conditional assignment means you can do things like: -# GH_REMOTE=myremote ./deploy -# to set these to something other than the default - -# branches and remote for pushing to github -: ${GH_PAGESBRANCH=gh-pages} -: ${GH_REMOTE=origin} - -# if not interactive, automatically "yes" things but don't show anything -: ${INTERACTIVE=true} -: ${CURRENT_BRANCH_NAME="$(git symbolic-ref --quiet --short HEAD)"} - -if [ -z "$CURRENT_BRANCH_NAME" ]; then - echo "Could not determine current branch. Cannot continue with deployment." - exit 1 -fi - -giveup_message () { - echo "\n" - echo "You're now in an orphaned test deploy branch." - echo "To get back to normal you can run the following:" - echo " git checkout -f $CURRENT_BRANCH_NAME" - echo " git clean -f" - echo " git branch -D $GH_PAGESBRANCH" -} - -promptifinteractive () { - # first argument is message, second is non-interactive answer, all others passed to read - if [ "$INTERACTIVE" = true ] ; then - read -p "$1" -r "${@:3}" - else - echo $1 $2 - REPLY=$2 - fi -} - -echo "*****************************************************************" -echo "WARNING! This script will remove the local $GH_PAGESBRANCH branch," -echo "build the notebook files into HTML, then push to remote gh-pages" -echo "located here: $GH_REMOTE/gh-pages." -echo -echo "Make sure you have no uncommitted changes in your current branch" -echo "as these may be overwritten!" -echo -promptifinteractive "Are you sure you want to do this? [y/N] " y -n 1 -echo -if [[ $REPLY =~ ^[Yy]$ ]] -then - # first run the notebooks - OUTPUT=`python prepare_deploy.py run` - if [[ $OUTPUT == *ERROR* ]] - then - echo "Error running notebook files!"; - exit; - fi - - # then convert the notebooks to HTML - OUTPUT=`python prepare_deploy.py convert` - if [[ $OUTPUT == *ERROR* ]] - then - echo "Error converting notebook files to HTML!"; - exit; - fi - - # remove the old $GH_PAGESBRANCH branch - OUTPUT=`git branch -D $GH_PAGESBRANCH` - if [[ $OUTPUT == *fatal* ]] - then - echo "Error deleting branch '$GH_PAGESBRANCH'."; - exit; - fi - - # Create a new "orphaned" branch -- we don't need history for - # the built products - git checkout --orphan $GH_PAGESBRANCH - - # Copy the built files to a tmp location - cp -R html _tmp - - # This will delete all of the git-managed files here - git rm -rf . - - # Now copy the html back into here - cp -R _tmp/* . - rm -rf _tmp - - git add *.html - git add images - git add css - git commit -m "Generated from sources" - - promptifinteractive "Would you like to preview the rendered HTML? [y/N] " N -n 1 - if [[ $REPLY =~ ^[Yy]$ ]]; then - echo - echo - open index.html - else - echo - fi - - promptifinteractive "Are you sure you want to push to the remote branch '$GH_PAGESBRANCH' on the remote '$GH_REMOTE'? [y/N] " y -n 1 - if [[ $REPLY =~ ^[Yy]$ ]]; then - echo - git ls-remote --exit-code $GH_REMOTE > /dev/null 2> /dev/null - while [[ $? != 0 ]] - do - promptifinteractive "Could not communicate with remote '$GH_REMOTE'. Enter an alternate remote name (or 'quit' to give up):" quit - if [[ $REPLY = "quit" ]]; then - giveup_message - exit - fi - GH_REMOTE=$REPLY - - git ls-remote --exit-code $GH_REMOTE > /dev/null 2> /dev/null - done - - echo "Pushing to '$GH_PAGESBRANCH' on remote '$GH_REMOTE'" - if [ "$INTERACTIVE" = true ] ; then - git push -f $GH_REMOTE $GH_PAGESBRANCH - else - # we do this with nothing to stdout because otherwise it might reveal secret tokens - git push -f --quiet $GH_REMOTE $GH_PAGESBRANCH >/dev/null 2>&1 - echo "Silent push finished." - fi - - git checkout -f $CURRENT_BRANCH_NAME - git clean -f - git branch -D $GH_PAGESBRANCH - else - giveup_message - fi -fi diff --git a/html/css/docs.css b/html/css/docs.css deleted file mode 100644 index 78993c444..000000000 --- a/html/css/docs.css +++ /dev/null @@ -1,844 +0,0 @@ -/* Add additional stylesheets below --------------------------------------------------- */ -/* - Bootstrap's documentation styles - Special styles for presenting Bootstrap's documentation and examples - - Note: if you want to make specific modifications for the tutorials' notebooks, - it's probably better to go into the style.css (look for the #notebook selectors). - That way we can mostly keep them in one place. -*/ - - -/* Body and structure --------------------------------------------------- */ -body { - position: relative; - background-color: #fff; - background-repeat: repeat-x; - background-position: 0 40px; - padding-top: 40px; -} - - -/* Tweak navbar brand link to be super sleek --------------------------------------------------- */ -.navbar-fixed-top .brand { - padding-right: 0; - padding-left: 0; - margin-left: 20px; - float: right; - font-weight: bold; - color: #000; - text-shadow: 0 1px 0 rgba(255,255,255,.1), 0 0 30px rgba(255,255,255,.125); - -webkit-transition: all .2s linear; - -moz-transition: all .2s linear; - transition: all .2s linear; -} -.navbar-fixed-top .brand:hover { - text-decoration: none; -} - - -/* Space out sub-sections more --------------------------------------------------- */ -section { - padding-top: 60px; -} - -/* Faded out hr */ -hr.soften { - height: 1px; - margin: 54px 0; - background-image: -webkit-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,0)); - background-image: -moz-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,0)); - background-image: -ms-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,0)); - background-image: -o-linear-gradient(left, rgba(0,0,0,0), rgba(0,0,0,.1), rgba(0,0,0,0)); - border: 0; -} - - -/* Jumbotrons --------------------------------------------------- */ -.jumbotron { - position: relative; -} -.jumbotron h1 { - margin-bottom: 9px; - font-size: 81px; - font-weight: bold; - letter-spacing: -1px; - line-height: 1; -} -.jumbotron p { - margin-bottom: 18px; - font-weight: 300; -} -.jumbotron .btn-large { - font-size: 20px; - font-weight: normal; - padding: 14px 24px; - margin-right: 10px; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - border-radius: 6px; -} -.jumbotron .btn-large small { - font-size: 14px; -} - -/* Masthead (docs home) */ -.masthead { - margin-bottom: 72px; -} -.masthead h1, -.masthead p { - text-align: center; -} -.masthead h1 { - margin-bottom: 18px; -} -.masthead p { - margin-left: 5%; - margin-right: 5%; - font-size: 30px; - line-height: 36px; -} - - -/* Specific jumbotrons -------------------------- */ -/* supporting docs pages */ -.subhead { - padding-bottom: 0; - margin-bottom: 9px; -} -.subhead h1 { - font-size: 54px; -} - -/* Subnav */ -.subnav { - width: 100%; - height: 36px; - background-color: #eeeeee; /* Old browsers */ - background-repeat: repeat-x; /* Repeat the gradient */ - background-image: -moz-linear-gradient(top, #f5f5f5 0%, #eeeeee 100%); /* FF3.6+ */ - background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#f5f5f5), color-stop(100%,#eeeeee)); /* Chrome,Safari4+ */ - background-image: -webkit-linear-gradient(top, #f5f5f5 0%,#eeeeee 100%); /* Chrome 10+,Safari 5.1+ */ - background-image: -ms-linear-gradient(top, #f5f5f5 0%,#eeeeee 100%); /* IE10+ */ - background-image: -o-linear-gradient(top, #f5f5f5 0%,#eeeeee 100%); /* Opera 11.10+ */ - filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f5f5f5', endColorstr='#eeeeee',GradientType=0 ); /* IE6-9 */ - background-image: linear-gradient(top, #f5f5f5 0%,#eeeeee 100%); /* W3C */ - border: 1px solid #e5e5e5; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} -.subnav .nav { - margin-bottom: 0; -} -.subnav .nav > li > a { - margin: 0; - padding-top: 11px; - padding-bottom: 11px; - border-left: 1px solid #f5f5f5; - border-right: 1px solid #e5e5e5; - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; -} -.subnav .nav > .active > a, -.subnav .nav > .active > a:hover { - padding-left: 13px; - color: #777; - background-color: #e9e9e9; - border-right-color: #ddd; - border-left: 0; - -webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,.05); - -moz-box-shadow: inset 0 3px 5px rgba(0,0,0,.05); - box-shadow: inset 0 3px 5px rgba(0,0,0,.05); -} -.subnav .nav > .active > a .caret, -.subnav .nav > .active > a:hover .caret { - border-top-color: #777; -} -.subnav .nav > li:first-child > a, -.subnav .nav > li:first-child > a:hover { - border-left: 0; - padding-left: 12px; - -webkit-border-radius: 4px 0 0 4px; - -moz-border-radius: 4px 0 0 4px; - border-radius: 4px 0 0 4px; -} -.subnav .nav > li:last-child > a { - border-right: 0; -} -.subnav .dropdown-menu { - -webkit-border-radius: 0 0 4px 4px; - -moz-border-radius: 0 0 4px 4px; - border-radius: 0 0 4px 4px; -} - -/* Fixed subnav on scroll, but only for 980px and up (sorry IE!) */ -@media (min-width: 980px) { - .subnav-fixed { - position: fixed; - top: 40px; - left: 0; - right: 0; - z-index: 1020; /* 10 less than .navbar-fixed to prevent any overlap */ - border-color: #d5d5d5; - border-width: 0 0 1px; /* drop the border on the fixed edges */ - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; - -webkit-box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1); - -moz-box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1); - box-shadow: inset 0 1px 0 #fff, 0 1px 5px rgba(0,0,0,.1); - filter: progid:DXImageTransform.Microsoft.gradient(enabled=false); /* IE6-9 */ - } - .subnav-fixed .nav { - width: 938px; - margin: 0 auto; - padding: 0 1px; - } - .subnav .nav > li:first-child > a, - .subnav .nav > li:first-child > a:hover { - -webkit-border-radius: 0; - -moz-border-radius: 0; - border-radius: 0; - } -} - - -/* Quick links --------------------------------------------------- */ -.bs-links { - margin: 36px 0; -} -.quick-links { - min-height: 30px; - margin: 0; - padding: 5px 20px; - list-style: none; - text-align: center; - overflow: hidden; -} -.quick-links:first-child { - min-height: 0; -} -.quick-links li { - display: inline; - margin: 0 8px; - color: #999; -} -.quick-links .github-btn, -.quick-links .tweet-btn, -.quick-links .follow-btn { - position: relative; - top: 5px; -} - - -/* Marketing section of Overview --------------------------------------------------- */ -.marketing .row { - margin-bottom: 9px; -} -.marketing h1 { - margin: 36px 0 27px; - font-size: 40px; - font-weight: 300; - text-align: center; -} -.marketing h2, -.marketing h3 { - font-weight: 300; -} -.marketing h2 { - font-size: 22px; -} -.marketing p { - margin-right: 10px; -} -.marketing .bs-icon { - float: left; - margin: 7px 10px 0 0; - opacity: .8; -} -.marketing .small-bs-icon { - float: left; - margin: 4px 5px 0 0; -} - - - -/* Footer --------------------------------------------------- */ -.footer { - margin-top: 45px; - padding: 35px 0 36px; - border-top: 1px solid #e5e5e5; -} -.footer p { - margin-bottom: 0; - color: #555; -} - - - -/* Special grid styles --------------------------------------------------- */ -.show-grid { - margin-top: 10px; - margin-bottom: 20px; -} -.show-grid [class*="span"] { - background-color: #eee; - text-align: center; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - min-height: 30px; - line-height: 30px; -} -.show-grid:hover [class*="span"] { - background: #ddd; -} -.show-grid .show-grid { - margin-top: 0; - margin-bottom: 0; -} -.show-grid .show-grid [class*="span"] { - background-color: #ccc; -} - - -/* Render mini layout previews --------------------------------------------------- */ -.mini-layout { - border: 1px solid #ddd; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - border-radius: 6px; - -webkit-box-shadow: 0 1px 2px rgba(0,0,0,.075); - -moz-box-shadow: 0 1px 2px rgba(0,0,0,.075); - box-shadow: 0 1px 2px rgba(0,0,0,.075); -} -.mini-layout { - height: 240px; - margin-bottom: 20px; - padding: 9px; -} -.mini-layout div { - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} -.mini-layout .mini-layout-body { - background-color: #dceaf4; - margin: 0 auto; - width: 70%; - height: 240px; -} -.mini-layout.fluid .mini-layout-sidebar, -.mini-layout.fluid .mini-layout-header, -.mini-layout.fluid .mini-layout-body { - float: left; -} -.mini-layout.fluid .mini-layout-sidebar { - background-color: #bbd8e9; - width: 20%; - height: 240px; -} -.mini-layout.fluid .mini-layout-body { - width: 77.5%; - margin-left: 2.5%; -} - - -/* Popover docs --------------------------------------------------- */ -.popover-well { - min-height: 160px; -} -.popover-well .popover { - display: block; -} -.popover-well .popover-wrapper { - width: 50%; - height: 160px; - float: left; - margin-left: 55px; - position: relative; -} -.popover-well .popover-menu-wrapper { - height: 80px; -} -.large-bird { - margin: 5px 0 0 310px; - opacity: .1; -} - - -/* Download page --------------------------------------------------- */ -.download .page-header { - margin-top: 36px; -} -.page-header .toggle-all { - margin-top: 5px; -} - -/* Space out h3s when following a section */ -.download h3 { - margin-bottom: 5px; -} -.download-builder input + h3, -.download-builder .checkbox + h3 { - margin-top: 9px; -} - -/* Fields for variables */ -.download-builder input[type=text] { - margin-bottom: 9px; - font-family: Menlo, Monaco, "Courier New", monospace; - font-size: 12px; - color: #d14; -} -.download-builder input[type=text]:focus { - background-color: #fff; -} - -/* Custom, larger checkbox labels */ -.download .checkbox { - padding: 6px 10px 6px 25px; - color: #555; - background-color: #f9f9f9; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - cursor: pointer; -} -.download .checkbox:hover { - color: #333; - background-color: #f5f5f5; -} -.download .checkbox small { - font-size: 12px; - color: #777; -} - -/* Variables section */ -#variables label { - margin-bottom: 0; -} - -/* Giant download button */ -.download-btn { - margin: 36px 0 108px; -} -#download p, -#download h4 { - max-width: 50%; - margin: 0 auto; - color: #999; - text-align: center; -} -#download h4 { - margin-bottom: 0; -} -#download p { - margin-bottom: 18px; -} -.download-btn .btn { - display: block; - width: auto; - padding: 19px 24px; - margin-bottom: 27px; - font-size: 30px; - line-height: 1; - text-align: center; - -webkit-border-radius: 6px; - -moz-border-radius: 6px; - border-radius: 6px; -} - - - -/* Color swatches on LESS docs page --------------------------------------------------- */ -/* Sets the width of the td */ -.swatch-col { - width: 30px; -} -/* Le swatch */ -.swatch { - display: inline-block; - width: 30px; - height: 20px; - margin: -6px 0; - -webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; -} -/* For white swatches, give a border */ -.swatch-bordered { - width: 28px; - height: 18px; - border: 1px solid #eee; -} - - -/* Misc --------------------------------------------------- */ - -/* Make tables spaced out a bit more */ -h2 + table, -h3 + table, -h4 + table, -h2 + .row { - margin-top: 5px; -} - -/* Example sites showcase */ -.example-sites img { - max-width: 100%; - margin: 0 auto; -} -.marketing-byline { - font-size: 18px; - font-weight: 300; - line-height: 24px; - color: #999; - text-align: center; -} - -.scrollspy-example { - height: 200px; - overflow: auto; - position: relative; -} - -/* Remove bottom margin on example forms in wells */ -form.well { - padding: 14px; -} - -/* Tighten up spacing */ -.well hr { - margin: 18px 0; -} - -/* Fake the :focus state to demo it */ -.focused { - border-color: rgba(82,168,236,.8); - -webkit-box-shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6); - -moz-box-shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6); - box-shadow: inset 0 1px 3px rgba(0,0,0,.1), 0 0 8px rgba(82,168,236,.6); - outline: 0; -} - -/* For input sizes, make them display block */ -.docs-input-sizes select, -.docs-input-sizes input[type=text] { - display: block; - margin-bottom: 9px; -} - -/* Icons -------------------------- */ -.the-icons { - margin-left: 0; - list-style: none; -} -.the-icons i:hover { - background-color: rgba(255,0,0,.25); -} - -/* Eaxmples page -------------------------- */ -.bootstrap-examples .thumbnail { - margin-bottom: 9px; - background-color: #fff; -} - -/* Responsive table -------------------------- */ -.responsive-utilities th small { - display: block; - font-weight: normal; - color: #999; -} -.responsive-utilities tbody th { - font-weight: normal; -} -.responsive-utilities td { - text-align: center; -} -.responsive-utilities td.is-visible { - color: #468847; - background-color: #dff0d8 !important; -} -.responsive-utilities td.is-hidden { - color: #ccc; - background-color: #f9f9f9 !important; -} - -/* Responsive tests -------------------------- */ -.responsive-utilities-test { - margin-top: 5px; - margin-left: 0; - list-style: none; - overflow: hidden; /* clear floats */ -} -.responsive-utilities-test li { - position: relative; - float: left; - width: 25%; - height: 43px; - font-size: 14px; - font-weight: bold; - line-height: 43px; - color: #999; - text-align: center; - border: 1px solid #ddd; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} -.responsive-utilities-test li + li { - margin-left: 10px; -} -.responsive-utilities-test span { - position: absolute; - top: -1px; - left: -1px; - right: -1px; - bottom: -1px; - -webkit-border-radius: 4px; - -moz-border-radius: 4px; - border-radius: 4px; -} -.responsive-utilities-test span { - color: #468847; - background-color: #dff0d8; - border: 1px solid #d6e9c6; -} - - -/* Responsive Docs --------------------------------------------------- */ -@media (max-width: 480px) { - - /* Change up some type stuff */ - h2 { - margin-top: 27px; - } - h2 small { - display: block; - line-height: 18px; - } - h3 { - margin-top: 18px; - } - - /* icons */ - .marketing .bs-icon { - margin: 0; - } - - /* Adjust the jumbotron */ - .jumbotron h1, - .jumbotron p { - text-align: center; - margin-right: 0; - } - .jumbotron h1 { - font-size: 45px; - margin-right: 0; - } - .jumbotron p { - margin-right: 0; - margin-left: 0; - font-size: 18px; - line-height: 24px; - } - .jumbotron .btn { - display: block; - font-size: 18px; - padding: 10px 14px; - margin: 0 auto 10px; - } - /* Masthead (home page jumbotron) */ - .masthead { - padding-top: 0; - } - - /* Don't space out quick links so much */ - .quick-links { - margin: 40px 0 0; - } - /* hide the bullets on mobile since our horizontal space is limited */ - .quick-links .divider { - display: none; - } - - /* center example sites */ - .example-sites { - margin-left: 0; - } - .example-sites > li { - float: none; - display: block; - max-width: 280px; - margin: 0 auto 18px; - text-align: center; - } - .example-sites .thumbnail > img { - max-width: 270px; - } - - table code { - white-space: normal; - word-wrap: break-word; - word-break: break-all; - } - - /* Modal example */ - .modal-example .modal { - position: relative; - top: auto; - right: auto; - bottom: auto; - left: auto; - } - -} - - -@media (max-width: 768px) { - - /* This was in the version copied from the main site, but it mucks up the ipython notebooks */ - /* Remove any padding from the body */ - /*body { - padding-top: 0; - }*/ - - /* Jumbotron buttons */ - .jumbotron .btn { - margin-bottom: 10px; - } - - /* Subnav */ - .subnav { - position: static; - top: auto; - z-index: auto; - width: auto; - height: auto; - background: #fff; /* whole background property since we use a background-image for gradient */ - -webkit-box-shadow: none; - -moz-box-shadow: none; - box-shadow: none; - } - .subnav .nav > li { - float: none; - } - .subnav .nav > li > a { - border: 0; - } - .subnav .nav > li + li > a { - border-top: 1px solid #e5e5e5; - } - .subnav .nav > li:first-child > a, - .subnav .nav > li:first-child > a:hover { - -webkit-border-radius: 4px 4px 0 0; - -moz-border-radius: 4px 4px 0 0; - border-radius: 4px 4px 0 0; - } - - /* Popovers */ - .large-bird { - display: none; - } - .popover-well .popover-wrapper { - margin-left: 0; - } - - /* Space out the show-grid examples */ - .show-grid [class*="span"] { - margin-bottom: 5px; - } - - /* Unfloat the back to top link in footer */ - .footer .pull-right { - float: none; - } - .footer p { - margin-bottom: 9px; - } - -} - - -@media (min-width: 480px) and (max-width: 768px) { - - /* Scale down the jumbotron content */ - .jumbotron h1 { - font-size: 54px; - } - .jumbotron p { - margin-right: 0; - margin-left: 0; - } - -} - - -@media (min-width: 768px) and (max-width: 980px) { - - /* This was in the version copied from the main site, but it mucks up the ipython notebooks */ - /* Remove any padding from the body */ - /*body { - padding-top: 0; - }*/ - - /* Scale down the jumbotron content */ - .jumbotron h1 { - font-size: 72px; - } - -} - - -@media (max-width: 980px) { - - /* Unfloat brand */ - .navbar-fixed-top .brand { - float: left; - margin-left: 0; - padding-left: 10px; - padding-right: 10px; - } - - /* Inline-block quick links for more spacing */ - .quick-links li { - display: inline-block; - margin: 5px; - } - -} - - -/* LARGE DESKTOP SCREENS */ -@media (min-width: 1210px) { - - /* Update subnav container */ - .subnav-fixed .nav { - width: 1168px; /* 2px less to account for left/right borders being removed when in fixed mode */ - } - -} diff --git a/html/css/style.css b/html/css/style.css deleted file mode 100644 index 3e8374490..000000000 --- a/html/css/style.css +++ /dev/null @@ -1,304 +0,0 @@ -/* Ripped from the main astropy website with some modifications*/ -/* http://meyerweb.com/eric/tools/css/reset/ - v2.0 | 20110126 - License: none (public domain) -*/ - -/* HTML5 display-role reset for older browsers */ -article, aside, details, figcaption, figure, -footer, header, hgroup, menu, nav, section { - display: block; -} -body { - line-height: 1; -} -ol, ul { - list-style: none; -} -blockquote, q { - quotes: none; -} -blockquote:before, blockquote:after, -q:before, q:after { - content: ''; - content: none; -} -table { - border-collapse: collapse; - border-spacing: 0; -} - -body{ - line-height: 1.25em; - font-size: 16px; - color:#333; - font-family: 'Open Sans', sans-serif; -} - -#wrapper{ - margin:0 auto; - max-width:960px; - padding:0 10px; - min-width: 320px; /* min-width of whole site */ -} - -a{ - color: #FF5000; - text-decoration: none; -} -a, svg{ - -webkit-transition: all 0.3s ease; - -moz-transition: all 0.3s ease; - -o-transition: all 0.3s ease; - -ms-transition: all 0.3s ease; - transition: all 0.3s ease; -} - -a:hover{ - color:#333; -} - -h1{ - font-size: 28px; - font-weight: bold; - margin-top: 10px; - margin-bottom: 20px; -} - -h2{ - font-size: 24px; - margin-bottom: 10px; -} - -h3{ - font-size: 20px; - margin: 20px 0px 10px 0px; - -} - -p{ - margin-bottom: 10px; - margin-top: 10px; - line-height: 1.5em; -} - -strong{ - font-weight: bold; - -} - -section{ - border-bottom: 1px #efefef solid; - padding: 20px 0 20px; - clear: both; -} - -section:first-of-type{ - margin-top:42px; -} - -section:last-of-type{ - border-bottom: 0px; -} - -section *:last-child{ - margin-bottom: 0px; -} - -ul li{ - list-style-type: square; - list-style-position: outside; - list-style-color: #FF5000; - line-height: 1.5em; - margin-bottom:0.5em; - margin-left: 30px; -} - -ul li:last-child{ - margin-bottom: 0px; -} - -cite{ - font-family: monospace; -} - -pre{ - background-color: #f5f5f5; - border: 1px solid #ddd; - padding: 10px; - color: black; - font-family: Monaco, Andale Mono, Courier New, monospace; - webkit-border-radius: 3px; - -moz-border-radius: 3px; - border-radius: 3px; - margin-bottom: 5px; -} - -.button{ - padding: 8px; - display: inline-block; - background-image: -webkit-gradient( - linear, - left top, - left bottom, - color-stop(0, #FC9468), - color-stop(0.89, #FF5100) - ); - background-image: -o-linear-gradient(bottom, #FC9468 0%, #FF5100 89%); - background-image: -moz-linear-gradient(bottom, #FC9468 0%, #FF5100 89%); - background-image: -webkit-linear-gradient(bottom, #FC9468 0%, #FF5100 89%); - background-image: -ms-linear-gradient(bottom, #FC9468 0%, #FF5100 89%); - background-image: linear-gradient(to bottom, #FC9468 0%, #FF5100 89%); -} - -a.button, .button a{ - color: white; -} - - -p .button{ - padding-top:0px; - padding-bottom:0px; - padding-right:4px; - padding-left:4px; -} - -.button:hover{ - cursor: pointer; - background-image: -webkit-gradient( - linear, - left top, - left bottom, - color-stop(0, #FFA47D), - color-stop(1, #FF7D45) - ); - background-image: -o-linear-gradient(bottom, #FFA47D 0%, #FF7D45 100%); - background-image: -moz-linear-gradient(bottom, #FFA47D 0%, #FF7D45 100%); - background-image: -webkit-linear-gradient(bottom, #FFA47D 0%, #FF7D45 100%); - background-image: -ms-linear-gradient(bottom, #FFA47D 0%, #FF7D45 100%); - background-image: linear-gradient(to bottom, #FFA47D 0%, #FF7D45 100%); -} - - -.right{ - float: right; -} - -/* nav */ -nav{ - line-height: 42px; - position:absolute; - left:0px; - top:0px; - width:100%; - background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #222222),color-stop(0.89, #333333)); - background-image: -o-linear-gradient(bottom, #222222 0%, #333333 89%); - background-image: -moz-linear-gradient(bottom, #222222 0%, #333333 89%); - background-image: -webkit-linear-gradient(bottom, #222222 0%, #333333 89%); - background-image: -ms-linear-gradient(bottom, #222222 0%, #333333 89%); - background-image: linear-gradient(to bottom, #222222 0%, #333333 89%); -} - -nav > *{ - display:inline-block; - vertical-align:top; -} - -nav img{ - float: left; - margin-left: 20px; - margin-top: 5px; -} - -nav ul{ - max-width:960px; - margin: 0; - padding: 0; -} - -nav ul li{ - display:inline; - list-style: none; - display: block; - margin: 0; -} - -nav li a, nav li a:link{ - color:#fff; - font-size: 22px; - font-weight: 300; -} -nav li a:hover{ - color:#FF5000; -} - -nav li a.active{ - color:#FF5000; -} - -nav .pull-right{ - float: right; - margin-right:10px; -} - - -/* - IPython overrides -*/ - -/* Tweaks to make a bit more responsive in conjuction with astropy scheme */ - -@media (max-width: 355px) { - - #wrapper { - padding-left: 0px; - padding-right: 0px; - } - - body { - padding-left: 0px; - padding-right: 0px; - } - - .text_cell_render { - padding-left: 0px; - padding-right: 0px; - } - -} - -.container { - max-width: 900px; - font-size: 12pt; -} - -.tutorials li { - padding-top: 10px; - padding-bottom: 10px; - margin-bottom: 0; -} - - -/* - Notebook styling -*/ - -#notebook p { - font-size: 16px; - line-height: 20px; -} - -#notebook code, pre{ - padding:0 3px 2px; - font-family: monospace; - word-wrap: break-word; -} - -#notebook pre { - font-size:14px; - line-height: 17px; -} - -#notebook sub { - line-height: 1; -} \ No newline at end of file diff --git a/html/images/astropy_word_32.png b/html/images/astropy_word_32.png deleted file mode 100644 index 7125b632b..000000000 Binary files a/html/images/astropy_word_32.png and /dev/null differ diff --git a/make.bat b/make.bat new file mode 100644 index 000000000..0da9bbc56 --- /dev/null +++ b/make.bat @@ -0,0 +1,170 @@ +@ECHO OFF + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set BUILDDIR=build +set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% tutorials +if NOT "%PAPER%" == "" ( + set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% +) + +if "%1" == "" goto help + +if "%1" == "help" ( + :help + echo.Please use `make ^` where ^ is one of + echo. html to make standalone HTML files + echo. dirhtml to make HTML files named index.html in directories + echo. singlehtml to make a single large HTML file + echo. pickle to make pickle files + echo. json to make JSON files + echo. htmlhelp to make HTML files and a HTML help project + echo. qthelp to make HTML files and a qthelp project + echo. devhelp to make HTML files and a Devhelp project + echo. epub to make an epub + echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter + echo. text to make text files + echo. man to make manual pages + echo. changes to make an overview over all changed/added/deprecated items + echo. linkcheck to check all external links for integrity + echo. doctest to run all doctests embedded in the documentation if enabled + goto end +) + +if "%1" == "clean" ( + for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i + del /q /s %BUILDDIR%\* + goto end +) + +if "%1" == "html" ( + %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/html. + goto end +) + +if "%1" == "dirhtml" ( + %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. + goto end +) + +if "%1" == "singlehtml" ( + %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. + goto end +) + +if "%1" == "pickle" ( + %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the pickle files. + goto end +) + +if "%1" == "json" ( + %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can process the JSON files. + goto end +) + +if "%1" == "htmlhelp" ( + %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run HTML Help Workshop with the ^ +.hhp project file in %BUILDDIR%/htmlhelp. + goto end +) + +if "%1" == "qthelp" ( + %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; now you can run "qcollectiongenerator" with the ^ +.qhcp project file in %BUILDDIR%/qthelp, like this: + echo.^> qcollectiongenerator %BUILDDIR%\qthelp\Astropy.qhcp + echo.To view the help file: + echo.^> assistant -collectionFile %BUILDDIR%\qthelp\Astropy.ghc + goto end +) + +if "%1" == "devhelp" ( + %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. + goto end +) + +if "%1" == "epub" ( + %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The epub file is in %BUILDDIR%/epub. + goto end +) + +if "%1" == "latex" ( + %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex + if errorlevel 1 exit /b 1 + echo. + echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. + goto end +) + +if "%1" == "text" ( + %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The text files are in %BUILDDIR%/text. + goto end +) + +if "%1" == "man" ( + %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man + if errorlevel 1 exit /b 1 + echo. + echo.Build finished. The manual pages are in %BUILDDIR%/man. + goto end +) + +if "%1" == "changes" ( + %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes + if errorlevel 1 exit /b 1 + echo. + echo.The overview file is in %BUILDDIR%/changes. + goto end +) + +if "%1" == "linkcheck" ( + %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck + if errorlevel 1 exit /b 1 + echo. + echo.Link check complete; look for any errors in the above output ^ +or in %BUILDDIR%/linkcheck/output.txt. + goto end +) + +if "%1" == "doctest" ( + %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest + if errorlevel 1 exit /b 1 + echo. + echo.Testing of doctests in the sources finished, look at the ^ +results in %BUILDDIR%/doctest/output.txt. + goto end +) + +:end diff --git a/metadata.cfg b/metadata.cfg new file mode 100644 index 000000000..383df43c0 --- /dev/null +++ b/metadata.cfg @@ -0,0 +1,11 @@ +[metadata] +package_name = astropy-tutorials +description = Tutorials for the Astropy Project +author = The Astropy Developers +author_email = astropy.team@gmail.com +license = BSD +url = http://tutorials.astropy.org/ +edit_on_github = False +github_project = astropy/astropy-tutorials +# version should be PEP440 compatible (http://www.python.org/dev/peps/pep-0440) +version = 3.0.dev \ No newline at end of file diff --git a/pip-requirements.txt b/pip-requirements.txt index cd1f31faa..6e549b406 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -3,3 +3,5 @@ astropy==2.0.2 astroquery==0.3.6 matplotlib==2.0.2 numpy==1.13.1 +jupyter==1.0 +scipy=0.19 diff --git a/prepare_deploy.py b/prepare_deploy.py deleted file mode 100644 index 3b79a163b..000000000 --- a/prepare_deploy.py +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env python -# coding: utf-8 - -""" Build all notebook files into HTML pages. """ - -from __future__ import division, print_function - -# Standard library -import os -import re -import sys -import shutil -import check_env - -# protect for 2.* vs. 3.* -try: - import configparser - cp = configparser -except ImportError: - import ConfigParser - cp = ConfigParser - -from astropy import log as logger -from IPython.nbformat.current import read, write - -# A template for the index page -with open("templates/index_template.html") as f: - INDEX_TEMPLATE = f.read() - -def walk_through_tutorials(only_published=True, selected_nb_re=None): - """ Generator for walking through the tutorials directory structure. - This returns tuples of (full_tutorial_path, tutorial_name) for - each tutorial. If published is set to True, this will only return - the published tutorials. - """ - nbre = re.compile(selected_nb_re) if selected_nb_re else None - - current_directory = os.getcwd() - tutorials_base = os.path.join(current_directory,'tutorials') - - if not os.path.exists(tutorials_base): - err = ("Can't find 'tutorials' path! You must run this script from the" - " top-level astropy-tutorials directory.") - raise IOError(err) - - # walk through each directory in tutorials/ to find all .ipynb file - for tutorial_name in os.listdir(tutorials_base): - tutorial_path = os.path.join(tutorials_base, tutorial_name) - if not os.path.isdir(tutorial_path): - # skip files / things that are not directories - continue - - for filename in os.listdir(tutorial_path): - base,ext = os.path.splitext(filename) - - if ext.lower() == ".ipynb" and "checkpoint" not in base: - full_filename = os.path.join(tutorial_path, filename) - notebook = read(open(full_filename), 'json') - is_published = notebook['metadata']['astropy-tutorials'].get('published', False) - if not is_published and only_published: - continue - - if nbre and nbre.match(base) is None: - continue - - yield full_filename,notebook - -def run_notebooks(selected_nb_re=None): - """ Run the tutorial notebooks. """ - from runipy.notebook_runner import NotebookRunner - - _orig_path = os.getcwd() - - # walk through each directory in tutorials/ to find all .ipynb file - for tutorial_filename,nb in walk_through_tutorials(only_published=True, - selected_nb_re=selected_nb_re): - path,filename = os.path.split(tutorial_filename) - - if filename.startswith("_run_"): - continue - - logger.info("Running tutorial: {}".format(filename)) - - # notebook file - output_filename = os.path.join(path,"_run_{}" - .format(filename)) - - # prepend _run_ to the notebook names to create new files - # so the user isn't left with a bunch of modified files. - os.chdir(path) - r = NotebookRunner(nb, mpl_inline=True) - r.run_notebook(skip_exceptions=True) - write(r.nb, open(output_filename, 'w'), 'json') - - os.chdir(_orig_path) - -def convert_notebooks(selected_nb_re=None): - """ Convert the tutorials (IPython notebook files) located in tutorials/* - into static HTML pages. - """ - from IPython.nbconvert.nbconvertapp import NbConvertApp - - current_directory = os.getcwd() - html_base = os.path.join(current_directory,"html") - if not os.path.exists(html_base): - os.mkdir(html_base) - template_path = os.path.join(current_directory, 'templates') - - app = NbConvertApp() - app.initialize(argv=[]) # hack - app.export_format = 'html' - app.config.Exporter.template_path = ['templates', template_path] - app.config.Exporter.template_file = 'astropy' - - # walk through each directory in tutorials/ to find all .ipynb file - index_list = [] - re_str = ('_run_' + selected_nb_re) if selected_nb_re else None - for tutorial_filename,nb in walk_through_tutorials(only_published=True, - selected_nb_re=re_str): - path,filename = os.path.split(tutorial_filename) - if not filename.startswith("_run_"): - continue - - # remove _run_ from base filename - base = os.path.splitext(filename)[0] - cleanbase = base.lstrip("_run_") - - app.output_base = os.path.join(html_base,cleanbase) - app.notebooks = [os.path.join(path,filename)] - app.start() - - # HACK to set title and other things in rendered notebook - html_filename = "{}.html".format(os.path.join(html_base,cleanbase)) - with open(html_filename, 'rb') as f: - html_file_data = f.read() - - with open(html_filename, 'wb') as f: - html_file_data = html_file_data.decode("utf-8") - html_file_data = html_file_data.replace("{title}",nb['metadata']['astropy-tutorials']['link_name']) - html_file_data = html_file_data.replace("{author}",nb['metadata']['astropy-tutorials']['author']) - html_file_data = html_file_data.replace("{date}",nb['metadata']['astropy-tutorials']['date']) - html_file_data = html_file_data.replace("{abspageurl}","{}".format(cleanbase)) - html_file_data = html_file_data.replace("{pageurl}","{}.html".format(cleanbase)) - f.write(html_file_data.encode("utf8")) - - index_listing = dict() - index_listing["link_path"] = "{}.html".format(cleanbase) - index_listing["link_name"] = nb['metadata']['astropy-tutorials']['link_name'] - index_listing["description"] = nb['metadata']['astropy-tutorials']['description'] - index_list.append(index_listing) - - # Make an index of all notes - entries = [] - for page in sorted(index_list, key=lambda x: x['link_name']): # sort on tutorial name - entry_html = "
  • " - entry_html += "{0[link_name]}".format(page) - entry_html += "
    {0[description]}".format(page) - entry_html += "
  • " - entries.append(entry_html) - - with open(os.path.join(current_directory,'html','index.html'), 'w') as f: - f.write(INDEX_TEMPLATE.format(entries='\n'.join(entries))) - - -if __name__ == "__main__": - from argparse import ArgumentParser - - # Define parser object - parser = ArgumentParser(description="Prepare the tutorials for deployment.") - parser.add_argument("-v", "--verbose", action="store_true", dest="verbose", - default=False, help="Be chatty! (default = False)") - parser.add_argument("-q", "--quiet", action="store_true", dest="quiet", - default=False, help="Be quiet! (default = False)") - parser.add_argument("-n", "--nameregex", default=None, - help="A regular expression to select the names of the " - "notebooks to be processed. If not given, all " - "notebooks will be used.") - - parser.add_argument('action', nargs='+', choices=['run', 'convert','check'], - help='The action(s) to take when running the script. ' - '"run" means to just run the notebooks, while ' - '"convert" will use nbconvert to turn them to ' - 'convert them to HTML.' - '"check" will use check_env.py to check the ' - 'environment for any missing or outdated packages') - - args = parser.parse_args() - - # Set logger level based on verbose flags - if args.verbose: - logger.setLevel('DEBUG') - elif args.quiet: - logger.setLevel('ERROR') - else: - logger.setLevel('INFO') - - for action in args.action: - if action == 'run': - run_notebooks(args.nameregex) - elif action == 'convert': - convert_notebooks(args.nameregex) - elif action == 'check': - check_env.check_environment(args.nameregex) diff --git a/readthedocs.yml b/readthedocs.yml new file mode 100644 index 000000000..ef49fa6aa --- /dev/null +++ b/readthedocs.yml @@ -0,0 +1,8 @@ +conda: + file: .rtd-environment.yml + +python: + setup_py_install: false + +formats: + - none diff --git a/scripts/__init__.py b/scripts/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/check_env.py b/scripts/check_env.py similarity index 56% rename from check_env.py rename to scripts/check_env.py index 6955d7477..4c1d6c10e 100644 --- a/check_env.py +++ b/scripts/check_env.py @@ -39,52 +39,31 @@ from astropy import log as logger -def check_environment(tutorial=None): +def check_environment(tutorials_base_path, tutorial=None): error = False warnings = False # 'enter' checks if the tutorial name passed by user exists in the repository enter = False logger.info("Running Environment Tests...") - _orig_path = os.getcwd() - tutorials_base = os.path.join(_orig_path, 'tutorials') - for tutorial_name in os.listdir(tutorials_base): + for tutorial_name in os.listdir(tutorials_base_path): + print(tutorial_name,'ARG') if (tutorial_name == tutorial or tutorial is None): enter = True - tutorial_path = os.path.join( - tutorials_base, - tutorial_name) # Path to tutorial folder + tutorialreq_path = os.path.join(tutorials_base_path, tutorial_name, + 'requirements.txt') # Path to tutorial folder try: - with open(tutorial_path + "/requirements.json") as data_file: - # Import data from json file - data = json.load(data_file) + with open(tutorialreq_path) as req_file: # Check for all the packages to be imported - for pkgname in data: - # Check for versioning - for subinfo in data[pkgname]: - if subinfo == 'min_version': - if(not astropy.utils.introspection.minversion(pkgname, data[pkgname][subinfo])): - logger.error( - "Package " + - pkgname + - " is either missing or is out of date to run Tutorial: " + - tutorial_name) - error = True - #Package is Missing - elif subinfo == 'pref_version': - if(not astropy.utils.introspection.minversion(pkgname, data[pkgname][subinfo])): - logger.warning( - "Please upgrade Package " + - pkgname + - " to version " + - data[pkgname][subinfo] + - " for Tutorial: " + - tutorial_name) - warnings = True - # Out of date package is present + for line in req_file: + line_strip = line.strip() + astropy.utils.introspection.minversion(line_strip, '') + logger.info('Sucessfully checked requirements for ' + '"{}".'.format(tutorial_name)) + except IOError: - error = True - logger.error( - "Environment Check Failed ! requirements.json not found") + warnings = True + logger.warn('requirements.txt not found for "{}" - couldn\'t do' + ' environment check.'.format(tutorial_name)) if not enter: logger.error( @@ -112,6 +91,10 @@ def check_environment(tutorial=None): help="A regular expression to select the names of the " "notebooks to be processed. If not given, all " "notebooks will be used.") + parser.add_argument("tutorial_base_path", default='tutorials/notebooks', + nargs='?', + help="The path to the root of the tutorial " + "directories.") args = parser.parse_args() - check_environment(args.nameregex) # name passed to check_env function + check_environment(args.tutorial_base_path, args.nameregex) # name passed to check_env function diff --git a/scripts/convert.py b/scripts/convert.py new file mode 100644 index 000000000..fb25153ca --- /dev/null +++ b/scripts/convert.py @@ -0,0 +1,260 @@ +# Standard library +from os import path, walk, remove, makedirs + +# Third-party +from astropy import log as logger +logger.setLevel('INFO') + +from nbconvert.preprocessors import ExecutePreprocessor, CellExecutionError +from nbconvert.exporters import RSTExporter +from nbconvert.writers import FilesWriter +import nbformat + +IPYTHON_VERSION = 4 + +class NBTutorialsConverter(object): + + def __init__(self, nb_path, output_path=None, template_file=None, + overwrite=False, kernel_name=None): + self.nb_path = path.abspath(nb_path) + fn = path.basename(self.nb_path) + self.path_only = path.dirname(self.nb_path) + self.nb_name, _ = path.splitext(fn) + + if output_path is not None: + self.output_path = output_path + makedirs(self.output_path, exist_ok=True) + else: + self.output_path = self.path_only + + if template_file is not None: + self.template_file = path.abspath(template_file) + else: + self.template_file = None + + self.overwrite = overwrite + + # the executed notebook + self._executed_nb_path = path.join(self.output_path, + 'exec_{0}'.format(fn)) + + logger.info('Processing notebook {0} (in {1})'.format(fn, + self.path_only)) + + if kernel_name is None: + self.kernel_name = ExecutePreprocessor.kernel_name.default_value + else: + self.kernel_name = kernel_name + + def execute(self, write=True): + """ + Execute the specified notebook file, and optionally write out the + executed notebook to a new file. + + Parameters + ---------- + write : bool, optional + Write the executed notebook to a new file, or not. + + Returns + ------- + executed_nb_path : str, ``None`` + The path to the executed notebook path, or ``None`` if + ``write=False``. + + """ + + if path.exists(self._executed_nb_path) and not self.overwrite: + logger.debug("Executed notebook already exists at {0}. Use " + "overwrite=True or --overwrite (at cmd line) to re-run" + .format(self._executed_nb_path)) + return self._executed_nb_path + + # Execute the notebook + logger.debug('Executing notebook using kernel ' + '"{}"...'.format(self.kernel_name)) + executor = ExecutePreprocessor(timeout=900, + kernel_name=self.kernel_name) + + with open(self.nb_path) as f: + nb = nbformat.read(f, as_version=IPYTHON_VERSION) + + try: + executor.preprocess(nb, {'metadata': {'path': self.path_only}}) + except CellExecutionError: + # TODO: should we fail fast and raies, or record all errors? + raise + + if write: + logger.debug('Writing executed notebook to file {0}...' + .format(self._executed_nb_path)) + with open(self._executed_nb_path, 'w') as f: + nbformat.write(nb, f) + + return self._executed_nb_path + + def convert(self, remove_executed=False): + """ + Convert the executed notebook to a restructured text (RST) file. + + Parameters + ---------- + delete_executed : bool, optional + Controls whether to remove the executed notebook or not. + """ + + if not path.exists(self._executed_nb_path): + raise IOError("Executed notebook file doesn't exist! Expected: {0}" + .format(self._executed_nb_path)) + + # Initialize the resources dict - see: + # https://github.com/jupyter/nbconvert/blob/master/nbconvert/nbconvertapp.py#L327 + resources = {} + resources['config_dir'] = '' # we don't need to specify config + resources['unique_key'] = self.nb_name + + # path to store extra files, like plots generated + resources['output_files_dir'] = 'nboutput' + + # Exports the notebook to RST + logger.debug('Exporting notebook to RST...') + exporter = RSTExporter() + + if self.template_file: + exporter.template_file = self.template_file + output, resources = exporter.from_filename(self._executed_nb_path, + resources=resources) + + # Write the output RST file + writer = FilesWriter() + output_file_path = writer.write(output, resources, + notebook_name=self.nb_name) + + if remove_executed: # optionally, clean up the executed notebook file + remove(self._executed_nb_path) + + return output_file_path + +def process_notebooks(nbfile_or_path, exec_only=False, **kwargs): + """ + Execute and optionally convert the specified notebook file or directory of + notebook files. + + This is a wrapper around the ``NBTutorialsConverter`` class that does file + handling. + + Parameters + ---------- + nbfile_or_path : str + Either a single notebook filename or a path containing notebook files. + exec_only : bool, optional + Just execute the notebooks, don't run them. + **kwargs + Any other keyword arguments are passed to the ``NBTutorialsConverter`` + init. + + """ + if path.isdir(nbfile_or_path): + # It's a path, so we need to walk through recursively and find any + # notebook files + for root, dirs, files in walk(nbfile_or_path): + for name in files: + _,ext = path.splitext(name) + full_path = path.join(root, name) + + if 'ipynb_checkpoints' in full_path: # skip checkpoint saves + continue + + if name.startswith('exec'): # notebook already executed + continue + + if ext == '.ipynb': + nbc = NBTutorialsConverter(full_path, **kwargs) + nbc.execute() + + if not exec_only: + nbc.convert() + + else: + # It's a single file, so convert it + nbc = NBTutorialsConverter(nbfile_or_path, **kwargs) + nbc.execute() + + if not exec_only: + nbc.convert() + +if __name__ == "__main__": + from argparse import ArgumentParser + import logging + + # Define parser object + parser = ArgumentParser(description="") + + vq_group = parser.add_mutually_exclusive_group() + vq_group.add_argument('-v', '--verbose', action='count', default=0, + dest='verbosity') + vq_group.add_argument('-q', '--quiet', action='count', default=0, + dest='quietness') + + parser.add_argument('--exec-only', default=False, action='store_true', + dest='exec_only', help='Just execute the notebooks, ' + 'don\'t convert them as well. ' + 'This is useful for testing that' + ' the notebooks run.') + + parser.add_argument('-o', '--overwrite', action='store_true', + dest='overwrite', default=False, + help='Re-run and overwrite any existing executed ' + 'notebook or RST files.') + + parser.add_argument('nbfile_or_path', default='tutorials/notebooks/', + nargs='?', + help='Path to a specific notebook file, or the ' + 'top-level path to a directory containing ' + 'notebook files to process.') + + parser.add_argument('--template', default=None, dest='template_file', + help='The path to a jinja2 template file for the ' + 'notebook to RST conversion.') + + parser.add_argument('--output-path', default=None, dest='output_path', + help='The path to save all executed or converted ' + 'notebook files. If not specified, the executed/' + 'converted files will be in the same path as the ' + 'source notebooks.') + + parser.add_argument('--kernel-name', default='python3', dest='kernel_name', + help='The name of the kernel to run the notebooks with.' + ' Must be an available kernel from "jupyter ' + 'kernelspec list".') + + args = parser.parse_args() + + # Set logger level based on verbose flags + if args.verbosity != 0: + if args.verbosity == 1: + logger.setLevel(logging.DEBUG) + else: # anything >= 2 + logger.setLevel(1) + + elif args.quietness != 0: + if args.quietness == 1: + logger.setLevel(logging.WARNING) + else: # anything >= 2 + logger.setLevel(logging.ERROR) + + # make sure output path exists + output_path = args.output_path + if output_path is not None: + output_path = path.abspath(output_path) + makedirs(output_path, exist_ok=True) + + # make sure the template file exists + template_file = args.template_file + if template_file is not None and not path.exists(template_file): + raise IOError("Couldn't find RST template file at {0}" + .format(template_file)) + + process_notebooks(args.nbfile_or_path, exec_only=args.exec_only, + output_path=output_path, template_file=template_file, + overwrite=args.overwrite, kernel_name=args.kernel_name) diff --git a/scripts/tests/__init__.py b/scripts/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/scripts/tests/test-fail.ipynb b/scripts/tests/test-fail.ipynb new file mode 100644 index 000000000..bf3f1277a --- /dev/null +++ b/scripts/tests/test-fail.ipynb @@ -0,0 +1,92 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import astropy.units as u\n", + "import numpy as np\n", + "import matplotlib as mpl\n", + "import matplotlib.pyplot as plt\n", + "%matplotlib inline" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "a = np.arange(10)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "print(\"This is some stuff\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "plt.plot(a)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "print 100" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "celltoolbar": "Edit Metadata", + "kernelspec": { + "display_name": "Python [default]", + "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.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/scripts/tests/test-succeed.ipynb b/scripts/tests/test-succeed.ipynb new file mode 100644 index 000000000..5c0953dbc --- /dev/null +++ b/scripts/tests/test-succeed.ipynb @@ -0,0 +1,112 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "import astropy.units as u\n", + "import numpy as np\n", + "import matplotlib as mpl\n", + "import matplotlib.pyplot as plt\n", + "%matplotlib inline" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "a = np.arange(10)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "print(\"This is some stuff\")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "plt.plot(a)" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "tags": [ + "raises-exception" + ] + }, + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "ERROR: SyntaxError: Missing parentheses in call to 'print' (, line 1) [IPython.core.compilerop]\n" + ] + }, + { + "ename": "SyntaxError", + "evalue": "Missing parentheses in call to 'print' (, line 1)", + "output_type": "error", + "traceback": [ + "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m print 100\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m Missing parentheses in call to 'print'\n" + ] + } + ], + "source": [ + "print 100" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "celltoolbar": "Edit Metadata", + "kernelspec": { + "display_name": "Python [default]", + "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.5.2" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/scripts/tests/test_convert.py b/scripts/tests/test_convert.py new file mode 100644 index 000000000..b709a0f47 --- /dev/null +++ b/scripts/tests/test_convert.py @@ -0,0 +1,26 @@ +# Standard library +from os import path, remove + +# Third-party +import pytest + +# This project +from ..convert import NBConverter + +tests_path = path.split(path.abspath(__file__))[0] + +def test_convert_succeed(): + # With the current master version of nbconvert, we can allow errors + # per-cell. This notebook, even though it raises an exception, should still + # execute fine: + nbc = NBConverter(path.join(tests_path, 'test-succeed.ipynb')) + filename = nbc.execute() + remove(filename) # clean up + +def test_convert_fail(): + # This notebook raises an exception in a cell, but doesn't use the + # 'raises-exception' tag in the cell metadata, so it should fail + nbc = NBConverter(path.join(tests_path, 'test-fail.ipynb')) + + with pytest.raises(Exception): + nbc.execute() diff --git a/templates/astropy.tpl b/templates/astropy.tpl deleted file mode 100644 index 910f43ca2..000000000 --- a/templates/astropy.tpl +++ /dev/null @@ -1,91 +0,0 @@ -{%- extends 'full.tpl' -%} - -{% block header %} - - -{title} - - - - - -{{ super() }} - - - - - -{%- endblock header %} - -{% block body %} - -
    - - - - - -
    - -
    - - {{ super() }} - - - - -
    - - - - -
    - - - - -{%- endblock body %} \ No newline at end of file diff --git a/templates/index_template.html b/templates/index_template.html deleted file mode 100644 index 3acca0f48..000000000 --- a/templates/index_template.html +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - -Astropy Tutorials - - - - - - - - -
    - -
    - -

    Astropy Tutorials

    -

    The tutorials on this site walk through some typical software tasks and demonstrate the features in Astropy sub-packages in the context of a story or standard workflow. See the Astropy documentation for a structured view of the functionality within the Astropy project.

    - - -
    -
    - -

    List of Tutorials

    -
      -{entries} -
    - -
    - -
    - -

    Contributing

    - -

    We welcome feedback and improvements to these tutorials via the Astropy Tutorials repo on Github. If you find a typo or would like to clarify some text, please either create an issue or make the change yourself and then submit a pull request directly to the repository. Questions and/or comments about the tutorials are welcome on the astropy-dev mailing list.

    - -

    If you are interested in contributing an ipython notebook as a tutorial, please check the README or contact the developer list. Also, if you have an idea for a tutorial or a tutorial request, please post to the developer list. If you would like to contribute to this effort, but need some inspiration, check out the open issues. This is a collaborative effort and we are looking for contributions and ideas from users like you!

    - -
    - -
    - - - diff --git a/travis_deploy b/travis_deploy deleted file mode 100755 index c9a518518..000000000 --- a/travis_deploy +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# The key element here is using ``travis encrypt GH_TOKEN=`` -# and then adding the resulting secure key/value pair to .travis.yml . For security, -# probably best to use an account that only has access to this specific repo, not -# someone's personal token with general access to all of their stuff. - -echo "Adding deployment remote" -git remote add deploy "https://${GH_TOKEN}@${GH_REF}" - -export CURRENT_BRANCH_NAME="$(git rev-parse HEAD)" -export INTERACTIVE=false -export GH_REMOTE=deploy -export GH_PAGESBRANCH="test-gh-pages" # remove this to get deployment on the "real branch" -./deploy \ No newline at end of file diff --git a/tutorials/_static/custom.css b/tutorials/_static/custom.css new file mode 100644 index 000000000..3f1226a9c --- /dev/null +++ b/tutorials/_static/custom.css @@ -0,0 +1,6 @@ +@import url("bootstrap-astropy.css"); + +div.body { + margin: 0 auto; + max-width: 768px; +} diff --git a/tutorials/astropy.tpl b/tutorials/astropy.tpl new file mode 100644 index 000000000..12cadb3cf --- /dev/null +++ b/tutorials/astropy.tpl @@ -0,0 +1,106 @@ +{%- extends 'display_priority.tpl' -%} + +{% block header %} + +{# Remove the exec_ prefix #} +{% set nb_name = resources.metadata.name[5:] %} + +.. note:: + + This tutorial was generated from an IPython notebook that can be downloaded `here + <../_static/{{ nb_name }}/{{ nb_name }}.ipynb>`_. + + You can interact with a live version of the source notebook through binder: + + |binder{{ nb_name }}| + +.. |binder{{ nb_name }}| image:: http://mybinder.org/badge.svg + :target: https://beta.mybinder.org/v2/gh/astropy/astropy-tutorials/master?filepath=docs/_static/tutorials/{{ nb_name }}/{{ nb_name }}.ipynb + +.. _{{nb_name}}: +{% endblock %} + +{% block in_prompt %} +{% endblock in_prompt %} + +{% block output_prompt %} +{% endblock output_prompt %} + +{% block input %} +{%- if cell.source.strip() and not cell.source.startswith("%") -%} +.. code:: python + +{{ cell.source | indent}} +{% endif -%} +{% endblock input %} + +{% block error %} +:: + +{{ super() }} +{% endblock error %} + +{% block traceback_line %} +{{ line | indent | strip_ansi }} +{% endblock traceback_line %} + +{% block execute_result %} +{% block data_priority scoped %} +{{ super() }} +{% endblock %} +{% endblock execute_result %} + +{% block stream %} +.. parsed-literal:: + +{{ output.text | indent }} +{% endblock stream %} + +{% block data_svg %} +.. image:: {{ output.metadata.filenames['image/svg+xml'] | posix_path }} +{% endblock data_svg %} + +{% block data_png %} +.. image:: {{ output.metadata.filenames['image/png'] | posix_path }} + +{% endblock data_png %} + +{% block data_jpg %} +.. image:: {{ output.metadata.filenames['image/jpeg'] | posix_path }} +{% endblock data_jpg %} + +{% block data_latex %} +.. math:: + +{{ output.data['text/latex'] | strip_dollars | indent }} +{% endblock data_latex %} + +{% block data_text scoped %} +.. parsed-literal:: + +{{ output.data['text/plain'] | indent }} +{% endblock data_text %} + +{% block data_html scoped %} +.. raw:: html + +{{ output.data['text/html'] | indent }} +{% endblock data_html %} + +{% block markdowncell scoped %} +{{ cell.source | markdown2rst }} +{% endblock markdowncell %} + +{%- block rawcell scoped -%} +{%- if cell.metadata.get('raw_mimetype', '').lower() in resources.get('raw_mimetypes', ['']) %} +{{cell.source}} +{% endif -%} +{%- endblock rawcell -%} + +{% block headingcell scoped %} +{{ ("#" * cell.level + cell.source) | replace('\n', ' ') | markdown2rst }} +{% endblock headingcell %} + +{% block unknowncell scoped %} +unknown type {{cell.type}} +{% endblock unknowncell %} diff --git a/tutorials/conf.py b/tutorials/conf.py new file mode 100644 index 000000000..c6014c257 --- /dev/null +++ b/tutorials/conf.py @@ -0,0 +1,180 @@ +# -*- coding: utf-8 -*- +# Licensed under a 3-clause BSD style license - see LICENSE.rst + +# Astropy documentation build configuration file. + +import datetime +import re +import os +import sys + +# Building from inside the tutorials/ directory? Need to add correct helpers to the python path +a_h_path = None +if os.path.basename(os.getcwd()) == 'tutorials': + a_h_path = os.path.abspath(os.path.join('..', 'astropy_helpers')) + if os.path.isdir(a_h_path): + sys.path.insert(1, a_h_path) + +# Load all of the global Astropy configuration +try: + # at some point hopefully this can be replaced with installing a + # standalone sphinx-astropy-theme + from astropy_helpers.sphinx.conf import * + + import astropy_helpers + if a_h_path is not None and not astropy_helpers.__path__[0].startswith(a_h_path): + from warnings import warn + warn("The astropy_helpers you are importing is not the one that's " + "included with the tutorials. This may be fine but might cause " + "unexpected problems. You'll probably need to init/update the " + "submodules to rectify this, or delete your installed version of " + "the helpers (normally you shouldn't need to have them installed)") +except ImportError: + raise ImportError('Couldn\'t import astropy_helpers. You may need to "git ' + 'submodule init" and then "git submodule update" from ' + 'the base of the tutorials repo?') + +# Get configuration information from setup.cfg +try: + from ConfigParser import ConfigParser +except ImportError: + from configparser import ConfigParser +conf = ConfigParser() + +conf.read([os.path.join(os.path.dirname(__file__), '..', 'metadata.cfg')]) +setup_cfg = dict(conf.items('metadata')) + + +# -- General configuration ---------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = '1.4' # needed for suppress_warnings + +# To perform a Sphinx version check that needs to be more specific than +# major.minor, call `check_sphinx_version("x.y.z")` here. +# check_sphinx_version("1.2.1") + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns.append('**.ipynb_checkpoints') + +# This is added to the end of RST files - a good place to put substitutions to +# be used globally. +rst_epilog += """ +""" + +# -- Project information ------------------------------------------------------ + +# This does not *have* to match the package name, but typically does +project = setup_cfg['package_name'] +author = setup_cfg['author'] +copyright = '2013–{0}, {1}'.format( + datetime.datetime.now().year, setup_cfg['author']) + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. + +# The full version, including alpha/beta/rc tags. +release = setup_cfg['version'] +# The short X.Y version. +version = re.match(r'([\d\.]*)(\D*\d?)', setup_cfg['version']).group(1) +if version.endswith('.'): # e.g. "3.0.dev", which splits into groups "3.0." and "dev" + version = version[:-1] + + +if release.endswith('dev'): + # once the sphinx-astropy-theme is ready, just copy over the git_helpers.py file + # into this repo - it has been long-term stable so the helpers aren't needed + # just for this. + from astropy_helpers.git_helpers import get_git_devstr + release = release + get_git_devstr(path=os.path.join(os.path.split(__file__)[0],'..')) + + + +# -- Options for HTML output -------------------------------------------------- + +# A NOTE ON HTML THEMES +# The global astropy configuration uses a custom theme, 'bootstrap-astropy', +# which is installed along with astropy. A different theme can be used or +# the options for this theme can be modified by overriding some of the +# variables set in the global configuration. The variables set in the +# global configuration are listed below, commented out. + + +# Please update these texts to match the name of your package. +html_theme_options = { + 'logotext1': 'astro', # white, semi-bold + 'logotext2': 'py', # orange, light + 'logotext3': ':tutorials', # white, light + 'nosidebar': True + } + +html_style = 'custom.css' + +# Add any paths that contain custom themes here, relative to this directory. +# To use a different custom theme, add the directory containing the theme. +#html_theme_path = [] + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. To override the custom theme, set this to the +# name of a builtin theme or the name of a custom theme in html_theme_path. +#html_theme = None + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = '' + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '' + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +html_title = '{0} v{1}'.format(project, release) + +# Output file base name for HTML help builder. +htmlhelp_basename = project + 'doc' + + +# -- Options for LaTeX output ------------------------------------------------- + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [('index', project + '.tex', project + u' Documentation', + author, 'manual')] + + +# -- Options for manual page output ------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [('index', project.lower(), project + u' Documentation', + [author], 1)] + + +# -- Resolving issue number to links in changelog ----------------------------- +github_issues_url = 'https://github.com/{0}/issues/'.format(setup_cfg['github_project']) + + +# -- Run and convert the notebook files to RST -------------------------------- + +_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +_scripts_path = os.path.join(_root, 'scripts') +if _scripts_path not in sys.path: + sys.path.insert(1, _scripts_path) + +from convert import process_notebooks +nb_tutorials_path = os.path.join(_root, 'tutorials', 'notebooks') +template_path = os.path.join(_root, 'tutorials', 'astropy.tpl') +rst_output_path = os.path.join(_root, 'tutorials', 'rst-tutorials') +process_notebooks(nb_tutorials_path, output_path=rst_output_path, + template_file=template_path) + + +suppress_warnings = ['image.nonlocal_uri'] +html_static_path = ['notebooks', '_static'] diff --git a/tutorials/dev.rst b/tutorials/dev.rst new file mode 100644 index 000000000..0652ab764 --- /dev/null +++ b/tutorials/dev.rst @@ -0,0 +1,113 @@ +Documentation on tutorials infrastructure +========================================= + +Overview +-------- + +Tutorials are written as Jupyter notebooks on the ``master`` branch of the +``astropy/astropy-tutorials`` repository in ``tutorials/notebooks/``. These +notebook files do not contain output in order to simplify version-controlling +the files. + +The rendered Astropy-tutorials site is built using Sphinx with the Astropy theme +to look like the main documentation. Sphinx requires restructured text (RST) +files for its build process, so use an intermediate step to run the notebooks to +produce output, and then convert the notebook files into RST files. + +We use our own run-and-convert machinery using ``nbconvert``. We use the same +script that converts the notebooks to RST to test the notebooks on travis by +simply executing the notebooks and ignoring the output. + +We use `readthedocs `_ to do the Sphinx build, which is what +allows us to preserve the version history of the tutorials. The notebooks are +first converted to RST files during the Sphinx build by doing the conversion +at the end of the `Sphinx configuration file +`_. + +Why not use nbsphinx? +--------------------- + +Both running and converting the notebooks is handled automatically by the Sphinx +plugin ``nbsphinx``, but it doesn't support all of the features we want. In +particular, there is no supported way to modify the template file that controls +the output RST file that gets generated from each notebook; we want to be able +to modify the template so we can add the links mentioned above. + +Tutorials directory structure +----------------------------- + +The notebook files must be written as a single Jupyter notebook in a directory +within the ``tutorials/notebooks`` directory. The name of the notebook must +be the same as the subdirectory name. This is just needed for auto-generating +links to the source notebooks from the generated RST pages. + +Testing notebook execution +-------------------------- + +You can use the custom nbconvert script in the astropy-tutorials repository to +test that the tutorials all execute correctly. From the top-level repository +path:: + + python scripts/convert.py tutorials/notebooks -v --exec-only + +Running the convert script with the flag ``--exec-only`` will just execute the +notebooks and won't generate RST files. If you have already run the notebooks +once, you may need to also specify the ``-o`` or ``--overwrite`` flag: by +default, the script will only execute notebooks that haven't already been +executed. The ``-v`` flag just tells the script to output more "verbose" +messages, which you may or may not want. + +The above command will execute all notebooks in any subdirectory of the +``tutorials/notebooks`` path. If you want to just execute a single notebook, +you can specify the path to a single notebook file, e.g.:: + + python scripts/convert.py tutorials/notebooks/coordinates/coordinates.ipynb -v --exec-only + +You can also do this when running and generating RST files, which can be useful +when writing a new tutorial to make sure it renders in RST properly. To do +this, just remove the ``--exec-only`` flag:: + + python scripts/convert.py tutorials/notebooks/coordinates/coordinates.ipynb -v + +Building the tutorials page locally +----------------------------------- + +For this, you can use the `Makefile +`_ at the +top-level of the tutorials repository. From the root level of the cloned or +downloaded repository:: + + make html + +Will execute and convert the Jupyter notebooks to RST files, then do the Sphinx +build. If this returns an error, you may need to initialize the +``astropy_helpers`` submodule (read the error message). That is, you may need to +do:: + + git submodule init + git submodule update + make html + +Once this is done, you will find the index for the pages in your local +``build/html/index.html`` file. + +Releases +-------- + +We will release a new version of the tutorials with each major release of the +Astropy core package; i.e. we will release for 3.0, 3.1, etc., but not for +bugfix releases like 2.0.3, etc. With each release, we update the pinned +versions of the global dependency files (``conda-envirionment.yml`` for Anaconda +and ``pip-requirements.txt`` for pip). + +To actually update the version, modify the ``metadata.cfg`` at the root of this +repository with the new version. This is the version number that will be +shown in the sphinx builds. Note that if it ends in ``.dev``, this will be +followed by a revision number that is determined by the number of git commits. + +Marking a cell with an intentional error +---------------------------------------- + +Edit the cell metadata of the cell in which you would like to raise an exception +and add the following to the top-level JSON: ``"tags": ["raises-exception"]`` +This tag is recognized by the latest (master) version of nbconvert. diff --git a/tutorials/index.rst b/tutorials/index.rst new file mode 100644 index 000000000..6adde10de --- /dev/null +++ b/tutorials/index.rst @@ -0,0 +1,39 @@ +Astropy Tutorials +================= + +The tutorials on this site walk through some typical software tasks and +demonstrate the features in Astropy sub-packages in the context of a story or +standard workflow. See the `Astropy documentation `_ +for a structured view of the functionality within the Astropy project. + +List of tutorials +----------------- + +.. toctree:: + :maxdepth: 1 + :glob: + + rst-tutorials/* + +For contributors +---------------- + +We welcome feedback, improvements, and new tutorial content via the `Astropy +Tutorials repository `_ on +GitHub. If you find a typo or would like to clarify some text, please either +`create an issue `_ or +make the change yourself and then submit a pull request directly to the +repository. Questions and/or comments about the tutorials are welcome on the +`astropy-dev `_ mailing +list. + +If you are interested in contributing a new tutorial or content, please see +:ref:`contributing-page`. + +For developers +-------------- + +.. toctree:: + :maxdepth: 1 + + dev diff --git a/tutorials/FITS-header/FITS-header.ipynb b/tutorials/notebooks/FITS-header/FITS-header.ipynb similarity index 100% rename from tutorials/FITS-header/FITS-header.ipynb rename to tutorials/notebooks/FITS-header/FITS-header.ipynb diff --git a/tutorials/FITS-header/input_file.fits b/tutorials/notebooks/FITS-header/input_file.fits similarity index 100% rename from tutorials/FITS-header/input_file.fits rename to tutorials/notebooks/FITS-header/input_file.fits diff --git a/tutorials/FITS-header/requirements.txt b/tutorials/notebooks/FITS-header/requirements.txt similarity index 100% rename from tutorials/FITS-header/requirements.txt rename to tutorials/notebooks/FITS-header/requirements.txt diff --git a/tutorials/FITS-images/FITS-images.ipynb b/tutorials/notebooks/FITS-images/FITS-images.ipynb similarity index 100% rename from tutorials/FITS-images/FITS-images.ipynb rename to tutorials/notebooks/FITS-images/FITS-images.ipynb diff --git a/tutorials/FITS-images/requirements.txt b/tutorials/notebooks/FITS-images/requirements.txt similarity index 100% rename from tutorials/FITS-images/requirements.txt rename to tutorials/notebooks/FITS-images/requirements.txt diff --git a/tutorials/FITS-tables/FITS-tables.ipynb b/tutorials/notebooks/FITS-tables/FITS-tables.ipynb similarity index 100% rename from tutorials/FITS-tables/FITS-tables.ipynb rename to tutorials/notebooks/FITS-tables/FITS-tables.ipynb diff --git a/tutorials/FITS-tables/requirements.txt b/tutorials/notebooks/FITS-tables/requirements.txt similarity index 100% rename from tutorials/FITS-tables/requirements.txt rename to tutorials/notebooks/FITS-tables/requirements.txt diff --git a/tutorials/UVES/CaII-1.png b/tutorials/notebooks/UVES/CaII-1.png similarity index 100% rename from tutorials/UVES/CaII-1.png rename to tutorials/notebooks/UVES/CaII-1.png diff --git a/tutorials/UVES/CaII-2.png b/tutorials/notebooks/UVES/CaII-2.png similarity index 100% rename from tutorials/UVES/CaII-2.png rename to tutorials/notebooks/UVES/CaII-2.png diff --git a/tutorials/UVES/CaII-3.png b/tutorials/notebooks/UVES/CaII-3.png similarity index 100% rename from tutorials/UVES/CaII-3.png rename to tutorials/notebooks/UVES/CaII-3.png diff --git a/tutorials/UVES/CaII-lines-all.png b/tutorials/notebooks/UVES/CaII-lines-all.png similarity index 100% rename from tutorials/UVES/CaII-lines-all.png rename to tutorials/notebooks/UVES/CaII-lines-all.png diff --git a/tutorials/UVES/CaII-lines-one.png b/tutorials/notebooks/UVES/CaII-lines-one.png similarity index 100% rename from tutorials/UVES/CaII-lines-one.png rename to tutorials/notebooks/UVES/CaII-lines-one.png diff --git a/tutorials/UVES/CaII.png b/tutorials/notebooks/UVES/CaII.png similarity index 100% rename from tutorials/UVES/CaII.png rename to tutorials/notebooks/UVES/CaII.png diff --git a/tutorials/UVES/UVES.ipynb b/tutorials/notebooks/UVES/UVES.ipynb similarity index 96% rename from tutorials/UVES/UVES.ipynb rename to tutorials/notebooks/UVES/UVES.ipynb index 3a2cffbef..2dbd4bbfd 100644 --- a/tutorials/UVES/UVES.ipynb +++ b/tutorials/notebooks/UVES/UVES.ipynb @@ -81,7 +81,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "import tarfile\n", @@ -138,7 +140,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from glob import glob\n", @@ -171,7 +175,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "sp = fits.open(filelist[0])\n", @@ -193,7 +199,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "header = sp[0].header\n", @@ -218,7 +226,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "flux = sp[0].data" @@ -282,7 +292,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def read_spec(filename):\n", @@ -335,7 +347,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "help(read_spec)\n", @@ -366,7 +380,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def read_setup(filename):\n", @@ -409,7 +425,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "flux = np.zeros((len(filelist), len(wavelength)))\n", @@ -426,7 +444,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Units and constants in astropy" + "## Units and constants in astropy" ] }, { @@ -449,7 +467,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "import astropy.units as u\n", @@ -503,7 +523,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "v_accr = (2.* G * M_MN_Lup/R_MN_Lup)**0.5 \n", @@ -525,7 +547,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "v_rot = vsini / np.sin(incl)\n", @@ -543,7 +567,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "(v_accr / v_rot).decompose()" @@ -579,7 +605,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "wavelength = wavelength * (1. + heliocentric/c)" @@ -601,7 +629,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "wavelength = wavelength * (1. * u.dimensionless_unscaled+ heliocentric/c)" @@ -622,7 +652,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "wavelength.to(u.keV, equivalencies=u.spectral())\n", @@ -663,7 +695,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "print(np.log10((G*M_MN_Lup/R_MN_Lup**2)/u.cm*u.second**2))" @@ -692,7 +726,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "waveclosetoHa = np.array([6562.,6563,6565.]) * u.AA" @@ -708,7 +744,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# This function uses the Doppler equivalency between wavelength and velocity\n", @@ -745,7 +783,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def w2vsini(wavelength_array, wavelength_line):\n", @@ -756,7 +796,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def w2vsini(w, w0):\n", @@ -789,7 +831,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from astropy.time import Time\n", @@ -807,7 +851,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "t1\n", @@ -825,7 +871,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "t1.tt" @@ -841,7 +889,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "obs_times = Time(date, scale = 'utc')\n", @@ -861,7 +911,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "delta_p = delta_t.value * u.day / period" @@ -900,7 +952,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def region_around_line(w, flux, cont):\n", @@ -960,7 +1014,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "ew = fcaII[0,:] - 1.\n", @@ -978,7 +1034,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "delta_lam = np.diff(wcaII.to(u.AA).value)\n", @@ -1000,7 +1058,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from astropy.table import Column, Table\n", @@ -1048,7 +1108,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "x = w2vsini(wcaII, 393.366 * u.nm).decompose()" @@ -1064,7 +1126,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# set reasonable figsize for 1-column figures\n", @@ -1106,7 +1170,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "yshift = np.arange((fcaII.shape[0])) * 0.5\n", @@ -1141,7 +1207,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "fmean = np.mean(fcaII, axis=0)\n", @@ -1160,7 +1228,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "fig = plt.figure()\n", @@ -1180,7 +1250,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "ind1 = delta_p < 1 * u.dimensionless_unscaled\n", @@ -1217,7 +1289,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# shift a little for plotting purposes\n", diff --git a/tutorials/Plot-Catalog/requirements.txt b/tutorials/notebooks/UVES/requirements.txt similarity index 100% rename from tutorials/Plot-Catalog/requirements.txt rename to tutorials/notebooks/UVES/requirements.txt diff --git a/tutorials/Coordinates/HCG7_2MASS.tbl b/tutorials/notebooks/coordinates/HCG7_2MASS.tbl similarity index 100% rename from tutorials/Coordinates/HCG7_2MASS.tbl rename to tutorials/notebooks/coordinates/HCG7_2MASS.tbl diff --git a/tutorials/Coordinates/HCG7_SDSS_cutout.jpg b/tutorials/notebooks/coordinates/HCG7_SDSS_cutout.jpg similarity index 100% rename from tutorials/Coordinates/HCG7_SDSS_cutout.jpg rename to tutorials/notebooks/coordinates/HCG7_SDSS_cutout.jpg diff --git a/tutorials/Coordinates/HCG7_SDSS_photo.dat b/tutorials/notebooks/coordinates/HCG7_SDSS_photo.dat similarity index 100% rename from tutorials/Coordinates/HCG7_SDSS_photo.dat rename to tutorials/notebooks/coordinates/HCG7_SDSS_photo.dat diff --git a/tutorials/Coordinates/Coordinates.ipynb b/tutorials/notebooks/coordinates/coordinates.ipynb similarity index 93% rename from tutorials/Coordinates/Coordinates.ipynb rename to tutorials/notebooks/coordinates/coordinates.ipynb index 9736fd039..c70b342be 100644 --- a/tutorials/Coordinates/Coordinates.ipynb +++ b/tutorials/notebooks/coordinates/coordinates.ipynb @@ -17,7 +17,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# Python standard-library\n", @@ -35,7 +37,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# Set up matplotlib and use a nicer set of plot parameters\n", @@ -66,7 +70,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "hcg7_center = SkyCoord(9.81625*u.deg, 0.88806*u.deg, frame='icrs')\n", @@ -83,7 +89,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "SkyCoord('0h39m15.9s', '0d53m17.016s', frame='icrs')" @@ -92,7 +100,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "SkyCoord('0:39:15.9 0:53:17.016', unit=(u.hour, u.deg), frame='icrs')" @@ -110,7 +120,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "hcg7_center = SkyCoord.from_name('HCG 7')\n", @@ -127,7 +139,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "type(hcg7_center.ra), type(hcg7_center.dec)" @@ -136,7 +150,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "hcg7_center.dec" @@ -145,7 +161,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "hcg7_center.ra" @@ -154,7 +172,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "hcg7_center.ra.hour" @@ -172,7 +192,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "impix = 1024\n", @@ -198,7 +220,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "Image('HCG7_SDSS_cutout.jpg')" @@ -230,7 +254,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -246,7 +272,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -274,7 +302,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from astroquery.sdss import SDSS\n", @@ -295,7 +325,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "sdss.write('HCG7_SDSS_photo.dat', format='ascii')" @@ -311,7 +343,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "sdss = Table.read('HCG7_SDSS_photo.dat', format='ascii')" @@ -327,7 +361,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "twomass = Table.read('HCG7_2MASS.tbl', format='ascii')" @@ -343,7 +379,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "sdss # just to see an example of the format" @@ -352,7 +390,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "twomass # just to see an example of the format" @@ -370,7 +410,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "coo_sdss = SkyCoord(sdss['ra']*u.deg, sdss['dec']*u.deg)\n", @@ -389,7 +431,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "idx_sdss, d2d_sdss, d3d_sdss = coo_twomass.match_to_catalog_sky(coo_sdss)" @@ -405,7 +449,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "plt.hist(d2d_sdss.arcsec, histtype='step', range=(0,2))\n", @@ -425,7 +471,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "ras_sim = np.random.rand(len(coo_twomass))*coo_sdss.ra.ptp() + coo_sdss.ra.min()\n", @@ -445,7 +493,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "coo_simulated = SkyCoord(ras_sim, decs_sim) \n", @@ -462,7 +512,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "plt.hist(d2d_sim.arcsec, bins='auto', histtype='step', label='Simulated', linestyle='dashed')\n", @@ -482,7 +534,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "rmag = sdss['r'][idx_sdss]\n", @@ -531,7 +585,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -547,7 +603,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -582,7 +640,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "hcg7_center.galactic" @@ -598,7 +658,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from astropy.coordinates import Galactic\n", @@ -615,7 +677,12 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true, + "tags": [ + "raises-exception" + ] + }, "outputs": [], "source": [ "hcg7_center.galactic.ra # should fail because galactic coordinates are l/b not RA/Dec" @@ -624,7 +691,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "hcg7_center.galactic.b" @@ -647,7 +716,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from astropy.coordinates import EarthLocation\n", @@ -670,7 +741,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from astropy.coordinates import AltAz\n", @@ -689,7 +762,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "hcg7_center.transform_to(aa)" @@ -705,7 +780,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# this gives a Time object with an *array* of times\n", @@ -731,7 +808,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "from astropy.coordinates import get_sun\n", @@ -768,7 +847,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -784,7 +865,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, diff --git a/tutorials/Coordinates/requirements.txt b/tutorials/notebooks/coordinates/requirements.txt similarity index 88% rename from tutorials/Coordinates/requirements.txt rename to tutorials/notebooks/coordinates/requirements.txt index 7f537aa82..eb2904129 100644 --- a/tutorials/Coordinates/requirements.txt +++ b/tutorials/notebooks/coordinates/requirements.txt @@ -3,3 +3,4 @@ numpy matplotlib astroquery IPython +scipy diff --git a/tutorials/Plot-Catalog/Young-Objects-Compilation.csv b/tutorials/notebooks/plot-catalog/Young-Objects-Compilation.csv similarity index 100% rename from tutorials/Plot-Catalog/Young-Objects-Compilation.csv rename to tutorials/notebooks/plot-catalog/Young-Objects-Compilation.csv diff --git a/tutorials/Plot-Catalog/plot-catalog.ipynb b/tutorials/notebooks/plot-catalog/plot-catalog.ipynb similarity index 100% rename from tutorials/Plot-Catalog/plot-catalog.ipynb rename to tutorials/notebooks/plot-catalog/plot-catalog.ipynb diff --git a/tutorials/Quantities/requirements.txt b/tutorials/notebooks/plot-catalog/requirements.txt similarity index 100% rename from tutorials/Quantities/requirements.txt rename to tutorials/notebooks/plot-catalog/requirements.txt diff --git a/tutorials/Plot-Catalog/simple_table.csv b/tutorials/notebooks/plot-catalog/simple_table.csv similarity index 100% rename from tutorials/Plot-Catalog/simple_table.csv rename to tutorials/notebooks/plot-catalog/simple_table.csv diff --git a/tutorials/Quantities/Quantities.ipynb b/tutorials/notebooks/quantities/quantities.ipynb similarity index 96% rename from tutorials/Quantities/Quantities.ipynb rename to tutorials/notebooks/quantities/quantities.ipynb index 9189221ab..c632dcc37 100644 --- a/tutorials/Quantities/Quantities.ipynb +++ b/tutorials/notebooks/quantities/quantities.ipynb @@ -33,7 +33,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "import numpy as np\n", @@ -62,7 +64,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "import astropy.units as u\n", @@ -93,7 +97,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "Reff = 29 * u.pc" @@ -109,7 +115,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "Reff = u.Quantity(29, unit=u.pc)" @@ -177,7 +185,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "vmean = 206\n", @@ -235,7 +245,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "sigma_scalar = np.sqrt(np.sum((v - np.mean(v))**2) / len(v))" @@ -326,7 +338,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "raises-exception" + ] + }, "outputs": [], "source": [ "np.log10(M)" @@ -351,7 +367,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -365,7 +383,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -379,7 +399,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -414,7 +436,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "d = 250 * u.pc\n", @@ -431,7 +455,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "# Cloud's center\n", @@ -467,7 +493,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "data = data_gauss * u.K" @@ -576,7 +604,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "lambda13 = 2.60076 * u.mm\n", @@ -593,7 +623,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "raises-exception" + ] + }, "outputs": [], "source": [ "nu13 = lambda13.to(u.Hz)" @@ -611,7 +645,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "nu13 = lambda13.to(u.Hz, equivalencies=u.spectral())\n", @@ -648,7 +684,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "B = h * nu18 / (k_B * Tex)" @@ -731,7 +769,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "mH2 = 2 * 1.008 * u.Dalton #aka atomic mass unit/amu\n", @@ -791,7 +831,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "raises-exception" + ] + }, "outputs": [], "source": [ "da.to(u.cm**2)" @@ -857,7 +901,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -871,7 +917,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] }, @@ -879,7 +927,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "### 3. Using Quantities with Functions" + "## 3. Using Quantities with Functions" ] }, { @@ -899,7 +947,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def response_func(xinarcsec, yinarcsec):\n", @@ -937,7 +987,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "def response_func(x, y):\n", @@ -959,7 +1011,11 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "tags": [ + "raises-exception" + ] + }, "outputs": [], "source": [ "response_func(1.0, 1.2)" @@ -1005,7 +1061,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [] } diff --git a/tutorials/UVES/requirements.txt b/tutorials/notebooks/quantities/requirements.txt similarity index 100% rename from tutorials/UVES/requirements.txt rename to tutorials/notebooks/quantities/requirements.txt diff --git a/tutorials/redshift_plot/ang_dist.png b/tutorials/notebooks/redshift-plot/ang_dist.png similarity index 100% rename from tutorials/redshift_plot/ang_dist.png rename to tutorials/notebooks/redshift-plot/ang_dist.png diff --git a/tutorials/redshift_plot/redshift_plot.ipynb b/tutorials/notebooks/redshift-plot/redshift-plot.ipynb similarity index 100% rename from tutorials/redshift_plot/redshift_plot.ipynb rename to tutorials/notebooks/redshift-plot/redshift-plot.ipynb diff --git a/tutorials/redshift_plot/requirements.txt b/tutorials/notebooks/redshift-plot/requirements.txt similarity index 100% rename from tutorials/redshift_plot/requirements.txt rename to tutorials/notebooks/redshift-plot/requirements.txt diff --git a/tutorials/vo/README.rst b/tutorials/notebooks/vo/README.md similarity index 100% rename from tutorials/vo/README.rst rename to tutorials/notebooks/vo/README.md diff --git a/tutorials/vo/conesearch_tutorial.ipynb b/tutorials/notebooks/vo/conesearch.ipynb similarity index 94% rename from tutorials/vo/conesearch_tutorial.ipynb rename to tutorials/notebooks/vo/conesearch.ipynb index 6bee59fcd..e98126af2 100644 --- a/tutorials/vo/conesearch_tutorial.ipynb +++ b/tutorials/notebooks/vo/conesearch.ipynb @@ -159,7 +159,7 @@ "outputs": [], "source": [ "row = result_tab[0]\n", - "simbad_obj = coord.SkyCoord(ra=row['RA']*u.deg, dec=row['DEC']*u.deg)\n", + "simbad_obj = coord.SkyCoord(ra=row['RAJ2000']*u.deg, dec=row['DEJ2000']*u.deg)\n", "print('Searching SIMBAD for\\n{}\\n'.format(simbad_obj))\n", "simbad_result = Simbad.query_region(simbad_obj, radius=5*u.arcsec)\n", "print(simbad_result)" @@ -297,7 +297,9 @@ { "cell_type": "code", "execution_count": null, - "metadata": {}, + "metadata": { + "collapsed": true + }, "outputs": [], "source": [ "with warnings.catch_warnings():\n", @@ -387,7 +389,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's predict the run time of performing Cone Search on `http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&` with a radius of 0.5 degrees. For now, the prediction assumes a very simple linear model, which might or might not reflect the actual trend.\n", + "Let's predict the run time of performing Cone Search on `http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&` with a radius of 0.1 degrees. For now, the prediction assumes a very simple linear model, which might or might not reflect the actual trend.\n", "\n", "This might take a while." ] @@ -402,7 +404,7 @@ " warnings.simplefilter('ignore')\n", " t_est, n_est = conesearch.predict_search(\n", " 'http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&',\n", - " c, 0.5 * u.degree, verbose=False, plot=True)" + " c, 0.1 * u.degree, verbose=False, plot=True)" ] }, { @@ -431,7 +433,7 @@ "outputs": [], "source": [ "t_real, tab = conesearch.conesearch_timer(\n", - " c, 0.5 * u.degree,\n", + " c, 0.1 * u.degree,\n", " catalog_db='http://gsss.stsci.edu/webservices/vo/ConeSearch.aspx?CAT=GSC23&',\n", " verbose=False)" ] @@ -445,6 +447,15 @@ "print('Actual run time is', t_real, 'seconds')\n", "print('Actual number of rows is', tab.nrows)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] } ], "metadata": { @@ -460,6 +471,18 @@ "display_name": "Python [default]", "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.5.2" } }, "nbformat": 4, diff --git a/tutorials/notebooks/vo/requirements.txt b/tutorials/notebooks/vo/requirements.txt new file mode 100644 index 000000000..30317e981 --- /dev/null +++ b/tutorials/notebooks/vo/requirements.txt @@ -0,0 +1 @@ +astroquery