Skip to content

Commit 7d9c109

Browse files
authoredMar 1, 2023
Merge pull request #593 from ICB-DCM/develop
Release 0.12.9
2 parents 59e06fd + cc64c37 commit 7d9c109

17 files changed

+55
-34
lines changed
 

‎.pre-commit-config.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
repos:
1313
- repo: https://github.com/psf/black
14-
rev: 22.3.0
14+
rev: 23.1.0
1515
hooks:
1616
- id: black
1717
description: The uncompromising code formatter
1818
- repo: https://github.com/pycqa/isort
19-
rev: 5.10.1
19+
rev: 5.12.0
2020
hooks:
2121
- id: isort
2222
name: isort (python)
@@ -27,14 +27,14 @@ repos:
2727
name: isort (pyi)
2828
types: [pyi]
2929
- repo: https://github.com/nbQA-dev/nbQA
30-
rev: 1.2.3
30+
rev: 1.6.1
3131
hooks:
3232
- id: nbqa-black
3333
- id: nbqa-pyupgrade
3434
args: [--py36-plus]
3535
- id: nbqa-isort
3636
- repo: https://github.com/pre-commit/pre-commit-hooks
37-
rev: v4.2.0
37+
rev: v4.4.0
3838
hooks:
3939
- id: check-yaml
4040
description: Check yaml files for parseable syntax
@@ -55,6 +55,6 @@ repos:
5555
- id: style
5656
name: Check style
5757
description: Check style
58-
entry: tox -e project,flake8
59-
language: python
58+
entry: tox -e flake8 --
59+
language: system
6060
types: [python]

‎CHANGELOG.rst

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ Release Notes
77
0.12 Series
88
...........
99

10+
0.12.9 (2023-03-01)
11+
-------------------
12+
13+
Minor:
14+
15+
* Improve documentation of p-norm (#592)
16+
* Update citation to JOSS
17+
* Temporarily fixate sqlalchemy version
18+
* Update pre-commit hooks (all #596)
1019

1120
0.12.8 (2022-11-16)
1221
-------------------

‎CITE.rst

+17-12
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,26 @@ When using pyABC version >= 0.8, please cite:
55

66
* Schälte, Y., Klinger, E., Alamoudi, E., Hasenauer, J., 2022.
77
pyABC: Efficient and robust easy-to-use approximate Bayesian computation.
8-
arXiv.
9-
https://doi.org/10.48550/arxiv.2203.13043.
8+
Journal of Open Source Software.
9+
https://doi.org/10.21105/joss.04304.
1010

1111
.. code-block:: bibtex
1212
13-
@article{schaelte2022pyabc,
14-
title = {pyABC: Efficient and robust easy-to-use approximate Bayesian computation},
15-
author = {Schälte, Yannik and Klinger, Emmanuel and Alamoudi, Emad and Hasenauer, Jan},
16-
journal = {arXiv},
17-
year = {2022},
18-
doi = {10.48550/arxiv.2203.13043},
19-
url = {https://arxiv.org/abs/2203.13043},
20-
}
21-
22-
When using pyABC version < 0.8 or functionality not introduced in later versions, please cite:
13+
@article{schaelte2022pyabc,
14+
title = {pyABC: Efficient and robust easy-to-use approximate Bayesian computation},
15+
author = {Schälte, Yannik and Klinger, Emmanuel and Alamoudi, Emad and Hasenauer, Jan},
16+
journal = {Journal of Open Source Software},
17+
publisher = {The Open Journal},
18+
year = {2022},
19+
volume = {7},
20+
number = {74},
21+
pages = {4304},
22+
doi = {10.21105/joss.04304},
23+
url = {https://doi.org/10.21105/joss.04304},
24+
}
25+
26+
When using pyABC version < 0.8 or functionality not introduced in later
27+
versions, please (also) cite:
2328

2429
* Klinger, E., Rickert, D., Hasenauer, J., 2018.
2530
pyABC: distributed, likelihood-free inference.

‎doc/examples/adaptive_distances.ipynb

+2
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
"df_logger = logging.getLogger(\"ABC.Distance\")\n",
112112
"df_logger.setLevel(logging.DEBUG)\n",
113113
"\n",
114+
"\n",
114115
"# model definition\n",
115116
"def model(p):\n",
116117
" return {\n",
@@ -470,6 +471,7 @@
470471
"df_logger = logging.getLogger(\"Distance\")\n",
471472
"df_logger.setLevel(logging.DEBUG)\n",
472473
"\n",
474+
"\n",
473475
"# model definition\n",
474476
"def model(p):\n",
475477
" return {\n",

‎pyabc/distance/pnorm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class PNormDistance(Distance):
3535
\\left [\\sum_{i} \\left| w_i ( x_i-y_i ) \\right|^{p} \\right ]^{1/p}
3636
3737
E.g.
38-
* p=1 for a Euclidean or L1 metric,
39-
* p=2 for a Manhattan or L2 metric,
38+
* p=1 for a Manhattan or L1 metric,
39+
* p=2 for a Euclidean or L2 metric,
4040
* p=np.inf for a Chebyshev, maximum or inf metric.
4141
4242
Parameters

‎pyabc/epsilon/temperature.py

+1
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,7 @@ def match_acceptance_rate(weights, pds, pdf_norm, kernel_scale, target_rate):
372372
For a temperature close to 1, subtler changes are neccesary, however here
373373
the logarhtm is nearly linear anyway.
374374
"""
375+
375376
# objective function which we wish to find a root for
376377
def obj(b):
377378
beta = np.exp(b)

‎pyabc/external/r/r_rpy2.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ class R:
7878
def __init__(self, source_file: str):
7979
if r is None:
8080
raise ImportError("Install rpy2, e.g. via `pip install pyabc[R]`")
81-
warnings.warn("The support of R via rpy2 is considered experimental.")
81+
warnings.warn(
82+
"The support of R via rpy2 is considered experimental.",
83+
stacklevel=2,
84+
)
8285
self.source_file = source_file
8386
self._read_source()
8487

‎pyabc/population.py

-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def __init__(
7272
proposal_id: int = 0,
7373
preliminary: bool = False,
7474
):
75-
7675
self.m = m
7776
self.parameter = parameter
7877
self.weight = weight

‎pyabc/sampler/multicore_evaluation_parallel.py

-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ def work(
4343
sample.append(new_sim)
4444

4545
if new_sim.accepted:
46-
4746
# increase number of accepted particles
4847
with n_acc.get_lock():
4948
n_acc.value += 1

‎pyabc/sge/sge.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,6 @@ def __init__(
133133
execution_context=DefaultContext,
134134
chunk_size=1,
135135
):
136-
137136
# simple assignments
138137
self.memory = memory
139138
self.time_h = time_h
@@ -159,7 +158,8 @@ def __init__(
159158
self.job_name = name
160159
if self.config["SGE"]["PRIORITY"] == "0":
161160
warnings.warn(
162-
"Priority set to 0. " "This enables the reservation flag."
161+
"Priority set to 0. " "This enables the reservation flag.",
162+
stacklevel=2,
163163
)
164164
self.num_threads = num_threads
165165
self.execution_context = execution_context
@@ -168,7 +168,8 @@ def __init__(
168168
if chunk_size != 1:
169169
warnings.warn(
170170
"Chunk size != 1. "
171-
"This can potentially have bad side effect."
171+
"This can potentially have bad side effect.",
172+
stacklevel=2,
172173
)
173174

174175
if not sge_available():

‎pyabc/storage/dataframe_bytes_storage.py

+1
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ def df_to_bytes(df: pd.DataFrame) -> bytes:
129129
"Can't find pyarrow, falling back to less efficient csv "
130130
"to store pandas DataFrames.\n"
131131
"Install e.g. via `pip install pyabc[pyarrow]`",
132+
stacklevel=2,
132133
)
133134
return df_to_bytes_csv(df)
134135
return df_to_bytes_parquet(df)

‎pyabc/storage/history.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import os
55
import tempfile
66
from functools import wraps
7-
from typing import List, Union
7+
from typing import List, Tuple, Union
88

99
import numpy as np
1010
import pandas as pd
@@ -308,7 +308,7 @@ def alive_models(self, t: int = None) -> List:
308308
@with_session
309309
def get_distribution(
310310
self, m: int = 0, t: int = None
311-
) -> (pd.DataFrame, np.ndarray):
311+
) -> Tuple[pd.DataFrame, np.ndarray]:
312312
"""
313313
Returns the weighted population sample for model m and timepoint t
314314
as a tuple.
@@ -997,7 +997,7 @@ def n_populations(self):
997997
@with_session
998998
def get_weighted_sum_stats_for_model(
999999
self, m: int = 0, t: int = None
1000-
) -> (np.ndarray, List):
1000+
) -> Tuple[np.ndarray, List]:
10011001
"""
10021002
Summary statistics for model `m`. The weights sum to 1, unless
10031003
there were multiple acceptances per particle.
@@ -1046,7 +1046,7 @@ def get_weighted_sum_stats_for_model(
10461046
@with_session
10471047
def get_weighted_sum_stats(
10481048
self, t: int = None
1049-
) -> (List[float], List[dict]):
1049+
) -> Tuple[List[float], List[dict]]:
10501050
"""
10511051
Population's weighted summary statistics.
10521052
These weights do not necessarily sum up to 1.

‎pyabc/transition/grid_search.py

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def __init__(
4040
error_score='raise',
4141
return_train_score=True,
4242
):
43-
4443
if estimator is None:
4544
estimator = MultivariateNormalTransition()
4645
if param_grid is None:

‎pyabc/version.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.12.8'
1+
__version__ = '0.12.9'

‎setup.cfg

+2-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ install_requires =
6060
redis >= 2.10.6
6161
distributed >= 2022.10.2
6262
matplotlib >= 3.3.0
63-
sqlalchemy >= 1.3.18
63+
# until https://github.com/pandas-dev/pandas/issues/40686
64+
sqlalchemy >= 1.3.18, < 2.0.0
6465
jabbar >= 0.0.10
6566
gitpython >= 3.1.7
6667

‎test/base/test_epsilon.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_constantepsilon():
2020

2121
def test_listepsilon():
2222
eps = pyabc.ListEpsilon([3.5, 2.3, 1, 0.3])
23-
with pytest.raises(Exception):
23+
with pytest.raises(IndexError):
2424
eps(4)
2525

2626

‎test/base/test_storage.py

+1
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,7 @@ def test_export():
572572
573573
Just calls export and does some very basic checks.
574574
"""
575+
575576
# simple problem
576577
def model(p):
577578
return {"y": p["p"] + 0.1 * np.random.normal()}

0 commit comments

Comments
 (0)
Please sign in to comment.