;+ ; NAME: ; smei_orb_fractions ; PURPOSE: ; Calculates approximations for parameters needed to ; create orbital "on-the-fly" patterns ; CATEGORY: ; CALLING SEQUENCE: PRO smei_orb_fractions ; INPUTS: ; (none) ; OUTPUTS: ; (output to screen) ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; flt_read, FindAllFiles, GetFileSpec ; timeposn, smei_orbit_get ; TimeSet, TimeUnit, TimeOp, TimeLInterpol ; PROCEDURE: ; MODIFICATION HISTORY: ; APR-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- uday = TimeUnit(/day ) uyr = TimeUnit(/year) ; Read c3orb bash script f = filepath(root=getenv('SSWDB_SMEI'),subdir=['cat','list'],'c3orb') IF NOT flt_read(f, atleast=5, d) THEN $ RETURN d = reverse(d,2) ; d[0,*] minimum orbit ; d[1,*] first difference orbit ; d[2,*] last difference orbit ; d[3,*] low fraction ; d[4,*] high fraction nr_min_orb = reform(d[0,*]) ut_min_orb = TimeSet(smei=nr_min_orb) ; The line for minimum orbit 16275 was the last one set up by Zach ; The lines up to this one are used to calculate the later ones. loc = (where( nr_min_orb EQ 16276))[0] nr_min_orb = nr_min_orb[0:loc] ; Minimum orbit number ut_min_orb = ut_min_orb[0:loc] ; Start time of minimum orbit ; Time of last minimum orbit seet up by Zach ut_last = ut_min_orb[loc] lo_frac = reform(d[3,0:loc]) ; Low orbit fraction hi_frac = reform(d[4,0:loc]) ; High orbit fraction ;plotcurve, ut_min_orb, lo_frac, xstyle=1 ;plotcurve, ut_min_orb, hi_frac, linestyle=3, /oplot ; Read the catalogue containing the number of frames ; per orbit for camera 3 in mode 1. ; Remember that this file is in reverse chronological order f = filepath(root=getenv('SSWDB_SMEI'),subdir=['cat','list'],'smei_frm_orb_m1.txt') IF NOT flt_read(f, atleast=11, c3m1) THEN $ RETURN c3m1_orb = round( reform(c3m1[ 0,*] ) ) ; Orbit number c3m1_cnt = round( reform(c3m1[10,*] ) ) ; Nr of frames in orbit with mode=1 ;c3m1_cnt = round( reform(c3m1[14,*] ) ) ; Pick up a list all "closed shutter" calibration patterns cals = FindAllFiles('c3cal*.fts.gz',path=filepath(root=getenv('SSWDB_SMEI'),'cal'),count=count) message, /info, strcompress(count,/rem)+' calibration patterns for camera 3' IF count EQ 0 THEN RETURN cals = GetFileSpec(cals, part='name') cal_ut = timeposn(cals,/extract) ; Time of calibration pattern cal_orb = TimeGet(/smei, cal_ut) cal_orb = smei_orbit_get(cal_orb,/number); Integer orbit number for cal pattern one_year = TimeSet(/diff,1,uyr) FOR i=0,count-2 DO BEGIN ; Loop over calibration patterns ; Find entries in c3m1 between subsequent calibration patterns ; Since c3m1_orb is in reverse chronological order loc2 < loc1 loc1 = (where(cal_orb[i] EQ c3m1_orb))[0] IF i LT count-1 THEN loc2 = (where(cal_orb[i+1] EQ c3m1_orb))[0] ELSE loc2 = -1 ;print, cals[i], cal_orb[i] IF loc1 NE -1 THEN BEGIN IF loc2 EQ -1 THEN $ loc2 = (loc1-100) > 0 ; Pick up nr of frames for orbit between subsequent cal patterns ; Pick up a list of orbits with more than 1000 frames enough = where( c3m1_cnt[loc2:loc1] GT 1000, n ) IF n NE 0 THEN BEGIN ; First orbit is first orbit after cal pattern with ; more than 1000 frames ; Last orbit is last orbit preceding subsequent cal pattern ; with more than 1000 frames ; (Remember c3m1_orb is in reverse chronological order) first_orbit = (c3m1_orb[loc2:loc1])[enough[n-1]] last_orbit = (c3m1_orb[loc2:loc1])[enough[ 0]]+1 min_orbit = first_orbit ; Step back from start time for minimum orbit ; by one-year steps until we are in the range of times ; extracted from the c3orb script. ut = TimeSet(smei=min_orbit) REPEAT ut = TimeOp(/subtract,ut,one_year) $ UNTIL TimeOp(/subtract,ut,ut_last,uday) LT 0 ; Interpolate to get lo_frac and hi_frac lo_frac_prev = TimeLInterpol(lo_frac,ut_min_orb,ut) hi_frac_prev = TimeLInterpol(hi_frac,ut_min_orb,ut) ;print, cals[i], cal_orb[i], min_orbit, first_orbit, last_orbit, lo_frac_prev,hi_frac_prev cmd = '$orb -min=' +string(min_orbit ,format='(I5.5)') + $ ' -start=' +string(first_orbit ,format='(I5.5)') + $ ' -stop=' +string(last_orbit ,format='(I5.5)') + $ ' $arg' + $ ' -low=' +string(lo_frac_prev,format='(F5.3)') + $ ' -high=' +string(hi_frac_prev,format='(F5.3)') print, cmd ENDIF ENDIF ENDFOR RETURN & END