Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example notebooks in Sphinx documentation #941

Merged
merged 23 commits into from
Jan 29, 2019

Conversation

kosack
Copy link
Contributor

@kosack kosack commented Jan 28, 2019

This PR makes it possible to add notebooks into the documentation directly using nbsphinx. It moves some of the current examples/notebooks into docs/examples and docs/tutorials. I also reorganized a bit the documentation tree (to put the API docs at a lower-level)

The features are:

  • the notebooks are executed during the doc build (and if fail the tests fail)
  • the notebooks now must be stored "Stripped" (e.g. with no output), which is nicer for git
  • the docs look like this!:

image

This is still a bit of a work in progress, as I need to migrate more of the notebooks to this new scheme (it takes some re-editing), but I think already it's useful.

@codecov
Copy link

codecov bot commented Jan 28, 2019

Codecov Report

Merging #941 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff           @@
##           master    #941   +/-   ##
======================================
  Coverage    78.6%   78.6%           
======================================
  Files         191     191           
  Lines       10910   10910           
======================================
  Hits         8576    8576           
  Misses       2334    2334
Impacted Files Coverage Δ
ctapipe/image/toymodel.py 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c1f9931...c3cee76. Read the comment docs.

- made some modifications to table_writer_reader so that no cells fail (even ones that are supposed to)
dneise
dneise previously approved these changes Jan 29, 2019
Copy link
Member

@dneise dneise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is great work and should be merged.
I have some minor comments.

"metadata": {},
"outputs": [],
"source": [
"data = utils.get_dataset_path(\"gamma_test.simtel.gz\")\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the return value of get_dataset_path is a path-like or string pointing to a file containing data .. it is not the data itself. Therefore I think this should be named path

"cell_type": "markdown",
"metadata": {},
"source": [
"note that this is (N_chan, N_pix, N_samp)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output of Box 7 uses this terminology: n_channels x n_pixels, n_samples. I think a few more letters might not hurt here. Also I always wondered: why does the container help use a an x between the first two dimensions and a comma , between the last two?

"metadata": {},
"outputs": [],
"source": [
"data = utils.get_dataset(\"gamma_test_large.simtel.gz\") \n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecated: --> get_dataset_path

"source": [
"import pandas as pd\n",
"\n",
"hillas = pd.read_hdf(\"hillas.h5\", key='/dl1/hillas')\n",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assumed, somebody just sent me hillas.h5 via email .. how would I know the key?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe one could show a bit how dataset exploration works in ctapipe

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i think many of these noteboooks will need improvement, for now I'm just moving them over from the old dir and not making large mods other than bug fixes.

To look inside a hdf5 file there are many options h5ls probably is the easiest

@kbruegge
Copy link
Member

Nice work. While I didn't look at each notebook in detail I think its a good idea 👍

@kosack
Copy link
Contributor Author

kosack commented Jan 29, 2019

Ok, I think this PR is ready to go - I've entirely removed the old examples/notesbooks dir and migrated everything over to the documentation. I'm not going to do many changes to the notebooks in this PR - we can have another to clean them up more, here I'm just focusing on getting them to render correctly. Their content probably needs a second look later.

The next step (for another PR) will be to clean up the non-notebook examples (probably turn some into notebooks and others in to Tools)

deprecated - now uses nbsphinx
dneise
dneise previously approved these changes Jan 29, 2019
Copy link
Member

@dneise dneise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Let's merge it once tests are passing.

@kosack
Copy link
Contributor Author

kosack commented Jan 29, 2019

Ok all tests finally pass, so I just need some reviewers

@kosack kosack merged commit bcee2ff into cta-observatory:master Jan 29, 2019
@kosack kosack deleted the feature/notebooks-in-docs branch January 29, 2019 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants