;+ ; NAME: ; oc_getstar_sao ; ; PURPOSE: (one line) ; Returns SAO star structures given their ID's. ; ; DESCRIPTION: ; Returns a fully-populated SAO star structure for each ID supplied. ; The ID's must be in the SAO format. The star structure is returned in ; the standard format, and includes the raw SAO catalog line as well as ; standard-format RA, DEC, magnitudes, etc. ; ; CATEGORY: ; Star catalogs ; ; CALLING SEQUENCE: ; oc_getstar_sao, ids [, NSTARS=nstars] [, /VERBOSE] ; ; INPUTS: ; ids -- SAO id's in string format. Can be either scalar or vector. ; Either SCAT-format SCAT-format ('221.00434') or standard UCAC2 ; format ('00534450'), but all ids must be in the same format. ; ; 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.sao.record is the SAO text catalog entry. ; The fields in star.sao.* are exactly as described in the ; SAO Vizier ReadMe file. ; If a star is not found, that entry is blank. ; ; COMMON BLOCKS: ; None ; ; SIDE EFFECTS: ; None ; ; RESTRICTIONS: ; SAO catalog must be available at $WCS_CATDIR/sao/catalog.dat . ; ; EXAMPLE: ; print, (oc_getstar_sao(['0', '1000', '10000'])).id ; [Prints "none 1000 10000"] ; ; MODIFICATION HISTORY: ; ; ;- function oc_getstar_sao, ids, NSTARS=nstars, VERBOSE=verbose ; ** SAO catalog file format, from Vizier's ReadMe Bytes. ** ; ;-------------------------------------------------------------------------------- ; file Format Units Label Explanations ;-------------------------------------------------------------------------------- ; 1- 6 I6 --- SAO [1/258997]+ SAO Catalog number ; 7 A1 --- delFlag [D] if star deleted (ignore all fields) ; 8- 9 I2 h RAh Hours RA, Equinox=B1950, Epoch=1950.0 ; 10- 11 I2 min RAm Minutes RA, equinox B1950, Epoch=1950.0 ; 12- 17 F6.3 s RAs Seconds RA, equinox B1950, Epoch=1950.0 ; 18- 24 F7.4 s/a pmRA Annual proper motion in RA (FK4 system) ; 25- 26 I2 mas/a e_pmRA Standard deviation in pmRA ; 27 A1 --- RA2mFlag [+-] '+', add 1, or '-', substract 1, ; RA minute: indication that the minutes ; of time associated with the seconds ; portion RA2 must be increased or ; decreased by 1 ; 28- 33 F6.3 s RA2s Seconds portion of RA, original epoch, ; precessed to B1950 ; 34- 35 I2 10mas e_RA2 Standard deviation of RA2 ; 36- 41 F6.1 a EpRA2 Epoch of RA2 (RA original epoch) ; 42 A1 --- DE- Sign Dec, equinox B1950, Epoch=1950.0 ; 43- 44 I2 deg DEd Degrees Dec, equinox B1950, Epoch=1950.0 ; 45- 46 I2 arcmin DEm Minutes Dec, equinox B1950, Epoch=1950.0 ; 47- 51 F5.2 arcsec DEs Seconds Dec, equinox B1950, Epoch=1950.0 ; 52- 57 F6.3 arcsec/a pmDE ? Annual proper motion in Dec (FK4 system) (9) ; 58- 59 I2 mas/a e_pmDE Standard deviation of Dec proper motion ; 60 A1 --- D2m_Flag [+-] '+', add 1, or '-', substract 1: ; Indication that the arcminutes ; associated with DE2 must be increased or ; decreased by 1 ; 61- 65 F5.2 arcsec DE2s Seconds of Declination, original epoch, ; precessed to B1950 ; 66- 67 I2 10mas e_DE2 Standard deviation of DE2 ; 68- 73 F6.1 a EpDE2 Epoch of DE2 (Declinaation original epoch) ; 74- 76 I3 10mas e_Pos Standard deviation of position at epoch 1950.0 ; 77- 80 F4.1 mag Pmag []?=99.9 Photographic magnitude ; 81- 84 F4.1 mag Vmag []?=99.9 Visual magnitude ; 85- 87 A3 --- SpType Spectral type, '+++' for composite spectra ; 88- 89 I2 --- r_Vmag Coded source of visual magnitude (1) ; 90- 91 I2 --- r_Num Coded source of star number and footnotes (2) ; 92 I1 --- r_Pmag Coded source of photographic magnitude (3) ; 93 I1 --- r_pmRA Coded source of proper motions (4) ; 94 I1 --- r_SpType Coded source of spectral type (5) ; 95 I1 --- Rem Coded remarks duplicity and variability (6) ; 96 I1 --- a_Vmag Accuracy of V: 0 = 2 decimals, 1=1 decimal ; 97 I1 --- a_Pmag Accuracy of Ptg: 0 = 2 decimals, 1=1 decimal ; 98- 99 I2 --- r_Cat Code for source catalog (7) ; 100-104 I5 --- CatNum Number in source catalog ; 105-117 A13 --- DM Durchmusterung identification, as ; catalog 'BD', 'CD', 'CP' (A2) ; zone and number (A8), and ; component identification (A2) if there ; are two or more SAO stars having ; the same DM number ; supplement letter (A1) for BD ; (Warren and Kress, Catalogue ) ; 118-123 A6 --- HD Henry Draper Catalog (HD or HDE) number (A6) ; (Catalogue ) ; 124 A1 --- m_HD HD component and multiple code (8) ; 125-129 A5 --- GC Boss General Catalog (GC) number ; (Catalogue ) ; 130-139 D10.8 rad RArad Right ascension, 1950.0, in radians ; 140-150 D11.8 rad DErad Declination, 1950.0, in radians ; 151-152 I2 h RAh2000 Hours RA, equinox, epoch J2000.0 ; 153-154 I2 min RAm2000 Minutes RA, equinox, epoch J2000.0 ; 155-160 F6.3 s RAs2000 Seconds RA, equinox, epoch J2000.0 ; 161-167 F7.4 s/a pmRA2000 Annual proper motion FK5 system ; 168 A1 --- DE-2000 Sign Dec, equinox, epoch J2000.0 ; 169-170 I2 deg DEd2000 Degrees Dec, equinox, epoch J2000.0 ; 171-172 I2 arcmin DEm2000 Minutes Dec, equinox, epoch J2000.0 ; 173-177 F5.2 arcsec DEs2000 Seconds Dec, equinox, epoch J2000.0 ; 178-183 F6.3 arcsec/a pmDE2000 ? Annual proper motion in FK5 system (9) ; 184-193 D10.8 rad RArad2000 Right ascension, J2000.0, in radians ; 194-204 D11.8 rad DErad2000 Declination, J2000.0, in radians ; ; Initialize all of the proper *STAR* variables ; Ideally we would call oc_struct_star to set this up, but this does not work ; here because it is not possible to add new fields (e.g., .sao) to an existing ; structure. idcat = '' id = '' poscat = '' et = 0d ra = 0d dec = 0d raerr = 0d decerr = 0d radot = 0d decdot = 0d radoterr = 0d decdoterr = 0d etpm = [0d, 0d] 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 *SAO* variables. All values are kept as their ; original format, even if this is a little unusual (e.g., RA is integer, in ; tenths of a minute). ; This is 'sao' in SAO catalog. This causes IDL confusion between variable and ; structure names. sao_ = 0L delFlag = '' RAh = 0 RAm = 0 RAs = 0.d paRA = 0.d e_pmRA = 0 RA2mFlag = '' RA2s = 0.d e_RA2 = 0 EpRA2 = 0.d ; This is 'DE-' in SAO catalog, which is not a legal IDL variable name. ; Changed to DE. DE = '' DEd = 0 DEm = 0 DEs = 0.d pmDE = 0.d e_pmDE = 0 D2m_Flag = '' DE2s = 0.d e_DE2 = 0 EpDE2 = 0. e_pos = 0 Pmag = 0.d Vmag = 0.d SpType = '' r_Vmag = 0 r_Num = 0 r_Pmag = 0 r_pmRA = 0 r_SpType = 0 Rem = 0 a_Vmag = 0 a_Pmag = 0 r_Cat = 0 CatNum = 0 DM = '' HD = '' m_HD = '' GC = '' RArad = 0.d DErad = 0.d RAh2000 = 0 RAm2000 = 0 RAs2000 = 0.d pmRA2000 = 0.d DE_2000 = '' DEd2000 = 0 DEm2000 = 0 DEs2000 = 0.d pmDE2000 = 0.d RArad2000 = 0.d DErad2000 = 0.d ; Not an SAO field. This field stores the entire SAO catalog line entry. record = '' sao = {sao:sao_, delFlag:delFlag, $ RAh:RAh,RAm:RAm,RAs:RAs,pmRA:pmRA,e_pmRAe_pmRA,$ RA2mFlag:RA2mFlag,RA2s:RA2s,e_RA2:e_RA2,epRA2:epRA2,$ DE,DEd,DEm,DEs,pmDE,e_pmDE,D2mFlag,DE2s,e_DE2,epDE2,$ e_pos, Pmag,Vmag,SpType,r_Vmag,r_Num,r_Pmag,r_pmRA,r_SpType,$ Rem,a_Vmag,a_Pmag,r_Cat,CatNum,DM,HD,m_HD,GC,$ RArad,DErad,$ RAh2000,RAm2000,RAs2000,pmRA2000,$ DE_2000,DEd2000,DEm2000,DEs2000,pmDE2000,$ RArad2000, DErad2000, $ record:record} ; sao = {sao:sao_, delFlag, $ ; RAh,RAm,RAs,pmRA,e_pmRA,RA2mFlag,RA2s,e_RA2,epRA2,$ ; DE,DEd,DEm,DEs,pmDE,e_pmDE,D2mFlag,DE2s,e_DE2,epDE2,$ ; e_pos, Pmag,Vmag,SpType,r_Vmag,r_Num,r_Pmag,r_pmRA,r_SpType,$ ; Rem,a_Vmag,a_Pmag,r_Cat,CatNum,DM,HD,m_HD,GC,$ ; RArad,DErad,$ ; RAh2000,RAm2000,RAs2000,pmRA2000,$ ; DE_2000,DEd2000,DEm2000,DEs2000,pmDE2000,$ ; RArad2000, DErad2000, $ ; 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, $ sao:sao} sao_init = sao star_init = star num_ids = sizex(ids) stars = make_array(num_ids, value=star) ; Get the raw catalog lines from the SAO catalog lines = oc_getline_sao(ids, NSTARS=nstars, VERBOSE=verbose) ; Now process each line for i = 0, num_ids-1 do begin id = ids[i] line = lines[i] id = ids[i] ; Check to make sure it's valid if (line eq '') then begin star = oc_star_set_empty(star_init) goto, parse_end end ; Set the string from the Vizier ReadMe catalog description file string_sao = '(I6, A12, I2, I3, A1, I2, I2, I1, A5, A1, I1,' + $ 'A5, A1, A3, A2, A1)' ; Parse the raw catalog line into a bunch of variables line = str_replace(line, ' .$', ' ', /REGEX) reads, line, format=string_sao, sao_, dm, rah, radm, de, ded, dem, $ q_ptm, ptm_str, $ n_ptm, q_ptg, ptg_str, n_ptg, sptype, intensity, remarks ; Clear the star structure, then stick each variable into its proper *SAO* ; structure location ; We handle as special cases a few stars (SAO 37020, 37026, etc.) ; which have missing fields for ptm and ptg, and we want to set these to -999, ; *not* 0.0. sao = sao_init star = star_init sao.record = line sao.sao = sao_ ; illegal line if (strcompress(dm,/REM)) eq '' then dm = 'none' sao.dm = dm sao.rah = rah sao.radm = radm sao.de = de sao.ded = ded sao.dem = dem sao.q_ptm = q_ptm if (strcompress(ptm_str,/REM)) eq '' then ptm = -999d else ptm = double(ptm_str) sao.ptm = ptm sao.n_ptm = n_ptm sao.q_ptg = q_ptg if (strcompress(ptg_str,/REM)) eq '' then ptg = -999d else ptg = double(ptg_str) sao.ptg = ptg sao.n_ptg = n_ptg sao.sptype = sptype sao.intensity = intensity sao.remarks = remarks ; Process the variables, precess the coords, and stick them all into the ; proper *STAR* structure location. ; ; Precess to J2000. Note that the SAO catalog is limited intrinsically in its ; precision, and better coordinates for SAO stars can be taken from the ; SAO->Tycho star cross-reference catalog. ; RA, B1900, radians ra_1900 = (sao.rah + (sao.radm * 0.1)/60d ) * (2d*!dpi/24d) ; Dec, B1900, radians dec_1900 = (sao.de eq '-' ? -1d : 1d) * $ ( sao.ded + (sao.dem/60d)) * (2d*!dpi/360d) ra = ra_1900 dec = dec_1900 ; Call astrolib precession routine precess, ra, dec, 1900, 2000, /RADIAN star.ra = ra star.dec = dec star.ra_etpm = ra star.dec_etpm = dec star.idcat = 'sao' star.id = strcompress(string(sao.sao), /REMOVE) star.poscat = 'sao' ; Fill in the proper motion fields. We mostly keep these blank, since ; SAO has no proper motion. However, we do set ETPM to be the year 1920, ; since original obs were taken 1918-1925. star.et = 0d ; Default to 2000 for ET star.etpm = [1,1]*(1920-2000) * yr2sec star.raerr_etpm = -999d star.decerr_etpm = -999d star.raerr = -999d star.decerr = -999d star.radot = -999d star.decdot = -999d star.radoterr = -999d star.decdoterr = -999d star.mag = [sao.ptm, sao.ptg] star.magcat = ['sao', 'sao'] star.magname = ['Ptm', 'Ptg'] ; Photovisual, photographic mags star.magerr = [-999d, -999d] star.SpTcat = ['sao'] star.SpT = sao.sptype star.notecat = 'sao' note = strcompress(sao.remarks + ' ' + $ sao_mag_to_flag(sao.ptm) + ' ' + sao_mag_to_flag(sao.ptg), /REMOVE) star.note = [note] star.sao = sao 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 end