Skip to content

Commit 3001b62

Browse files
authored
Citations allow passing single function (#89)
* allow passing single function, update refs * fix doctring
1 parent 763ea94 commit 3001b62

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/arviz_base/citations.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def citations(methods=None, filepath=None, format_type="bibtex"):
1010
1111
Parameters
1212
----------
13-
methods : List
13+
methods : Callable or list of callable, optional
1414
Methods implemented in ArviZ from which to retrieve citations.
1515
filepath : str, optional
1616
Specifies the location to save the file with the citations.
@@ -28,6 +28,10 @@ def citations(methods=None, filepath=None, format_type="bibtex"):
2828
"""
2929
method_citations = [{"doi": "10.21105/joss.XXXXX"}]
3030
if methods is not None:
31+
if isinstance(methods, str):
32+
raise TypeError("you should pass an ArviZ function or list of functions.")
33+
if not isinstance(methods, list | tuple):
34+
methods = [methods]
3135
for method in methods:
3236
_extract_ids_per_entry(method_citations, method.__doc__)
3337

src/arviz_base/citations.pyi

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
import os
44
import re
5-
from typing import List
5+
from collections.abc import Callable
66

77
from _typeshed import Incomplete
88

99
def citations(
10-
methods: List | None = ..., filepath: str | None = ..., format_type: str = ...
10+
methods: Callable | list[Callable] | None = ...,
11+
filepath: str | None = ...,
12+
format_type: str = ...,
1113
) -> None: ...
1214
def _extract_ids_per_entry(data: Incomplete, text: Incomplete) -> None: ...
1315
def _find_bibtex_entries(header: Incomplete, data: Incomplete) -> None: ...

src/arviz_base/references.bib

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,3 +290,15 @@ @misc{bickel2005
290290
doi= {https://doi.org/10.48550/arXiv.math/0505419},
291291
url={https://arxiv.org/abs/math/0505419},
292292
}
293+
294+
295+
@misc{sivula_2025,
296+
title={Uncertainty in Bayesian Leave-One-Out Cross-Validation Based Model Comparison},
297+
author={Tuomas Sivula and Måns Magnusson and Asael Alonzo Matamoros and Aki Vehtari},
298+
year={2025},
299+
eprint={2008.10296},
300+
archivePrefix={arXiv},
301+
primaryClass={stat.ME},
302+
doi={https://doi.org/10.48550/arXiv.2008.10296},
303+
url={https://arxiv.org/abs/2008.10296},
304+
}

0 commit comments

Comments
 (0)