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

Fix images titles and arrangements in docs #85

Merged
merged 4 commits into from
Jan 16, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <ins>Bi</ins>o <ins>R</ins>eactor <ins>D</ins>esign (BiRD) Toolbox [![bird-CI](https://github.com/NREL/BioReactorDesign/actions/workflows/ci.yml/badge.svg)](https://github.com/NREL/BioReactorDesign/actions/workflows/ci.yml) [![bird-pyversion](https://img.shields.io/pypi/pyversions/NREL-bird.svg)](https://pypi.org/project/NREL-bird/) [![bird-pypi](https://badge.fury.io/py/nrel-bird.svg)](https://badge.fury.io/py/nrel-bird)
# <ins>Bi</ins>o <ins>R</ins>eactor <ins>D</ins>esign (BiRD) [![bird-CI](https://github.com/NREL/BioReactorDesign/actions/workflows/ci.yml/badge.svg)](https://github.com/NREL/BioReactorDesign/actions/workflows/ci.yml) [![bird-pyversion](https://img.shields.io/pypi/pyversions/NREL-bird.svg)](https://pypi.org/project/NREL-bird/) [![bird-pypi](https://badge.fury.io/py/nrel-bird.svg)](https://badge.fury.io/py/nrel-bird)

## Quick start
1. Follow the steps to install the python package (see `Installation of python package for developers` or `Installation of python package for users` below)
Expand Down
Binary file modified docs/assets/calibration/tutorial_bsd/Surr_cal_binary_prop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/calibration/tutorial_bsd/Surr_cal_ternary_prop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/calibration/tutorial_bsd/Surr_opt_binary_prop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/assets/calibration/tutorial_bsd/Surr_opt_ternary_prop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
133 changes: 58 additions & 75 deletions docs/source/calibration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The following plots should be generated. The first one shows the training and te
.. container:: figures-surr-train

.. figure:: ../assets/calibration/tutorial_normal_beta/Loss_surr.png
:width: 30%
:width: 50%
:align: center
:alt: Loss history

Expand All @@ -67,18 +67,16 @@ Calibrate without a surrogate for ``alpha=5, beta=5``
python tut_calibration.py --alpha 5 --beta 5


.. container:: figures-cal-True-5-5

.. figure:: ../assets/calibration/tutorial_normal_beta/True_opt_5.0_5.0_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the true forward model
|figures-cal-True-5-5-prop| |figures-cal-True-5-5-corn|

.. figure:: ../assets/calibration/tutorial_normal_beta/True_opt_5.0_5.0_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the true forward model
.. |figures-cal-True-5-5-prop| image:: ../assets/calibration/tutorial_normal_beta/True_opt_5.0_5.0_prop.png
:width: 49.5%
:alt: Calibrated prediction with the true forward model

.. |figures-cal-True-5-5-corn| image:: ../assets/calibration/tutorial_normal_beta/True_opt_5.0_5.0_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the true forward model

Calibrate with a surrogate for ``alpha=5, beta=5``

Expand All @@ -87,18 +85,15 @@ Calibrate with a surrogate for ``alpha=5, beta=5``
python tut_calibration.py -useNN --alpha 5 --beta 5


|figures-cal-Surr-5-5-prop| |figures-cal-Surr-5-5-corn|

.. container:: figures-cal-Surr-5-5
.. |figures-cal-Surr-5-5-prop| image:: ../assets/calibration/tutorial_normal_beta/Surr_opt_5.0_5.0_prop.png
:width: 49.5%
:alt: Calibrated prediction with the surrogate forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/Surr_opt_5.0_5.0_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the surrogate forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/Surr_opt_5.0_5.0_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the surrogate forward model
.. |figures-cal-Surr-5-5-corn| image:: ../assets/calibration/tutorial_normal_beta/Surr_opt_5.0_5.0_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the surrogate forward model


Calibrate without a surrogate for ``alpha=2, beta=5``
Expand All @@ -109,17 +104,15 @@ Calibrate without a surrogate for ``alpha=2, beta=5``
python tut_calibration.py --alpha 2 --beta 5


.. container:: figures-cal-True-2-5
|figures-cal-True-2-5-prop| |figures-cal-True-2-5-corn|

.. figure:: ../assets/calibration/tutorial_normal_beta/True_opt_2.0_5.0_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the true forward model
.. |figures-cal-True-2-5-prop| image:: ../assets/calibration/tutorial_normal_beta/True_opt_2.0_5.0_prop.png
:width: 49.5%
:alt: Calibrated prediction with the true forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/True_opt_2.0_5.0_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the true forward model
.. |figures-cal-True-2-5-corn| image:: ../assets/calibration/tutorial_normal_beta/True_opt_2.0_5.0_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the true forward model


Calibrate with a surrogate for ``alpha=2, beta=5``
Expand All @@ -130,17 +123,15 @@ Calibrate with a surrogate for ``alpha=2, beta=5``



.. container:: figures-cal-True-2-5
|figures-cal-Surr-2-5-prop| |figures-cal-Surr-2-5-corn|

.. figure:: ../assets/calibration/tutorial_normal_beta/Surr_opt_2.0_5.0_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the surrogate forward model
.. |figures-cal-Surr-2-5-prop| image:: ../assets/calibration/tutorial_normal_beta/Surr_opt_2.0_5.0_prop.png
:width: 49.5%
:alt: Calibrated prediction with the surrogate forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/Surr_opt_2.0_5.0_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the surrogate forward model
.. |figures-cal-Surr-2-5-corn| image:: ../assets/calibration/tutorial_normal_beta/Surr_opt_2.0_5.0_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the surrogate forward model


Clearly, the amount of missing physics vary depending on the observations.
Expand All @@ -160,17 +151,15 @@ Calibrate without a surrogate for ``alpha=5, beta=5``
python tut_calibration.py --alpha 5 --beta 5 -cal_err


.. container:: figures-cal-calerr-True-5-5
|figures-cal-calerr-True-5-5-prop| |figures-cal-calerr-True-5-5-corn|

.. figure:: ../assets/calibration/tutorial_normal_beta/True_cal_5.0_5.0_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the true forward model
.. |figures-cal-calerr-True-5-5-prop| image:: ../assets/calibration/tutorial_normal_beta/True_cal_5.0_5.0_prop.png
:width: 49.5%
:alt: Calibrated prediction with the true forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/True_cal_5.0_5.0_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the true forward model
.. |figures-cal-calerr-True-5-5-corn| image:: ../assets/calibration/tutorial_normal_beta/True_cal_5.0_5.0_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the true forward model


Calibrate with a surrogate for ``alpha=5, beta=5``
Expand All @@ -180,18 +169,15 @@ Calibrate with a surrogate for ``alpha=5, beta=5``
python tut_calibration.py -useNN --alpha 5 --beta 5 -cal_err


|figures-cal-calerr-Surr-5-5-prop| |figures-cal-calerr-Surr-5-5-corn|

.. container:: figures-cal-calerr-Surr-5-5
.. |figures-cal-calerr-Surr-5-5-prop| image:: ../assets/calibration/tutorial_normal_beta/Surr_cal_5.0_5.0_prop.png
:width: 49.5%
:alt: Calibrated prediction with the surrogate forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/Surr_cal_5.0_5.0_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the surrogate forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/Surr_cal_5.0_5.0_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the surrogate forward model
.. |figures-cal-calerr-Surr-5-5-corn| image:: ../assets/calibration/tutorial_normal_beta/Surr_cal_5.0_5.0_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the surrogate forward model


Calibrate without a surrogate for ``alpha=2, beta=5``
Expand All @@ -202,17 +188,15 @@ Calibrate without a surrogate for ``alpha=2, beta=5``
python tut_calibration.py --alpha 2 --beta 5 -cal_err


.. container:: figures-cal-calerr-True-2-5
|figures-cal-calerr-True-2-5-prop| |figures-cal-calerr-True-2-5-corn|

.. figure:: ../assets/calibration/tutorial_normal_beta/True_cal_2.0_5.0_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the true forward model
.. |figures-cal-calerr-True-2-5-prop| image:: ../assets/calibration/tutorial_normal_beta/True_cal_2.0_5.0_prop.png
:width: 49.5%
:alt: Calibrated prediction with the true forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/True_cal_2.0_5.0_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the true forward model
.. |figures-cal-calerr-True-2-5-corn| image:: ../assets/calibration/tutorial_normal_beta/True_cal_2.0_5.0_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the true forward model


Calibrate with a surrogate for ``alpha=2, beta=5``
Expand All @@ -223,17 +207,16 @@ Calibrate with a surrogate for ``alpha=2, beta=5``



.. container:: figures-cal-calerr-True-2-5
|figures-cal-calerr-Surr-2-5-prop| |figures-cal-calerr-Surr-2-5-corn|

.. figure:: ../assets/calibration/tutorial_normal_beta/Surr_cal_2.0_5.0_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the surrogate forward model
.. |figures-cal-calerr-Surr-2-5-prop| image:: ../assets/calibration/tutorial_normal_beta/Surr_cal_2.0_5.0_prop.png
:width: 49.5%
:alt: Calibrated prediction with the surrogate forward model

.. |figures-cal-calerr-Surr-2-5-corn| image:: ../assets/calibration/tutorial_normal_beta/Surr_cal_2.0_5.0_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the surrogate forward model

.. figure:: ../assets/calibration/tutorial_normal_beta/Surr_cal_2.0_5.0_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the surrogate forward model



Expand Down
100 changes: 45 additions & 55 deletions docs/source/calibration_bsd.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,33 +94,28 @@ The plot below shows the values of `Bf` and `Cr` simulated and whether they lead

We can also look at how close the generated data is to the target data. For the ternary breakup and coalescence, there is clearly a discrepancy that is not resolvable by adjusting the coalescence and breakup rates.

|figures-viz-pred-ter_bf| |figures-viz-pred-ter_cr|

.. container:: figures-viz-pred-ter
.. |figures-viz-pred-ter_bf| image:: ../assets/calibration/tutorial_bsd/cmap_bf_ternary.png
:width: 49.5%
:alt: Predicted data with the binary breakup and coalescence colored by Bf against the ternary target data

.. figure:: ../assets/calibration/tutorial_bsd/cmap_bf_ternary.png
:width: 50%
:align: center
:alt: Predicted data with the binary breakup and coalescence colored by Bf against the ternary target data

.. figure:: ../assets/calibration/tutorial_bsd/cmap_cr_ternary.png
:width: 50%
:align: center
:alt: Predicted data with the binary breakup and coalescence colored by Cr against the ternary target data
.. |figures-viz-pred-ter_cr| image:: ../assets/calibration/tutorial_bsd/cmap_cr_ternary.png
:width: 49.5%
:alt: Predicted data with the binary breakup and coalescence colored by Cr against the ternary target data


In the case of the binary breakup and coalescence target data, a low value of `Bf` and a high value of `Cr` should lead to a good agreement between the forward model and the target data.

.. container:: figures-viz-pred-bin
|figures-viz-pred-bin_bf| |figures-viz-pred-bin_cr|

.. figure:: ../assets/calibration/tutorial_bsd/cmap_bf_binary.png
:width: 50%
:align: center
:alt: Predicted data with the binary breakup and coalescence colored by Bf against the binary target data
.. |figures-viz-pred-bin_bf| image:: ../assets/calibration/tutorial_bsd/cmap_bf_binary.png
:width: 49.5%
:alt: Predicted data with the binary breakup and coalescence colored by Bf against the binary target data

.. figure:: ../assets/calibration/tutorial_bsd/cmap_cr_binary.png
:width: 50%
:align: center
:alt: Predicted data with the binary breakup and coalescence colored by Cr against the binary target data
.. |figures-viz-pred-bin_cr| image:: ../assets/calibration/tutorial_bsd/cmap_cr_binary.png
:width: 49.5%
:alt: Predicted data with the binary breakup and coalescence colored by Cr against the binary target data


Train a neural net surrogate
Expand Down Expand Up @@ -152,18 +147,17 @@ Calibrate against the target data obtained with ternary breakup and coalescence
python tut_calibration.py -ter


.. container:: figures-cal-tern

.. figure:: ../assets/calibration/tutorial_bsd/Surr_opt_ternary_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the surrogate forward model against ternary target data
|figures-cal-tern-prop| |figures-cal-tern-corn|

.. figure:: ../assets/calibration/tutorial_bsd/Surr_opt_ternary_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the surrogate forward model with ternary target data
.. |figures-cal-tern-prop| image:: ../assets/calibration/tutorial_bsd/Surr_opt_ternary_prop.png
:width: 49.5%
:alt: Calibrated prediction with the surrogate forward model against ternary target data

.. |figures-cal-tern-corn| image:: ../assets/calibration/tutorial_bsd/Surr_opt_ternary_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the surrogate forward model with ternary target data
.. container:: figures-cal-tern


Calibrate against the target data obtained with binary breakup and coalescence
Expand All @@ -172,17 +166,15 @@ Calibrate against the target data obtained with binary breakup and coalescence

python tut_calibration.py

.. container:: figures-cal-bin
|figures-cal-bin-prop| |figures-cal-bin-corn|

.. figure:: ../assets/calibration/tutorial_bsd/Surr_opt_binary_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the surrogate forward model against binary target data
.. |figures-cal-bin-prop| image:: ../assets/calibration/tutorial_bsd/Surr_opt_binary_prop.png
:width: 49.5%
:alt: Calibrated prediction with the surrogate forward model against binary target data

.. figure:: ../assets/calibration/tutorial_bsd/Surr_opt_binary_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the surrogate forward model with binary target data
.. |figures-cal-bin-corn| image:: ../assets/calibration/tutorial_bsd/Surr_opt_binary_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the surrogate forward model with binary target data


Clearly, the amount of missing physics vary depending on the observations and is significantly lower when calibrating against binary breakup and coalescence data.
Expand All @@ -199,17 +191,17 @@ Calibrate against the target data obtained with ternary breakup and coalescence

python tut_calibration.py -ter -cal_err

.. container:: figures-cal-tern-calerr
|figures-cal-tern-calerr-prop| |figures-cal-tern-calerr-corn|

.. |figures-cal-tern-calerr-prop| image:: ../assets/calibration/tutorial_bsd/Surr_cal_ternary_prop.png
:width: 49.5%
:alt: Calibrated prediction with the surrogate forward model against ternary target data

.. |figures-cal-tern-calerr-corn| image:: ../assets/calibration/tutorial_bsd/Surr_cal_ternary_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the surrogate forward model with ternary target data

.. figure:: ../assets/calibration/tutorial_bsd/Surr_cal_ternary_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the surrogate forward model against ternary target data

.. figure:: ../assets/calibration/tutorial_bsd/Surr_cal_ternary_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the surrogate forward model with ternary target data

Calibrate against the target data obtained with binary breakup and coalescence

Expand All @@ -218,18 +210,16 @@ Calibrate against the target data obtained with binary breakup and coalescence

python tut_calibration.py -cal_err

.. container:: figures-cal-bin-calerr

.. figure:: ../assets/calibration/tutorial_bsd/Surr_cal_binary_prop.png
:width: 50%
:align: center
:alt: Calibrated prediction with the surrogate forward model against binary target data
|figures-cal-bin-calerr-prop| |figures-cal-bin-calerr-corn|

.. figure:: ../assets/calibration/tutorial_bsd/Surr_cal_binary_corner.png
:width: 50%
:align: center
:alt: Parameter PDF obtained with the surrogate forward model with binary target data
.. |figures-cal-bin-calerr-prop| image:: ../assets/calibration/tutorial_bsd/Surr_cal_binary_prop.png
:width: 49.5%
:alt: Calibrated prediction with the surrogate forward model against binary target data

.. |figures-cal-bin-calerr-corn| image:: ../assets/calibration/tutorial_bsd/Surr_cal_binary_corner.png
:width: 49.5%
:alt: Parameter PDF obtained with the surrogate forward model with binary target data



Expand Down
2 changes: 1 addition & 1 deletion docs/source/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Tutorials
:maxdepth: 3
:caption: Tutorials contents:

bubbleColumn.rst
calibration.rst
calibration_bsd.rst
bubbleColumn.rst
4 changes: 3 additions & 1 deletion tutorial_cases/calibration/bsd/post_cal.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def post_process_cal(
label="95% Model confidence interval",
)
plt.plot(rangex, std2_5_real, "--", color="k", linewidth=3)
pretty_labels("", "", 20, title=f"Missing phys. unc. = {sigma:.2g}")
pretty_labels(
"", "", 20, title=f"Noise + missing phys. unc. = {sigma:.2g}"
)
filename = ""
filename += "Surr"
if args.cal_err:
Expand Down
Loading