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

Update the examples #52

Merged
merged 93 commits into from
Dec 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
665aa83
DOC #24 start examples section
prjemian Nov 24, 2020
ba7ac47
MNT #51 rename directory doc to docs
prjemian Nov 24, 2020
c12209e
DOC #24
prjemian Nov 24, 2020
5fea657
Merge branch 'main' into 24-examples
prjemian Dec 3, 2020
aac83b8
CI #24 flake8
prjemian Dec 3, 2020
56754c9
WIP #24
prjemian Dec 4, 2020
1ef5a31
DOC #24 E4CV:fourc example WIP
prjemian Dec 6, 2020
3351bd8
DOC #24 E6C:sixc example WIP
prjemian Dec 6, 2020
30b9229
DOC #24
prjemian Dec 6, 2020
5d382f0
DOC #24 WIP 4-circle
prjemian Dec 7, 2020
975a3c6
DOC #24 WIP 6-circle
prjemian Dec 7, 2020
c9e8776
DOC #24 hklpy name first
prjemian Dec 7, 2020
f240171
DOC #24 WIP
prjemian Dec 7, 2020
482726d
DOC #24 e4cv example notebook
prjemian Dec 7, 2020
491cff7
DOC #24 alignment
prjemian Dec 7, 2020
5470d06
MNT #57 archive most existing examples
prjemian Dec 8, 2020
79acdef
MNT #57 converts ipynb to rst
prjemian Dec 8, 2020
b38e746
MNT #57 housekeeping
prjemian Dec 8, 2020
10906b9
MNT #57 rename and update
prjemian Dec 8, 2020
26779bd
MNT #57 nb -> rst
prjemian Dec 8, 2020
3a348a9
MNT #57
prjemian Dec 8, 2020
350efb3
MNT #57
prjemian Dec 8, 2020
c77c3cd
CI #57 no unit tests in examples
prjemian Dec 9, 2020
5c55e04
MNT #57 E6C
prjemian Dec 9, 2020
ab7829b
MNT #57 k4cv
prjemian Dec 9, 2020
46dd9e9
MNT #57
prjemian Dec 9, 2020
dadd22e
DOC #57
prjemian Dec 9, 2020
396204f
MNT #57 refactor for more resources
prjemian Dec 9, 2020
92d374b
DOC #57
prjemian Dec 9, 2020
8eb39ea
MNT #57 add to spec2nexus
prjemian Dec 9, 2020
8d12e2f
MNT #57
prjemian Dec 10, 2020
d4214a4
Update docs/source/examples/notebooks/e4cv.rst
prjemian Dec 10, 2020
94f600b
Update docs/source/examples/notebooks/e4cv.rst
prjemian Dec 10, 2020
3cb6d9b
Update docs/source/examples/notebooks/e4cv.rst
prjemian Dec 10, 2020
c1f1a46
Update docs/source/examples/notebooks/e4cv.rst
prjemian Dec 10, 2020
aa8aaac
Update docs/source/examples/notebooks/e6c.rst
prjemian Dec 10, 2020
4c43f0e
Merge branch 'main' into 59-publish-docs
prjemian Dec 10, 2020
8d236cf
MNT #59 edited publishing workflow from ophyd
prjemian Dec 10, 2020
772817b
CI #59 need jupyter
prjemian Dec 10, 2020
63dc2e9
MNT #59 almost time for tmate
prjemian Dec 10, 2020
108674f
MNT #59 explicit activate env
prjemian Dec 10, 2020
66dc0c1
MNT #59 hello tmate
prjemian Dec 11, 2020
3b5229b
CI #59 force activate conda
prjemian Dec 11, 2020
b32e2c2
CI #59 Diagnostics
prjemian Dec 11, 2020
badc5f7
CI #59 need sphinx to build docs
prjemian Dec 11, 2020
5f83770
CI #59 yikes! push to dir=hklpy now!
prjemian Dec 11, 2020
f6c2b46
CI #59 cleanup workflow
prjemian Dec 11, 2020
eb46315
CI #59 ensure package name is used when publishing
prjemian Dec 11, 2020
3eb82c2
MNT #59 these files will be built now
prjemian Dec 11, 2020
4187261
CI #59 test conda activation
prjemian Dec 11, 2020
0203ba0
CI #59 no explicit activation
prjemian Dec 11, 2020
926d8c3
CI #59 install publishing requirements to ENV_NAME
prjemian Dec 11, 2020
4d28043
CI #59 explicit activation of ENV_NAME
prjemian Dec 11, 2020
bffe18e
CI #59 for pip install
prjemian Dec 11, 2020
ffa781e
CI #59 diagnostic
prjemian Dec 11, 2020
0b778fd
CI #59 indentation?
prjemian Dec 11, 2020
1a92ca9
CI #59 simpler env var citation
prjemian Dec 11, 2020
f74a4b7
CI #59 use default env name
prjemian Dec 11, 2020
4568d4a
CI #59 choose the shell each "run"
prjemian Dec 11, 2020
4fdeabf
CI #59 channels
prjemian Dec 11, 2020
cf49b52
CI #59 channels same order as env file
prjemian Dec 11, 2020
bbd626e
CI #59 confirm after cleanup
prjemian Dec 11, 2020
9c5b479
CI #59 ready for production
prjemian Dec 11, 2020
261b955
MNT #59 test
prjemian Dec 11, 2020
ed547ca
CI #59 test
prjemian Dec 11, 2020
f1211b8
CI #59 retry
prjemian Dec 11, 2020
8463e1c
CI #59 set package name in workflow from repo
prjemian Dec 11, 2020
fc5d16e
CI #59 production ready again
prjemian Dec 11, 2020
457c073
MNT #24 categorize
prjemian Dec 11, 2020
9cb4ed3
MNT #59 now ignore built parts
prjemian Dec 11, 2020
93a6e50
MNT #52 per review
prjemian Dec 11, 2020
acc5086
WIP #52 per review
prjemian Dec 11, 2020
ba74518
MNT #52 re-run all notebooks
prjemian Dec 11, 2020
01992ce
Merge pull request #60 from bluesky/59-publish-docs
mrakitin Dec 12, 2020
85d396e
WIP #24 sync the examples
prjemian Dec 12, 2020
bc9b47d
DOC #24 notebook viewers
prjemian Dec 14, 2020
3c4484e
DOC #24 always cp resources to docs
prjemian Dec 17, 2020
c6bea81
DOC #24 E4CV, K4CV, E6C consistency
prjemian Dec 17, 2020
8668887
DOC #24 consistency checking
prjemian Dec 17, 2020
cfbfb9c
DOC #52 publish the docs for review
prjemian Dec 17, 2020
c3a2261
CI #52 back to SOP
prjemian Dec 17, 2020
30ff2f7
DOC #24 link to notebook viewers
prjemian Dec 17, 2020
8dccd95
MNT #52 change the 6-circle graphics
prjemian Dec 17, 2020
fe188fd
MNT #52 E6C: less scary now
prjemian Dec 17, 2020
5111792
MNT #52 less scary now for all geometries
prjemian Dec 17, 2020
4216f62
MNT #52 recompute
prjemian Dec 17, 2020
5c97b3d
Update docs/source/examples/index.rst
prjemian Dec 18, 2020
d542c9e
Update docs/source/examples/index.rst
prjemian Dec 18, 2020
013e8f5
Update docs/source/examples/index.rst
prjemian Dec 18, 2020
4646164
MNT #52 per review
prjemian Dec 18, 2020
fd701f8
MNT #52 more obvious wrt sign & precision
prjemian Dec 18, 2020
7704e88
MNT #52 consistency in print per review
prjemian Dec 18, 2020
eb81c1c
remove travis configuration resources
prjemian Dec 18, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ exclude =
build,
dist,
versioneer.py,
doc/source
docs/source
max-line-length = 115
ignore: W504,W503,E741,E402,E226
2 changes: 1 addition & 1 deletion .github/workflows/conda_unit_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ jobs:
- name: Test with coverage and pytest
shell: bash -l {0}
run: |
coverage run --concurrency=thread --parallel-mode -m pytest -vvv
coverage run --concurrency=thread --parallel-mode -m pytest -vvv --ignore=examples
coverage combine
coverage report
88 changes: 88 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Publish Documentation

# comment for normal
# (For development use)
# on: push

# comment here and uncomment above to publish docs for _any_ branch
# (For production use)
on:
push:
branches:
- main

jobs:
build:
env:
ENV_NAME: test
# will define PACKAGE in steps, obtained from GITHUB_REPOSITORY

if: github.repository_owner == 'bluesky'
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]

steps:
- name: get correct package name from repository
shell: bash -l {0}
run: |
echo "PACKAGE=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV

- name: show that
shell: bash -l {0}
run: |
env | sort | grep hklpy

- uses: actions/checkout@v2

- name: set environment name in YAML file
shell: bash -l {0}
run: |
sed -i.bak "s/name: ${PACKAGE}/name: ${ENV_NAME}/g" environment.yml
head envir*

- name: Setup Miniconda ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v2
with:
auto-update-conda: true
channel-priority: true
channels: nsls2forge,conda-forge,defaults
environment-file: environment.yml
mamba-version: "*"
python-version: ${{ matrix.python-version }}
use-only-tar-bz2: true # required for caching

- name: Install publishing requirements
shell: bash -l {0}
run: |
conda install jupyter nbconvert sphinx sphinxcontrib-napoleon -c defaults -c conda-forge
pip install sphinx-rtd-theme

- name: Install the package locally
shell: bash -l {0}
run: |
pip install -e .

- name: Build Docs
shell: bash -l {0}
run: |
# conda info
# conda list jupyter
# conda list nbconvert
env | sort | grep -i CONDA
make -C examples/
make -C docs/ html

- name: Deploy documentation to blueskyproject.io.
# We pin to the SHA, not the tag, for security reasons.
# https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions
uses: peaceiris/actions-gh-pages@bbdfb200618d235585ad98e965f4aafc39b4c501 # v3.7.3
with:
deploy_key: ${{ secrets.ACTIONS_DOCUMENTATION_DEPLOY_KEY }}
publish_branch: master
publish_dir: ./docs/build/html
external_repository: bluesky/bluesky.github.io
destination_dir: ${PACKAGE}
keep_files: true # Keep old files.
force_orphan: false # Keep git history.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,11 @@ target/
.ipynb_checkpoints

# generated docs
doc/source/generated
docs/source/generated

# Microsoft VS Code editor
.vscode/
.history/

# PyTest cache
.pytest_cache/
83 changes: 0 additions & 83 deletions .travis.yml

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 36 additions & 0 deletions docs/source/examples/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
.. _examples:

Examples
========

All examples are available as
`Jupyter notebooks <https://jupyter.org/>`_
from the *hklpy* source
code website: https://github.com/bluesky/hklpy/tree/main/examples

Diffractometer Geometries
-------------------------

.. toctree::
:maxdepth: 1
:glob:

notebooks/geo_*

Variations
----------

.. toctree::
:maxdepth: 1
:glob:

notebooks/var_*

Tests and Comparisons
---------------------

.. toctree::
:maxdepth: 1
:glob:

notebooks/tst_*
8 changes: 8 additions & 0 deletions docs/source/examples/notebooks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ignore any built content from notebooks

# written by nbconvert from root/examples/*.ipynb
*.rst
*_files/

# copied from root/examples/resources/*
resources/
Empty file.
2 changes: 2 additions & 0 deletions doc/source/index.rst → docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ Contents:

.. toctree::
:maxdepth: 1
:glob:

calc
context
diffract
engine
sample
util
examples/*

File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
- pip
- prettytable
- pyepics
- pyRestTable
- pip:
- coveralls
- pytest
Expand Down
22 changes: 22 additions & 0 deletions examples/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# create reStructured text from jupyter notebooks
#
# Create the rst files and related resources
# in the documentation directory.

TARGET_DIR = ../docs/source/examples/notebooks
NOTEBOOKS := $(wildcard *.ipynb)
RSTS := $(subst .ipynb,.rst, ${NOTEBOOKS})
RESOURCES := $(wildcard resources/*)

# default rule: just rebuild everything
# TODO: could be smarter and rebuild conditionally
all :: ${RSTS} resources

# copy all the local resources cited in the notebooks
resources :: #./resources/*
mkdir -p ${TARGET_DIR}/resources/
cp ${RESOURCES} ${TARGET_DIR}/resources/

# rule to build a rst file from a notebook
%.rst: %.ipynb
jupyter nbconvert --output-dir ${TARGET_DIR} --to rst $<
27 changes: 27 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Examples

## file names

To facilitate automatic sorting in the documentation, a file naming
convention is set forth for the examples. The convention is to prefix
the file names.

prefix | type of example
------ | -------
``geo_`` | diffractometer geometry example
``var_`` | variation on a geometry
``tst_`` | tests and comparisons

## notebook views
The examples can be viewed directly as notebooks in most web
browsers. If an example fails to load properly, try using this
convenient web tool to view:

TODO: Change these links to `main` branch after PR #52 is merged.

* https://nbviewer.jupyter.org/github/bluesky/hklpy/blob/24-examples/examples/geo_e4cv.ipynb
* https://nbviewer.jupyter.org/github/bluesky/hklpy/blob/24-examples/examples/geo_e6c.ipynb
* https://nbviewer.jupyter.org/github/bluesky/hklpy/blob/24-examples/examples/geo_k4cv.ipynb
* https://nbviewer.jupyter.org/github/bluesky/hklpy/blob/24-examples/examples/tst_e4cv_fourc.ipynb
* https://nbviewer.jupyter.org/github/bluesky/hklpy/blob/24-examples/examples/tst_e6c_test_calculations.ipynb
* https://nbviewer.jupyter.org/github/bluesky/hklpy/blob/24-examples/examples/var_e4cv_renamed_axes.ipynb
prjemian marked this conversation as resolved.
Show resolved Hide resolved
Loading