Skip to content

Commit 8ab2d16

Browse files
authored
Merge pull request #414 from larrybradley/add-citation
Add citation file
2 parents 7c0f90f + 71709dd commit 8ab2d16

File tree

6 files changed

+97
-1
lines changed

6 files changed

+97
-1
lines changed

CITATION.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
See https://github.com/astropy/regions/blob/main/regions/CITATION.rst

MANIFEST.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
include CHANGES.rst
2+
include CITATION.rst
3+
include regions/CITATION.rst
24
include LICENSE.rst
35
include README.rst
46
include pyproject.toml

README.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,26 @@ instructions
1515
and usage information.
1616

1717

18+
Citing Regions
19+
--------------
20+
21+
|Zenodo|
22+
23+
If you use Regions for a project that leads to a publication, whether
24+
directly or as a dependency of another package, please include the
25+
following acknowledgment::
26+
27+
This research made use of Regions, an Astropy package for region
28+
handling (Bradley et al. 202X).
29+
30+
where (Bradley et al. 202X) is a citation to the `Zenodo
31+
record <https://doi.org/10.5281/zenodo.5826358>`_ of the
32+
Regions version that was used. We also encourage citations in
33+
the main text wherever appropriate. Please see the `CITATION
34+
<https://github.com/astropy/regions/blob/main/regions/CITATION.rst>`_
35+
file for details and an example BibTeX entry.
36+
37+
1838
License
1939
-------
2040

@@ -36,6 +56,9 @@ for details.
3656
:target: https://www.astropy.org/
3757
:alt: Powered by Astropy
3858

59+
.. |Zenodo| image:: https://zenodo.org/badge/35690635.svg
60+
:target: https://zenodo.org/badge/latestdoi/35690635
61+
3962
.. |CI Status| image:: https://github.com/astropy/regions/workflows/CI%20Tests/badge.svg#
4063
:target: https://github.com/astropy/regions/actions
4164
:alt: CI Status

regions/CITATION.rst

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
Citing Regions
2+
--------------
3+
4+
If you use Regions for a project that leads to a publication, whether
5+
directly or as a dependency of another package, please include the
6+
following acknowledgment:
7+
8+
.. code-block:: text
9+
10+
This research made use of Regions, an Astropy package for region
11+
handling (Bradley et al. 202X).
12+
13+
where (Bradley et al. 202X) is a citation to the `Zenodo record
14+
<https://doi.org/10.5281/zenodo.5826358>`_ of the Regions version
15+
that was used. We also encourage citations in the main text wherever
16+
appropriate.
17+
18+
All Regions versions and citation formats can be found at
19+
https://doi.org/10.5281/zenodo.5826358. For example, for Regions
20+
v0.5 one would cite Bradley et al. 2022 with the BibTeX entry
21+
(https://zenodo.org/record/5826359/export/hx):
22+
23+
.. code-block:: text
24+
25+
@software{larry_bradley_2022_5826359,
26+
author = {Larry Bradley and
27+
Christoph Deil and
28+
Sushobhana Patra and
29+
Adam Ginsburg and
30+
Thomas Robitaille and
31+
Brigitta Sip{\H o}cz and
32+
Johannes King and
33+
P. L. Lim and
34+
Leo Singer and
35+
Miguel de Val-Borro and
36+
Tim Jenness and
37+
Matthieu Baumann and
38+
Yash-10 and
39+
Axel Donath and
40+
Erik Tollerud and
41+
Jae-Joon Lee and
42+
Katrin Leinweber and
43+
Z\`e Vin{\'{\i}}cius},
44+
title = {astropy/regions: v0.5},
45+
month = jan,
46+
year = 2022,
47+
publisher = {Zenodo},
48+
version = {v0.5},
49+
doi = {10.5281/zenodo.5826359},
50+
url = {https://doi.org/10.5281/zenodo.5826359}
51+
}

regions/__init__.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,21 @@
1414
from .io import * # noqa
1515
from .shapes import * # noqa
1616
from ._utils.examples import * # noqa
17+
18+
19+
# Set the bibtex entry to the article referenced in CITATION.rst.
20+
def _get_bibtex():
21+
import os
22+
citation_file = os.path.join(os.path.dirname(__file__), 'CITATION.rst')
23+
24+
with open(citation_file, 'r') as citation:
25+
refs = citation.read().split('@software')[1:]
26+
if len(refs) == 0:
27+
return ''
28+
bibtexreference = f"@software{refs[0]}"
29+
return bibtexreference
30+
31+
32+
__citation__ = __bibtex__ = _get_bibtex()
33+
34+
del _get_bibtex # noqa

setup.cfg

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ docs =
4343
sphinx-astropy
4444

4545
[options.package_data]
46-
regions = data/*
46+
* = data/*
47+
regions = CITATION.rst
4748
regions.shapes.tests = reference/*.txt, data/*.fits
4849
regions.io.crtf.tests = data/*.crtf
4950
regions.io.ds9.tests = data/*.reg

0 commit comments

Comments
 (0)