Skip to content

Commit

Permalink
Merge branch 'main' into cesinf
Browse files Browse the repository at this point in the history
  • Loading branch information
yuema137 authored Dec 8, 2024
2 parents fcdf7c8 + aed79c8 commit 437786a
Show file tree
Hide file tree
Showing 37 changed files with 1,943 additions and 212 deletions.
8 changes: 6 additions & 2 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
[bumpversion]
current_version = 0.2.4
files = setup.py alea/__init__.py
current_version = 0.3.0
files = alea/__init__.py
commit = True
tag = True

[bumpversion:file:pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"
6 changes: 3 additions & 3 deletions .github/workflows/pypi_install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: PyPI
on:
workflow_dispatch:
release:
types: [ created ]
types: [published]

jobs:
build:
Expand All @@ -23,10 +23,10 @@ jobs:
uses: actions/checkout@v3

- name: Install dependencies
run: pip install wheel
run: pip install build

- name: Build package
run: python setup.py sdist bdist_wheel
run: python -m build

- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
3 changes: 1 addition & 2 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
branches: [ main ]

jobs:
build:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -44,7 +44,6 @@ jobs:
run: |
python -m pip install --upgrade pip
python -m pip install pytest coverage coveralls
pip install -r requirements.txt
- name: Install Alea
run: |
Expand Down
14 changes: 8 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/psf/black
rev: 24.4.2
rev: 24.10.0
hooks:
- id: black
args: [--safe, --line-length=100]
Expand All @@ -19,25 +19,27 @@ repos:
language_version: python3.9

- repo: https://github.com/pycqa/docformatter
rev: v1.7.5
rev: master
hooks:
- id: docformatter
additional_dependencies: [tomli]
args: [--config, pyproject.toml]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.11.2
hooks:
- id: mypy
additional_dependencies: [types-PyYAML, types-tqdm]

- repo: https://github.com/pycqa/doc8
rev: v1.1.1
rev: v1.1.2
hooks:
- id: doc8
files: ^docs/.*\.(rst|md)$
args: [--ignore, D001]

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
rev: 7.1.1
hooks:
- id: flake8

Expand Down
4 changes: 0 additions & 4 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,10 @@ build:

python:
install:
- requirements: requirements.txt
- requirements: docs/requirements-docs.txt
- method: pip
path: .
extra_requirements:
- docs
- method: setuptools
path: .

formats:
- htmlzip
Expand Down
78 changes: 78 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,81 @@
0.3.0 / 2024-09-21
------------------
* Use `pyproject.toml` to install alea-inference by @dachengx in https://github.com/XENONnT/alea/pull/192
* Removed deprecated `_pegasus_properties` by @FaroutYLq in https://github.com/XENONnT/alea/pull/196
* Simplify `SubmitterHTCondor` by @dachengx in https://github.com/XENONnT/alea/pull/193
* Debug for pypi build by @dachengx in https://github.com/XENONnT/alea/pull/197
* There was a typo in docstr by @FaroutYLq in https://github.com/XENONnT/alea/pull/198
* Prefer f-string than format by @dachengx in https://github.com/XENONnT/alea/pull/200
* Use tree structure work directory by @dachengx in https://github.com/XENONnT/alea/pull/202
* Use MB all the time in `SubmitterHTCondor`, no more kB by @dachengx in https://github.com/XENONnT/alea/pull/201
* Decompress outputs into `outputfolder` by @dachengx in https://github.com/XENONnT/alea/pull/199
* Support more `toydata_mode` by @dachengx in https://github.com/XENONnT/alea/pull/206
* No need to plan or submit workflow if no job added by @dachengx in https://github.com/XENONnT/alea/pull/207
* Save log for OSG jobs by @dachengx in https://github.com/XENONnT/alea/pull/208
* Use `shlex.quote` to convert the arguments into unix format by @dachengx in https://github.com/XENONnT/alea/pull/209
* Fix the usage of scripts by @dachengx in https://github.com/XENONnT/alea/pull/210
* Add `spectrum_axis` configuration for `SpectrumTemplateSource` by @dachengx in https://github.com/XENONnT/alea/pull/212
* Use utilix to validate X509 proxy by @dachengx in https://github.com/XENONnT/alea/pull/213
* Tarball all needed templates from different folder by @dachengx in https://github.com/XENONnT/alea/pull/214
* Fix the path of `alea_run_toymc` script by @dachengx in https://github.com/XENONnT/alea/pull/216
* Tarball alea for later user installation by @dachengx in https://github.com/XENONnT/alea/pull/215
* Use `install.sh` from utilix by @dachengx in https://github.com/XENONnT/alea/pull/217
* Bump version of utilix by @dachengx in https://github.com/XENONnT/alea/pull/218


**Full Changelog**: https://github.com/XENONnT/alea/compare/v0.2.8...v0.3.0


0.2.8 / 2024-08-26
------------------
* Fix OSG submission by @hammannr in https://github.com/XENONnT/alea/pull/189


**Full Changelog**: https://github.com/XENONnT/alea/compare/v0.2.7...v0.2.8

0.2.7 / 2024-08-07
------------------
* Trigger PyPI workflow on "published" by @hammannr in https://github.com/XENONnT/alea/pull/185
* Fix apply efficiency by @hammannr in https://github.com/XENONnT/alea/pull/187
* Conditional Parameters by @hammannr in https://github.com/XENONnT/alea/pull/186
* Enable choosing the fit strategy by @hammannr in https://github.com/XENONnT/alea/pull/182


**Full Changelog**: https://github.com/XENONnT/alea/compare/v0.2.6...v0.2.7

0.2.6 / 2024-07-31
------------------
* Defunctionalize `apply_efficiency`, apply efficiency when `efficiency_name` is specified by @dachengx in https://github.com/XENONnT/alea/pull/183

**Full Changelog**: https://github.com/XENONnT/alea/compare/v0.2.5...v0.3.0


0.2.5 / 2024-07-30
------------------
* Consistent sorting for BlueiceExtendedModel by @hammannr in https://github.com/XENONnT/alea/pull/149
* Fixed data storing by @hammannr in https://github.com/XENONnT/alea/pull/152
* Add lxml_html_clean to fix readthedocs building error by @zihaoxu98 in https://github.com/XENONnT/alea/pull/157
* Fitting index variables by @zihaoxu98 in https://github.com/XENONnT/alea/pull/156
* Print Argument combinations to be submitted by @hammannr in https://github.com/XENONnT/alea/pull/151
* Minor changes to fitting index variables (PR #156) by @hammannr in https://github.com/XENONnT/alea/pull/159
* Set `i_batch` for `SubmitterLocal` when submitting by @dachengx in https://github.com/XENONnT/alea/pull/164
* Debug for interpolator deduction of `NeymanConstructor` by @dachengx in https://github.com/XENONnT/alea/pull/165
* The first i batch should be 0 by @dachengx in https://github.com/XENONnT/alea/pull/166
* Try prefix every file path in likelihood configuration with template folder by @dachengx in https://github.com/XENONnT/alea/pull/169
* Forbid prexing every key when adapt_likelihood_config_for_blueice by @FaroutYLq in https://github.com/XENONnT/alea/pull/170
* Refactored Pegasus-based OSG submitter by @FaroutYLq in https://github.com/XENONnT/alea/pull/163
* Try fixing https://github.com/XENONnT/alea/issues/173 by @dachengx in https://github.com/XENONnT/alea/pull/176
* Allow assigning kwargs in debug mode by @dachengx in https://github.com/XENONnT/alea/pull/174
* Allow `confidence_level` in filename by @dachengx in https://github.com/XENONnT/alea/pull/179
* Add 68% coverage as one of the defaults of `confidence_levels` by @dachengx in https://github.com/XENONnT/alea/pull/180
* Document to increase CPUs by @FaroutYLq in https://github.com/XENONnT/alea/pull/178

New Contributors
* @FaroutYLq made their first contribution in https://github.com/XENONnT/alea/pull/170

**Full Changelog**: https://github.com/XENONnT/alea/compare/v0.2.4...v0.2.5


0.2.4 / 2024-03-18
------------------
* Point away from alea for physics models by @kdund in https://github.com/XENONnT/alea/pull/143
Expand Down
2 changes: 1 addition & 1 deletion alea/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.2.4"
__version__ = "0.3.0"

from .parameters import *

Expand Down
12 changes: 10 additions & 2 deletions alea/examples/configs/unbinned_wimp_statistical_model.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ likelihood_config:
named_parameters:
- wimp_mass
template_filename: wimp{wimp_mass:d}gev_template.ii.h5
apply_efficiency: True
efficiency_name: signal_efficiency

# SR1
Expand Down Expand Up @@ -134,5 +133,14 @@ likelihood_config:
named_parameters:
- wimp_mass
template_filename: wimp{wimp_mass:d}gev_template.ii.h5
apply_efficiency: True
efficiency_name: signal_efficiency

# just for illusrative purposes, the default values are shown here.
# they are not needed in the configuration file but you could
# overwrite them here.
fit_strategy:
disable_index_fitting: False
max_index_fitting_iter: 10
minimizer_routine: "migrad"
minuit_strategy: 1
refit_invalid: True
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
parameter_definition:
wimp_mass:
nominal_value: 50
fittable: false
description: WIMP mass in GeV/c^2

livetime_sr0:
nominal_value: 0.2
ptype: livetime
fittable: false
description: Livetime of SR0 in years

livetime_sr1:
nominal_value: 1.0
ptype: livetime
fittable: false
description: Livetime of SR1 in years

wimp_rate_multiplier:
nominal_value: 1.0
ptype: rate
fittable: true
fit_limits:
- 0
- null
parameter_interval_bounds:
- 0
- null

er_rate_multiplier:
nominal_value: 1.0
ptype: rate
uncertainty: 0.2
relative_uncertainty: true
fittable: true
fit_limits:
- 0
- null
fit_guess: 1.0

signal_efficiency:
conditioning_parameter_name: wimp_mass
nominal_value: 1.0
ptype: efficiency
uncertainty:
5: 0.3
10: 0.2
50: 0.15
100: 0.1
500: 0.1
relative_uncertainty: true
fittable: true
fit_limits:
- 0
- 10.
fit_guess: 1.0
description: Parameter to account for the uncertain signal expectation given a certain cross-section

er_band_shift:
nominal_value: 0
ptype: shape
uncertainty: 'stats.uniform(loc=-2, scale=4)'
# relative_uncertainty: false
fittable: true
blueice_anchors:
- -2
- -1
- 0
- 1
- 2
fit_limits:
- -2
- 2
description: ER band shape parameter (shifts the ER band up and down)

likelihood_config:
likelihood_weights: [1, 1, 1]
template_folder: null # will try to find the templates in alea
likelihood_terms:
# SR0
- name: sr0
default_source_class: alea.template_source.TemplateSource
likelihood_type: blueice.likelihood.UnbinnedLogLikelihood
analysis_space:
- cs1: np.linspace(0, 100, 51)
- cs2: np.geomspace(100, 100000, 51)
in_events_per_bin: true
livetime_parameter: livetime_sr0
slice_args: {}
sources:
- name: er
histname: er_template # TODO: implement a default histname based on the source name
parameters:
- er_rate_multiplier
- er_band_shift
named_parameters:
- er_band_shift
template_filename: er_template_{er_band_shift}.ii.h5
histogram_scale_factor: 1

- name: wimp
histname: wimp_template
parameters:
- wimp_mass
- wimp_rate_multiplier
- signal_efficiency
named_parameters:
- wimp_mass
template_filename: wimp{wimp_mass:d}gev_template.ii.h5
apply_efficiency: True
efficiency_name: signal_efficiency

# SR1
- name: sr1
default_source_class: alea.template_source.TemplateSource
likelihood_type: blueice.likelihood.UnbinnedLogLikelihood
analysis_space:
- cs1: np.linspace(0, 100, 51)
- cs2: np.geomspace(100, 100000, 51)
in_events_per_bin: true
livetime_parameter: livetime_sr1
slice_args: {}
sources:
- name: er
histname: er_template
parameters:
- er_rate_multiplier
- er_band_shift
named_parameters:
- er_band_shift
template_filename: er_template_{er_band_shift}.ii.h5
histogram_scale_factor: 2

- name: wimp
histname: wimp_template
parameters:
- wimp_mass
- wimp_rate_multiplier
- signal_efficiency
named_parameters:
- wimp_mass
template_filename: wimp{wimp_mass:d}gev_template.ii.h5
apply_efficiency: True
efficiency_name: signal_efficiency
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ likelihood_config:
- wimp_mass
- signal_efficiency
template_filename: wimp50gev_template.ii.h5
apply_efficiency: True
efficiency_name: signal_efficiency

# SR3, 1D inference on cS2 space
Expand Down Expand Up @@ -127,5 +126,5 @@ likelihood_config:
- signal_efficiency
template_filename: wimp50gev_template.ii.h5
spectrum_name: test_cs1_spectrum.json
apply_efficiency: True
spectrum_axis: 1
efficiency_name: signal_efficiency
Loading

0 comments on commit 437786a

Please sign in to comment.