; This file continas rd_term_times, rd_sfc, op_term_score ; Last update was 22-Apr-00, HSH ; ; ---------------------------------------------------------------- pro rd_term_times, t1, t2, op_times, downlink ;NAME: ; rd_term_times ;PURPOSE: ; Read the term_times.txt file on the $ydb/orbit/opog directory ;HISTORY: ; 27-Feb-97, J. R. Lemen, Written ; 12-Mar-97, JRL, Added t1, t2 parameters ; 3-Sep-97, JRL, Guard against blank lines in the term_times.txt file ;- term_file = '$ydb/orbit/opog/term_times.txt' term_op = rd_tfile(term_file) xx = where(strlen(strtrim(term_op,2)) gt 0, npts) if npts gt 0 then term_op = term_op(xx) else delvarx, term_op npts = n_elements(term_op) op_times = strarr(npts) downlink = strarr(npts) for i=0,npts-1 do begin xx = str2arr(strcompress(term_op(i)),' ') op_times(i) = xx(1) + ' ' + xx(2) downlink(i) = xx(6) endfor ; Time sort just to be sure: ii=int2secarr(op_times) jj=sort(ii) op_times = op_times(jj) downlink = downlink(jj) if n_elements(t1) eq 0 then t1 = op_times(0) else t1 = fmt_tim(t1) if n_elements(t2) eq 0 then t2 = op_times(npts-1) else t2 = fmt_tim(t2) ss = int2secarr(op_times) & ss1 = int2secarr([t1,t2],op_times(0)) print,' File '+term_file,' contains op_first_guess times from:' print,' '+fmt_tim(op_times(0))+' to '+fmt_tim(op_times(npts-1)) jj = where(ss ge ss1(0) and ss le ss1(1), nn) if nn eq 0 then begin on_error,1 message,'No valid op_first_guess times in specified range' endif op_times = op_times(jj) downlink = downlink(jj) end ; end of rd_term_times ; ---------------------------------------------------------------- pro rd_sfc, t1, t2, rmap_sfc, files_sfc=files_sfc, qdebug = qdebug ;NAME: ; rd_sfc ;PURPOSE: ; Read the roadmaps of the sfc files that occurred between times t1 and t2 ;CALLING SEQUENCE: ; rd_sfc, t1, t2, rmap_sfc ;HISTORY: ; 25-Feb-97, J. R. Lemen, Written ; 20-Jun-99, H. S. Hudson, replaced "findfile" with "file_list" ; 18-Jan-00, D. McKenzie, replaced file_list with find_file ; 30-Jan-00, HSH, sorted the output ; 22-Apr-00, HSH, sorted the input times (derived from file names) ;- ;files_sfc = findfile('$DIR_SXT_SFC/sfc*') ;files_sfc = file_list('$DIR_SXT_SFC','sfc*',/cd) files_sfc = find_file('$DIR_SXT_SFC/sfc*',/nodot) ; DMcK 18-jan-00 break_file, files_sfc, dsk, dir, name, ext month = [' ','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] yr = strmid(name,3,2) mn = month(strmid(name,5,2)) dd = strmid(name,7,2) hh = strmid(ext,1,2) mm = strmid(ext,3,2) times = dd + '-' + mn + '-' + yr + ' ' + hh + ':' + mm time_sort = sort(anytim(times)) i1 = tim2dset(times(time_sort),t1) i2 = tim2dset(times(time_sort),t2) files_sfc = files_sfc(i1:i2) message,string('Reading ',strtrim(i2-i1+1,2),' SFC roadmaps'),/info rd_roadmap,files_sfc,rmap_sfc ss = sort(anytim(rmap_sfc)) rmap_sfc = rmap_sfc(ss) if keyword_set(qdebug) then stop end ; end of rd_sfc ; ---------------------------------------------------------------- ;+ ;NAME: ; op_term_score ;PURPOSE: ; Determine how well op_first_guess is scheduling terminators ;CALLING SEQUENCE: ; op_term_score ; op_term_score, time1, time2 ; op_term_score, buff=buff ; Return string output array in buff ; op_term_score, outfile=outfile ; Write results to a file for printing ; ; Reads the file on $ydb/orbit/opog/term_times.txt . This file is ; updated by a cron job which reads recent op*txt files. ; ; OPTIONAL INPUTS: ; time1, time2 - Specify the range times ; outfile - If filename exists, write text to file ; ; OPTIONAL OUTPUTS: ; buff - String array with results ; files_sfc - Names of the sfc files ; index_accidental - Indicies of the accidentals ; ; If time1 and time are not specified, then the first and last time ; of the term_times.txt file is assumed. ; ;HISTORY: ; 27-Feb-97, V1.0, J. R. Lemen, Written ; 12-Mar-97, V1.1, JRL, Improved the header information ; 20-Jun-99, V1.2, H. Hudson, added NOVERB and XY keywords ; 30-Jan-00, V1.3, DMCK and HSH patched up the listing ;- pro op_term_score, t1, t2, qstop=qstop, buff=buff, outfile=outfile, $ files_sfc=files_sfc, index_accidental=index_accidental, $ noverb = noverb, xy = xy version = 'OP_TERM_SCORE V1.3 (30-Jan-00)' if n_elements(t1) gt 0 then tt1 = t1 if n_elements(t2) gt 0 then tt2 = t2 rd_term_times, tt1, tt2, op_times, downlink ; Get op_first_guess times rd_sfc, tt1, tt2, rmap_sfc, files_sfc=files_sfc ; Get sfc image times tim2orbit,rmap_sfc,tim2night=tim2night ; Get the time-to-night data if n_elements(xy) ne 2*n_elements(rmap_sfc) $ then xy = sxt_cen(rmap_sfc) ; Get pointing buff = [string(version,'Run on: ',!stime,form='(a,10x,2a)'),' '] buff = [buff,string('Time range is ',fmt_tim(tt1),' to ',fmt_tim(tt2)),' '] buff = [buff,string('Number of op_first_guess scheduled terminators = ',n_elements(op_times),form='(a,i4)')] buff = [buff,string('Number of sfc files = ',n_elements(rmap_sfc),form='(a,i4)')] buff = [buff,' ',' '] buffh= buff buff0 = '---------------------------------------------------------------------------------' buff = [buff,buff0,'---op_first_guess-- ----- sfc time ---- delta tim2night',buff0] jj=tim2dset(op_times,rmap_sfc) delta=addtime(op_times(jj),diff=rmap_sfc,/sec) qacc=0 for i=0,n_elements(rmap_sfc)-1 do begin if abs(delta(i)) gt 32. then begin op_x = ' ' dxx = ' ****' comm = 'Accidental' qacc = qacc + 1 endif else begin op_x = fmt_tim(op_times(jj(i))) dxx = string(delta(i),format='(f8.2)') comm = '' endelse buff = [buff, string(op_x,fmt_tim(rmap_sfc(i)), $ dxx,tim2night(i)*60.,gt_res(rmap_sfc(i),/shor), $ gt_filtb(rmap_sfc(i),/str)+'/'+gt_filta(rmap_sfc(i),/short),comm,$ form='(a,2x,2a,f8.2,2x,a,2x,a,x,a)')] endfor index_accidental = where(abs(delta) gt 32.) index_no_acc = where(abs(delta) le 32.) dlate = stdev(delta(index_no_acc),late) score0 = float(n_elements(rmap_sfc))/ n_elements(op_times) ; score score1 = float(n_elements(rmap_sfc)-qacc) / n_elements(op_times); w/o accidentals score0_str = string('(',strtrim(n_elements(rmap_sfc),2),'/',strtrim(n_elements(op_times),2),')') score1_str = string('(',strtrim(n_elements(rmap_sfc)-qacc,2),'/',strtrim(n_elements(op_times),2),')') buff = [buff,buff0,' ',buffh] buff = [buff,string('------- Summary -------',format='(26x,a)')] summ = intarr(7,2) for i=2,6 do for j=0,1 do begin kk = [1,6] jj = where(gt_filtb(rmap_sfc) eq i and gt_filta(rmap_sfc) eq kk(j),ncc) summ(i,j) = ncc endfor ij = [2,3,6,5,4] buff = [buff,string(gt_filtb(ij,/string),format='(6x,3x,5x,2x,5(3x,a))')] buff = [buff,string(gt_filta( 1,/string),summ(ij,0),format='(6x,3x,a,5i8)')] buff = [buff,string(gt_filta( 6,/string),summ(ij,1),format='(6x,3x,a,5i8)'),' '] buff = [buff,string('Number of accidentals = ',qacc,format='(6x,a,i3)')] fmt = '(6x,a,f5.1,a,10x,a)' buff = [buff,string('Percentage success rate = ',score0*100.,' %',score0_str,form=fmt)] buff = [buff,string(' without accidentals = ',score1*100.,' %',score1_str,form=fmt)] buff = [buff,string('Mean latency = ',late,' +/-',dlate,' (sec)', $ form='(6x,a,f6.2,a,f6.2,a)')] if keyword_set(noverb) eq 0 then more,buff if keyword_set(outfile) then prstr,file=outfile,buff if keyword_set(qstop) then stop end