; docformat = 'rst' ; ; NAME: ; K2ReadTarget ; PURPOSE: ; Read the list of targets from a K2 Campaign ; ;+ ; :Description: ; Read the list of targets from a K2 Campaign ; ; :Categories: ; K2 ; ; :Params: ; file: in, required, type=string ; The campaign target file in CSV format from http://keplerscience.arc.nasa.gov/ ; ; :Keywords: ; ; :Examples: ; Read target characteristics from Campaign 3:: ; IDL> epic = K2ReadTarget( 'K2Campaign3targets.csv' ) ; ; :Uses: ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Created in July 2016 by B. Carry (OCA) ;- function K2ReadTarget, file ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; COMPILE_OPT hidden, idl2 ;--I.1-- Input checks ------------------------------------------------------------------------ if not keyword_set(file) then begin message, /ioError, 'Input missing: File' return, -1 endif ;--I.2-- File Exists on Disk ----------------------------------------------------------------- if not file_test(file,/read) then begin message, /ioError, 'Input file cannot be read: '+strTrim(file,2) return, -2 endif ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Read , Store, and Return Box File -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--I.1-- Read the File ----------------------------------------------------------------------- readcol, file, delimiter=',', /Silent, skipLine=1, $ format='(D,D,D,F,A)', id, RA, Dec, Kmag, progID ;--I.2-- Prepare Output Structure ------------------------------------------------------------ n=n_elements(id) empty = {epic:0.d, RA:0., Dec:0., Kmag:0., progID:''} res=replicate(empty,n) ;--I.3-- Fill Output Structure --------------------------------------------------------------- res.epic = id res.ra = RA res.dec = Dec res.Kmag = Kmag res.progId = progID ;--I.4-- Return Output Structure ------------------------------------------------------------- return, res end