;--- Convert a list of txt entries into the SQL file ;- produce the figures of citation doPubli = 01 doTalks = 0 doH = 0 ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; spawn, 'hostname', host case strTrim(host) of 'raul': root = '/var/www/html/' 'hyperion': root = '/var/www/html/' ; 'hyperion': root = '/home/bcarry/Documents/web/' 'endymion': root = '/srv/www/htdocs/' else: stop endcase ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Create Individual Graphs for Each Publication -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; if doPubli eq 1 then begin print, '' print, ' Compile citations in publications' cwd = root+'publication/sql/refereed/' ;--II-- Read & prepare ;--II.1-- Read list of publications readcol, cwd+'list.ref', pub, format='(A)',/Silent nbPub = n_elements( pub ) ;--II.2-- Output structure empty={ads:'',year:0,month:'',published:0,first:0,journal:'',author:'',title:'',$ volume:'',pages:'',pdf:'',graph:'',abstract:''} ref = replicate( empty, nbPub ) ;--II.3-- SQL in files: import and update openw, idS, cwd+'in.refereed.sql', /get_lun printf, idS, 'INSERT INTO refereed (id,ads,year,month,published,first,citation,journal,author,title,volume,pages,pdf,graph,abstract)' printf, idS, 'VALUES' openw, idC, cwd+'cit.refereed.sql', /get_lun ;--II.4-- Loop over references citArr = intarr(nbPub) for kPub=0, nbPub-1 do begin iFile = pub[kPub]+'.txt' ;--II.4.1-- Read biblio entry loc = readBiblioEntry( cwd+iFile ) loc.id = pub[kPub] print, loc.id ;--II.4.2-- Create citation graphic if ~strcmp(loc.ads,'') then begin cit = getAuthorCitations(loc,/Plot) if file_test( loc.id+'.png', /read) then $ if ~strcmp( loc.id+'.png', loc.link.graph) then $ spawn, 'mv '+loc.id+'.png '+cwd+loc.link.graph citArr[kPub] = n_elements( cit ) if citArr[kPub] eq 1 then begin if strcmp(cit[0].ads,'') then citArr[kPub]=0 endif endif ;--II.4.3-- Add entry to SQL command if kPub eq nbPub-1 then sEnd='");' else sEnd='"),' printf, idS, '('+strtrim(string(kPub,format='(I)'),2)+',"' + $ loc.ads + '",' + $ string(loc.year,format='(I4)') + ',"' + $ loc.month + '",' + $ string(loc.published,format='(I1)') + ',' + $ string(loc.first,format='(I1)') + ',' + $ strtrim(string(citArr[kPub],format='(I)'),2)+ ',"' + $ loc.journal + '","' + $ loc.author + '","' + $ loc.title + '","' + $ loc.volume + '","' + $ loc.pages + '","' + $ loc.link.pdf + '","' + $ loc.link.graph + '","' + $ loc.abstract + sEnd ;--II.4.4-- Add citation update command printf, idC, 'UPDATE refereed SET citation='+strtrim(string(citArr[kPub],format='(I)'),2)+$ ' WHERE ads="'+loc.ads+'";' endfor close, idS free_lun, idS close, idC free_lun, idC endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Create Individual Graphs for Each Talk/Poster -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; if doTalks eq 1 then begin print, '' print, ' Compile citations in contributions' ;--III.1-- Read list of publications ------------------------------------------------------- cwd = root+'publication/sql/contrib/' readcol, cwd+'list.con', pub, format='(A)',/Silent nbPub = n_elements( pub ) ;--III.2-- Output structure ---------------------------------------------------------------- ; empty={ads:'',year:0,month:'',published:0,first:0,journal:'',author:'',title:'',$ ; volume:'',pages:'',pdf:'',graph:'',abstract:''} ; empty={ads:'',year:0,month:'',first:0,meeting:'',author:'',title:'',graph:'',abstract:''} ; ref = replicate( empty, nbPub ) ;--III.3-- SQL in files: import and update ------------------------------------------------- openw, idS, cwd+'in.contrib.sql', /get_lun printf, idS, 'INSERT INTO contributed (id,ads,year,month,first,meeting,author,title,graph,abstract)' printf, idS, 'VALUES' openw, idC, cwd+'cit.contrib.sql', /get_lun ;--III.4-- Loop over references ------------------------------------------------------------ citArr = intarr(nbPub) for kPub=0, nbPub-1 do begin iFile = pub[kPub]+'.txt' ;--III.4.1-- Read biblio entry loc = readBiblioEntry( cwd+iFile ) loc.id = pub[kPub] print, loc.id ;--III.4.2-- Create citation graphic ; if ~strcmp(loc.ads,'') then begin ; cit = getAuthorCitations(loc,/Plot) ; if file_test( loc.id+'.png', /read) then $ ; if ~strcmp( loc.id+'.png', loc.link.graph) then spawn, 'mv '+loc.id+'.png '+cwd+loc.link.graph ; citArr[kPub] = n_elements( cit ) ; if citArr[kPub] eq 1 then begin ; if strcmp(cit[0].ads,'') then citArr[kPub]=0 ; endif ; endif ;---- pas tres utile pour les talks..... ;--III.4.3-- Add entry to SQL command if kPub eq nbPub-1 then sEnd='");' else sEnd='"),' printf, idS, '('+strtrim(string(kPub,format='(I)'),2)+',"' + $ loc.ads + '",' + $ string(loc.year,format='(I4)') + ',"' + $ loc.month + '",' + $ string(loc.first,format='(I1)') + ',"' + $ loc.meeting + '","' + $ loc.author + '","' + $ loc.title + '","' + $ loc.link.graph + '","' + $ loc.abstract + sEnd ;--III.4.4-- Add citation update command printf, idC, 'UPDATE contributed SET citation='+strtrim(string(citArr[kPub],format='(I)'),2)+$ ' WHERE ads="'+loc.ads+'";' endfor free_lun, idS free_lun, idC ;--III.5-- Loop over references ------------------------------------------------------------ openw, idS, cwd+'up.summary.sql', /get_lun printf, idS, 'UPDATE summary SET nbContrib='+strtrim(string(nbPub,format='(I)'),2) free_lun, idS endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- IV -- H-Index and History -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; if doH eq 1 then begin print, '' print, ' Build H index' cwd = root+'publication/sql/refereed/' ;--IV.1-- Create Record, Citation, H-Index Figures ------------------------------------------ ref = getAuthorRecord('carry, b', /refereed) cit = getAuthorCitations(ref, hIndex=vecCit ) refWithGolfer = [ref[0],ref] refWithGolfer[0].year=2006 plotBiblioYear, refWithGolfer, cwd+'PublicationHistory.png', cumulative=cit plotHindex, ref, vecCit, cwd+'hIndex.png', /yLog ;---version ERC ; ind=[indgen(8),9,14+indgen(13),28,29,30,32,33,36+indgen(51)] ; noGaia = ref[ind] ; cit = getAuthorCitations(noGaia, hIndex=vecCit ) ; v2=[vecCit,indgen(9)] ; ; refWithGolfer = [ref[0],ref] ; refWithGolfer[0].year=2006 ; ; ; plotBiblioYear, refWithGolfer, cwd+'PublicationHistory.png', cumulative=cit ; plotHindex, ref, v2, cwd+'hIndex.png', /yLog ;stop ;--IV.2-- Set Summary File ------------------------------------------------------------------ ;--IV.2.1-- Refereed articles & Citations nbRef = n_elements(ref) nbCit = n_elements(cit) ;--IV.2.2-- H-Index xArr = indgen(nbRef) ord = reverse(sort(vecCit)) diff = vecCit[ord] - xArr trash = max( where(diff ge 0), pH ) hIndex = xArr[ph] nowJD = systime(/Julian) nowISO= strmid(date_conv(nowJD,'FITS'),0,10) openw, idS, cwd+'in.summary.sql', /get_lun printf, idS, 'UPDATE summary SET'+$ ' nbRefereed='+strtrim(string(nbRef,format='(I)'),2)+$ ', nbCitation='+strtrim(string(nbCit,format='(I)'),2)+$ ', H='+strtrim(string(hIndex,format='(I)'),2)+$ ", date='"+nowISO+"'" close, idS free_lun, idS endif end