;+ ; NAME: ; oc_star_apply_pm ; ; PURPOSE: ; Apply proper motion to a star ; ; DESCRIPTION: ; Apply proper motion to a star ; ; CALLING SEQUENCE: ; star_et = oc_star_apply_pm(star, et) ; ; INPUTS: ; star - star structure or array of structures ; et - ephemeris time (seconds TDB after J2000) ; ; OPTIONAL INPUT PARAMETERS: ; None ; ; KEYWORDS: ; None ; ; OUTPUTS: ; If et is a scalar and star is a single structure then ; return a star structure ; ; If et is an array and the star is a single structure ; then return [star_0,star_1,...] where star_i is for et[i] ; ; If et is a scalar and the star is an array of structures ; then return [ star_0, star_1, ... ] where star_i is for star[i] ; ; If both et and the star are arrays ; then return [ star_0, star_1, ... ] where star_i is for et[i], star[i] ; (if they are different lengths, then do up to the minimum) ; ; REVISON HISTORY: ; 2006 Mar 08 Leslie Young. ; 2006 Mar 21 Henry Throop. Modified to return proper ET. ;- function oc_star_apply_pm, starin, et net = n_elements(et) nstar = n_elements(starin) star = starin ; Call the routine to calculate the new RA/DEC/ERR. ; That routine returns the RA/DEC/ERR only, but does *not* ; populate the structure. ; Populate the structure with the new RA/DEC/ERR. ; One ET, one star if (net eq 1) and (nstar eq 1) then begin radec = oc_star_radec(et, starin, dradec, radecerr) for i = 0L, nstar-1 do begin star[i].ra = radec[0,i] star[i].dec = radec[1,i] star[i].raerr = radecerr[0,i] star[i].decerr = radecerr[1,i] endfor star.et = et end ; Many ET's, one star if (net gt 1) and (nstar eq 1) then begin star = replicate(star, net) radec = oc_star_radec(et, starin, dradec, radecerr) for i = 0L, net-1 do begin star[i].ra = radec[0,i] star[i].dec = radec[1,i] star[i].raerr = radecerr[0,i] star[i].decerr = radecerr[1,i] star[i].et = et[i] endfor end ; One ET, many stars if (net eq 1) and (nstar gt 1) then begin radec = oc_star_radec(et, starin, dradec, radecerr) for i = 0L, nstar-1 do begin star[i].ra = radec[0,i] star[i].dec = radec[1,i] star[i].raerr = radecerr[0,i] star[i].decerr = radecerr[1,i] star[i].et = et endfor end ; Many ET, many stars if (net gt 1) and (nstar gt 1) then begin radec = oc_star_radec(et, starin, dradec, radecerr) for i = 0L, max([nstar-1, net-1]) do begin star[i].ra = radec[0,i] star[i].dec = radec[1,i] star[i].raerr = radecerr[0,i] star[i].decerr = radecerr[1,i] star[i].et = et[i] endfor end return, star end