LM-SAL / aiapy

Python library for AIA data analysis
https://aiapy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Incorporating citation information - [merged] #206

Closed nabobalis closed 10 months ago

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 17:12

Merges citation -> master

Starting to address #78. This will have to be edited after !79 is finished.

nabobalis commented 3 years ago

In GitLab by @codecov on Sep 24, 2020, 17:16

Codecov Report

Merging #82 into master will increase coverage by 0.08%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #82      +/-   ##
==========================================
+ Coverage   96.79%   96.88%   +0.08%     
==========================================
  Files          14       14              
  Lines         406      417      +11     
==========================================
+ Hits          393      404      +11     
  Misses         13       13              
Impacted Files Coverage Δ
aiapy/__init__.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9ecb5fb...8d3bfd9. Read the comment docs.

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 17:30

The SunPy code for extracting the bibtex information from CITATION.rst is:

def _get_bibtex():
    import textwrap

    # Set the bibtex entry to the article referenced in CITATION.rst
    citation_file = os.path.join(os.path.dirname(__file__), 'CITATION.rst')

    # Explicitly specify UTF-8 encoding in case the system's default encoding is problematic
    with open(citation_file, 'r', encoding='utf-8') as citation:
        # Extract the first bibtex block:
        ref = citation.read().partition(".. code:: bibtex\n\n")[2]
        lines = ref.split("\n")
        # Only read the lines which are indented
        lines = lines[:[l.startswith("    ") for l in lines].index(False)]
        ref = textwrap.dedent('\n'.join(lines))
    return ref

__citation__ = __bibtex__ = _get_bibtex()

Is there a good way of using this function without just copying it? Calling the function like

from sunpy import _get_bibtex

__citation__ = _get_bibtex()

and then aiapy.__citation__ would just return the SunPy citation.

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 24, 2020, 20:35

Commented on aiapy/CITATION.rst line 6

Can probably remove this sub-heading

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 24, 2020, 20:35

Commented on aiapy/CITATION.rst line 4

If you use aiapy in your scientific work, we would appreciate you citing it in your publications.

This wording still seems strange...

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 24, 2020, 20:39

We actually already include the sunpy license so copying over this function and modifying it for our purposes should be perfectly fine.

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 20:59

Okay!

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 21:00

Commented on aiapy/CITATION.rst line 4

I agree. It's similar/the same as the wording in https://github.com/sunpy/sunpy/blob/master/sunpy/CITATION.rst

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 21:01

Commented on aiapy/CITATION.rst line 4

changed this line in version 2 of the diff

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 21:01

added 1 commit

Compare with previous version

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 21:01

resolved all threads

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 21:03

Commented on aiapy/CITATION.rst line 6

changed this line in version 3 of the diff

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 21:03

added 1 commit

Compare with previous version

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 21:42

added 1 commit

Compare with previous version

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 21:43

Great, updated the CITATION.rst; added the citation code to __init__.py. I'll look at the docs tomorrow morning

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 22:17

(not sure why it's failing CI though)

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 24, 2020, 22:25

E   FileNotFoundError: [Errno 2] No such file or directory: '/builds/PaulJWright/aiapy/.tox/py37/lib/python3.7/site-packages/aiapy/CITATION.rst'

Hmm, seems it can't find the citation file?

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 22:53

added 1 commit

Compare with previous version

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 23:41

added 1 commit

Compare with previous version

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 24, 2020, 23:42

I think we need to add CITATION.rst to the setup.cfg (see, https://github.com/sunpy/sunpy/commit/19c16046a45cf0b9d6351a642135a8f56d54fb15). If I replace aiapy = data/* with aiapy = CITATION.rst, data/* it passes fine. I am not entirely sure if that's the right way to go about doing it though.

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 24, 2020, 23:51

Yeah I think you're definitely right. By default, any non .py files do not get installed.

What I'm confused by is why those lines don't exist in sunpy now...but honestly I'm not too concerned. I'd just go ahead and modify that line.

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 24:05

added 1 commit

Compare with previous version

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 24:05

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 24:12

I wonder if that's because it's built as part of the docs... here it's not part of the docs yet.

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 25, 2020, 24:15

oooh possible.

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 08:52

added 1 commit

Compare with previous version

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 08:52

unmarked as a Work In Progress

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 08:54

added 1 commit

Compare with previous version

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 09:05

marked as a Work In Progress

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 09:34

unmarked as a Work In Progress

nabobalis commented 3 years ago

In GitLab by @PaulJWright on Sep 25, 2020, 09:42

resolved all threads

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 25, 2020, 10:26

https://aiapy--82.org.readthedocs.build/en/82/index.html Looks good in the docs!

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 25, 2020, 10:28

approved this merge request

nabobalis commented 3 years ago

In GitLab by @wtbarnes on Sep 25, 2020, 10:36

mentioned in commit 60ee010ce34b8e99f8beebc50a239f74404b053f