root = '/home/bcarry/data/mining/ukidss/' dirIn = root+'input/' dirFilt=root+'filters/' dirCol=root+'colors/' readcol, root+'ukidss.list', list, format='(A)', /Silent nbSSO = n_elements(list) print, nbSSO thresMin = 30000000000. fColor= [ 'Red', 'Blue', 'Green', 'Black','Cyan' ] fSymb = ['OpenCircle', 'FilledSquare', 'FilledCircle', 'OpenSquare','Star'] plotMag = 01 plotCoord = 0 ;-Sun colors ; readcol, dirFilt+'sun.dat',sunF, sunC, sunU, format='(A,F,F)', /Silent ; sun={YmJ:{val:sunC[0], unc:sunU[0]}, $ ; YmH:{val:sunC[1], unc:sunU[1]}, $ ; YmK:{val:sunC[2], unc:sunU[2]}, $ ; JmH:{val:sunC[3], unc:sunU[3]}, $ ; JmK:{val:sunC[4], unc:sunU[4]}, $ ; HmK:{val:sunC[5], unc:sunU[5]}, $ ; val:sunC, unc:sunU} filters=['Z','Y', 'J', 'H', 'Ks'] nbFilt = n_elements(filters) nbComb = factorial(nbFilt)/(2*factorial(nbFilt-2)) empty={ok:0, name:'', val:0., unc:0., dt:-99.9999, n1:0, n2:0 } cols=replicate(empty, nbSSO, nbComb) ssoInfo = replicate({num:0L, name:''}, nbSSO) void = -9.9999949E8 for kSSO=0, nbSSO-1 do begin ; print, '---------------------------------------------------------------------------------' ; if list[kSSO] ne '118569_ukidss_lasnew' then goto, j2NextSSO ;-identify survey len = strLen( list[kSSO] ) survey = strMid( list[kSSO], len-6,3) ; print, list[kSso] ;---- read magnitudes if strCmp( survey,'las') then begin readcol, dirIn+list[kSSO]+'.csv', iso, ra, dec, delimiter=',', $ y, yu, j1, ju1, j2, ju2, h, hu, k, ku, $ format='(A,F,F,F,F,F,F,F,F,F,F,F,F)', /Silent nbObs=n_elements(iso) z =y*0 + void zu=z issue = where( j1 ne void and j2 ne void, nb2 ) ; if issue[0] ne -1 then goto, j2NextSSO good1 = where( j1 ne void, nGood1 ) good2 = where( j2 ne void, nGood2 ) j=fltarr(nbObs) +void ju=fltarr(nbObs)+void if Good1[0] ne -1 then begin j[good1]=j1[good1] ju[good1]=ju1[good1] endif if Good2[0] ne -1 then begin j[good2]=j2[good2] ju[good2]=ju2[good2] endif endif else begin ; goto, j2next ;print, dirIn+list[kSSO]+'.csv' ;stop readcol, dirIn+list[kSSO]+'.csv', format='(A,F,F,F,F,F,F,F,F,F,F,F,F,F,F)', $ iso, ra, dec, z,zu, y, yu, j, ju, h, hu, k1, ku1, k2, ku2, /Silent, delimiter=',' nbObs=n_elements(iso) issue = where( k1 ne void and k2 ne void, nb2 ) if issue[0] ne -1 then goto, j2NextSSO good1 = where( k1 ne void, nGood1 ) good2 = where( k2 ne void, nGood2 ) k=fltarr(nbObs) +void ku=fltarr(nbObs)+void if nGood1 ne 0 then begin k[good1]=k1[good2] ku[good1]=ku1[good2] endif if nGood2 ne 0 then begin k[good2]=k2[good2] ku[good2]=ku2[good2] endif endelse magArr = [ [z], [y], [j], [h], [k] ] ;- time,filter uncArr = [ [zu], [yu], [ju], [hu], [ku] ] ;- time,filter ;--- get target ID s = strSplit(list[kSSO],'_',/Extract) ssoId = s[0] ssodnet = voSsODNet_resolver(ssoId,/Quiet) dimS = size(ssodnet) if valid_num(ssoId) then begin ssoNum =round(float(ssoId)) if dims[dims[0]+1] eq 8 then ssoName=ssodnet.name else ssoName='' endif else begin ssoName=strTrim(ssoId,2) if isnumeric(ssoName) then ssoName=strmid(ssoName,0,4)+' '+strmid(ssoName,4,10) if dims[dims[0]+1] eq 8 then begin s=strSplit(ssodnet.others,',',/Extract) if valid_num(s[0]) then ssoNum= round(float(s[0])) endif else ssoNum=0 endelse ; nbObs = n_elements(date) ;-time span of observations jd = dblarr(nbObs) for kObs=0, nbObs-1 do jd[kObs] = date_conv(iso[kObs],'JULIAN') ssoInfo[kSSO].num = ssoNum ssoInfo[kSSO].name= ssoName uDate = uniq( iso, sort(iso) ) nbDate= n_elements( uDate ) done=0.D for kD=0, nbDate-1 do begin ; print, iso[uDate[kD]] already = where( done eq jd[uDate[kD]] ) if already[0] ne -1 then goto, j2NextDate ;--- AUTO - date kCC = 0 for k1=0, nbFilt-1 do begin for k2=k1+1, nbFilt-1 do begin cols[kSSO,kCC].name = filters[k1]+'m'+filters[k2] ; sel1 = where( magArr[*,k1] ne void and (iso eq iso[uDate[kD]], n1 ) ; sel2 = where( magArr[*,k2] ne void and (iso eq iso[uDate[kD]], n2 ) sel1 = where( magArr[*,k1] ne void and (abs(jd-jd[uDate[kD]])*24.*60) le thresMin, n1 ) sel2 = where( magArr[*,k2] ne void and (abs(jd-jd[uDate[kD]])*24.*60) le thresMin, n2 ) ; print, k1,k2, cols[kSSO,kCC].name, n1, n2, format='(I2,1x,I2,2x,A-5,4x,I2,2x,I2)' ;stop if n1 ne 0 and n2 ne 0 then begin ; help, sel1, sel2 ; ; forprint, iso, subset=sel1, textout=2 ; forprint, iso, subset=sel2, textout=2 done=[done,jd[sel1], jd[sel2]] cols[kSSO,kCC].ok = 1 mag1 = meanWithUnc( magArr[sel1,k1], uncArr[sel1,k1] ) jd1 = mean( jd[sel1] ) mag2 = meanWithUnc( magArr[sel2,k2], uncArr[sel2,k2] ) jd2 = mean( jd[sel2] ) ; print, cols[kSSO,kCC].name ; print, abs(jd1-jd2) ; ;stop cols[kSSO,kCC].val = mag1[0]-mag2[0] cols[kSSO,kCC].unc = sqrt( mag1[1]^2 + mag2[1]^2 ) cols[kSSO,kCC].dt = abs(jd1-jd2) cols[kSSO,kCC].n1 += n1 cols[kSSO,kCC].n2 += n2 endif kCC++ endfor endfor j2NextDate: endfor print, list[kSso], nbObs, nb2, nbDate, format='(A-30,2x,I2,2x,I2,3x,I2)' ; ok = where( cols[kSSO,*].ok eq 1 ) ;; forprint, cols[kSSO,*].name, cols[kSSO,*].val, cols[kSSO,*].unc, cols[kSSO,*].dt*24.*60, $ ;; textout=2, format='(A-5,2x,F6.3,2x,F6.3,2x,F5.1)', subset=ok ;stop j2NextSSO: endfor ; cols.dt *= 24.*60 header = 'Number, Name' for kC=0, nbComb-1 do begin s = strSplit(cols[0,kC].name,'m',/Extract) header+= ', '+cols[0,kC].name+', '+$ 'd('+cols[0,kC].name+'), '+$ '('+cols[0,kC].name+')_Dt, '+$ 'N_'+s[0]+', '+$ 'N_'+s[1] endfor forprint, ssoInfo.num, ssoInfo.name, $ 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, $ cols[*,6].val, cols[*,6].unc, cols[*,6].dt, cols[*,6].n1, cols[*,6].n2, $ cols[*,7].val, cols[*,7].unc, cols[*,7].dt, cols[*,7].n1, cols[*,7].n2, $ cols[*,8].val, cols[*,8].unc, cols[*,8].dt, cols[*,8].n1, cols[*,8].n2, $ cols[*,9].val, cols[*,9].unc, cols[*,9].dt, cols[*,9].n1, cols[*,9].n2, $ format='(I6,",",A-22,10(",",F6.3,",",F6.3,",",F9.5,",",I3,",",I3))', /Silent, $ textout=dirCol+'ukidss-col.csv', $ comment=header for kC=0, nbComb-1 do begin p=where( cols[*,kC].val ne 0 and cols[*,kC].dt gt -90 and cols[*,kC].dt le 1, n) print, cols[0,kC].name, n endfor ; ; ; ; ; ; for kC=0, nbComb-1 do begin ; ; sel = where( cols[*,kC].ok eq 1, nbSel ) ; ; print, cols[0,kC].name, nbSel, format='(A-5,2x,I4)' ; window, 0 ; cgHistoPlot, abs(cols[sel,*].dt)*24.*60, binSize=1, xTitle='Time interval (min)' ; ; window, 2 ; cgHistoPlot, cols[sel,*].val, xTitle=cols[0,kC].name ; ; ; endfor ; ; ; ; ; x= 5 ; y= 3 ; ; sel = where( cols[*,x].ok eq 1 and cols[*,y].ok eq 1, nbSel ) ; cgPlot, cols[sel,x].val, cols[sel,y].val, psym='Filled circle', $ ; xTitle=cols[0,x].name, $ ; yTitle=cols[0,y].name end