; docformat = 'rst' ; ; NAME: ; K2ReadSsoBox ; PURPOSE: ; Read box coordinates information for K2/SSO processing ; ;+ ; :Description: ; Read box coordinates information for K2/SSO processing ; ; :Categories: ; K2 ; ; :Returns: ; A structure with the box coordinates. ; ; :Params: ; file: in, required, type=string ; Path to the box coordinates file ; ; :Keywords: ; ; :Examples: ; Read the box coordinates for a given target:: ; IDL> box = K2ReadSsoBox( 'Jimihendrix.box' ) ; ; :Uses: ; readcol ; ; :Author: ; B.Carry (OCA) ; ; :History: ; Change History:: ; Created in July 2016 by B. Carry (OCA) ;- function K2ReadSsoBox, 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-- Input checks ------------------------------------------------------------------------ readcol, file, delimiter=',', /Silent, skipLine=1, $ format='(D,D,D,D,F,'+$ 'D,D,D,F,F,F,D,D,D,'+$ 'D,D,D,D,D,D,D,D,A)', $ id, jd, boxRa, boxDec, Kmag, $ ssoRA, ssoDec, ssoDist, ssoV, ssoPhase, ssoElong, muRA, muDec, muRad, $ urRA, urDec, ulRA, ulDec, lrRa, lrDec, llRa, llDec, name ;--I.2-- Prepare Output Structure ------------------------------------------------------------ n=n_elements(jd) rd={ra:0.,dec:0.} empty = {epic:0.d, jd:0., star:{RA:0., Dec:0., Kmag:0.}, $ sso:{name:'', ra:0., dec:0., dist:0., Vmag:0., phase:0., elong:0., muRA:0., muDec:0., muRad:0.}, $ box:{UL:rd, UR:rd, LL:rd, LR:rd}} res=replicate(empty,n) ;--I.3-- Fill Output Structure --------------------------------------------------------------- res.epic = id res.jd = jd res.star.ra = boxRA res.star.dec = boxDec res.star.Kmag = Kmag res.sso.name = name res.sso.ra = ssoRA res.sso.dec = ssoDec res.sso.dist = ssoDist res.sso.Vmag = ssoV res.sso.phase = ssoPhase res.sso.elong = ssoElong res.sso.muRA = muRA res.sso.muDec = muDec res.sso.muRad = muRad res.box.UL.ra = ulRA res.box.UL.dec= ulDec res.box.UR.ra = urRA res.box.UR.dec= urDec res.box.LL.ra = llRA res.box.LL.dec= llDec res.box.LR.ra = lrRA res.box.LR.dec= lrDec ;--I.4-- Return Output Structure ------------------------------------------------------------- return, res end