Skip to content

Instantly share code, notes, and snippets.

@MohamedElashri
Last active February 1, 2025 11:02
Show Gist options
  • Select an option

  • Save MohamedElashri/d193e0afc07a4294a7f5540e2431992a to your computer and use it in GitHub Desktop.

Select an option

Save MohamedElashri/d193e0afc07a4294a7f5540e2431992a to your computer and use it in GitHub Desktop.
use inspirehep api to look into top cited papers in 2024 in hep-ph

INSPIRE HEP-PH Top Papers Analysis

This script fetches and analyzes the top cited High Energy Physics - Phenomenology (HEP-PH) papers from 2024 using the INSPIRE API. It focuses on papers with 10 or fewer authors and generates a detailed table of the most cited papers.

Requirements

  • Python 3.7+
  • Required packages:
    pip install requests pandas tabulate

Usage

  1. Clone or download python script
  2. Run the script:
    python inspire_analysis.py

The script will:

  1. Fetch the top cited HEP-PH papers from 2024
  2. Display a formatted table in the console
  3. Save the data to top_cited_papers_2024.csv

Example Output

Top Most Cited HEP-PH Papers (2024):
╒═════════════════════════════════════════════════════════════════════════════════════════════════════════════╤═════════════════════════════════════════════════════════════╤═════════════╤═══════════════════════════════════════╤═════════╤════════════════════════════════╤════════════╕
│ Title                                                                                                       │ Authors                                                     │  Citations  │ Journal                               │  arXiv  │ DOI                            │ Date       │
╞═════════════════════════════════════════════════════════════════════════════════════════════════════════════╪═════════════════════════════════════════════════════════════╪═════════════╪═══════════════════════════════════════╪═════════╪════════════════════════════════╪════════════╡
│ Cosmological phase transitions: From perturbative particle physics to gravitational waves                   │ Athron, Peter, Balázs, Csaba, Fowlie, Andrew, et al.        │     150     │ Prog.Part.Nucl.Phys. 135 (2024)       │ 2305.02 │ 10.1016/j.ppnp.2023.104094     │ 2023-05-03 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ Gravitational waves from domain wall collapse, and application to nanohertz signals with QCD-coupled axions │ Kitajima, Naoya, Lee, Junseok, Murai, Kai, et al.           │     116     │ Phys.Lett.B 851 (2024)                │ 2306.17 │ 10.1016/j.physletb.2024.138586 │ 2023-06-29 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ Footprints of axion-like particle in pulsar timing array data and James Webb Space Telescope observations   │ Guo, Shu-Yuan, Khlopov, Maxim, Liu, Xuewen, et al.          │     99      │ Sci.China Phys.Mech.Astron. 67 (2024) │ 2306.17 │ 10.1007/s11433-024-2445-1      │ 2023-06-29 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ $\Lambda_b \to \Lambda_c \tau \bar{\nu}_{\tau}$ Decay in the Standard Model and with New Physics            │ Shivashankara, Shanmuka, Wu, Wanwei, Datta, Alakabha        │     94      │ Phys.Rev.D 91 (2015)                  │ 1502.07 │ 10.1103/PhysRevD.109.119904    │ 2015-02-25 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ The standard model effective field theory at work                                                           │ Isidori, Gino, Wilsch, Felix, Wyler, Daniel                 │     92      │ Rev.Mod.Phys. 96 (2024)               │ 2303.17 │ 10.1103/RevModPhys.96.015006   │ 2023-03-29 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ Singlet-assisted electroweak phase transition at two loops                                                  │ Niemi, Lauri, Schicho, Philipp, Tenkanen, Tuomas V.I.       │     90      │ Phys.Rev.D 103 (2021)                 │ 2103.07 │ 10.1103/PhysRevD.103.115035    │ 2021-03-12 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ Fully heavy tetraquark states and their evidences in LHC observations                                       │ liu, Ming-Sheng, Liu, Feng-Xiao, Zhong, Xian-Hui, et al.    │     89      │ Phys.Rev.D 109 (2024)                 │ 2006.12 │ 10.1103/PhysRevD.109.076017    │ 2020-06-21 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ Quantum simulation of fundamental particles and forces                                                      │ Bauer, Christian W., Davoudi, Zohreh, Klco, Natalie, et al. │     89      │ Nature Rev.Phys. 5 (2023) 420         │ 2404.06 │ 10.1038/s42254-023-00599-8     │ 2023-06-21 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ Self-interacting dark matter implied by nano-Hertz gravitational waves                                      │ Han, Chengcheng, Xie, Ke-Pan, Yang, Jin Min, et al.         │     79      │ Phys.Rev.D 109 (2024)                 │ 2306.17 │ 10.1103/PhysRevD.109.115025    │ 2023-06-29 │
├─────────────────────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────┼─────────────┼───────────────────────────────────────┼─────────┼────────────────────────────────┼────────────┤
│ Neutrino Masses from Generalized Symmetry Breaking                                                          │ Cordova, Clay, Hong, Sungwoo, Koren, Seth, et al.           │     78      │ Phys.Rev.X 14 (2024)                  │ 2211.08 │ 10.1103/PhysRevX.14.031033     │ 2022-11-14 │
╘═════════════════════════════════════════════════════════════════════════════════════════════════════════════╧═════════════════════════════════════════════════════════════╧═════════════╧═══════════════════════════════════════╧═════════╧════════════════════════════════╧════════════╛

Detailed data saved to 'top_cited_papers_2024.csv'
import requests
import pandas as pd
from tabulate import tabulate
import time
def fetch_papers(page=1, size=25):
"""
Fetch papers from INSPIRE HEP API with specific criteria
"""
base_url = "https://inspirehep.net/api/literature"
# Query parameters for 2024 hep-ph papers with 1-10 authors
query = "primarch:hep-ph AND tc p AND d 2024 AND ac 1->10"
params = {
"sort": "mostcited",
"size": size,
"page": page,
"q": query,
"fields": "titles,authors,citation_count,arxiv_eprints,dois,publication_info,earliest_date"
}
try:
response = requests.get(base_url, params=params)
response.raise_for_status()
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error fetching data: {e}")
return None
def get_author_names(authors, max_authors=3):
"""
Format author names, showing first max_authors names plus et al. if more exist
"""
if not authors:
return "No authors listed"
author_names = [author.get('full_name', 'Unknown') for author in authors[:max_authors]]
if len(authors) > max_authors:
author_names.append("et al.")
return ", ".join(author_names)
def get_journal_info(publication_info):
"""
Extract formatted journal information
"""
if not publication_info:
return "Preprint"
journal = publication_info[0]
journal_name = journal.get('journal_title', '')
volume = journal.get('journal_volume', '')
pages = journal.get('page_start', '')
year = journal.get('year', '')
if journal_name:
return f"{journal_name} {volume} ({year}) {pages}".strip()
return "Preprint"
def process_papers(n=10):
"""
Process papers and return top n cited papers
"""
papers_data = []
page = 1
print(f"Fetching top {n} cited HEP-PH papers from 2024...")
while len(papers_data) < n:
# Respect rate limits
time.sleep(0.4)
response = fetch_papers(page=page)
if not response or not response['hits']['hits']:
break
for hit in response['hits']['hits']:
metadata = hit['metadata']
paper_info = {
'Title': metadata['titles'][0]['title'] if metadata.get('titles') else 'No title',
'Authors': get_author_names(metadata.get('authors', [])),
'Citations': metadata.get('citation_count', 0),
'Journal': get_journal_info(metadata.get('publication_info')),
'arXiv': metadata['arxiv_eprints'][0]['value'] if metadata.get('arxiv_eprints') else 'N/A',
'DOI': metadata['dois'][0]['value'] if metadata.get('dois') else 'N/A',
'Date': metadata.get('earliest_date', 'Unknown'),
}
papers_data.append(paper_info)
if len(papers_data) >= n:
break
page += 1
return pd.DataFrame(papers_data)
def display_top_papers(df):
"""
Display table of top cited papers
"""
# Sort by citations to ensure proper order
df_sorted = df.sort_values('Citations', ascending=False)
# Print formatted table
print("\nTop Most Cited HEP-PH Papers (2024):")
# Create a more visually appealing table with custom formatting
print(tabulate(df_sorted,
headers='keys',
tablefmt='fancy_grid',
showindex=False,
numalign="center",
stralign="left"))
# Save to CSV
df_sorted.to_csv('top_cited_papers_2024.csv', index=False)
print(f"\nDetailed data saved to 'top_cited_papers_2024.csv'")
def main():
df = process_papers(n=10)
if not df.empty:
display_top_papers(df)
else:
print("No data was processed.")
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment