Skip to content

Commit

Permalink
Merge pull request #57 from bandframework/main
Browse files Browse the repository at this point in the history
Merging recent changes into joss-submission branch
  • Loading branch information
asemposki authored Feb 2, 2024
2 parents 85e4782 + bf136da commit a1014c8
Show file tree
Hide file tree
Showing 17 changed files with 682 additions and 607 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Dananjaya Liyanage
Copyright (c) 2022 Dananjaya Liyanage, Alexandra Semposki, John Yannotty, Kevin Ingles

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
35 changes: 29 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ See Taweret's docs webpage [here](https://bandframework.github.io/Taweret/).
This repository uses submodules.
To clone this repository and automatically checkout all the submodules, use
```terminal
git clone --recursive https://github.com/TaweretOrg/Taweret.git
git clone --recursive https://github.com/bandframework/Taweret.git
```

If you want to limit the size of the repository (this or the submodules), you can use the `depth` flag
```terminal
git clone --depth=1 https://github.com/TaweretOrg/Taweret.git
git clone --depth=1 https://github.com/bandframework/Taweret.git
```
Inside the directory containing the cloned repository, you then run
```terminal
Expand Down Expand Up @@ -67,7 +67,7 @@ Python dependencies are listed in the requirements.txt file. Taweret also depend

```
$ cd /location/of/downloaded/.deb
$ dpkg -i openbt_mixing0.current_amd64-MPI_Ubuntu_20.04.deb
$ sudo dpkg -i openbt_mixing0.current_amd64-MPI_Ubuntu_20.04.deb
$ ldconfig
```

Expand Down Expand Up @@ -106,13 +106,36 @@ Rather than installing the pre-built packages, one can also download the code fr
and compile the C++ code locally. Then the trees module can be used by specifiying the location of the local openbt repository when
initializing the trees class instance.

## Citing Taweret
If you have benefited from Taweret, please cite our software using the following format:

```
@inproceedings{Taweret,
author = "Liyanage, Dan and Semposki, Alexandra and Yannotty, John and Ingles, Kevin",
title = "{{Taweret: A Python Package for Bayesian Model Mixing}}",
year = "2023",
url = {https://github.com/bandframework/Taweret}
}
```

and our explanatory paper:

```
@article{Ingles:2023nha,
author = "Ingles, Kevin and Liyanage, Dananjaya and Semposki, Alexandra C. and Yannotty, John C.",
title = "{Taweret: a Python package for Bayesian model mixing}",
eprint = "2310.20549",
archivePrefix = "arXiv",
primaryClass = "nucl-th",
month = "10",
year = "2023"
}
```

## Citing BAND software
If you have benefited from Taweret, please cite the BAND collaboration software suite using the format [here](https://github.com/bandframework/bandframework#citing-the-band-framework).
Please also cite the BAND collaboration software suite using the format [here](https://github.com/bandframework/bandframework#citing-the-band-framework).

## BAND SDK compliance
Check out our SDK form [here](https://github.com/TaweretOrg/Taweret/blob/main/Taweretbandsdk.md).
Check out our SDK form [here](https://github.com/bandframework/Taweret/blob/main/Taweretbandsdk.md).

## Contact
To contact the Taweret team, please submit an issue through the Issues page.
Expand Down
13 changes: 11 additions & 2 deletions Taweret/mix/bivariate_linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ def train(self,
object returned by the bilby sampler
'''
import platform
i

if platform.system() == 'Darwin':
if 'threads' in kwargs_for_sampler.keys(
) and kwargs_for_sampler['threads'] > 1:
Expand All @@ -635,11 +635,20 @@ def train(self,
warnings.warn("'threads' detected in `kwargs` on Darwin." +
" Setting `start_method` fot `fork`")
multiprocessing.set_start_method('fork')

prior = self._prior
if prior is None:
raise Exception("Please define the priors before training")

if platform.system() == "Darwin":
if "threads" in kwargs_for_sampler.keys(
) and kwargs_for_sampler['threads'] > 1:
import warnings
import multiprocessing
warnings.warn("'threads' dectected in 'kwargs_for_sampler'" +
" on Darwin. Setting `start_method` to `fork`")
multiprocessing.set_start_method('fork')

# A few simple setup steps
likelihood = likelihood_wrapper_for_bilby(self, x_exp, y_exp, y_err)

Expand Down
6 changes: 3 additions & 3 deletions docs/source/how_to_add_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ With conda:
conda env create --file=environment.yml
conda activate test_env
With virtualenv:
With venv:

.. code:: bash
virtualenv test_env
python3 -m venv test_env
source test_env/bin/activate
Expand Down Expand Up @@ -69,6 +69,6 @@ the below set of instructions.
git push origin develop
Then make a pull request from your forked repository to
the ``danOSU/Taweret`` repository, ``develop`` branch.
the ``bandframework/Taweret`` repository, ``develop`` branch.
**Note** : You do not have to add or commit anything in
the ``Taweret/docs/build`` folder.
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Welcome to Bayesian Model Mixing with Taweret!
:caption: Installation:

installation
macos_users
macos_user

.. toctree::
:maxdepth: 4
Expand Down
26 changes: 17 additions & 9 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@ Installation
============

Taweret requires the following for for basic functionality.
- python
- numpy
- python (>3.7)
- matplotlib
- numpy (>=1.20.3)
- scipy (>=1.7.0)
- seaborn
- jupyter
- emcee
- corner
- scikit-learn
- cycler
- statistics
- bilby
- jupyter
- ptemcee
- pytest

Follow these steps to install Taweret from github.

.. code-block:: bash
git clone https://github.com/danOSU/Taweret.git
git clone https://github.com/bandframework/Taweret.git
#If you want to use SMABA toy models please clone samba repo
#git clone https://github.com/asemposki/SAMBA.git
cd Taweret
Expand All @@ -27,9 +35,9 @@ you need to add a new mixing method please refer to the **For Developers** secti

The pip installation is not available yet.

.. code-block:: bash
pip install Taweret
.. .. code-block:: bash
..
.. pip install Taweret
Expand Down Expand Up @@ -62,7 +70,7 @@ please follow the steps below based on the operating system of choice.
.. code-block:: bash
$ cd /location/of/downloaded/.deb
$ dpkg -i openbt_mixing0.current_amd64-MPI_Ubuntu_20.04.deb
$ sudo dpkg -i openbt_mixing0.current_amd64-MPI_Ubuntu_20.04.deb
$ ldconfig
Expand Down Expand Up @@ -92,7 +100,7 @@ installed the WSL Ubuntu layer, start the WSL Ubuntu shell from the start menu a
.. code-block:: bash
$ cd /mnt/c/location/of/downloaded/.deb
$ dpkg -i openbt_mixing0.current_amd64-MPI_Ubuntu_20.04.deb
$ sudo dpkg -i openbt_mixing0.current_amd64-MPI_Ubuntu_20.04.deb
**Alternative:**
Expand Down
14 changes: 14 additions & 0 deletions docs/source/macos_user.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
MacOS Users
===========

To run the `bilby` examples using the `ptemcee` module, you will need \
to run the following commands at the beginning of your notebook

.. code-block:: python
import multiprocessing
multiprocessing.set_start_method('fork')
There is currently an `issue <https://git.ligo.org/lscsoft/bilby/-/issues/722>`_ open on the `bilby` \
repository that will address this automatically in the future. \
For now, you will receive a warning whenever you use `ptemcee` with more than one `thread`, even if you have set the start method.
We will remove this warning once `bilby` patches their bug.
1 change: 1 addition & 0 deletions docs/source/notebooks/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
outdir/
2 changes: 1 addition & 1 deletion docs/source/notebooks/Bivariate_Test.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.11"
"version": "3.11.5"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Linear Bivariate BMM with SAMBA toy models : cdf mixing\n",
"\n",
"The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook [here.](https://mybinder.org/v2/gh/danOSU/Taweret/c2d8fd3ce3d74a5891d51adb5afc0afa0b503127?urlpath=lab%2Ftree%2Fdocs%2Fsource%2Fnotebooks%2FLinear_BMM_with_cdf_function_for_SAMBA_models.ipynb)\n"
"The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook on [GitHub Codespaces](https://github.com/bandframework/Taweret)."
]
},
{
Expand Down Expand Up @@ -38,13 +38,6 @@
"# You will have to change the following imports depending on where you have \n",
"# the packages installed\n",
"\n",
"# If using binder please uncomment the followings.\n",
"#sys.path.append(\"/home/jovyan/\")\n",
"#sys.path.append(\"/home/jovyan/subpackages/SAMBA\")\n",
"\n",
"#sys.path.append(\"/Users/dananjayaliyanage/temp2/Taweret\")\n",
"#sys.path.append(\"/Users/dananjayaliyanage/temp2/Taweret/subpackages/SAMBA\")\n",
"\n",
"cwd = os.getcwd()\n",
"\n",
"# Get the first part of this path and append to the sys.path\n",
Expand Down Expand Up @@ -131,7 +124,6 @@
}
],
"source": [
"\n",
"fig, ax_f = plt.subplots(figsize=(10,10))\n",
"ax_f.plot(plot_g, m1_prediction[0].flatten(), label='low order')\n",
"ax_f.plot(plot_g, m2_prediction[0].flatten(), label='high order')\n",
Expand Down Expand Up @@ -429,7 +421,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.11.5"
},
"vscode": {
"interpreter": {
Expand Down
1,094 changes: 587 additions & 507 deletions docs/source/notebooks/Linear_BMM_with_cdf_function_for_coleman_models.ipynb

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
"source": [
"# Linear Bivariate BMM with SAMBA toy models : step mixing\n",
"\n",
"The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook [here.](https://mybinder.org/v2/gh/danOSU/Taweret/c2d8fd3ce3d74a5891d51adb5afc0afa0b503127?urlpath=lab%2Ftree%2Fdocs%2Fsource%2Fnotebooks%2FLinear_BMM_with_step_function_for_SAMBA_models.ipynb)\n",
"\n"
"The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook [on GitHub Codespaces](https://github.com/bandframework/Taweret)."
]
},
{
Expand Down Expand Up @@ -38,12 +37,6 @@
"\n",
"# You will have to change the following imports depending on where you have \n",
"# the packages installed\n",
"# If using binder please uncomment the followings.\n",
"#sys.path.append(\"/home/jovyan/\")\n",
"#sys.path.append(\"/home/jovyan/subpackages/SAMBA\")\n",
"\n",
"#sys.path.append(\"/Users/dananjayaliyanage/temp2/Taweret\")\n",
"#sys.path.append(\"/Users/dananjayaliyanage/temp2/Taweret/subpackages/SAMBA\")\n",
"\n",
"cwd = os.getcwd()\n",
"\n",
Expand Down Expand Up @@ -245,13 +238,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"15:29 bilby INFO : Running for label 'step_mix', output will be saved to 'outdir/samba_bivaraite'\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"15:29 bilby INFO : Running for label 'step_mix', output will be saved to 'outdir/samba_bivaraite'\n",
"15:29 bilby INFO : Search parameters:\n",
"15:29 bilby INFO : step_0 = Uniform(minimum=0, maximum=1, name='step_0', latex_label='step_0', unit=None, boundary=None)\n"
]
Expand Down Expand Up @@ -906,7 +893,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.16"
"version": "3.11.5"
},
"vscode": {
"interpreter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Linear Bivariate BMM with SAMBA toy models : switchcos mixing\n",
"\n",
"The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook [here.](https://mybinder.org/v2/gh/danOSU/Taweret/c2d8fd3ce3d74a5891d51adb5afc0afa0b503127?urlpath=lab%2Ftree%2Fdocs%2Fsource%2Fnotebooks%2FLinear_BMM_with_switchcos_function_for_SAMBA_models.ipynb)\n"
"The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook [GitHub Codespaces](https://github.com/bandframework/Taweret)."
]
},
{
Expand Down Expand Up @@ -50,12 +50,6 @@
"\n",
"# You will have to change the following imports depending on where you have \n",
"# the packages installed\n",
"# If using binder please uncomment the followings.\n",
"#sys.path.append(\"/home/jovyan/\")\n",
"#sys.path.append(\"/home/jovyan/subpackages/SAMBA\")\n",
"\n",
"#sys.path.append(\"/Users/dananjayaliyanage/temp2/Taweret\")\n",
"#sys.path.append(\"/Users/dananjayaliyanage/temp2/Taweret/subpackages/SAMBA\")\n",
"\n",
"cwd = os.getcwd()\n",
"\n",
Expand Down Expand Up @@ -923,7 +917,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.16"
"version": "3.11.5"
},
"vscode": {
"interpreter": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"source": [
"# Linear Bivariate BMM with SAMBA toy models : switchcos mixing - bilby constrained priors\n",
"\n",
"The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook [here.](https://mybinder.org/v2/gh/danOSU/Taweret/c2d8fd3ce3d74a5891d51adb5afc0afa0b503127?urlpath=lab%2Ftree%2Fdocs%2Fsource%2Fnotebooks%2FLinear_BMM_with_switchcos_function_for_SAMBA_models_Bilby_constrained_prior.ipynb)\n"
"The best way to learn Taweret is to use it. You can run, modify and experiment with this notebook on [GitHub Codespaces](https://github.com/bandframework/Taweret)."
]
},
{
Expand Down Expand Up @@ -50,12 +50,6 @@
"\n",
"# You will have to change the following imports depending on where you have \n",
"# the packages installed\n",
"# If using binder please uncomment the followings.\n",
"#sys.path.append(\"/home/jovyan/\")\n",
"#sys.path.append(\"/home/jovyan/subpackages/SAMBA\")\n",
"\n",
"#sys.path.append(\"/Users/dananjayaliyanage/temp2/Taweret\")\n",
"#sys.path.append(\"/Users/dananjayaliyanage/temp2/Taweret/subpackages/SAMBA\")\n",
"\n",
"cwd = os.getcwd()\n",
"\n",
Expand Down Expand Up @@ -954,7 +948,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.16"
"version": "3.11.5"
},
"vscode": {
"interpreter": {
Expand Down
Loading

0 comments on commit a1014c8

Please sign in to comment.