;+ ; NAME: ; oc_getstar_ty2 ; ; PURPOSE: (one line) ; Returns Tycho-2 star structures given their ID's. ; ; DESCRIPTION: ; Returns a fully-populated Tycho-2 star structure for each ID supplied. ; The ID's must be in the Tycho-2 format. The star structure is returned in ; the standard format, and includes the raw Tycho-2 data as well as ; standard-format RA, DEC, magnitudes, etc. ; ; The Tycho-2 Supplement is not searched. ; ; CATEGORY: ; Star catalogs. ; ; CALLING SEQUENCE: ; oc_getstar_tyc2, ids [, NSTARS=nstars] [, /VERBOSE] ; ; INPUTS: ; ids -- Tycho-2 id's in string format. Can be either scalar or vector. ; ; OPTIONAL INPUT PARAMETERS: ; None ; ; KEYWORD INPUT PARAMETERS: ; VERBOSE -- Print messages about incorrect/missing ID's to screen if set. ; ; KEYWORD OUTPUT PARAMETERS: ; NSTARS -- Returns the number of successfully-retrieved stars ; ; OUTPUTS: ; Structures of type 'star' with fields filled in. ; Returns either a vector or a scalar depending on input value 'ids'. ; Length of returned value is the same as that of input 'ids.' ; The field star.tyc2.record is the Tycho-2 catalog entry line. ; The remaining fields in star.tyc2.* are exactly as described in the ; Vizier Tycho-2 'ReadMe' file. ; ; If a star is not found, that entry is blank. ; ; COMMON BLOCKS: ; None ; ; SIDE EFFECTS: ; None ; ; RESTRICTIONS: ; Tycho-2 catalog must be available at $WCS_CATDIR/tyc2/catalog.dat . ; ; EXAMPLE: ; print, oc_getstar_tyc2(['9537-003881', '9537-00309'], nst=nst, /VERB) ; ; MODIFICATION HISTORY: ; Written 18-Oct-2005 by Henry Throop, SwRI ; Modified 30-Nov-2005 by HBT. Fixed to properly parse TYC/HIP/CCDM fields. ; Modified 7-Dec-2005 by HBT. Fixed to handle unfound stars. ; Modified 8-Dec-2005 by HBT. Fixed units for position error and pm. ; Modified 23-Feb-2006 by HBT. Improved documentation and formatting. ; Modified 28-Feb-2006 by HBT. Fixed to handle missing positions (pflag='X') ; Modified 24-Mar-2006 by HBT. Added handling of proper motion with ; ETPM, ra_etpm, etc. ; Modified 14-Apr-2006 by Leslie Young. Made loop index long. ; ;- function oc_getstar_tyc2, ids, NSTARS=nstars, VERBOSE=verbose ; ** Description of Tycho-2 file format, from Vizier's ReadMe ** ; ; -------------------------------------------------------------------------------- ; Bytes Format Units Label Explanations ; -------------------------------------------------------------------------------- ; 1- 4 I4 --- TYC1 [1,9537]+= TYC1 from TYC or GSC (1) ; 6- 10 I5 --- TYC2 [1,12121] TYC2 from TYC or GSC (1) ; 12 I1 --- TYC3 [1,3] TYC3 from TYC (1) ; 14 A1 --- pflag [ PX] mean position flag (2) ; 16- 27 F12.8 deg RAmdeg []? Mean Right Asc, ICRS, epoch=J2000 (3) ; 29- 40 F12.8 deg DEmdeg []? Mean Decl, ICRS, at epoch=J2000 (3) ; 42- 48 F7.1 mas/yr pmRA ? Proper motion in RA*cos(dec) (12) ; 50- 56 F7.1 mas/yr pmDE ? Proper motion in Dec (12) ; 58- 60 I3 mas e_RAmdeg [3,183]? s.e. RA*cos(dec),at mean epoch (5) ; 62- 64 I3 mas e_DEmdeg [1,184]? s.e. of Dec at mean epoch (5) ; 66- 69 F4.1 mas/yr e_pmRA [0.2,11.5]? s.e. prop mot in RA*cos(dec)(5) ; 71- 74 F4.1 mas/yr e_pmDE [0.2,10.3]? s.e. of proper motion in Dec(5) ; 76- 82 F7.2 yr EpRAm [1915.95,1992.53]? mean epoch of RA (4) ; 84- 90 F7.2 yr EpDEm [1911.94,1992.01]? mean epoch of Dec (4) ; 92- 93 I2 --- Num [2,36]? Number of positions used ; 95- 97 F3.1 --- q_RAmdeg [0.0,9.9]? Goodness of fit for mean RA (6) ; 99-101 F3.1 --- q_DEmdeg [0.0,9.9]? Goodness of fit for mean Dec (6) ; 103-105 F3.1 --- q_pmRA [0.0,9.9]? Goodness of fit for pmRA (6) ; 107-109 F3.1 --- q_pmDE [0.0,9.9]? Goodness of fit for pmDE (6) ; 111-116 F6.3 mag BTmag [2.183,16.581]? Tycho-2 BT magnitude (7) ; 118-122 F5.3 mag e_BTmag [0.014,1.977]? s.e. of BT (7) ; 124-129 F6.3 mag VTmag [1.905,15.193]? Tycho-2 VT magnitude (7) ; 131-135 F5.3 mag e_VTmag [0.009,1.468]? s.e. of VT (7) ; 137-139 I3 0.1arcsec prox [3,999] proximity indicator (8) ; 141 A1 --- TYC [T] Tycho-1 star (9) ; 143-148 I6 --- HIP [1,120404]? Hipparcos number ; 149-151 A3 --- CCDM CCDM component identifier for HIP stars(10) ; 153-164 F12.8 deg RAdeg Observed Tycho-2 Right Ascension, ICRS ; 166-177 F12.8 deg DEdeg Observed Tycho-2 Declination, ICRS ; 179-182 F4.2 yr EpRA-1990 [0.81,2.13] epoch-1990 of RAdeg ; 184-187 F4.2 yr EpDE-1990 [0.72,2.36] epoch-1990 of DEdeg ; 189-193 F5.1 mas e_RAdeg s.e.RA*cos(dec), of observed Tycho-2 RA (5) ; 195-199 F5.1 mas e_DEdeg s.e. of observed Tycho-2 Dec (5) ; 201 A1 --- posflg [ DP] type of Tycho-2 solution (11) ; 203-206 F4.1 --- corr [-1,1] correlation (RAdeg,DEdeg) ; -------------------------------------------------------------------------------- catalog = 'tyc2/catalog.dat' path_catalog = getenv('WCS_CATDIR') d2r = 2*!dpi / 360d ; Degrees -> radians as2d = 1/(60d * 60d) ; Arcsec -> degrees mas2d = as2d / 1000d ; mArcsec -> degrees mas2r = mas2d*d2r ; mArcsec -> radians yr2sec = 31557600d ; Year -> seconds. ; 31557600 from cspice_jyear(). ; Initialize all of the proper *STAR* variables idcat = '' id = '' poscat = '' et = 0d ra = 0d dec = 0d raerr = 0d decerr = 0d radot = 0d decdot = 0d radoterr = 0d decdoterr = 0d etpm = [0d, 0d] ; ET at which PM=0 ra_etpm = 0d ; RA at PM=0 dec_etpm = 0d ; DEC at PM=0 raerr_etpm = 0d ; RA err at PM=0 decerr_etpm = 0d ; Dec err at PM=0 magcat = ['', ''] magname = ['', ''] mag = [0d, 0d] magerr = [0d, 0d] SpTcat = '' SpT = '' notecat = [''] note = [''] ; Initialize all of the proper *TYC2* variables. All values are kept as their ; original format, even if this is a little unusual. TYC1_ = 0L ; was TYC1 TYC2_ = 0L ; was TYC2, but a conflict with structure tyc2 TYC3_ = 0L ; was TYC3 pflag = '' RAmdeg = 0d DEmdeg = 0d pmRA = 0d pmDE = 0d e_RAmdeg = 0d e_DEmdeg = 0d e_pmRA = 0d e_pmDE = 0d EpRAm = 0d EpDEm = 0d Num = 0 q_RAmdeg = 0d q_DEmdeg = 0d q_pmRA = 0d q_pmDE = 0d BTmag = 0d e_BTmag = 0d VTmag = 0d e_VTmag = 0d prox = 0 TYC = '' HIP = 0L CCDM = '' RAdeg = 0d DEdeg = 0d EpRA_1990 = 0d ; was Ep_RA-1990 EpDE_1990 = 0d ; was Ep_DE-1990 e_RAdeg = 0d e_DEdeg = 0d posflg = '' corr = 0d ; Not a tyc2 field. This field stores the entire TYC2 catalog line entry. record = '' tyc2 = {tyc1_:tyc1_, tyc2_:tyc2_, tyc3_:tyc3_, $ pflag:pflag, RAmdeg:RAmdeg, DEmdeg:DEmdeg, pmRA:pmRA, pmDE:pmDE, $ e_RAmdeg:e_RAmdeg, e_DEmdeg:e_DEmdeg, e_pmRA:e_pmRA, e_pmDE:e_pmDE, $ EpRAm:EpRAm, EpDEm:EpDEm, Num:Num, q_RAmdeg:q_RAmdeg, $ q_DEmdeg:q_DEmdeg, q_pmRA:q_pmRA, q_pmDE:q_pmDE, BTmag:BTmag, $ e_BTmag:e_BTmag, VTmag:VTmag, e_VTmag:e_VTmag, prox:prox, TYC:TYC, $ HIP:HIP, CCDM:CCDM, RAdeg:RAdeg, DEdeg:DEdeg, EpRA_1990:EpRA_1990, $ EpDE_1990:EpDE_1990, e_RAdeg:e_RAdeg, e_DEdeg:e_DEdeg, $ posflg:posflg, corr:corr, record:record} star = {idcat:idcat, id:id, poscat:poscat, et:et, $ ra:ra, dec:dec, raerr:raerr, decerr:decerr, radot:radot, $ decdot:decdot, radoterr:radoterr, decdoterr:decdoterr, $ etpm:etpm, ra_etpm:ra_etpm, dec_etpm:dec_etpm, $ raerr_etpm:raerr_etpm, decerr_etpm:decerr_etpm, $ magcat:magcat, magname:magname, mag:mag, magerr:magerr, $ sptcat:sptcat, spt:spt, notecat:notecat, note:note, $ tyc2:tyc2} tyc2_init = tyc2 star_init = star num_ids = sizex(ids) stars = make_array(num_ids, value=star) ; Get the catalog entry line for each star lines = oc_getline_tyc2(ids, nstars=nstars, verbose=verbose) ; Set the string from the Vizier ReadMe catalog description file string_tyc2 = '(I4, X, I5, X, I1, X, A1, X, F12.8, X, ' + $ 'F12.8, X, F7.1, X, F7.1, X, I3, X, I3, X, F4.1, X, ' + $ 'F4.1, X, F7.2, X, F7.2, X, I2, X, F3.1, X, ' + $ 'F3.1, X, F3.1, X, F3.1, X, F6.3, X, F5.3, X, ' + $ 'F6.3, X, F5.3, X, I3, X, A1, X, I6, ' + $ 'A3, X, F12.8, X, F12.8, X, F4.2, X, F4.2, X, ' + $ 'F5.1, X, F5.1, X, A1, X, F4.1)' ; Note that as by the Vizier specification, all fields are separated by '|' ; except for fields TYC and HIP, which are separated by nothing. ; Loop over every star and fill in the fields for i = 0L, num_ids-1 do begin id = ids[i] line = lines[i] ; Parse the raw catalog line into a bunch of variables if (line eq '') then begin star = oc_star_set_empty(star_init) goto, parse_end end reads, line, format=string_tyc2, tyc1_, tyc2_, tyc3_, $ pflag, RAmdeg, DEmdeg, pmRA, pmDE, e_RAmdeg, e_DEmdeg, $ e_pmRA, e_pmDE, EpRAm, EpDEm, Num, q_RAmdeg, q_DEmdeg, $ q_pmRA, q_pmDE, BTmag, e_BTmag, VTmag, e_VTmag, prox, TYC, HIP, CCDM, $ RAdeg, DEdeg, EpRA_1990, EpDE_1990, e_RAdeg, e_DEdeg, posflg, corr ; Clear the star structure, then stick each variable into its proper *TYC2* ; structure location tyc2 = tyc2_init star = star_init tyc2.record = line tyc2.tyc1_ = tyc1_ tyc2.tyc2_ = tyc2_ tyc2.tyc3_ = tyc3_ tyc2.pflag = pflag tyc2.RAmdeg = RAmdeg tyc2.DEmdeg = DEmdeg tyc2.pmRA = pmRA tyc2.pmDE = pmDE tyc2.e_RAmdeg = e_RAmdeg tyc2.e_DEmdeg = e_DEmdeg tyc2.e_pmRA = e_pmRA tyc2.e_pmDE = e_pmDE tyc2.EpRAm = EpRAm tyc2.EpDEm = EpDEm tyc2.Num = Num tyc2.q_RAmdeg = q_RAmdeg tyc2.q_DEmdeg = q_DEmdeg tyc2.q_pmRA = q_pmRA tyc2.q_pmDE = q_pmDE tyc2.BTmag = BTmag tyc2.e_BTmag = e_BTmag tyc2.VTmag = VTmag tyc2.e_VTmag = e_VTmag tyc2.prox = prox tyc2.TYC = TYC tyc2.HIP = HIP tyc2.CCDM = CCDM tyc2.RAdeg = RAdeg tyc2.DEdeg = DEdeg tyc2.EpRA_1990 = EpRA_1990 tyc2.EpDE_1990 = EpDE_1990 tyc2.e_RAdeg = e_RAdeg tyc2.e_DEdeg = e_DEdeg tyc2.posflg = posflg tyc2.corr = corr ; Process the variables and stick them all into the proper *STAR* structure ; location. No precession or PM is necessary, since TYC2 is already in J2000. ; Convert RA to radians star.ra = RAmdeg*d2r star.dec = DEmdeg*d2r star.idcat = 'tyc2' star.id = st(tyc2.tyc1_) + '-' + st(tyc2.tyc2_) + $ '-' + st(tyc2.tyc3_) star.poscat = 'tyc2' ; Epoch of original obs, for proper motion corrections. ; star.et is seconds before 2000. For TYC2 catalog, ; default ET is 0 (i.e., year 2000). star.et = 0d ; Error of RA*cos(Dec). See ReadMe. Convert to radians. ; TYC2 already includes cos(Dec). star.raerr_etpm = e_RAmdeg*mas2d*d2r ; Error of Dec star.decerr_etpm = e_DEmdeg*mas2d*d2r ; Proper motion, mas/yr. Convert mas/yr -> radians/sec ; TYC2 already includes cos(Dec) in RA. star.radot = pmRA*mas2r/yr2sec star.decdot = pmDE*mas2r/yr2sec star.radoterr = e_pmRA*mas2r/yr2sec star.decdoterr = e_pmDE*mas2r/yr2sec ; ETPM -- default RA, Dec at which PM to apply is zero ; Catalog is in years (e.g., 1900.5). star.etpm = ([EpRAm, EpDEm]-2000d)*yr2sec ; RA_ETPM -- RA at ETPM (ie, ~time at which obs was taken) ; We subtract out the PM, since catalog is *not* supplied ; with the actual RA at ETPM. star.ra_etpm = star.ra + star.radot/cos(star.dec) * $ (star.etpm[0]-star.et) star.dec_etpm = star.dec + star.decdot * $ (star.etpm[1]-star.et) ; RAERR -- error in position at epoch ET. ; This is usually going to be *larger* than the error star.raerr, ; since the latter is taken at ETPM where (by definition -- Note (8)) ; the positional error is the smallest. ; Since cos(dec) applies to all three factors here, it divides out. star.raerr = sqrt((star.raerr_etpm)^2 + $ ((star.etpm[0]-star.et)*star.radoterr)^2 ) star.decerr = sqrt( (star.decerr_etpm)^2 + $ ((star.etpm[1]-star.et)*star.decdoterr)^2 ) star.mag = [BTmag, VTmag] star.magcat = ['tyc2', 'tyc2'] star.magname = ['BT', 'VT'] star.magerr = [e_BTmag, e_VTmag] star.SpTcat = ['none'] ; TYC2 has no spectral types star.SpT = [''] star.notecat = 'tyc2' star.note = '' star.tyc2 = tyc2 ; In the rare case of missing positions, flag them properly (e.g., 15-408-1) ; (See ReadMe file) if (pflag eq 'X') then begin star.ra = -999d star.dec = -999d star.raerr = -999d star.decerr = -999d star.radot = -999d star.decdot = -999d star.radoterr = -999d star.decdoterr = -999d end parse_end: ; Store the structure in an array stars[i] = star end ; Based on whether a scalar or an array was passed in, return the same. (In ; reality, it appears to always return a one-element array of structures, but ; this makes no difference to the user.) if is_scalar(ids) then return, stars[0] if is_array(ids) then return, stars return, stars end