Skip to content

Commit

Permalink
add cross-links to doc notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesBuchner committed May 28, 2024
1 parent 49ecc4d commit 531cd91
Showing 4 changed files with 25 additions and 73 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -81,7 +81,7 @@ docs: ## generate Sphinx HTML documentation, including API docs
cp -vu examples/xspec/reference-output/*.png doc/
sphinx-apidoc -H API -o doc/ bxa
$(MAKE) -C doc clean
PYTHONPATH=${PWD}:${PWD}/examples/xspec/bayesian-workflow/:${PWD}/npyinterp:${PYTHONPATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/npyinterp $(MAKE) MAKESPHINXDOC=1 -C doc html
PYTHONPATH=${PWD}:${PWD}/examples/xspec/bayesian-workflow/:${PWD}/npyinterp:${PYTHONPATH} LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${PWD}/npyinterp $(MAKE) MAKESPHINXDOC=1 -C doc update-gh-pages
$(BROWSER) doc/build/html/index.html

servedocs: docs ## compile the docs watching for changes
2 changes: 2 additions & 0 deletions doc/Makefile
Original file line number Diff line number Diff line change
@@ -23,6 +23,8 @@ reset-gh-pages:
update-gh-pages:
rm -rf build/html/.buildinfo build/html/*
$(MAKE) html
touch build/html/.nojekyll
git worktree repair
git -C build/html add .
git -C build/html commit -av -m 'update doc'

Original file line number Diff line number Diff line change
@@ -7,13 +7,13 @@
"source": [
"# PlotBXA example \n",
"\n",
"## Basic BXA usage & additional plotting\n",
"## Basic BXA usage with Xspec & additional plotting\n",
"\n",
"This notebook aims to illustrate additional plotting features for BXA fitting results, as implemented in the PlotBXA class. The methods of this class will be demonstrated in a basic example of BXA fitting. For details on BXA usage and the underlying fitting algorithm please see refer to Johannes Buchner's detailed [BXA documentation](https://johannesbuchner.github.io/BXA/index.html) and [UltraNest documentation](https://johannesbuchner.github.io/UltraNest/readme.html), which also contain several useful examples. \n",
"\n",
"An overview of tutorials on BXA usage can be found [here](https://johannesbuchner.github.io/BXA/tutorials.html). The methods in PlotBXA are extensions of the built-in methods of UltraNest and BXA. Furthermore, they are strongly based on the [excellent tutorial](https://peterboorman.com/tutorial_bxa) by Peter Boorman. As for the classes defined in PlotXspec, some users may find it more helpful to use these methods as a template for their own plotting.\n",
"\n",
"_Please note_: this notebook relates to BXA, for examples of PyXspec and the PlotXspec class, please see the notebook _tutorial_usage_plotxspec_. The notebooks both fit the same datasets, but with different methodologies.\n",
"_Please note_: this notebook relates to BXA, for examples of PyXspec and the PlotXspec class, please see the notebook [_tutorial_usage_plotxspec_](https://johannesbuchner.github.io/BXA/tutorial_usage_plotxspec.html). The notebooks both fit the same datasets, but with different methodologies.\n",
"\n",
"\n",
"#### This notebook is structured as follows\n",
@@ -214,9 +214,7 @@
"cell_type": "code",
"execution_count": null,
"id": "bb435d3a",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# What are the spectral shapes that can be covered based on our specified priors?\n",
@@ -296,9 +294,7 @@
"cell_type": "code",
"execution_count": null,
"id": "12428f7c",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"pbx.plot_overview_posteriors(solver,convert_log=True)"
@@ -308,9 +304,7 @@
"cell_type": "code",
"execution_count": null,
"id": "88f68c1a",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# And what is the posterior distribution of the flux?\n",
@@ -356,9 +350,7 @@
"cell_type": "code",
"execution_count": null,
"id": "6a205741",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"with XSilence():\n",
@@ -748,9 +740,7 @@
"cell_type": "code",
"execution_count": null,
"id": "69688cff",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# the fluxes\n",
@@ -1386,7 +1376,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -1400,7 +1390,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.12.3"
}
},
"nbformat": 4,
Original file line number Diff line number Diff line change
@@ -1,27 +1,19 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "99a6b73c",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"id": "7a454ff3",
"metadata": {},
"source": [
"# PlotXspec Example\n",
"# PlotXspec example\n",
"\n",
"## Basic PyXspec usage & additional plotting\n",
"\n",
"This notebook is aimed at illustrating the _basic_ usage of PyXspec, as well as a few supporting methods related to plotting. The supporing methods are part of the PlotXspec class. The notebook will cover how to load spectra, define a define a model and fit it to the data, and how to plot the results. PyXspec makes all Xspec functionality accessible through Python, so covers a much broader range of options than covered here. For further details on PyXspec usage, please see the [documentation](https://heasarc.gsfc.nasa.gov/xanadu/xspec/python/html/index.html).\n",
"This notebook is aimed at illustrating the _basic_ usage of PyXspec, as well as a few supporting methods related to plotting. The supporting methods are part of the [PlotXspec class available for download here](https://github.com/JohannesBuchner/BXA/tree/master/examples/xspec/bayesian-workflow). The notebook will cover how to load spectra, define a model, fit it to the data, and plot the results. PyXspec makes all Xspec functionality accessible through Python, so has a much broader range of options than covered here. For further details on PyXspec usage, please see the [documentation](https://heasarc.gsfc.nasa.gov/xanadu/xspec/python/html/index.html).\n",
"\n",
"In the following, we will assume a basic familiarity with both Python and Xspec usage. Users will need to have a working HEASOFT installation, as well as a working Python3 installation. The examples focus on the 'out-of-the-box' usage of the PlotXSpec public methods. Some users may find it more helpful to use these methods as a template for their own plotting functions; the PlotXspec class includes several private methods that could also be of use as a guide (such as the ```_get_xspec_data()``` method).\n",
"\n",
"_Please note_: this notebook relates to PyXspec only, for examples of using BXA and the PlotBXA class, please see the notebook _tutorial_usage_plotbxa_. \n",
"_Please note_: this notebook relates to PyXspec only. For examples of using BXA and the PlotBXA class, please see the notebook [_tutorial_usage_plotbxa_](https://johannesbuchner.github.io/BXA/tutorial_usage_plotbxa.html). \n",
"\n",
"#### The notebook is structured as follows:\n",
"1) Basic loading and plotting data using PyXspec\n",
@@ -116,9 +108,7 @@
"cell_type": "code",
"execution_count": null,
"id": "5d99a2eb",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# Load the data\n",
@@ -219,9 +209,7 @@
"cell_type": "code",
"execution_count": null,
"id": "efa55c61",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# A first look at the data\n",
@@ -343,9 +331,7 @@
"cell_type": "code",
"execution_count": null,
"id": "824b245d",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# And we can look at the resulting fit\n",
@@ -356,9 +342,7 @@
"cell_type": "code",
"execution_count": null,
"id": "23e1d4d4",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# If we, e.g., would like to look at the unfolded spectrum,\n",
@@ -430,9 +414,7 @@
"cell_type": "code",
"execution_count": null,
"id": "5b4d4706",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# run steppar and plot. Here we vary parameters 1 (nH) and 2 (Gamma)\n",
@@ -588,9 +570,7 @@
"cell_type": "code",
"execution_count": null,
"id": "0e0f5c76",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# Silence XSpec for the moment...\n",
@@ -663,9 +643,7 @@
"cell_type": "code",
"execution_count": null,
"id": "e118dcd5",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# A quick overview of the fit results\n",
@@ -676,35 +654,17 @@
"cell_type": "code",
"execution_count": null,
"id": "9564e70e",
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"# ... and of the errors\n",
"px.print_errors(1.0)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "dae547df",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "08ca6670",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
@@ -718,7 +678,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.12.3"
}
},
"nbformat": 4,

0 comments on commit 531cd91

Please sign in to comment.