pro descent_cal_cycles,log ; Last modified by C. See, 12/11/98 ; Created by C. See in late March, 1998 (and into mid April) ; This program looks at the Cal Cycle data from descents, and creates a ; tabular display in the Log directory as ./cal_cycles.out. ; It also provides plots the data. If the data is printed, the Postscript ; file is saved in the Log directory as ./cal_cycles.ps ; The default Log is the current directory. ;This program calls 4 other procedures which deal with the Dark data sets, ; Spectrometers, Solar Aureole's, and Images. They are 'des_cal_cycle_....pro'. ;The basic algorithm is: ; 1 Read all of the Descent data sets and create a matrix listing all the Cal cycles ; 2 Print this data to './cal_cycles.out' ; 3 Plot the Altitude & Spin vs. time from the Descent Cycles. ; 4 Call the 4 Subroutines that treat the Cal data sets ;The subroutine algorithm's are essentially all the same: ;1 Read the data sets for the first Data Base type and create a list that contains ; the cycle number and measurement type for each file. ;2 Sort through this list to find the file corresponding to the first Cal A cycle. ;3 Read in the data for the first Cal A ;4 Repeat steps 2 & 3 for the Cal C data ;5 Repeat steps 2 & 3 for the Cal B (darks) and check to assure matching exposure times. ;6 Do the dark subtraction, Cal A - Cal B, and Cal C - Cal B. ;7 Print the data to the file & plot it out. ;8 Repeat steps 2 thru 7 for each Cal cycle Set (nominally 4 sets). ;9 Plot the progression of the Cal Data vs. time for the 4 Cal sets. ;10 Go to the next measurement type and repeat steps 1 thru 10. ;11 Repeat for each relevant Data Base directory ;The Dark Data set procedure (des_cal_cycle_dark.pro) has more comments than the others. ;It is possible to run only a portion of the procedure by commenting out the undesired ; subroutine calls near the end of this procedure ; cal_cycle_type is cal A, B or C (lamps on, off, on respectively) ; cal_cycle_set is 1st, 2nd, 3rd or 4th (9, 30, 41, or 79 minutes) @c_system.inc @c_header.inc ;__________________________________________________________________________ ;Initial Setup, Directory, Printing, etc.... if strpos(!path,'/des_cal_cycles:') eq -1 then $ !path='/users/csee/idl_programs/des_cal_cycles:'+!path ;subroutines !p.font=0 ;Use device fonts (for drawn fonts set to -1) ;4/28 !x.range=[0,0] ;initialize to autoscale !y.range=[0,0] Print,'' Print,'This program summarizes the data from descent cal cycles.' Print,'Tabular data is placed in the Test Log as: ./cal_cycles.out' Print,'It also plots the data to the Screen or Printer.' Print,'All data is dark subtracted using the Cal B darks. cd,'',current=cdir & cd,cdir ;establishes cdir as current directory if n_params() eq 0 then log = cdir ;current dir is the default Print,'The test log is: ',log Print,'' hardcopy=0 ans='' read,'Do you want the output to go to the printer (y or n)?: ',ans if ans eq 'y' then hardcopy=1 update=0 ans='' read,'Do you want to update the output files (y or n)?: ',ans if ans eq 'y' then update=1 if update eq 1 then outfile=cdir+'/cal_cycles.out' else outfile='~/junk.out' if update eq 1 then ps_file=cdir+'/cal_cycles.ps' else ps_file='~/idl.ps' Print,'Please wait...' Print,'' close,1 openw,1,outfile ;Print file header... printf,1,'This is a summary of the Cal Cycle Data from: ',log printf,1,'Todays date is: ',systime(0) printf,1,'All data is dark-subtracted using the darks from Cal B' ;To eliminate protions of the descent from consideration (i.e. out-of-lock) time1=0.0 & time2=0.0 ;begin and end times for block-out ans='' Read,'Do you want to block-out any portions of the descent? (y or n): ',ans if ans eq 'y' then begin read,'Input the begining and end times for the block in decimal minutes: ',time1,time2 print,'The time between ',sstr(time1),' and ',sstr(time2),' minutes will not be considered.' printf,1,'**The time between ',sstr(time1),' and ',sstr(time2),' minutes has been blocked out.**' endif if hardcopy EQ 1 then begin set_plot,'ps' device,filename=ps_file,xsize=6.0,ysize=10.0,yoffset=0.5,xoffset=1.0, $ /Palatino,/Bold,/inches,/portrait,bits=8 !p.font=0 endif cd,log+'/DB/Descent' files=t_getfil() numfiles=count_files() ;the number of descent cycles cal_cycles=intarr(4,3) ;descent cycle number (cal_cycle_set, cal_cycle_type) cal_mtimes=fltarr(4,3) ;beginning time of cal cycle (cal_cycle_set, cal_cycle_type) end_time=fltarr(4,3) ;ending time of cal cycle (cal_cycle_set, cal_cycle_type) alt=fltarr(4,3) ;beginning altitude cal cycle (cal_cycle_set, cal_cycle_type) spin=fltarr(4,3) ;spin rate (cal_cycle_set, cal_cycle_type) seqno=intarr(4,3) ;sequence number, for tracking files count=intarr(3) ;count=# of cal cycles, broken down by cal A, B or C timep=fltarr(12) ;time for plot altp=fltarr(12) ;altitude for plot spinp=fltarr(12) ;spin rate for plot cal=['A','B','C'] list=intarr(3,numfiles) ;i,cycle_type,time ;__________________________________________________________________________ ; Obtain Cal Cycles Information... reset=0 for i=0,numfiles-1 do begin d_read,files(i),h,p if d_value(h,89) eq 1 then reset=reset+1 ;checking for resets (multiple cycle 1) list(*,i)=[i,d_value(h,90),d_value(h,88)] ;i,cycle_type,time endfor if reset gt 1 then print,string(7B),'*** The Instrument Reset ',sstr(reset-1),' times during this Descent.',string(10B) col_sort,list,2 ;sorts list in time order for i=0,numfiles-1 do begin cycle_type=list(1,i) time=list(2,i) if time ge time1*60 and time le time2*60 then goto,next_cycle ;to skip blocked-out data if cycle_type gt 3 and cycle_type lt 7 then begin ;types 4,5,& 6 = cal cycles d_read,files(list(0,i)),h,p c=cycle_type-4 ;c=0 for cal A, c=1 for cal B, & c=2 for cal C cal_cycles(count(c),c)=d_value(h,89) ;assign descent cycle number cal_mtimes(count(c),c)=time/60. ;record beginning time (minutes) alt(count(c),c)=d_value(h,98) ;altitude in meters spin(count(c),c)=d_value(h,99) ;spin in RPM seqno(count(c),c)=d_value(h,87) ;sequence number, for tracking files if i+1 gt numfiles-1 then goto, continue ;for the last cycle, there is no end time d_read,files(list(0,i+1)),h,p end_time(count(c),c)=d_value(h,88)/60. ;end time is start time of next cycle continue: count(c)=count(c)+1 ;count is number of cal cycles (0 thru 4) of each type (A,B or C) endif next_cycle: endfor ;__________________________________________________________________________ ;Output Cal Cycle info... ;Print Cal Cycles header... printf,1,format='(/,"Cal Set #",T12,"Time (minutes)",T28,"Descent",T38,"Altitude",T50,"Spin Rate",T61,"Seq")' printf,1,format='(T12,"Begin End",T28," Cycle",T38,"(meters)",T50," (RPM)",T61," # ",/)' ;Print Cal Cycle information... for n=0,max(count)-1 do begin for m=0,2 do begin printf,1,n+1,cal(m),cal_mtimes(n,m),end_time(n,m),cal_cycles(n,m),alt(n,m),spin(n,m),seqno(n,m), $ format='(" Cal ",i1,a1,T10,F7.2,T19,F7.2,T28,i5,T37,i8,T49,F8.2,T60,I3)' timep(3*n+m)=cal_mtimes(n,m) ;time for plot altp(3*n+m)=alt(n,m) ;altitude for plot spinp(3*n+m)=spin(n,m) ;spin rate for plot endfor printf,1,'' endfor ;__________________________________________________________________________ ;Plot Cal Cycle information... Print,'Plotting Altitude & Spin vs. time...' if hardcopy eq 0 then window,0,xsize=655,ysize=960 !P.MULTI=[0,1,2,0,0] !x.title='Mission Time (Minutes)' !y.title='Altitude (kilometers)' !y.range=[0,140] ;altitude range time_spin=timep ;preserve time array for spin plot, following filtzero,timep,altp ;removes 0,0 datasets for plotting plot,timep,altp/1000,title='Altitude and Spin Plots' !y.title='Spin Rate (RPM)' !y.range=[0,10] ;spin range filtzero,time_spin,spinp ;removes 0,0 datasets for plotting plot,time_spin,spinp If hardcopy eq 0 then read,'Hit Return to proceed',ans erase ;__________________________________________________________________________ ; Collect data for Mission Plots (performance vs. time) Dark=fltarr(5,8) ;Dark(time;min;ave;max;temp , two measurements per set) DLIS=fltarr(5,8) ;DLIS(time;min;ave;max;temp , two measurements per set) ULIS=fltarr(5,8) ;ULIS(time;min;ave;max;temp , two measurements per set) Leak=fltarr(5,4) ;Leak(time;min;ave;max;temp , one measurements per set) DLV=fltarr(3,8) ;DLV(time;data;temp , two measurements per set) ULV=fltarr(3,8) ;ULV(time;data;temp , two measurements per set) DLVS=fltarr(5,8) ;DLVS(time;min;ave;max;temp , two measurements per set) ULVS=fltarr(5,8) ;ULVS(time;min;ave;max;temp , two measurements per set) SA1=fltarr(5,8) ;SA1(time;min;ave;max;temp , two measurements per set) SA2=fltarr(5,8) ;SA2(time;min;ave;max;temp , two measurements per set) SA3=fltarr(5,8) ;SA3(time;min;ave;max;temp , two measurements per set) SA4=fltarr(5,8) ;SA4(time;min;ave;max;temp , two measurements per set) MRI=fltarr(5,4) ;MRI(time;min;ave;max;temp , one measurements per set) SLI=fltarr(5,4) ;SLI(time;min;ave;max;temp , one measurements per set) HRI=fltarr(5,4) ;HRI(time;min;ave;max;temp , one measurements per set) ;_____________________________________________________________________________________________________________________________ ;Subroutine Calls... des_cal_cycle_dark,cal_cycles,Dark,log,hardcopy des_cal_cycle_spect,cal_cycles,DLIS,ULIS,Leak,DLV,ULV,DLVS,ULVS,log,hardcopy des_cal_cycle_sa,cal_cycles,SA1,SA2,SA3,SA4,log,hardcopy des_cal_cycle_image,cal_cycles,MRI,SLI,HRI,log,hardcopy ; junk,cal_cycles,MRI,SLI,HRI,log,hardcopy ;_____________________________________________________________________________________________________________________________ close,/all ;stop cd,cdir ;return to original directory close,/all if hardcopy eq 0 then wdelete,0 ;kill the window ; for printing ... if hardcopy EQ 1 then begin if update eq 1 then spawn,'lp -ofp14 -olm5 cal_cycles.out' else spawn,'lp -ofp14 -olm5 ~/junk.out' device,/close_file if update eq 1 then spawn,'lp ./cal_cycles.ps' else spawn,'lp ~/idl.ps' set_plot,'x' endif print,'' print,'The text output is in: ',outfile print,'If you printed, it is also on the printer (hopefully), ' print,'and the graphics print file is: ',ps_file print,'' print,'Bye for now!' print,'' end