C+ C NAME: C HOSPlot C PURPOSE: C Viewing and editing of Helios brightness time series C CATEGORY: C Data processing C CALLING SEQUENCE: program HOSPlot C INPUTS: C Helios data files C FOREIGN see PROCEDURE C OUTPUTS: C Edit operations are recorded in the input file upon exit C CALLS: C BadR4, pInfR4, ForeignInput, itrim, iHOSInfo, HOSRead, HOSUpdate, Say C IndexR4, AskWhat, AskYN, AskI4, AskR4, AskI4G, iwhitespace, C ArrR4GetMinMax, Int2Str, Str2Str, cInt2Str, cFlt2Str C HOSPlot_bCommand, HOSPlot_DrawBase, HOSPlot_EditPoints, HOSPlot_EraseBase C iSetTermAndPlot, iSwitchGraphicsOn, iSwitchGraphicsOff, ClearWindow C iSetForegroundColor, iSetBackgroundColor, iSetColor, iSetSysNormal, XYLabel C iSetSysUnits, iGetDeviLimits, USRDF, DrawBox, MoveDrawI, Move, Draw, MoveI C DrawI, FOut, GinBar, bIsXEvent, BlankLine, iSetCenterJustify C iSetTopJustify, iSetHorizJustify, iSetVertJustify, iSetRightJustify C iSetMiddleJustify, Hardcopy C INCLUDE: include 'openfile.h' include 'hos_e9.h' C COMMON BLOCKS: common /QUERIES/ DAT2,TOP1,TOP2 common /ZOOM/ TBeg,TEnd,TMax,TMin,YMax,YMin C RESTRICTIONS: C Only one photometer/color combination is read from the input file and C available for viewing/editing. C PROCEDURE: C > Display options: C - Next sector - Jump sector - Edit filter C - Print time series - Zoom - Exit C Editing options: C - subtracting linear 'background' (baseline subtraction) C - removing bad data points C - shift baseline for (part of) a time series C > Data points can be marked by vertical dashes, squares or crosses. C The choice is made in the command line invoking HOSPLOT (the $ commands C should be stored in a symbol, which is then executed at the DCL prompt) C dashes: run HOSPLOT or $ HOSPLOT C squares: $ HOSPLT HOSPLOT1 C crosses: $ HOSPLOT HOSPLOT2 C (the squares option basically implements the old TPRINT C program, written by Tina Schwenn) C MODIFICATION HISTORY: C ? C NOV-1991, Paul Hick (UCSD); added LAYOUT=1 option; introduced file checking by bOpenFile C JUN-1992, Paul Hick (UCSD); added 'shift baseline' option C Paul Hick (UCSD); added GinBar calls (EMU-TEK only) C SEP-1998, Paul Hick (UCSD); modified data input section (now uses iHOSInfo, HOSRead) and C data output section (now uses HOSUpdate) C- parameter (nT=10000) parameter (nS=32) integer NN(nT) integer PP(nT) integer CC(nT) integer FF(nT) real TT(nT) real RR(nT) real LL(nT) real YY(nS,nT) integer itt(nT) integer jtt(nT) integer NR(5) integer jEdt /0/ integer iS /1/ integer NORMAL /1/ integer BOLD /2/ integer LineTyp(5) /2,3,4,0,1/!dash,dotdash,dotlongdash,solid,dot integer ColorTyp(5) /1,2,3,8,5/!?,red,green,yellow,cyan integer iPScale(3) /100,50,10/ integer Lst(3,11) integer kPP(0:3) /HOS__P_ALL,HOS__P_1,HOS__P_2,HOS__P_3/ integer kCC(0:3) /HOS__C_ALL,HOS__C_1,HOS__C_2,HOS__C_3/ integer kFF(0:6) /HOS__F_ALL,HOS__F_1,HOS__F_2,HOS__F_3,HOS__F_4,HOS__F_5,HOS__F_CLRPB/ logical bMore logical bMove logical bAllFlt logical bAllClr logical bAuto logical bTmp logical HOSPlot_bCommand logical bOpenFile logical bIsXEvent character cPhotometer(3)*2/'16','31','90'/ character cColor(3)*6 /'UV ','BLUE ','VISUAL'/ character cFilter(5)*12 /'1. 0 DEG PF','2. 90 DEG PF','3. 45 DEG PF','4. NO POLAR.','5. POLAR. B.'/ character cVar(1) *6 character cInt2Str*14 character cFlt2Str*14 character cStr *80 character cFile *80 logical bPoint logical bGoodPoint logical bOnePP logical bOneCC logical bOneFF bPoint (I,J) = (bAllFlt .and. FF(I) .eq. J) .or. (bAllClr .and. CC(I) .eq. J) bGoodPoint(I ) = ( (bAllFlt .and. jBeg .le. FF(I) .and. FF(I) .le. jEnd) .or. & (bAllClr .and. jBeg .le. CC(I) .and. CC(I) .le. jEnd) ) .and. YY(iS,I) .ne. Bad kFn(I) = Lst(I,1)+Lst(I,2)+Lst(I,3)+Lst(I,6)+Lst(I,7)+Lst(I,8) !------- ! Statement functions to check for single phot/color/filter selections bOnePP(kP) = kP .eq. HOS__P_1 .or. kP .eq. HOS__P_2 .or. kP .eq. HOS__P_3 bOneCC(kC) = kC .eq. HOS__C_1 .or. kC .eq. HOS__C_2 .or. kC .eq. HOS__C_3 bOneFF(kF) = kF .eq. HOS__F_1 .or. kF .eq. HOS__F_2 .or. kF .eq. HOS__F_3 .or. kF .eq. HOS__F_4 .or. kF .eq. HOS__F_5 Bad = BadR4() Big = pInfR4() K = 1 call ForeignInput(',',K,cVar) ! Get foreign input LAYOUT = 0 ! LAYOUT determines symbol used if (K .eq. 1) then ! .. to mark data points K = itrim(cVar(1)) read (cVar(1)(K:K),'(I)',iostat=I) LAYOUT if (I .ne. 0 .or. (LAYOUT .ne. 1 .and. LAYOUT .ne. 2)) LAYOUT = 0 endif I = iSetTermAndPlot(-1,1) ! Set graphics mode kP = 1 999 iT = 0 do while (iT .eq. 0) if (iHOSInfo(0,cFile,iRecl,iSc,iYr,TMin,TMax,kPCF,Lst) .eq. 0) & call Say('HOSPlot','I','StopPlay','Exit') kP = iand(kPCF,HOS__P_ALL) if (bOnePP(kP)) then do I=1,3 if (kP .eq. kPP(I)) kP = I end do else call AskWhat('Photometer: 16 deg,31 deg,90 deg)',kP) end if kC = iand(kPCF,HOS__C_ALL) if (bOneCC(kC)) then do I=1,3 if (kC .eq. kCC(I)) kC = I end do bAllFlt = .TRUE. ! If one color, plot all filters else call AskWhat('Color: All, UV, Blue, Visual$0$3',kC) bAllFlt = kC .ne. 0 ! Single color selected, plot all filters end if bAllClr = .not. bAllFlt if (bAllClr) then ! Plot all colors kF = iand(kPCF,HOS__F_ALL) if (.not. bOneFF(kF)) call AskWhat('Filter: 1,2,3,Clr,pB$1$4',kF) ! Select single filter iBeg = 1 ! First color iEnd = 3 ! Last color else if (bAllFlt) then ! Plot all filters kF = 0 bTmp = kFn(kC) .eq. 0 ! Data points for filters 1 through 3? if (.not. bTmp) call AskYN ('Only clear and pB$no',bTmp)! Restrict to Clr+pB if (bTmp) then ! Only Clear+pB kF = 6 ! Passed to HOSRead iBeg = 4 ! First filter is clear filter else iBeg = 1 ! First filter is 0 deg filter end if iEnd = 5 ! Last filter (pB) end if kPCF = kPP(kP)+kCC(kC)+kFF(kF) ! HOSRead could modify kPCF call HOSRead(kPCF,cFile,nT,iT,NN,TT,PP,CC,FF,RR,LL,nS,YY) end do ! Modified values of kC,kF do I=0,3 if (iand(kPCF,HOS__C_ALL) .eq. kCC(I)) kC = I end do do I=0,6 if (iand(kPCF,HOS__F_ALL) .eq. kFF(I)) kF = I end do if (kF .eq. 6) kF = 0 ! Clr+pB info is saved in iBeg,iEnd if (bAllFlt .and. kF .ne. 0) then ! All filters requested, .. iBeg = kF ! .. but there is only one filter available iEnd = kF else if (bAllClr .and. kC .ne. 0) then iBeg = kC ! All colors requested, ... iEnd = kC ! .. but there is only one color available end if call IndexR4(1,iT,1,nT,TT,itt) ! Index array to sort TT in chronological order iS = 1 if (kP .ne. 3) call AskI4('Start sector$1$32',iS) call ArrR4GetMinMax(iT,TT,TBeg,TEnd) ! Time range available on file TBeg = int(TBeg ) ! Round down TEnd = int(TEnd+1) ! Round up TMin = TBeg ! Time range to be plotted TMax = TEnd cStr = 'Y-scale maximum '//cInt2Str(iPScale(kP))//'*2^(input)' I = iwhitespace(cStr) TopSca = 0. call AskR4(cStr,TopSca) TopSca = iPScale(kP)*2.**TopSca call AskYN('Auto-scaling$yes',bAuto) I = iSwitchGraphicsOn() bMore = .TRUE. do while (bMore) TRange = TMax-TMin DAT2 = TMin+(324-350)/600.*TRange !=324 in device units jBeg = iBeg ! All filters/colors are processed jEnd = iEnd if (jEdt .ne. 0) then ! Only edited filter/color is processed jBeg = jEdt jEnd = jEdt end if iTMin = 1 do while (iTMin .le. iT .and. TT(itt(iTMin)) .lt. TMin) iTMin = iTMin+1 end do iTMax = iTMin do while (iTMax .le. iT .and. TT(itt(iTMax)) .le. TMax) iTMax = iTMax+1 end do iTMax = iTMax-1 !------ ! Scale vertical scale (intensity). Adjust TopSca depending on ! sector. If auto-scaling is used, expand scale if necessary to ! keep all points inside plot window. YMax = TopSca if (kP .ne. 3) then ! If 16-31 degree photometer if (iS .ge. 4 .and. iS .le. 29) YMax = YMax/5 if (iS .ge. 12 .and. iS .le. 21) YMax = YMax/4 end if YMin = -.5*YMax ! Bottom of Y-axis in user units Y1 = Big ! Min/max function value to be plotted Y2 = -Big do I=iTMin,iTMax ! Loop over all times in [TMin,TMax] ip = itt(I) if (bGoodPoint(ip)) then! Valid color/filter and fnc value not bad Y1 = min(Y1,YY(iS,ip)) Y2 = max(Y2,YY(iS,ip)) end if end do if (Y1 .eq. Big) then ! No data points Y1 = YMin Y2 = YMax end if if (bAuto) then ! Auto scale adjustment YMin = min(YMin,Y1) YMax = max(YMax,Y2) end if Y0 = 0 ! Marks zero intensity if (Y2-Y1 .lt. .666*Y2 .or. Y1 .gt. YMax .or. Y2 .lt. YMin) then YMin = Y1 ! Adjust absurd scalings YMax = Y2 Y0 = Y1 end if if (YMax .eq. YMin) YMax = YMin+1! Prevents crash in USRDF YRange = YMax-YMin TOP1 = YMax+.205*YRange !=748 in device units TOP2 = YMax+.1207*YRange !=708 in device units !------ ! Label plot: file name, sector, color, photometer, filters call ClearWindow I = iSetForegroundColor() c call HLINE(SOLID,NORMAL) iSave = iSetSysNormal() call XYLabel(5.,3.,cFile) ! Plot file name label ! For 16/31 deg photometer, label sector if (kP .ne. 3) call XYLabel(0.,77.,'Sector '//cInt2Str(iS)) call XYLabel(0.,73.,cPhotometer(kP)//' deg. photometer') ! Photometer label if (bAllFlt) call XYLabel(0.,69.,'Color '//cColor(kC)) ! Color label if (bAllClr) call XYLabel(0.,69.,cFilter(kF)) ! Filter label iSave = iSetSysUnits(iSave) I = iSetForegroundColor() c call HLINE(SOLID,NORMAL) I = iGetDeviLimits(XL,YL) call USRDF(.34*XL,.20*YL,.93*XL,.82*YL, TMin,YMin,TMax,YMax) call DrawBox(TMin,YMin,TMax,YMax) if (Y0 .ne. Y1 .and. Y0 .ne. Y2) then call MoveDrawI(TMin,Y0, .06*TRange,0) call MoveDrawI(TMax,Y0,-.06*TRange,0) end if iH = iSetCenterJustify() iV = iSetTopJustify () do T=int(TMin)+1,int(TMax)-1,1+int(TRange-5)/10 ! Label bottom X-axis call MoveDrawI(T,YMax,0., YRange*.025) ! Draw tickmark at top call MoveDrawI(T,YMin,0.,-YRange*.025) ! Draw tickmark at bottom call XYLabel(T,YMin-YRange*.030,cFlt2Str(T,0)) end do iH = iSetHorizJustify(iH) iV = iSetVertJustify (iV) YSTEP = 10**int(alog10(YRange)) Y1 = int(YMin/YSTEP) if (YMin .lt. 0) Y1 = Y1-1 Y2 = int(YMax/YSTEP) do while (Y2-Y1 .gt. 12) if (Y2-Y1 .gt. 6) then YSTEP = 2*YSTEP else if (Y2-Y1 .lt. 3) then YSTEP = int(YSTEP)/2 else if (Y2-Y1 .eq. 1) then YSTEP = int(YSTEP)/5 end if Y1 = int(YMin/YSTEP) if (YMin .lt. 0) Y1 = Y1-1 Y2 = int(YMax/YSTEP) end do Y1 = Y1*YSTEP+YSTEP Y2 = Y2*YSTEP dY = .06*YRange iH = iSetRightJustify () iV = iSetMiddleJustify() if (YMin .lt. Y1-dY) then ! If enough room, ... call Move(TMin-TRange*.015,YMin) call FOut(YMin,5,-1) ! .. label Y-axis bottom end if do Y=Y1,Y2,YSTEP ! Label left Y-axis call MoveDrawI(TMax,Y, TRange*.015,0) ! Draw tickmark right call MoveDrawI(TMin,Y,-TRange*.015,0) ! Draw tickmark left call FOut(Y,5,-1) end do if (YMax .gt. Y-YSTEP+dY) then ! If enough room ... call Move(TMin-TRange*.015,YMax) call FOut(YMax,5,-1) ! .. label top Y-axis end if iH = iSetHorizJustify(iH) iV = iSetVertJustify (iV) do J=jBeg,jEnd ! Loop over time series jT = 0 jTMin = 0 ! In case iTMin=1 do I=1,iT ! Loop in chronological order ip = itt(I) if (bPoint(ip,J)) then ! Pick up all points in time series jT = jT+1 ! (including bad points and points outside [TMin,TMax]) jtt(jT) = ip end if if (I .lt. iTMin) jTMin = jT if (I .le. iTMax) jTMax = jT end do NR(J) = jT ! # Points in time series jTMin = jTMin+1 iSave = iSetColor(ColorTyp(J)) c call HLINE(LineTyp(J),NORMAL) bMove = .TRUE. ! Forces move to 1st point do I=jTMin,jTMax ! Plot time series ip = jtt(I) T = TT( ip) Y = YY(iS,ip) if (Y .ne. Bad) then bTmp = YMin .le. Y .and. Y .le. YMax if (bTmp) then if (bMove) then call Move(T,Y) else call Draw(T,Y) end if if (LAYOUT .eq. 1) then ! Mark with squares dT = .004*TRange dY = .006*YRange c call HLINE(SOLID,NORMAL) call DrawBox(T-dT/2,Y-dY/2,T+dT/2,Y+dY/2) call MoveI(dT/4,0.) do K=1,4 call DrawI(0.,-dY) call MoveI(dT/4,dY) end do else if (LAYOUT .eq. 2) then! Mark with crosses c call HLINE(SOLID,NORMAL) XP = .005 *TRange*(J-iBeg+1-iBeg)! Size of X depends on filter YP = YRange*.0067*(J-iBeg+1-iBeg) XP2 = 2.*XP YP2 = 2.*YP call MoveI( XP, YP) call DrawI(-XP2,-YP2) ! Draw / (slash) call MoveI( 0., YP2) call DrawI( XP2,-YP2) ! Draw \ (backslash) call MoveI( -XP, YP ) c call HLINE(LineTyp(J),NORMAL) else ! Mark with vertical dash YP = YRange*.013 call MoveI(0., -YP) call DrawI(0.,2.*YP) call MoveI(0., -YP) end if ! Add tickmark to X-axis for each data point if (J .eq. jBeg .or. kP .ne. 3) then c call HLINE(SOLID,NORMAL) call MoveDrawI(T,YMin,0.,YRange*.02) end if call Move(T,Y) end if bMove = .not. bTmp end if end do !------ ! Data point tickmarks on X-axis are required if: ! 1. For all filters, if photometer 1 or 2 is being processed (kP .ne. 3) ! 2. Only one filter is plotted (jEdt .ne. 0; jEdt = iBeg = iEnd) ! 3. Only the clear filter, if photometer 3 is processed and both clear ! and pB are available (times for the 90 deg photometer, clear ! and pB data are identical, so if both are plotted the tickmarks have ! to be added for only one of the two) iSave = iSetSysNormal() Y = 66. if (NR(J) .ne. 0) then ! .. if data available, ... I = iSetColor(ColorTyp(J)) ! .. select relevant color, ... if (bAllFlt) call XYLabel(0.,Y-3*J,cFilter(J)) ! .. label filter and ... if (bAllClr) call XYLabel(0.,Y-3*J,cColor (J)) ! .. label color and ... c call HLINE(LineTyp(iFilt),NORMAL) ! .. line type call MoveDrawI(18.,Y-3*J+1.1,7.,0.) end if iSave = iSetSysUnits(iSave) end do ! End of color/filter plotting loop 6 if (jEdt .ne. 0) then ! Edit time series if requested iEdt = 0 do while (iEdt .ne. 7) cStr = '1-SUBTRACT BASE,2-EDIT POINTS,3-SHIFT BASE,7-END EDIT' iAns = 1 call GinBar(1,iAns,10.,96.5,80.,cStr) if (bIsXEvent(iAns)) go to 105 iEdt = iAns if (iEdt .eq. 1) then call HOSPlot_DrawBase(TMin,YMin,TMax,YMax,XB1,YB1,XB2,YB2) iAns = 1 call GinBar(2,iAns,30.,96.5,40.,'1-BASE OK,0-BASE NOT OK') if (bIsXEvent(iAns)) go to 105 bTmp = iAns .eq. 1 call GinBar(2,-1,30.,96.5,40.,' ') if (.not. bTmp) then call HOSPlot_EraseBase(TMin,YMin,TMax,YMax,XB1,YB1,XB2,YB2) else ! Subtract baseline S1 = (YB2-YB1)/(XB2-XB1) do I=1,NR(jEdt) ip = jtt(I) if (YY(iS,ip) .ne. Bad) then YY(iS,ip) = YY(iS,ip)-(YB1+S1*(TT(ip)-XB1)) NN(ip) = IBSET(NN(ip),31) ! Set sign bit end if end do iEdt = 7 ! End editing end if else if (iEdt .eq. 2) then call HOSPlot_EditPoints(iS,TMin,TMax,YMin,YMax,jTMin,jTMax,jtt,TT,YY,NN) else if (iEdt .eq. 3) then call BlankLine(TOP2) call XYLabel(DAT2,TOP2,'CLICK ON WINDOW START TIME') if (bIsXEvent( iGin(T1,Y,IB) )) go to 105 if (TMin .lt. T1 .and. T1 .lt. TMax) call MoveDraw(T1,YMin,T1,YMax) call BlankLine(TOP2) call XYLabel(DAT2,TOP2,'CLICK ON WINDOW END TIME') if (bIsXEvent( iGin(T2,Y,IB) )) go to 105 if (TMin .lt. T2 .and. T2 .lt. TMax) call MoveDraw(T2,YMin,T2,YMax) if (T1 .gt. T2) then Y = T1 T1 = T2 T2 = Y end if if (T1 .lt. TMin) T1 = TBeg if (T2 .gt. TMax) T2 = TEnd call BlankLine(TOP1) call XYLabel(DAT2,TOP1,'DEFINE TARGET BASELINE') call HOSPlot_DrawBase(max(T1,TMin),YMin,min(T2,TMax),YMax,XB1,YB1,XE1,YE1) call BlankLine(TOP1) call XYLabel(DAT2,TOP1,'DEFINE CURRENT BASELINE') call HOSPlot_DrawBase(max(T1,TMin),YMin,min(T2,TMax),YMax,XB2,YB2,XE2,YE2) call BlankLine(TOP1) iAns = 1 call GinBar(2,iAns,35.,96.5,30.,'1-OK,0-NOT OK') if (bIsXEvent(iAns)) go to 105 bTmp = iAns .eq. 1 call GinBar(2,-1,30.,96.5,40.,' ') if (bTmp) then S1 = (YE1-YB1)/(XE1-XB1) S2 = (YE2-YB2)/(XE2-XB2) do I=1,NR(jEdt) ip = jtt(I) if (T1 .le. TT(ip) .and. TT(ip) .le. T2 .and. YY(iS,ip) .ne. Bad) then YY(iS,ip) = YY(iS,ip)+((YB1+S1*(TT(ip)-XB1))-(YB2+S2*(TT(ip)-XB2))) NN(ip) = IBSET(NN(ip),31) ! Set sign bit end if end do iEdt = 7 ! End editing else call HOSPlot_EraseBase(max(T1,TMin),YMin,min(T2,TMax),YMax,XB1,YB1,XE1,YE1) call HOSPlot_EraseBase(max(T1,TMin),YMin,min(T2,TMax),YMax,XB2,YB2,XE2,YE2) if (TMin .lt. T1 .and. T1 .lt. TMax) then I = iSetBackgroundColor() call MoveDraw(T1,YMin,T1,YMax) I = iSetColor(I) end if if (TMin .lt. T2 .and. T2 .lt. TMax) then I = iSetBackgroundColor() call MoveDraw(T2,YMin,T2,YMax) I = iSetColor(I) end if end if end if end do end if 105 if (bIsXEvent(iAns)) then ! Intercept X-windows events iAns = 100 ! Cancel event else if (jEdt .ne. 0) then ! If color/filter was edited plot all colors/filters again jEdt = 0 else ! Else get and process new commands bMore = HOSPlot_bCommand(bAllFlt,bAllClr,kP,iS,iBeg,iEnd,jEdt,NR,iT,NN) if (jEdt .ne. 0 .and. iBeg .eq. iEnd) go to 6 end if ! SHORTCUT: only one time series: no need to replot end do I = iSwitchGraphicsOff() call HOSUpdate(kPCF,cFile,nT,iT,NN,TT,PP,CC,FF,RR,LL,nS,YY) go to 999 ! Back to start for another file or exit end C+ C NAME: C HOSPlot_EraseBase C CALLING SEQUENCE: subroutine HOSPlot_EraseBase(TMin,YMin,TMax,YMax,X1,Y1,X2,Y2) C PROCEDURE: C Erase baseline C- real TMin real YMin real TMax real YMax real X1 real Y1 real X2 real Y2 I = iSetBackgroundColor() call MoveDraw(X1,Y1,X2,Y2) I = iSetColor(I) return end C+ C NAME: C HOSPlot_DrawBase C CALLING SEQUENCE: subroutine HOSPlot_DrawBase(TMin,YMin,TMax,YMax,T1,Y1,T2,Y2) C PROCEDURE: C Plot baseline ad return endpoints C- real TMin real YMin real TMax real YMax real T1 real Y1 real T2 real Y2 logical bIsXEvent common /QUERIES/ DAT2,TOP1,TOP2 call BlankLine(TOP2) call XYLabel(DAT2,TOP2,'ENTER LEFT END POINT') if (bIsXEvent( iGin(T1,Y1,IB) )) return call BlankLine(TOP2) call XYLabel(DAT2,TOP2,'ENTER RIGHT END POINT') if (bIsXEvent( iGin(T2,Y2,IB) )) return call BlankLine(TOP2) !------- ! PLOT THE NEW BASELINE MAKING SURE NOT TO DRAW OUTSIDE SCREEN if (T1 .ne. T2 .and. Y1 .ne. Y2) then S = (Y2-Y1)/(T2-T1) ! Baseline with slope S Y_at_TMin = Y1+S*(TMin-T1) Y_at_TMax = Y1+S*(TMax-T1) T_at_YMax = T1+(YMax-Y1)/S T_at_YMin = T1+(YMin-Y1)/S if (S .lt. 0.) then T1 = max(TMin,T_at_YMax) Y1 = min(YMax,Y_at_TMin) T2 = min(TMax,T_at_YMin) Y2 = max(YMin,Y_at_TMax) else T1 = max(TMin,T_at_YMin) Y1 = max(YMin,Y_at_TMin) T2 = min(TMax,T_at_YMax) Y2 = min(YMax,Y_at_TMax) end if else if (Y1 .eq. Y2) then ! Horizontal baseline X1 = TMin X2 = TMax else ! Vertical baseline Y1 = YMax Y2 = YMin end if call MoveDraw(T1,Y1,T2,Y2) ! Draw baseline return end C+ C NAME: C HOSPlot_EditPoints C CALLING SEQUENCE: subroutine HOSPlot_EditPoints(iS,TMin,TMax,YMin,YMax,jTMin,jTMax,jtt,TT,YY,NN) C PROCEDURE: C Allows editing of points associated with the filter and sector C- integer iS real TMin real TMax real YMin real YMax integer jTMin integer jTMax integer jtt(*) real TT( *) real YY(32,*) integer NN(*) character cStr *80 character cStrOld*80 common /QUERIES/ DAT2,TOP1,TOP2 logical bIsXEvent Bad = BadR4() dY = (YMax-YMin)*0.013 dT = (TMax-TMin)*0.004 iSave = iSetForegroundColor() iAns = 0 cStr = ' ' do while (iAns .lt. 6) call BlankLine(TOP2) call XYLabel(DAT2,TOP2,'CLICK ON DATA POINT') if (bIsXEvent( iGin(T,Y,IB) )) then iSave = iSetColor(iSave) return end if call BlankLine(TOP2) I = jTMin ! Find data point closest to T do while (I .lt. jTMax .and. TT(jtt(I)) .lt. T) I = I+1 end do if (I .gt. jTMin .and. TT(jtt(I))-T .gt. T-TT(jtt(I-1))) I = I-1 ip = jtt(I) T = TT(ip) ! Nearest time inside [TMin,TMax] cStrOld = cStr if (YY(iS,ip) .ne. Bad) then Y = YY(iS,ip) cStr = '0-IGNORE,1-FLAG,6-IGNORE/STOP,7-FLAG/STOP' else call XYLabel(DAT2,TOP2,'FLAGGED ! SUBSTITUTE CURSOR VALUE ?') cStr = '0-IGNORE,1-SUBST,6-IGNORE/STOP,7-SUBST/STOP' end if call DrawBox(T-dT,Y-dY,T+dT,Y+dY) ! Selected point iAns = 1 if (cStr .eq. cStrOld) iAns = 0 call GinBar(3,iAns,20.,96.5,60.,cStr) if (bIsXEvent(iAns)) then iSave = iSetColor(iSave) return end if if (YY(iS,ip) .eq. Bad) call BlankLine(TOP2) if (iAns .eq. 1 .or. iAns .eq. 7) then if (YY(iS,ip) .eq. Bad) then YY(iS,ip) = Y else YY(iS,ip) = Bad end if NN(ip) = IBSET(NN(ip),31) ! Set sign bit else ! Change not accepted: erase box I = iSetBackgroundColor() call DrawBox(T-dT,Y-dY,T+dT,Y+dY) I = iSetColor(I) end if end do call GinBar(3,-1,20.,96.5,60.,' ') iSave = iSetColor(iSave) return end C+ C NAME: C HOSPlot_bCommand C PURPOSE: C Controls continuation of the graphics display loop C CALLING SEQUENCE: logical function HOSPlot_bCommand(bAllFlt,bAllClr,kP,iS,iBeg,iEnd,jEdt,NR,iT,NN) C INPUTS: C If IPHOTOM .ne. 3 then always iBegFilt=4 C C kP integer photometer C iBeg integer 1=All filters used; 4=Only CLEAR and PB used C NR(5) integer number of data points for each filter C OUTPUTS: C jEdt integer 0=No filter to be edited;1-5=filter to be edited C iS integer 1-32 sector to be processed C HOSPlot_bCommand C logical .TRUE.=Continue; .FALSE.=Stop C- logical bAllFlt logical bAllClr integer kP integer iS integer iBeg integer iEnd integer jEdt integer NR(5) integer iT integer NN(*) character cStr*80 common /QUERIES/ DAT2,TOP1,TOP2 common /ZOOM/ TBeg,TEnd,TMax,TMin,YMax,YMin !save iAns integer Str2Str character cInt2Str*14 logical bIsXEvent iSave = iSetForegroundColor() HOSPlot_bCommand = .TRUE. I = 0 do J=iBeg,iEnd if (NR(J) .ne. 0) then I = I+Int2Str(J,cStr(I+1:)) if (J .le. 3) then if (bAllFlt) I = I+Str2Str('-F',cStr(I+1:)) if (bAllClr) I = I+Str2Str('-C',cStr(I+1:)) I = I+Int2Str(J,cStr(I+1:)) I = I+Str2Str(',',cStr(I+1:)) end if if (kP .ne. 3 .and. J .eq. 4) I = I+Str2Str('-INT,' ,cStr(I+1:)) if (kP .eq. 3 .and. J .eq. 4) I = I+Str2Str('-EDIT INT,',cStr(I+1:)) if (kP .ne. 3 .and. J .eq. 5) I = I+Str2Str('-PB,' ,cStr(I+1:)) if (kP .eq. 3 .and. J .eq. 5) I = I+Str2Str('-EDIT PB,',cStr(I+1:)) endif end do if (kP .ne. 3) I = I+Str2Str('6-PREV,7-NEXT,8-JUMP,',cStr(I+1:)) I = I+Str2Str('9-ZOOM,10-PRINT,',cStr(I+1:)) J = 1 do while (J .le. iT .and. .not. BTEST(NN(J),31)) J = J+1 end do if (J .le. iT) I = I+Str2Str('11-SAV/XIT,',cStr(I+1:)) I = I+Str2Str('12-EXIT',cStr(I+1:)) iReplot = 1 10 continue iAns = iReplot call GinBar(3,iAns,0.,96.5,100.,cStr) if (bIsXEvent(iAns)) then iSave = iSetColor(iSave) return end if if (iBeg .le. iAns .and. iAns .le. iEnd) then if (NR(iAns) .eq. 0) then call XYLabel(DAT2,TOP2,'NO DATA POINTS FOR FILTER '//cInt2Str(iAns)) call TimeOut(2.0) call BlankLine(TOP2) iReplot = 0 go to 10 ! No data points ? end if jEdt = iAns else if (iAns .eq. 6) then ! Previous sector (1 is followed by 32) iS = iS-1 if (iS .eq. 0) iS = 32 else if (iAns .eq. 7) then ! Next sector (32 is followed by 1) iS = 1+mod(iS,32) else if (iAns .eq. 8) then ! Jump to different sector I = iS call AskI4G(DAT2,TOP2,'JUMP TO SECTOR [1,32]',iS) if (iS .eq. I) then ! Same sector; ignore iReplot = 0 go to 10 end if else if (iAns .eq. 9) then ! Zoom in on different [TMin,TMax] TMinOld = TMin TMaxOld = TMax call BlankLine(TOP2) call XYLabel(DAT2,TOP2,'CLICK ON START DATE') !------- ! Copy the new values into TMin and TMax only after the two GIN ! have been executed to avoid problems with X-events if (bIsXEvent( iGin(TMinNew,Y,IB) )) then iSave = iSetColor(iSave) return end if if (TMinOld .lt. TMinNew .and. TMinNew .lt. TMaxOld) call MoveDraw(TMinNew,YMin,TMinNew,YMax) call BlankLine(TOP2) call XYLabel(DAT2,TOP2,'CLICK ON END DATE') if (bIsXEvent( iGin(TMaxNew,Y,IB) )) then iSave = iSetColor(iSave) return end if if (TMinOld .lt. TMaxNew .and. TMaxNew .lt. TMaxOld) call MoveDraw(TMaxNew,YMin,TMaxNew,YMax) call BlankLine(TOP2) TMin = TMinNew ! Copy new values TMax = TMaxNew if (TMax .le. TMin) then Y = TMax TMax = TMin TMin = Y end if if (TMin .lt. TMinOld) TMin = TBeg if (TMax .gt. TMaxOld) TMax = TEnd TMin = max(TBeg,TMin) TMax = min(TEnd,TMax) else if (iAns .eq. 10) then ! Print paper hardcopy call Hardcopy iReplot = 0 go to 10 else if (iAns .eq. 11) then ! Save and exit HOSPlot_bCommand = .FALSE. else if (iAns .eq. 12) then ! Exit without save do I=1,iT ! Clear sign bit NN(I) = IBCLR(NN(I),31) end do HOSPlot_bCommand = .FALSE. else ! Can't happen ??? iReplot = 0 go to 10 end if call GinBar(3,-1,0.,96.5,100.,' ') iSave = iSetColor(iSave) return end