Metadata-Version: 2.4
Name: dayabay-model
Version: 1.6.0
Summary: Model of the Daya Bay reactor antineutrino experiment for neutrino oscillation analysis based on gadolinium capture data.
Author-email: Daya Bay Collaboration <dagflow@jinr.ru>
Maintainer-email: DAGModelling Team <dagflow@jinr.ru>
License-Expression: MIT
Project-URL: Bug Tracker, https://github.com/dayabay-experiment/dayabay-model/issues
Project-URL: documentation, https://github.com/dayabay-experiment/dayabay-model/wiki
Project-URL: homepage, https://github.com/dayabay-experiment/dayabay-model
Project-URL: repository, https://github.com/dayabay-experiment/dayabay-model
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: colorama
Requires-Dist: dgm-fit>=0.2
Requires-Dist: dgm-reactor-neutrino>=0.2.2
Requires-Dist: more-itertools
Requires-Dist: semver
Provides-Extra: test
Requires-Dist: dgm-reactor-neutrino[test]>=0.2.2; extra == "test"
Requires-Dist: ipykernel; extra == "test"
Requires-Dist: ipython; extra == "test"
Requires-Dist: ipywidgets; extra == "test"
Requires-Dist: nbconvert; extra == "test"
Requires-Dist: parameterized; extra == "test"
Requires-Dist: pygraphviz; extra == "test"
Dynamic: license-file

# dayabay-model

[![python](https://img.shields.io/badge/python-3.11-purple.svg)](https://www.python.org/)
[![pipeline](https://git.jinr.ru/dagflow-team/dayabay-model/badges/main/pipeline.svg)](https://git.jinr.ru/dagflow-team/dayabay-model/commits/main)
[![coverage report](https://git.jinr.ru/dagflow-team/dayabay-model/badges/main/coverage.svg)](https://git.jinr.ru/dagflow-team/dayabay-model/-/commits/main)

<!--- Uncomment here after adding docs!
[![pages](https://img.shields.io/badge/pages-link-white.svg)](http://dagflow-team.pages.jinr.ru/dayabay-model)
-->

Official model of the Daya Bay reactor antineutrino experiment for neutrino oscillation analysis based on gadolinium capture data.

## Content

- [Repositories](#repository)
- [Minimal working example](minimal-working-example)


## Repositories

- Development/CI: https://git.jinr.ru/dagflow-team/dayabay-model
- Contact/pypi/mirror: https://github.com/dagflow-team/dayabay-model
- PYPI: https://pypi.org/project/dayabay-model

## Minimal working example

If you want to run examples from `extras/mwe`, clone this repository `git clone https://github.com/dagflow-team/dayabay-model` and change position to cloned reposiotry `cd dayabay-model`.
However, you can just copy examples that are listed below and run them where you want after installation of package and several others steps:

1. Install package `pip install dayabay-model`
2. Install required packages: `pip install -r requirements`
3. Clone the repository with Daya Bay data `git clone https://github.com/dayabay-experiment/dayabay-data-official`
  - Make sure that you have `git-lfs` in your system or install it
  - After installing `git-lfs`, change directory to `dayabay-data-official` and run command `git lfs pull` to download more files
  - Check any file that it was properly uploaded: `cat parameters-common/reactor_antineutrino_spectrum_edges.tsv`
  - Go back to the analysis directory `cd ../`
  - More details on how to work with data repository you can find in [README.md of the data repository](https://github.com/dagflow-team/dayabay-data-official)
4. Create soft links `ln -s dayabay-data-official/hdf5 data`
5. Set `PYTHONPATH` variable to the current directory: `set PYTHONPATH=$PHYTHONPATH:$PWD`. **Alternative**: set variable value when you are running example: `PYTHONPATH=PWD python ./extras/...`
6. Run script `python extras/mwe/run.py` or `PYTHONPATH=PWD python extras/mwe/run.py`
```python
from dayabay_model_official import model_dayabay

model = model_dayabay()
print(model.storage["outputs.statistic.full.pull.chi2p"].data)
```
within `python`
```bash
python extras/mwe/run.py
```
7. Check output in console, it might be something like below
```bash
INFO: Model version: model_dayabay
INFO: Source type: npz
INFO: Data path: data
INFO: Concatenation mode: detector_period
INFO: Spectrum correction mode: exponential
INFO: Spectrum correction location: before integration
[0.]
```
8. Also, you may pass custom path to data, if you put `path_data` parameter to model. For example,
```python
from dayabay_model_official import model_dayabay

model = model_dayabay(path_data="dayabay-data-official/npz")
print(model.storage["outputs.statistic.full.pull.chi2p"].data)
```
Example can be executed: `python extras/mwe/run-custom-data-path.py` or `PYTHONPATH=PWD python extras/mwe/run-custom-data-path.py`

9. If you want to switch between Asimov and observed data, you need to switch input in the next way
```python
from dayabay_model_official import model_dayabay

model = model_dayabay(path_data="dayabay-data-official/npz")

print(model.storage["outputs.statistic.full.pull.chi2p"].data)

model.switch_data("real")
print(model.storage["outputs.statistic.full.pull.chi2p"].data)

model.switch_data("asimov")
print(model.storage["outputs.statistic.full.pull.chi2p"].data)
```
Example can be executed: `python extras/mwe/run-switch-asimov-real-data.py` or `PYTHONPATH=PWD python extras/mwe/run-switch-asimov-real-data.py`
