Skip to content

Instantly share code, notes, and snippets.

@restrepo
Last active December 12, 2022 01:20
Show Gist options
  • Save restrepo/72f460cb01f68b94d755de8164092e9f to your computer and use it in GitHub Desktop.
Save restrepo/72f460cb01f68b94d755de8164092e9f to your computer and use it in GitHub Desktop.
def get_institutions(q):
page=1
if q:
url=f'https://inspirehep.net/api/institutions?q={q}&size=250&page={page}'
else:
url=f'https://inspirehep.net/api/institutions?size=250&page={page}'
r=requests.get(url)
time.sleep(sleep)
i=r.json()['hits']['hits']
total=r.json().get('hits').get('total')
if not page or page==1:
ins=[d.get('metadata') for d in i]
j=page
next=r.json().get('links').get('next')
while next:
print(j)
r=requests.get(next)
time.sleep(sleep)
i=r.json()['hits']['hits']
ins.extend([d.get('metadata') for d in i])
next=r.json().get('links').get('next')
j+=1
if j > total//250:
break
return ins
# Maxium results 10 000 → use main countries
kk=[]
for q in ['','u','england','germany','france','italy','spain','korea','china','japan','united states',
'russia','brazil']:
print(q)
ins=get_institutions(q)
for d in ins:
if d not in kk:
kk.append(d)
print(len(kk))
if len(kk)>11835:
break
legacy_ICN number_of_not_cn_papers number_of_papers
CERN 51756 70745
Fermilab 22038 35249
SLAC 18387 25303
Brookhaven 15710 22932
LBL, Berkeley 15152 24309
DESY 12930 19280
KEK, Tsukuba 12490 20330
Los Alamos 10148 13939
Caltech 8741 15051
Munich, Max Planck Inst. 8011 12765
Maryland U. 7932 13782
Beijing, Inst. High Energy Phys. 7719 14766
UC, Berkeley 7661 11991
Argonne 7496 13146
ICTP, Trieste 7397 8674
Oxford U. 7272 13469
SUNY, Stony Brook 7263 11322
Rome U. 7139 15282
Tokyo U. 7044 11818
Princeton U. 6954 11641
Moscow State U. 6684 11040
Imperial Coll., London 6473 12041
Princeton, Inst. Advanced Study 6347 6668
Harvard U. 6219 9517
MIT, LNS 6170 8576
UCLA 6076 11961
Saclay 6058 8694
SISSA, Trieste 5986 6825
Wisconsin U., Madison 5961 13260
Washington U., Seattle 5645 9523
INFN, Rome 5621 15373
Frascati 5589 15628
Heidelberg U. 5569 11155
Jefferson Lab 5402 7095
Kyoto U. 5384 8819
INFN, Turin 5310 12249
Beijing, Inst. Theor. Phys. 5255 5432
Cambridge U. 5239 8518
Bonn U. 5162 8861
Turin U. 5155 11842
Hamburg U. 5098 10043
Darmstadt, GSI 5095 8622
Valencia U., IFIC 5066 8712
INFN, Pisa 4795 12159
Cambridge U., DAMTP 4766 5075
Munich, Tech. U. 4760 7107
INFN, Trieste 4724 10739
Sao Paulo U. 4687 7481
Frankfurt U. 4645 6012
Kyoto U., Yukawa Inst., Kyoto 4613 4853
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment