root = '/home/bcarry/data/colors/vista/' dirCol = root+'colors/' dirFilt=root+'filters/' doPLOT=1 ;----- VISTA filters filters=['Y', 'J', 'H','Ks'] filtWave=[1.020,1.252,1.645,2.1487] nbFilt=n_elements(filters) nbComb = factorial(nbFilt)/ ( 2*factorial( nbFilt-2 )) centWave = fltarr(4) waveToMicron=1e-3 cClass=['A','B','C','Cb','Cg','Cgh','Ch','D','K','L','O','Q','R','S','Sa','Sq','Sqw','Sr','Srw','Sv','Svw','Sw','T','V','Vw','X','Xc','Xe','Xk'] cID =[ 1 , 2 , 3 , 3 , 3 , 3 , 3 , 4 , 5 , 6 , 8 , 7 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 9 ,11 ,11 ,10 ,10 ,10 ,10 ] cLabel=['U','A','B','C','D','K','L','Q','S','T','X','V'] nbClass = n_elements(cClass) nbGroup = n_elements( uniq(cID, sort(cID)) ) ;---- Valid groups ; for kID=0, nbGroup-1 do begin ; cur=where( cID eq kID+1 ) ; print, cLabel[kID+1] ; print, cClass[cur] ; print, '' ; endfor ; stop G2V = vistaReadSun( dirCol+'g2V_vistacolours.csv' ) sun = replicate({name:'', val:0., unc:0.}, nbComb) kCC=0 for k1=0, nbFilt-1 do begin for k2=k1+1, nbFilt-1 do begin V1 = G2V.(k1+2).val V2 = G2V.(k2+2).val histo= histogram( V1-V2, binSize=0.01, loc=colArr ) cgPlot, colArr, histo, psym=10, title=filters[k1]+'-'+filters[k2] gauss = mpfitpeak( colArr, histo, param ) cgPlot, /over, colArr, gauss, color='red' cgText, param[1],param[0]/2., strtrim(string(param[1]),2) sun[KCC].name=filters[k1]+'-'+filters[k2] sun[KCC].val=param[1] sun[KCC].unc=param[2] print, sun[KCC].name, sun[KCC].val, sun[KCC].unc,format='(A-5,2x,F7.4,2x,F7.4)' kCC++ endfor endfor stop ;--- Read Bus-DeMeo average spectra confAstroIM= initIDL() confCatalog= initIDL(confAstroIM.soft.catalog, /CATALOG) path = confCatalog.surface.taxo list='listspectra.csv' file = path + list readcol, file, fileName, ssoNum, ssoName, ssoClass, $ delimiter=',', format='(A,L,A,A)', /silent nbSSO=n_elements(fileName) fileName = strtrim(fileName,2) ssoName = strtrim(ssoName,2) ssoClass = strtrim(ssoClass,2) ;--- clean VISTA filters -> structure readcol, dirFilt+'VISTA_Filters_at80K_forETC_Y.dat', w, t, /SILENT ref = {name:'', cent:0., wave:w*waveToMicron, trans:t} filt=replicate(ref,nbFilt) for kFilt=0, nbFilt-1 do begin print, filters[kFilt] readcol, dirFilt+'VISTA_Filters_at80K_forETC_'+filters[kFilt]+'.dat', w, t, /SILENT ;----- Clean filters case filters[kFilt] of 'Y': begin wIn = 800 wEx = 1300 end 'J': begin wIn = 1000 wEx = 1600 end 'H': begin wIn = 1200 wEx = 2100 end 'Ks': begin wIn = 1700 wEx = 2600 end endcase off = where( w le wIn or w ge wEx ) t[off] *= 0 filt[kFilt].name=filters[kFilt] filt[kFilt].wave=w*waveToMicron filt[kFilt].trans= t noZero = where( filt[kFilt].trans ne 0 ) filt[kFilt].cent = mean( filt[kFilt].wave[noZero] ) endfor ;--- Convert average to colors classInfo = replicate({name:'',id:0},nbSSO) empty={ok:0, name:'', val:0., unc:0., dt:0., n1:0, n2:0 } cols=replicate(empty, nbSSO, nbComb) for kSSO=0, nbSSO-1 do begin readcol, path+fileName[kSSO], wave, sref, sunc, format='(F,F,F)', /SILENT demeo = { N:1, wave:wave, class: {name:ssoClass[kSSO], spec:sref, dev:sunc} } pClass = where( strcmp(cClass,demeo.class.name,/fold) ) classInfo[kSSO].ID = cID[pClass] classInfo[kSSO].name = cLabel[ cID[pClass] ] print, kSSO, demeo.class.name, classInfo[kSSO].name, classInfo[kSSO].ID, format='(I3,2x,A-3,3x,A-3,3x,I2)' kCC=0 for k1=0, nbFilt-1 do begin ref = {wave:filt[k1].wave, trans:filt[k1].trans} for k2=k1+1, nbFilt-1 do begin cur = {wave:filt[k2].wave, trans:filt[k2].trans} ; print, filt[k1].name+'-'+filt[k2].name cols[kSSO,kCC].name = filt[k1].name+'-'+filt[k2].name conv = convertTaxoToColor( demeo, cur, ref ) cols[kSSO,kCC].val = 2.5*alog10(conv.ref) + sun[kCC].val cols[kSSO,kCC].unc = conv.unc kCC++ endfor endfor endfor header = 'Class, ID' for kC=0, nbComb-1 do begin s = strSplit(cols[0,kC].name,'-',/Extract) header+= ', '+cols[0,kC].name+', '+$ 'd('+cols[0,kC].name+'), '+$ '('+cols[0,kC].name+')_Dt, '+$ 'N_'+s[0]+', '+$ 'N_'+s[1] endfor forprint, classInfo.name, classInfo.ID, $ cols[*,0].val, cols[*,0].unc, cols[*,0].dt, cols[*,0].n1, cols[*,0].n2, $ cols[*,1].val, cols[*,1].unc, cols[*,1].dt, cols[*,1].n1, cols[*,1].n2, $ cols[*,2].val, cols[*,2].unc, cols[*,2].dt, cols[*,2].n1, cols[*,2].n2, $ cols[*,3].val, cols[*,3].unc, cols[*,3].dt, cols[*,3].n1, cols[*,3].n2, $ cols[*,4].val, cols[*,4].unc, cols[*,4].dt, cols[*,4].n1, cols[*,4].n2, $ cols[*,5].val, cols[*,5].unc, cols[*,5].dt, cols[*,5].n1, cols[*,5].n2, $ format='(A-1,",",I2,6(",",F6.3,",",F6.3,",",F7.2,",",I3,",",I3))', /Silent, $ textout=dirCol+'bdm-col.csv', $ comment=header end