pro get_ybs_catalog, ybs_catalog ; ; Read the Yale Bright Star catalog into an array of structures ; ; B. Knapp, 2006-03-27 ; ; Print usage? if n_params() eq 0 then begin print,' ' print,' The procedure get_ybs_catalog retrieves the entire Yale ' print,' Bright Star Catalog (5th ed.) as an array of structures. The' print,' structure fields have the same names as the "labels" in the' print,' ReadMe description file (/tools/knapp/doc/ybs.readme),' print,' where each field is fully described. The NOTES field of the' print,' structure for each star contains all of the notes for that' print,' star, concatenated with the separator "|".' print,' ' print,' Usage: ' print,' get_ybs_catalog, ybs_catalog' print,' ' return endif ; ; Define the structure: ybs_record = { ybs_str, $ HR: 0L, $ RA: 0.d0, $ Dec: 0.d0, $ Name: '', $ DM: '', $ HD: 0L, $ SAO: 0L, $ FK5: 0L, $ IRflag: '', $ r_IRflag: '', $ Multiple: '', $ ADS: '', $ ADScomp: '', $ VarID: '', $ RAh1900: 0L, $ RAm1900: 0L, $ RAs1900: 0.0, $ DE_1900: '', $ DEd1900: 0L, $ DEm1900: 0L, $ DEs1900: 0L, $ RAh: 0L, $ RAm: 0L, $ RAs: 0.0, $ DE_: '', $ DEd: 0L, $ DEm: 0L, $ DEs: 0L, $ GLon: 0.0, $ GLat: 0.0, $ VMag: 0.0, $ n_VMag: '', $ u_VMag: '', $ B_V: 0.0, $ u_B_V: '', $ U_B: 0.0, $ u_U_B: '', $ R_I: 0.0, $ n_R_I: '', $ SpType: '', $ n_SpType: '', $ pmRA: 0.0, $ pmDE: 0.0, $ n_Parallax: '', $ Parallax: 0.0, $ RadVel: 0L, $ n_RadVel: '', $ l_RotVel: '', $ RotVel: 0L, $ u_RotVel: '', $ Dmag: 0.0, $ Sep: 0.0, $ MultID: '', $ MultCnt: 0L, $ Notes: '' $ } ; ; First, read the notes file into arrays nr1 = 9190L HR = lonarr(nr1) Count = intarr(nr1) Category = strarr(nr1) Remark = strarr(nr1) HR_j = 0L Count_j = 0 Category_j = '' Remark_j = '' fmt1='(1X,I4,I2,A4,1X,A120)' openr,lun,'/tools/knapp/dat/astronomy/ybs_notes.txt',/get_lun for j=0,nr1-1 do begin readf,lun,HR_j,Count_j,Category_j,Remark_j,format=fmt1 HR[j] = HR_j Count[j] = Count_j Category[j] = strtrim(Category_j) Remark[j] = strtrim(Remark_j) endfor close,lun ; ; Now read the catalog nr = 9110L ybs_catalog = replicate(ybs_record, nr) ; HR_j = 0L ;I4 Name_j = '' ;A10 DM_j = '' ;A11 HD_j = 0L ;I6 SAO_j = 0L ;I6 FK5_j = 0L ;I4 IRflag_j = '' ;A1 r_IRflag_j = '' ;A1 Multiple_j = '' ;A1 ADS_j = '' ;A5 ADScomp_j = '' ;A2 VarID_j = '' ;A9 RAh1900_j = 0L ;I2 RAm1900_j = 0L ;I2 RAs1900_j = 0.0 ;F4.1 DE_1900_j = '' ;A1 DEd1900_j = 0L ;I2 DEm1900_j = 0L ;I2 DEs1900_j = 0L ;I2 RAh_j = 0L ;I2 RAm_j = 0L ;I2 RAs_j = 0.0 ;F4.1 DE__j = '' ;A1 DEd_j = 0L ;I2 DEm_j = 0L ;I2 DEs_j = 0L ;I2 GLon_j = 0.0 ;F6.2 GLat_j = 0.0 ;F6.2 VMag_j = 0.0 ;F5.2 n_VMag_j = '' ;A1 u_VMag_j = '' ;A1 B_V_j = 0.0 ;F5.2 u_B_V_j = '' ;A1 U_B_j = 0.0 ;F5.2 u_U_B_j = '' ;A1 R_I_j = 0.0 ;F5.2 n_R_I_j = '' ;A1 SpType_j = '' ;A20 n_SpType_j = '' ;A1 pmRA_j = 0.0 ;F6.3 pmDE_j = 0.0 ;F6.3 n_Parallax_j = '' ;A1 Parallax_j = 0.0 ;F5.3 RadVel_j = 0L ;I4 n_RadVel_j = '' ;A4 l_RotVel_j = '' ;A2 RotVel_j = 0L ;I3 u_RotVel_j = '' ;A1 Dmag_j = 0.0 ;F4.1 Sep_j = 0.0 ;F6.1 MultID_j = '' ;A4 MultCnt_j = 0L ;I2 Notes_j = '' ;A1 ; fmt2 = $ '(I4,A10,A11,I6,I6,I4,A1,A1,A1,A5,A2,A9,I2,I2,F4.1,A1,I2,I2,I2,'+ $ 'I2,I2,F4.1,A1,I2,I2,I2,F6.2,F6.2,F5.2,A1,A1,F5.2,A1,F5.2,A1,'+ $ 'F5.2,A1,A20,A1,F6.3,F6.3,A1,F5.3,I4,A4,A2,I3,A1,F4.1,F6.1,A4,'+ $ 'I2,A1)' openr,lun,'/tools/knapp/dat/astronomy/ybs_catalog.txt' ar = '' for j=0,nr-1 do begin readf,lun,ar,format='(A197)' reads,ar,format=fmt2, $ HR_j,Name_j,DM_j,HD_j,SAO_j,FK5_j,IRflag_j,r_IRflag_j,Multiple_j, $ ADS_j,ADScomp_j,VarID_j,RAh1900_j,RAm1900_j,RAs1900_j, $ DE_1900_j,DEd1900_j,DEm1900_j,DEs1900_j,RAh_j,RAm_j,RAs_j, $ DE__j,DEd_j,DEm_j,DEs_j,GLon_j,GLat_j,Vmag_j,n_Vmag_j,u_Vmag_j, $ B_V_j,u_B_V_j,U_B_j,u_U_B_j,R_I_j,n_R_I_j,SpType_j,n_SpType_j, $ pmRA_j,pmDE_j,n_Parallax_j,Parallax_j,RadVel_j,n_RadVel_j,l_RotVel_j, $ RotVel_j,u_RotVel_j,Dmag_j,Sep_j,MultID_j,MultCnt_j,Notes_j ; ; Set missing data to null values rNULL = -1.d37 ; NULL real number iNULL = -2147483647 ; NULL int number if (strtrim(strmid(ar,25,6)) eq '') then HD_j = iNULL if (strtrim(strmid(ar,31,6)) eq '') then SAO_j = iNULL if (strtrim(strmid(ar,37,4)) eq '') then FK5_j = iNULL if (strtrim(strmid(ar,60,2)) eq '') then RAh1900_j = iNULL if (strtrim(strmid(ar,62,2)) eq '') then RAm1900_j = iNULL if (strtrim(strmid(ar,64,4)) eq '') then RAs1900_j = rNULL if (strtrim(strmid(ar,69,2)) eq '') then DEd1900_j = iNULL if (strtrim(strmid(ar,71,2)) eq '') then DEm1900_j = iNULL if (strtrim(strmid(ar,73,2)) eq '') then DEs1900_j = iNULL if (strtrim(strmid(ar,75,2)) eq '') then RAh_j = iNULL if (strtrim(strmid(ar,77,2)) eq '') then RAm_j = iNULL if (strtrim(strmid(ar,79,4)) eq '') then RAs_j = rNULL if (strtrim(strmid(ar,84,2)) eq '') then DEd_j = iNULL if (strtrim(strmid(ar,86,2)) eq '') then DEm_j = iNULL if (strtrim(strmid(ar,88,2)) eq '') then DEs_j = iNULL if (strtrim(strmid(ar,90,6)) eq '') then GLON_j = rNULL if (strtrim(strmid(ar,96,6)) eq '') then GLAT_j = rNULL if (strtrim(strmid(ar,102,5)) eq '') then Vmag_j = rNULL if (strtrim(strmid(ar,109,5)) eq '') then B_V_j = rNULL if (strtrim(strmid(ar,115,5)) eq '') then U_B_j = rNULL if (strtrim(strmid(ar,121,5)) eq '') then R_I_j = rNULL if (strtrim(strmid(ar,148,6)) eq '') then pmRA_j = rNULL if (strtrim(strmid(ar,154,6)) eq '') then pmDE_j = rNULL if (strtrim(strmid(ar,161,5)) eq '') then Parallax_j = rNULL if (strtrim(strmid(ar,166,4)) eq '') then RadVel_j = iNULL if (strtrim(strmid(ar,176,3)) eq '') then RotVel_j = iNULL if (strtrim(strmid(ar,180,4)) eq '') then Dmag_j = rNULL if (strtrim(strmid(ar,184,6)) eq '') then Sep_j = rNULL if (strtrim(strmid(ar,194,2)) eq '') then MultCnt_j = iNULL ; ; Derive coordinates RA and Dec from input data ; (RA and Dec are set to rNULL when unknown) RA_j = rNULL if (RAh_j ge 0) then RA_j=RAh_j*15.d0 if (RAm_j ge 0) then RA_j=RA_j+RAm_j/4.d0 if (RAs_j ge 0) then RA_j=RA_j+RAs_j/240.d0 Dec_j = rNULL if (DEd_j ge 0) then Dec_j=DEd_j if (DEm_j ge 0) then Dec_j=Dec_j+DEm_j/60.d0 if (DEs_j ge 0) then Dec_j=Dec_j+DEs_j/3600.d0 if (DE__j eq '-' and Dec_j ge 0) then Dec_j=-Dec_j ; ; Assemble notes p = where(HR eq HR_j, np) if (np gt 0 and Notes_j eq ' ' || np eq 0 and Notes_j eq '*') then $ message, 'Notes not in sync with catalog' if np gt 0 then begin Notes_j = Category[p[0]]+' '+Remark[p[0]] for k=1,np-1 do begin if Count[p[k]] eq Count[p[k-1]]+1 then $ Notes_j = Notes_j+' '+Remark[p[k]] $ else $ Notes_j = Notes_j+' | '+Category[p[k]]+' '+Remark[p[k]] endfor endif ; ; Construct record ybs_catalog[j] = {ybs_str, $ HR_j,RA_j,Dec_j,Name_j,DM_j,HD_j,SAO_j,FK5_j,IRflag_j,r_IRflag_j, $ Multiple_j, ADS_j,ADScomp_j,VarID_j,RAh1900_j,RAm1900_j,RAs1900_j, $ DE_1900_j,DEd1900_j,DEm1900_j,DEs1900_j,RAh_j,RAm_j,RAs_j, $ DE__j,DEd_j,DEm_j,DEs_j,GLon_j,GLat_j,Vmag_j,n_Vmag_j,u_Vmag_j, $ B_V_j,u_B_V_j,U_B_j,u_U_B_j,R_I_j,n_R_I_j,SpType_j,n_SpType_j, $ pmRA_j,pmDE_j,n_Parallax_j,Parallax_j,RadVel_j,n_RadVel_j,l_RotVel_j, $ RotVel_j,u_RotVel_j,Dmag_j,Sep_j,MultID_j,MultCnt_j,Notes_j} endfor return end