;--- June/July 2018 ; ;--[bcarry@hyperion]--[/home/bcarry/data/lc/ropacs/input]----------------------------------[4 files 7.8M]- ;--[13:25]-- $ stilts tcopy in=asteroids_lc01.xml ifmt=votable ofmt=csv out=benoit_ropacs_15june2018.csv ;-- update 2019-01-14 ;-- entire file for Miriam -> Josef ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- I -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; root='/data/lc/ropacs/2019-01-14/' dirLC = root+'lc/' dirSplit = root+'split/' file='ropacs.csv' ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- II -- Initialization And Input Verification -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; readcol, root+file, delimiter=',', /Silent, $ Num,Name,ALPHA_J2000,DELTA_J2000,J_mag,eJ_mag,HV_mag,JD,astpimage,gID,gSize, $ format='(A,A,F,F,F,F,F,D,A,L,L)' nEntry=n_elements(name) nbSSO = max(GID) ; uList = uniq(name,sort(name)) ; uName = name( uList ) ; nbSSO = n_elements( uName ) ord=uniq(gSize,reverse(sort(gSize))) ; ord=reverse(sort(gu)) print, nbSSO, nEntry;, 1.*nEntry/nbSSO help, ord ;stop ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; ;--- TAG --- III -- Convert Lightcurves -----------------------; ;-----------------------------------------------------------------------------------------------; ;-----------------------------------------------------------------------------------------------; for kSSO=0, nbSSO-1 do begin kID = kSSO+1;gId[ord[kSSO]] cur = where( kID eq GID, nbCur ) curName = name[cur[0]] fileName = curName space=strpos(curName,' ') if space[0] ne -1 then strPut, fileName, '_', space[0] ; print, kSSO, kId, nbCur ; print, curName+' -- '+fileName ;stop id = curName if valid_num(num[cur[0]]) then begin id=num[cur[0]] filename=strTrim(string(id,format='(I)'),2) endif print, kSSO, curName, nbCur, Gsize[cur[0]], id, format='(I4,2x,A-20,2x,I3,2x,I3,4x,A-15)' ;---Single Big LC forprint, JD, J_mag, eJ_mag, format='(D,F,F)', /NoComment, /Silent, $ subSet=cur, textout='/tmp/extract.dat' koalaConvLC, id, '/tmp/extract.dat', dirLC+fileName+'.lci', /Simple, filter='J', src='M_Cortes' ;---Split per night dates = floor(JD[cur]) uDates=uniq(dates, sort(dates)) nbd = n_elements(uDates) fTmp='/tmp/lc' fList='/tmp/list' spawn, 'rm -f '+fTmp+'* '+fList nbOk=0 for kD=0, nbd-1 do begin loc = where( dates eq dates[uDates[kD]], nbP ) print, kd, nbp if nbP gt 4 then begin forprint, JD, J_mag, eJ_mag, format='(D,F,F)', /NoComment, /Silent, $ subSet=cur[loc], textout='/tmp/extract.dat' koalaConvLC, id, '/tmp/extract.dat', fTmp+strTrim(string(kD+1,format='(I03)'),2)+'.lci', $ /Simple, filter='J', src='M_Cortes' spawn, 'echo "'+fTmp+strTrim(string(kD+1,format='(I03)'),2)+'.lci" >> '+fList nbOk++ endif endfor if nbOk gt 1 then begin readcol, fList, fileLC, format='(A)', /Silent fileLC=strTrim(fileLC,2) spawn, 'echo "'+strTrim(string(nbOk,format='(I4)'),2)+'" > '+dirSplit+fileName+'.lci' for kD=0, nbOk-1 do spawn, "awk 'NR>1' "+fileLC[kD]+' >> '+dirSplit+fileName+'.lci' endif ; stop endfor ; ; ; ; ; ; ; ;-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