; docformat = 'rst' ; ; NAME: ; biblioLoadConfig ; PURPOSE: ; Store the configuration file of bibliometry tools in a structure ; ;+ ; :Description: ; Store the configuration file of bibliometry tools in a structure ; ; :Categories: ; Bibliometry ; ; :Params: ; file: in, required, type=string ; Path to the configuration file to load ; config: in, optional, type=structure ; A pre-existing structure to complete with configuration data ; ; :Returns: A structure containing the configuration information. If a ; structure was provided upon input, the result are merged. Fields are:: ; .refereed: Plot style for refereed publications ; .color : Color for lines and symbols (see Coyote Graphics: cgColor) ; .symbol: Symbol label (see Coyote Graphics: cgSymCat) ; .size : Symbol scale factor ; .thick : Line thickness ; .line : Line style ; .invited: Plot style for invited talks ; .color : Color for lines and symbols (see Coyote Graphics: cgColor) ; .symbol: Symbol label (see Coyote Graphics: cgSymCat) ; .size : Symbol scale factor ; .thick : Line thickness ; .line : Line style ; .contributed: Plot style for contributed talks ; .color : Color for lines and symbols (see Coyote Graphics: cgColor) ; .symbol: Symbol label (see Coyote Graphics: cgSymCat) ; .size : Symbol scale factor ; .thick : Line thickness ; .line : Line style ; ; :Uses: ; updateStructure, lineStyleID ; ; :Author: ; B. Carry (OCA) ; ; :History: ; Change History:: ; Original Version written in October 2015, B. Carry (OCA) ; 2016 July - B. Carry (OCA) - Corrected bug for H-index ;- function biblioLoadConfig, file, config ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 ;--I.1-- Presence of Arguments -------------------------------------------------- if not keyword_set(file) then begin message, /IOERROR, ' Syntax - config = biblioLoadConfig( file [,config])' return, -1 endif ;--I.2-- Input Configuration File ----------------------------------------------- if not file_test(file,/READ) then begin message, ' Configuration file not found: '+strtrim(file,2) return, -2 endif ;--I.3-- Output Structure ------------------------------------------------------- empty={color: 'black' , $ ;-Line & Symbol Color (Coyote Graphics) symbol: 'circle', $ ;-Symbol label (Coyote Graphics) size: 1. , $ ;-Symbol Size thick: 1. , $ ;-Line thickness line: 0 } ;-Line style (IDL default) style ={refereed: empty, $ ;-Refereed publications invited: empty, $ ;-Invited talks contributed: empty,$ ;-Contributed talks citations: empty, $ ;-Citations hIndex: empty } ;-H-Index ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Read Input Configuration File -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--II.1-- Open File and Loop over Lines ---------------------------------------- openr, inputFile, file, /GET_LUN line = ' ' section = ' ' while ~EOF(inputFile) do begin ;--II.2-- Read Current Line ---------------------------------------------------- readf, inputFile, line ;--II.3-- Selection of Section ------------------------------------------------- if strmid(line,0,1) eq '[' then begin split = strsplit(line, '[]', /EXTRACT ) section = strlowcase(split[0]) ;--II.4-- Analysis of Section -------------------------------------------------- endif else begin split=strsplit(line, '=;\', /EXTRACT, count=nbField ) key = strlowcase(strtrim(split[0],2)) CASE section OF ;--II.4.1-- Refereed Publications 'refereed': BEGIN CASE key OF 'color' : style.refereed.color = strtrim(split[1],2) 'symbol': style.refereed.symbol = strtrim(split[1],2) 'size' : style.refereed.size = float(split[1]) 'thick' : style.refereed.thick = float(split[1]) 'line' : style.refereed.line = lineStyleID(split[1]) ELSE: ENDCASE END ;--II.4.2-- Invited talks 'invited': BEGIN CASE key OF 'color' : style.invited.color = strtrim(split[1],2) 'symbol': style.invited.symbol = strtrim(split[1],2) 'size' : style.invited.size = float(split[1]) 'thick' : style.invited.thick = float(split[1]) 'line' : style.invited.line = lineStyleID(split[1]) ELSE: ENDCASE END ;--II.4.3-- Invited talks 'contributed': BEGIN CASE key OF 'color' : style.contributed.color = strtrim(split[1],2) 'symbol': style.contributed.symbol = strtrim(split[1],2) 'size' : style.contributed.size = float(split[1]) 'thick' : style.contributed.thick = float(split[1]) 'line' : style.contributed.line = lineStyleID(split[1]) ELSE: ENDCASE END ;--II.4.4-- Citations 'citations': BEGIN CASE key OF 'color' : style.citations.color = strtrim(split[1],2) 'symbol': style.citations.symbol = strtrim(split[1],2) 'size' : style.citations.size = float(split[1]) 'thick' : style.citations.thick = float(split[1]) 'line' : style.citations.line = lineStyleID(split[1]) ELSE: ENDCASE END ;--II.4.5-- H-Index 'h-index': BEGIN CASE key OF 'color' : style.hIndex.color = strtrim(split[1],2) 'symbol': style.hIndex.symbol = strtrim(split[1],2) 'size' : style.hIndex.size = float(split[1]) 'thick' : style.hIndex.thick = float(split[1]) 'line' : style.hIndex.line = lineStyleID(split[1]) ELSE: ENDCASE END ELSE: ENDCASE endelse endwhile close, inputFile free_lun, inputFile ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Concatenation with Pre-Existing Structure -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--III.1-- Complete Input Configuration if Provided ----------------------------- if keyword_set(config) then begin config = updateStructure( config, style ) endif else config = style ;--III.2-- Return Configuration Structure --------------------------------------- return, config end