FUNCTION RD_TAUSCOLIST, DDIR=DDIR, SILENT = SILENT ; ;+ ; NAME: ; RD_TAUSCOLIST ; ; PURPOSE: ; This function reads the contents of the Tau Sco line list ; by Rogerson & Ewell (1985, ApJS, 58, 265; Table 3) from the ; ASCII file "TAUSCO.LIST" into an IDL structure. ; ; CALLING SEQUENCE: ; lines = RD_TAUSCOLIST() ; ; INPUTS: ; None. ; ; KEYWORD PARAMETERS: ; DDIR - string - directory location of the file TAUSCO.LIST ; Default is current working directory. ; SILENT - if set, suppresses output of comment lines ; ; OUTPUTS: ; A named structure is returned, with the following tags: ; 0 lam_obs FLOAT wavelength of observed feature ; 1 lam_lab FLOAT laboratory wavelength ; 2 species STRING ionic species for identified transitions ; 3 multiplet STRING multiplet number, when known ; 4 remarks STRING remarks; see file for details ; These tags correspond directly to the columns in Table 3 of ; Rogerson & Ewell. ; ; SIDE EFFECTS: ; The data in the ASCII file "TAUSCO.LIST" are read into the ; structure named by the user. Useful information is printed ; to the users screen unless the keyword "SILENT" is set. ; ; RESTRICTIONS: ; The IDL Astronomy User's Library procedures must be accessible. ; The only procedure called is "num_lines". ; ; PROCEDURE: ; a) The existence of the input file "TAUSCO.LIST" is confirmed. ; b) The file is read into a string array. Comment lines are extracted. ; c) The string array is parsed column-wise in to vectors, which are ; converted to numbers as required. ; d) The vectors are returned to the calling procedure or command line ; in a compact data structure. ; e) Helpful information is printed to the screen. ; ; ADDITIONAL NOTES: ; All the columns in Table 3 of Rogerson & Ewell contain null ; entries. In the present table, these are coded as O.0 for ; floating numbers and as blank strings ('') in the case of strings. ; For many applications, the user may have to screen for these values. ; ; MODIFICATION HISTORY: ; Written by: Alex Fullerton (JHU/UVic) 2001-11-12. ;- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Set default directory location IF NOT KEYWORD_SET( ddir ) THEN ddir = '' ; Create default output structure d = CREATE_STRUCT( 'lam_obs', 0., $ 'lam_lab', 0., $ 'species', ' ', $ 'multiplet', ' ', $ 'remarks', ' ' ) ; Check that file can be found dfil = 'TAUSCO.LIST' clist = FINDFILE( ddir + dfil, COUNT=check ) IF ( check[0] NE 1 ) THEN BEGIN PRINT PRINT,' RD_TAUSCOLIST: file not found - ' + ddir + dfil PRINT RETURN, d ENDIF ; Read the file as a string array. nl = numlines( ddir + dfil ) tmp = STRARR( nl ) OPENR, unit, ddir + dfil, /GET_LUN READF, unit, tmp FREE_LUN, unit ; Locate the comment lines. a = WHERE( STRMID( tmp, 0, 1 ) EQ '#' ) nn = N_ELEMENTS( a ) info = tmp[ a[0:nn-2] ] ; Strip comment lines from string array. a = WHERE( STRMID( tmp, 0, 1 ) NE '#' ) IF ( a[0] NE -1 ) THEN tmp = tmp[ a ] ; Extract columns from the string array. Convert to numbers as appropriate. lobs = FLOAT( STRTRIM( STRMID( tmp, 0, 8 ), 2 ) ) llab = FLOAT( STRTRIM( STRMID( tmp, 11, 8 ), 2 ) ) lid = STRTRIM( STRMID( tmp, 21, 6 ), 2 ) mnum = FLOAT( STRTRIM( STRMID( tmp, 32, 6 ), 2 ) ) lrem = STRTRIM( STRMID( tmp, 40, 1 ), 2 ) ; Pack into a structure for output. dd = REPLICATE( d, N_ELEMENTS( lobs ) ) dd.lam_obs = lobs dd.lam_lab = llab dd.species = lid dd.multiplet = mnum dd.remarks = lrem ; Print information about the data. IF NOT KEYWORD_SET( silent ) THEN BEGIN PRINT PRINT, info PRINT ENDIF RETURN, dd END