Skip to content

Commit

Permalink
generate list of papers that cite sunpy
Browse files Browse the repository at this point in the history
  • Loading branch information
wtbarnes committed Jul 9, 2023
1 parent ae90011 commit 07ad738
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ docs/tutorial/figure.png
.history
*.orig
.tmp
docs/sunpy-citations.bib

# Log files generated by 'vagrant up'
*.log
Expand Down
22 changes: 22 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@
'sphinx_design',
'sphinx_copybutton',
'hoverxref.extension',
'sphinxcontrib.bibtex',
]

# Set automodapi to generate files inside the generated directory
Expand Down Expand Up @@ -346,6 +347,27 @@
'is_development': not is_release,
}

# -- Generate citation bibtex file -----------------------------------------------
bibtex_bibfiles = [
'sunpy-citations.bib',
]
bibtex_default_style = 'plain'
if not os.path.exists(bibtex_bibfiles[0]):
bibcodes = [
"2020ApJ...890...68S",
"2015CS&D....8a4009S",
"2020JOSS....5.1832M",
]
import ads
sunpy_papers = [list(ads.SearchQuery(bibcode=bc, fl=["citation"]))[0] for bc in bibcodes]
citation_bibcodes = []
for p in sunpy_papers:
citation_bibcodes += p.citation
citation_bibcodes = list(set(citation_bibcodes)) # remove duplicates
export = ads.ExportQuery(citation_bibcodes, format="bibtex")
bibtex_entries = export.execute()
with open(bibtex_bibfiles[0], mode="w") as f:
f.write(bibtex_entries)

def rstjinja(app, docname, source):
"""
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ tests =
pytest>=6.0
docs =
astroquery
ads
hvpy>=1.0.1
jplephem
mplcairo
Expand All @@ -123,6 +124,7 @@ docs =
sphinxext-opengraph
sunpy-sphinx-theme
sphinx-hoverxref
sphinxcontrib-bibtex
dev =
%(all)s
%(tests)s
Expand Down
11 changes: 11 additions & 0 deletions sunpy/CITATION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ Please include the `Sunpy logo`_ on the title, conclusion slide, or about page.
For websites please link the image to `sunpy.org`_.
Other versions of the logo are available in the `sunpy-logo repository`_.

Publications that Cite SunPy
-----------------------

The following publications use sunpy in their published work and have cited at least one of the papers listed above.
This list is automatically generated based on citation information from `ADS <https://ui.adsabs.harvard.edu/>`__.
If you do not see your publication on this list, but believe it should be included, please let us know by `creating an issue on GitHub <https://github.com/sunpy/sunpy/issues>`__.

.. bibliography:: ../docs/sunpy-citations.bib
:all:
:list: enumerated

.. _SunPy paper: https://doi.org/10.3847/1538-4357/ab4f7a
.. _Sunpy logo: https://github.com/sunpy/sunpy-logo/blob/master/sunpy_logo.svg
.. _sunpy.org: https://sunpy.org/
Expand Down

0 comments on commit 07ad738

Please sign in to comment.