root='/home/bcarry/work/data/ropacs/' ; root='/observ/ropacs/' dirObj= root+'objects/' dirLC = root+'lc/' file='benoit_ropacs_8aug2013.csv' readcol, root+file, file, name, class, $ magO, uncO, raO, decO, $ magC, muRa, muDec, raC, decC, $ sep, band, JD, nInLC, $ format='(A,A,A,'+$ 'F,F,F,F,'+$ 'F,F,F,F,F,'+$ 'F,A,D,I)',/silent, $ delim=',' nEntry=n_elements(name) ; cgHistoPlot, raO-raC ; cgHistoPlot, decO-decC, /oPlot, color='blue' uList = uniq(name,sort(name)) uName = name( uList ) nbSSO = n_elements( uName ) print, nbSSO, nEntry, 1.*nEntry/nbSSO ;---- miss 171 ;---- miss 284 2002AQ6 for kSSO=44, nbSSO-1 do begin ;-remove numbered???? if valid_num(uName[kSSO]) then begin print, uName[kSSO] goto, jump endif ;-current object cur = where( strcmp(name, uName[kSSO]), nbCur ) ;-clean name if valid_num( strmid(uName[kSSO],0,4) ) then begin id = strmid(uName[kSSO],0,4)+' '+strmid(uName[kSSO],4,10) endif else begin id = uName[kSSO] endelse ;-licence ssoInfo = voSsoDNet_resolver( id ) ;-licence ssoInfo = ssoInfo[0] ;-licence dimS = size(ssoInfo) ;-licence if dimS[dimS[0]+1] ne 8 then begin ;-licence print, '------------ miss '+uName[kSSO] ;-licence goto, jump ;-licence endif ;-licence ;-licence if ssoInfo.number ne 0 then id=ssoInfo.number else id=ssoInfo.name ;-licence print, kSSO, uName[kSSO], nbCur, $ format='(I3,1x,A-20,1x,I3)' minJD = min( jd[cur] ) ; x= jd[cur]-minJD ; ord=sort(x) ; xs=x[ord] ; cgPlot, xs, psym='filled circle' ; cgPlot, round(xs), psym='filled circle', color='red', /over progressJD = jd[cur]-minJD roundJD = round(progressJD) uJD = uniq(roundJD, sort(roundJD)) nbEpoch = n_elements( uJD ) nbLC=0 for kEp=0, nbEpoch-1 do begin loc = where( roundJD[uJD[kEp]] eq roundJD, nbP ) ; print, name[cur[loc]] if nbP gt 1 then begin jdGo = jd[cur[loc]] magGo= magO[cur[loc]] uncGo= uncO[cur[loc]] order = sort(jdGo) jdGo = jdGo[order] magGo = magGo[order] uncGo = uncGo[order] muMag = meanWithUnc( magGo, uncGo ) rmsMag = sqrt( mean( ( (magGo-muMag[0]) )^2. ) ) rangeMag = max(magGo) - min(magGo) thres = 1.75 sel = where( abs(magGo-muMag[0]) le thres*abs(muMag[1]), nbSel ) mu2 = meanWithUnc( magGo[sel], uncGo[sel] ) rms2 = sqrt( mean( ( (magGo[sel]-mu2[0]) )^2. ) ) range2 = max(magGo[sel]) - min(magGo[sel]) xx = (jdGo-minJD)*24. cgPlot, xx, magGo, /yNoZero, $ title=strTrim(string(kSSO+1),2)+' '+uName[kSSO]+': '+$ strTrim(string(kEp+1),2)+'/'+strTrim(string(nbEpoch),2) cgErrPlot, xx, magGo-uncGo, magGo+uncGo, psym=4 cgPlot, /OverPlot, xx, replicate(muMag[0],nbP), color='cornflower blue' cgPlot, /OverPlot, xx, replicate(muMag[0]+muMag[1],nbP), color='cornflower blue', lineStyle=2 cgPlot, /OverPlot, xx, replicate(muMag[0]-muMag[1],nbP), color='cornflower blue', lineStyle=2 cgPlot, /OverPlot, xx[sel], magGo[sel], psym='Filled circle', color='Red', symSize=1.5 cgPlot, /OverPlot, xx[sel], magGo[sel], color='Red' cgPlot, /OverPlot, xx, replicate(mu2[0],nbP), color='Orange' cgPlot, /OverPlot, xx, replicate(mu2[0]+mu2[1],nbP), color='Orange', lineStyle=2 cgPlot, /OverPlot, xx, replicate(mu2[0]-mu2[1],nbP), color='Orange', lineStyle=2 print, ' ', rmsMag, rms2, abs(rmsMag-rms2), rangeMag, range2 if abs(rmsMag-rms2) gt 0.2 or range2 ge 1 then stop ; code somehting that tries to remove one point after another if var ; is super large? if range2 ge 2 then begin vec = magGo[sel] uec = uncGo[sel] rms = fltarr(nbSel) for kSel=0, nbSel-1 do begin pp = where(indgen(nbSel) ne kSel) print, pp muLoc = meanWithUnc( vec[pp], uec[pp] ) rms[kSel] = sqrt( mean( ( (vec-muLoc[0]) )^2. ) ) print, rms[ksel] endfor stop endif ; wait, 0.5 ; stop ;-licence tFile='/tmp/tempoLC.dat' ;-licence forprint, jd, magO, uncO, subset=[cur[loc]], /noComment, textout=tFile, format='(D,F,F)',/silent ;-licence ;-licence dirSSO = dirObj+uName[kSSO]+'/' ;-licence if not file_test(dirSSO,/dir) then file_mkdir, dirSSO ;-licence koalaConvLC, id, tFile, dirSSO+'in-'+string(kEp+1,format='(I02)')+'.lc', $ ;-licence filter=band[cur[0]], src='RoPACS' ;-licence nbLC++ endif endfor ;-licence if nbLC ne 0 then begin ;-licence spawn, 'echo '+strtrim(string(nbLC),2)+' > '+dirLC+strtrim(string(id),2)+'.lc' ;-licence spawn, "for k in `ls "+dirSSO+"*.lc`;do awk 'NR>1' $k >> "+dirLC+strtrim(string(id),2)+'.lc; done' ;-licence endif print, kSSO, uName[kSSO], nbCur, nbEpoch, nbLC, $ format='(I3,1x,A-20,1x,I3,1x,I3,1x,I3)' jump: endfor end