VmJ=1.151 VmH=1.409 VmK=1.505 dir='/home/bcarry/Downloads/2mass/' file = 'ast_ext2mass.tab' asc = read2MASS( dir+file ) nb2MASS = n_elements(asc) id = string(asc.ssoNum,format='(I06)')+strtrim(asc.ssoName,2) uniq=uniq(id, sort(id)) nbSSO = n_elements(uniq) print, '2MASS :', nb2MASS, nbSSO levels = [0.03, 0.05, 0.08, 0.1] nbL = n_elements( levels ) for kL=0, nbL-1 do begin cut = levels[kL] good = where (asc.Junc le cut and asc.Hunc le cut and asc.Kunc le cut, nbGood) print, levels[kL], nbGood, format='(F4.2,3x,I5)' endfor print, '----',nb2MASS, format='(A4,3x,I5)' cut = 0.08 good = where (asc.jUnc le cut and asc.hUnc le cut and asc.kUnc le cut, nbGood) good = where ( asc.Junc le cut and asc.Hunc le cut and asc.Kunc le cut and $ ( strcmp(asc.flag.reliable,'A') or $ strcmp(asc.flag.reliable,'B') or $ strcmp(asc.flag.reliable,'C') ) and $ abs(asc.Jmag-asc.Vmag) le 3., nbGood) id = string(asc[good].ssoNum,format='(I06)')+strtrim(asc[good].ssoName,2) uniq=uniq(id, sort(id)) nbSSO = n_elements(uniq) print, 'select:', nbGood, nbSSO HmJ = VmJ - VmH KmJ = VmJ - VmK ; rJ = 10.^( -0.4*J ) rH = 10.^( -0.4* ( (asc.hMag-asc.jMag) - HmJ ) ) rK = 10.^( -0.4* ( (asc.kMag-asc.jMag) - KmJ ) ) ;---work out error rHmax = 10.^( -0.4* ((asc.hMag-asc.jMag +asc.hUnc-asc.jUnc) - HmJ ) ) rHmin = 10.^( -0.4* ((asc.hMag-asc.jMag -asc.hUnc+asc.jUnc) - HmJ ) ) errH = rHmax-rHmin rKmax = 10.^( -0.4* ((asc.kMag-asc.jMag +asc.kUnc-asc.jUnc) - KmJ ) ) rKmin = 10.^( -0.4* ((asc.kMag-asc.jMag -asc.kUnc+asc.jUnc) - KmJ ) ) errK = rKmax-rKmin forprint, asc.ssoNum, asc.ssoName, rH, rK, errH, errK, /Silent, $ comment='Num,Name,rH,rK,errH,errK', $ format='(I6,",",A-17,",",F,",",F,",",F,",",F)', $ textout=dir+'2mass-colors.csv',subset=good print, 'H', mean(rH), median(rH), stddev(rH) print, 'K', mean(rK), median(rK), stddev(rK) ; ; ; ; ; readcol, dir+'ast_ext2mass.csv', num, name, des, mJ, uJ, mH, uH, mK, uK, format='(I,A,A,F,F,F,F,F,F)', delim=',' ; ; nb2MASS = n_elements(num) ; id = string(num,format='(I06)')+strtrim(name,2)+strtrim(des,2) ; uniq=uniq(id, sort(id)) ; nbSSO = n_elements(uniq) ; print, '2MASS :', nb2MASS, nbSSO ; ; ; levels = [0.03, 0.05, 0.08, 0.1] ; nbL = n_elements( levels ) ; for kL=0, nbL-1 do begin ; cut = levels[kL] ; good = where (uJ le cut and uH le cut and uK le cut, nbGood) ; print, levels[kL], nbGood, format='(F4.2,3x,I5)' ; endfor ; print, '----',n_elements(num), format='(A4,3x,I5)' ; ; cut = 0.08 ; good = where (uJ le cut and uH le cut and uK le cut, nbGood) ;; print, nbGood ; ; id = string(num[good],format='(I06)')+strtrim(name[good],2)+strtrim(des[good],2) ; uniq=uniq(id, sort(id)) ; nbSSO = n_elements(uniq) ; print, 'select:', nbGood, nbSSO ; ; ; ; ;; J = mJ - VmJ ;; H = mH - VmH ;; K = mK - VmK ; ; HmJ = VmJ - VmH ; KmJ = VmJ - VmK ; ; ;; rJ = 10.^( -0.4*J ) ; rH = 10.^( -0.4* ( (mH-mJ) - HmJ ) ) ; rK = 10.^( -0.4* ( (mK-mJ) - KmJ ) ) ; ; ;;---work out error ; rHmax = 10.^( -0.4* ((mH+uH-mJ-uJ) - HmJ ) ) ; rHmin = 10.^( -0.4* ((mH-uH-mJ+uJ) - HmJ ) ) ; errH = rHmax-rHmin ; ; rKmax = 10.^( -0.4* ((mK+uK-mJ-uJ) - KmJ ) ) ; rKmin = 10.^( -0.4* ((mK-uK-mJ+uJ) - KmJ ) ) ; errK = rKmax-rKmin ; ; forprint, num, name, des, rH, rK, errH, errK, /Silent, $ ; comment='Num,Name,Des,rH,rK,errH,errK', $ ; format='(I6,",",A-10,",",A-10,",",F,",",F,",",F,",",F)', $ ; textout=dir+'2mass-colors.csv',subset=good ; ; print, 'H', mean(rH), median(rH), stddev(rH) ; print, 'K', mean(rK), median(rK), stddev(rK) ; ; ; end