Skip to content
Snippets Groups Projects
Commit 32b63a51 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Fix for 'nan' in the abstract

parent 5fdea967
No related branches found
No related tags found
No related merge requests found
from myads.query import ADSQueryWrapper from myads.query import ADSQueryWrapper
import yaml import yaml
import sys import sys
import math
# Query papers citing the two SWIFT ADS entries # Query papers citing the two SWIFT ADS entries
query = ADSQueryWrapper(sys.argv[1]) query = ADSQueryWrapper(sys.argv[1])
query_data = query.get("citations(2016pasc.conf....2S) or citations(2018ascl.soft05020S) or citations(2023arXiv230513380S)", fl="title,bibcode,first_author_norm,date,year,author_count,bibstem,abstract,volume,issue,page,citation_count", rows=1000) query_data = query.get("citations(2016pasc.conf....2S) or citations(2018ascl.soft05020S) or citations(2023arXiv230513380S)", fl="title,bibcode,first_author_norm,date,year,author_count,bibstem,abstract,volume,issue,page,citation_count", rows=1000)
paper_list = query_data.papers paper_list = list(query_data.papers)
total_citations = 0 total_citations = 0
# Process the data to make the title a string and not an array of strings # Process the data to make the title a string and not an array of strings
...@@ -17,10 +18,11 @@ for paper in paper_list: ...@@ -17,10 +18,11 @@ for paper in paper_list:
if len(paper.title) == 1: if len(paper.title) == 1:
paper.title = paper.title[0] paper.title = paper.title[0]
paper.bibstem = paper.bibstem[0] paper.bibstem = paper.bibstem[0]
if hasattr(paper, "page"): if hasattr(paper, "page") and "PhDT" not in paper.bibcode:
paper.page = paper.page[0] paper.page = paper.page[0]
if hasattr(paper, "abstract"): if hasattr(paper, "abstract"):
paper.abstract = paper.abstract.replace("<P />", "") if not isinstance(paper.abstract, float):
paper.abstract = paper.abstract.replace("<P />", "")
total_citations += paper.citation_count total_citations += paper.citation_count
paper_list.remove(to_remove) paper_list.remove(to_remove)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment