- Timestamp:
- Jun 24, 2013 4:29:54 PM (10 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Auto_Fit.ipf
r912 r915 316 316 Window AutoFitPanel() 317 317 PauseUpdate; Silent 1 // building window... 318 NewPanel /W=( 685,44,1001,740) /K=1318 NewPanel /W=(434,44,1063,422) /K=1 319 319 DoWindow/C AutoFitPanel 320 320 SetDrawLayer UserBack 321 // DrawText 11,418,"Point Range"322 // DrawText 5,167,"Suffix"323 DrawLine 8,362,287,362324 PopupMenu popup0,pos={ 2,2},size={175,20},title="pick a function"321 /// DrawText 11,418,"Point Range" 322 /// DrawText 5,167,"Suffix" 323 // DrawLine 8,362,287,362 324 PopupMenu popup0,pos={13,6},size={175,20},title="Pick a Function" 325 325 PopupMenu popup0,mode=1,value= #"User_FunctionPopupList()",proc=AF_FuncPopupProc 326 326 … … 330 330 ListBox lb userColumnResize=1,widths={200,80} 331 331 332 // Button DelButton,pos={245,61},size={40,20},proc=DelButtonProc,title="Del",disable=2333 Button PathButton,pos={ 6,61},size={50,20},proc=PDPButton,title="Path..."332 /// Button DelButton,pos={245,61},size={40,20},proc=DelButtonProc,title="Del",disable=2 333 Button PathButton,pos={13,61},size={50,20},proc=PDPButton,title="Path..." 334 334 Button FileListButton,pos={82,61},size={50,20},proc=FileListButtonProc,title="List" 335 CheckBox AllFilesCheck,pos={1 82,64},size={32,14},proc=CheckAllFiles,title="Select All Files"335 CheckBox AllFilesCheck,pos={196,64},size={32,14},proc=CheckAllFiles,title="Select All Files" 336 336 CheckBox AllFilesCheck,value= 0 337 ListBox guessBox,pos={ 24,398},size={145,208},disable=1,proc=UpdateGuessMatrixProc337 ListBox guessBox,pos={345,102},size={145,208},disable=1,proc=UpdateGuessMatrixProc 338 338 ListBox guessBox,frame=2,listWave=root:AutoFit:guessList 339 339 ListBox guessBox,selWave=root:AutoFit:guessSel,mode= 2,selRow= 0 340 Button FillAllGuessButton,pos={ 196,406},size={50,20},disable=1,proc=FillAllGuessButtonProc,title="Fill All"341 Button FillAllHoldButton,pos={ 196,406},size={50,20},disable=1,proc=FillAllHoldButtonProc,title="Fill All"342 Button FillAllConstrButton,pos={ 196,406},size={50,20},proc=FillAllConstrButtonProc,title="Fill All"343 Button FillAllRangeB,pos={ 196,406},size={50,20},disable=1,proc=FillAllRangeButtonProc,title="Fill All"344 SetVariable NumParams,pos={ 7,34},size={150,15},proc=SetNumParamProc,title="Number of Parameters"340 Button FillAllGuessButton,pos={517,110},size={50,20},disable=1,proc=FillAllGuessButtonProc,title="Fill All" 341 Button FillAllHoldButton,pos={517,110},size={50,20},disable=1,proc=FillAllHoldButtonProc,title="Fill All" 342 Button FillAllConstrButton,pos={517,110},size={50,20},proc=FillAllConstrButtonProc,title="Fill All" 343 Button FillAllRangeB,pos={517,110},size={50,20},disable=1,proc=FillAllRangeButtonProc,title="Fill All" 344 SetVariable NumParams,pos={13,35},size={150,15},proc=SetNumParamProc,title="Number of Parameters" 345 345 SetVariable NumParams,limits={2,Inf,0},value= root:AutoFit:numPar 346 // CheckBox typeCheck,pos={207,31},size={32,14},title="NSE Data?",value=0347 // SetVariable fitTol,pos={80,208},size={80,15},title="Fit Tol"348 // SetVariable fitTol,limits={0.0001,0.1,0},value= root:AutoFit:fitTol349 CheckBox epsilonCheck,pos={156,3 35},size={32,14},value=0,title="Use Epsilon Wave?"350 351 TabControl tabC,pos={ 13,371},size={273,244},proc=tabProc,tabLabel(0)="Guess"346 /// CheckBox typeCheck,pos={207,31},size={32,14},title="NSE Data?",value=0 347 /// SetVariable fitTol,pos={80,208},size={80,15},title="Fit Tol" 348 /// SetVariable fitTol,limits={0.0001,0.1,0},value= root:AutoFit:fitTol 349 CheckBox epsilonCheck,pos={156,340},size={32,14},value=0,title="Use Epsilon Wave?" 350 351 TabControl tabC,pos={334,75},size={273,244},proc=tabProc,tabLabel(0)="Guess" 352 352 TabControl tabC,tabLabel(1)="Hold",tabLabel(2)="Constraint",tabLabel(3)="Range",value= 0 353 // CheckBox rangeCheck,pos={92,404},size={32,14},proc=RangeCheckProc,title="All"354 // CheckBox rangeCheck,value= 1,disable=2355 356 SetVariable lowPt,pos={136,404},size={60,15},title="low"357 SetVariable lowPt,limits={0,Inf,0},value= root:AutoFit:ptLow,noedit=1,disable=1358 SetVariable highPt,pos={201,404},size={60,15},title=" to "359 SetVariable highPt,limits={0,Inf,0},value= root:AutoFit:ptHigh,noedit=1,disable=1360 ListBox holdBox,pos={ 24,398},size={145,208},disable=1,proc=UpdateHoldMatrixProc353 /// CheckBox rangeCheck,pos={92,404},size={32,14},proc=RangeCheckProc,title="All" 354 /// CheckBox rangeCheck,value= 1,disable=2 355 356 //// SetVariable lowPt,pos={136,404},size={60,15},title="low" 357 //// SetVariable lowPt,limits={0,Inf,0},value= root:AutoFit:ptLow,noedit=1,disable=1 358 //// SetVariable highPt,pos={201,404},size={60,15},title=" to " 359 //// SetVariable highPt,limits={0,Inf,0},value= root:AutoFit:ptHigh,noedit=1,disable=1 360 ListBox holdBox,pos={345,102},size={145,208},disable=1,proc=UpdateHoldMatrixProc 361 361 ListBox holdBox,frame=2,listWave=root:AutoFit:holdList 362 362 ListBox holdBox,selWave=root:AutoFit:holdSel,mode= 2,selRow= 2 363 ListBox ConstrBox,pos={ 24,398},size={145,208},proc=UpdateConstrMatrixProc363 ListBox ConstrBox,pos={345,102},size={145,208},proc=UpdateConstrMatrixProc 364 364 ListBox ConstrBox,frame=2,listWave=root:AutoFit:ConstrList 365 365 ListBox ConstrBox,selWave=root:AutoFit:ConstrSel,mode= 2,selRow= 2 366 ListBox RangeBox,pos={ 24,398},size={145,208},proc=UpdateRangeMatrixProc366 ListBox RangeBox,pos={345,102},size={145,208},proc=UpdateRangeMatrixProc 367 367 ListBox RangeBox,frame=2,listWave=root:AutoFit:rangeList 368 368 ListBox RangeBox,selWave=root:AutoFit:RangeSel,mode= 2,selRow= 2 369 // Button MatrixButton,pos={12,205},size={60,20},proc=ToMatrixButtonProc,title="Matrix",disable=2370 Button DoItButton,pos={ 21,632},size={80,20},proc=DoTheFitsButtonProc,title="Do the fits"371 // Button savePathButton,pos={82,61},size={80,20},proc=SavePathButtonProc,title="Save Path..."372 TitleBox tb1,pos={ 139,634},size={128,12},anchor=MC,variable=root:AutoFit:gStatus,frame=0373 Button button0,pos={14,33 1},size={40,20},title="Plot",proc=LoadForGuessProc374 // SetVariable extStr,pos={4,170},size={40,15},title=" ",value= root:AutoFit:gExt375 376 Button GuessCoefB,pos={ 198,440},size={50,20},title="Guess",proc=UseCoefAsGuess377 Button GuessHoldB,pos={ 198,440},size={50,20},title="Guess",disable=1,proc=UseHoldAsGuess378 // Button GuessConstrB,pos={198,440},size={50,20},title="Guess",disable=1,proc=UseConstraintsAsGuess379 380 TitleBox infoTitleBox pos={ 180,470},fixedSize=1,size={96,130},variable=root:AutoFit:guessStr381 382 ValDisplay progressValdisp,pos={ 113,663},size={161,7},title="00:00"369 /// Button MatrixButton,pos={12,205},size={60,20},proc=ToMatrixButtonProc,title="Matrix",disable=2 370 Button DoItButton,pos={339,336},size={80,20},proc=DoTheFitsButtonProc,title="Do the fits" 371 /// Button savePathButton,pos={82,61},size={80,20},proc=SavePathButtonProc,title="Save Path..." 372 TitleBox tb1,pos={479,330},size={128,12},anchor=MC,variable=root:AutoFit:gStatus,frame=0 373 Button button0,pos={14,336},size={60,20},title="Plot",proc=LoadForGuessProc 374 /// SetVariable extStr,pos={4,170},size={40,15},title=" ",value= root:AutoFit:gExt 375 376 Button GuessCoefB,pos={519,144},size={50,20},title="Guess",proc=UseCoefAsGuess 377 Button GuessHoldB,pos={519,144},size={50,20},title="Guess",disable=1,proc=UseHoldAsGuess 378 /// Button GuessConstrB,pos={198,440},size={50,20},title="Guess",disable=1,proc=UseConstraintsAsGuess 379 380 TitleBox infoTitleBox pos={501,174},fixedSize=1,size={96,130},variable=root:AutoFit:guessStr 381 382 ValDisplay progressValdisp,pos={446,349},size={161,7},title="00:00" 383 383 ValDisplay progressValdisp,limits={0,root:AutoFit:endProgress,0},barmisc={0,0},value= root:AutoFit:curProgress 384 384 385 Button AF_DoneButton,pos={ 174,30},size={70,20},proc=AF_DoneButtonProc,title="Done"386 Button AF_HelpButton,pos={ 260,30},size={30,20},proc=AF_HelpButtonProc,title="?"385 Button AF_DoneButton,pos={541,8},size={70,20},proc=AF_DoneButtonProc,title="Done" 386 Button AF_HelpButton,pos={496,8},size={30,20},proc=AF_HelpButtonProc,title="?" 387 387 388 388 EndMacro -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_FlipperPanel.ipf
r867 r915 40 40 DrawFlipperPanel() 41 41 endif 42 // be sure that the panel is onscreen 43 DoIgorMenu "Control","Retrieve Window" 42 44 end 43 45 … … 62 64 63 65 PauseUpdate; Silent 1 // building window... 64 NewPanel /W=( 1023,44,1832,526)/N=FlipperPanel/K=1 as "Flipper and Supermirror"66 NewPanel /W=(250,44,1056,480)/N=FlipperPanel/K=1 as "Flipper and Supermirror" 65 67 ModifyPanel cbRGB=(1,52428,26586) 66 68 67 PopupMenu popup_0,pos={ 32,18},size={49,20},title="Field Condition",proc=FlipperPanelPopMenuProc69 PopupMenu popup_0,pos={13,8},size={49,20},title="Field Condition",proc=FlipperPanelPopMenuProc 68 70 PopupMenu popup_0,mode=1,value= #"D_ConditionNameList()" 69 71 70 Button button_0,pos={ 42,310},size={100,20},proc=FlipperAverageButtonProc,title="Do Average"71 72 GroupBox group_0,pos={ 39,350},size={335,103},title="AVERAGED RESULTS",fSize=1072 Button button_0,pos={18,288},size={100,20},proc=FlipperAverageButtonProc,title="Do Average" 73 74 GroupBox group_0,pos={18,316},size={290,102},title="AVERAGED RESULTS",fSize=10 73 75 GroupBox group_0,fStyle=1 74 SetVariable setvar_0,pos={ 49,385},size={250,15},title="Sam_depol*Psm*Pf"76 SetVariable setvar_0,pos={33,351},size={250,15},title="Sam_depol*Psm*Pf" 75 77 SetVariable setvar_0,fStyle=1 76 78 SetVariable setvar_0,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gPsmPf 77 SetVariable setvar_1,pos={ 49,417},size={250,15},title="Sam_depol*Psm",fStyle=179 SetVariable setvar_1,pos={33,383},size={250,15},title="Sam_depol*Psm",fStyle=1 78 80 SetVariable setvar_1,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gPsm 79 81 // SetVariable setvar_2,pos={560,518},size={200,13},title="Gamma (h)",fStyle=1 … … 84 86 85 87 86 Button button_1,pos={320,17},size={120,20},proc=AddFlipperConditionButton,title="Add Condition" 87 Button button_2,pos={403,295},size={110,20},proc=ClearAllFlipperWavesButton,title="Clear Table" 88 Button button_3,pos={183,310},size={120,20},proc=ShowFlipperCalcButton,title="Show Calc" 89 Button button_4,pos={540,295},size={110,20},proc=ClearFlipperRowButton,title="Clear Row" 90 Button button_5,pos={620,18},size={30,20},proc=FlipperHelpParButtonProc,title="?" 91 Button button_6,pos={488,418},size={100,20},proc=WindowSnapshotButton,title="Snapshot" 92 Button button_7,pos={488,380},size={130,20},proc=ManualEnterPfPsmButton,title="Manual Entry" 93 88 Button button_1,pos={322,8},size={120,20},proc=AddFlipperConditionButton,title="Add Condition" 89 Button button_2,pos={482,323},size={110,20},proc=ClearAllFlipperWavesButton,title="Clear Table" 90 Button button_3,pos={330,288},size={110,20},proc=ShowFlipperCalcButton,title="Show Calc" 91 Button button_4,pos={482,288},size={110,20},proc=ClearFlipperRowButton,title="Clear Row" 92 Button button_5,pos={759,8},size={30,20},proc=FlipperHelpParButtonProc,title="?" 93 Button button_6,pos={328,358},size={110,20},proc=WindowSnapshotButton,title="Snapshot" 94 Button button_7,pos={331,323},size={110,20},proc=ManualEnterPfPsmButton,title="Manual Entry" 95 96 Button button_8,pos={615,288},size={110,20},proc=SaveFlipperPanelButton,title="Save State" 97 Button button_9,pos={615,323},size={110,20},proc=RestoreFlipperPanelButton,title="Restore State" 98 94 99 // table 95 Edit/W=(14, 55,794,275)/HOST=#100 Edit/W=(14,40,794,275)/HOST=# 96 101 ModifyTable format=1,width=0 97 102 RenameWindow #,T0 … … 101 106 return(0) 102 107 End 108 109 Function SaveFlipperPanelButton(ba) : ButtonControl 110 STRUCT WMButtonAction &ba 111 112 switch( ba.eventCode ) 113 case 2: // mouse up 114 // click code here 115 SaveFlipperTable() 116 break 117 case -1: // control being killed 118 break 119 endswitch 120 121 return 0 122 End 123 124 Function RestoreFlipperPanelButton(ba) : ButtonControl 125 STRUCT WMButtonAction &ba 126 127 switch( ba.eventCode ) 128 case 2: // mouse up 129 // click code here 130 RestoreFlipperTable() 131 break 132 case -1: // control being killed 133 break 134 endswitch 135 136 return 0 137 End 138 103 139 104 140 // now, this does not depend on the cell, just the condition … … 1117 1153 1118 1154 Variable refnum 1119 String fname="CellParamSaveState .itx"1155 String fname="CellParamSaveState" 1120 1156 // WAVE w=root:testMat 1121 1157 WAVE/T cellName=root:Packages:NIST:Polarization:Cells:CellName … … 1126 1162 WAVE err_mu=root:Packages:NIST:Polarization:Cells:err_mu 1127 1163 1128 Open/P=home refnum //as fname // creates a new file, or overwrites the existing file 1164 // get the full path to the new file name before creating it 1165 fname = DoSaveFileDialog("Save the Cell Table",fname=fname,suffix=".itx") 1166 If(cmpstr(fname,"")==0) 1167 //user cancel, don't write out a file 1168 Close/A 1169 Abort "no data file was written" 1170 Endif 1171 1172 Open/P=home refnum as fname // creates a new file, or overwrites the existing file 1173 1129 1174 fprintf refNum,"IGOR\r" 1130 1175 … … 1179 1224 Variable num,ii,refnum 1180 1225 1181 fname = "CellDecayPanelSaveState .itx"1226 fname = "CellDecayPanelSaveState" 1182 1227 1183 1228 // get a list of the Decay waves … … 1186 1231 // print listStr 1187 1232 1188 Open/P=home refnum // as fname // creates a new file, or overwrites the existing file 1233 // get the full path to the new file name before creating it 1234 fname = DoSaveFileDialog("Save the Cell Decay Table",fname=fname,suffix=".itx") 1235 If(cmpstr(fname,"")==0) 1236 //user cancel, don't write out a file 1237 Close/A 1238 Abort "no data file was written" 1239 Endif 1240 1241 Open/P=home refnum as fname // creates a new file, or overwrites the existing file 1189 1242 fprintf refNum,"IGOR\r" 1190 1243 … … 1284 1337 Variable num,ii,refnum 1285 1338 1286 fname = "FlipperPanelSaveState .itx"1339 fname = "FlipperPanelSaveState" 1287 1340 1288 1341 // get a list of the "Condition" waves … … 1291 1344 // print listStr 1292 1345 1346 // get the full path to the new file name before creating it 1347 fname = DoSaveFileDialog("Save the Flipper State Table",fname=fname,suffix=".itx") 1348 If(cmpstr(fname,"")==0) 1349 //user cancel, don't write out a file 1350 Close/A 1351 Abort "no data file was written" 1352 Endif 1353 1293 1354 Open/P=home refnum // as fname // creates a new file, or overwrites the existing file 1294 1355 fprintf refNum,"IGOR\r" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf
r867 r915 82 82 restore=Initialize_PolCorPanel() 83 83 PolCor_Panel() 84 85 // be sure that the panel is onscreen 86 DoIgorMenu "Control","Retrieve Window" 87 84 88 SetWindow PolCor_Panel hook(kill)=PolCorPanelHook //to save the state when panel is killed 85 89 //disable the controls on other tabs … … 131 135 Variable num,ii,refnum 132 136 133 fname = "PolCorPanelSaveState .itx"137 fname = "PolCorPanelSaveState" 134 138 135 139 // get a list of the List waves … … 138 142 // print listStr 139 143 144 145 // get the full path to the new file name before creating it 146 fname = DoSaveFileDialog("Save the Pol_Cor Panel State",fname=fname,suffix=".itx") 147 If(cmpstr(fname,"")==0) 148 //user cancel, don't write out a file 149 Close/A 150 Abort "no data file was written" 151 Endif 152 153 140 154 Open/P=home refnum// as fname // creates a new file, or overwrites the existing file 141 155 fprintf refNum,"IGOR\r" … … 327 341 Window PolCor_Panel() 328 342 PauseUpdate; Silent 1 // building window... 329 NewPanel /W=( 925,44,1662,800) /K=1343 NewPanel /W=(300,44,1036,624) /K=1 as "Polarization Correction" 330 344 ModifyPanel cbRGB=(64349,63913,44660) 331 345 // ShowTools/A 332 346 SetDrawEnv linethick= 2.00 333 DrawLine 1 0,510,600,510334 335 TabControl PolCorTab,pos={15,2 7},size={708,401},proc=PolCorTabProc347 DrawLine 11,427,696,427 348 349 TabControl PolCorTab,pos={15,20},size={515,360},proc=PolCorTabProc 336 350 TabControl PolCorTab,tabLabel(0)="SAM",tabLabel(1)="EMP",tabLabel(2)="BGD" 337 351 TabControl PolCorTab,value= 0 338 352 339 353 // always visible 340 Button button0,pos={26,445},size={80,20},proc=LoadRawPolarizedButton,title="Load ..." 341 Button button1,pos={26,473},size={130,20},proc=PolCorButton,title="Pol Correct Data" 342 Button button2,pos={222,445},size={130,20},proc=ShowPolMatrixButton,title="Show Coef Matrix" 343 Button button3,pos={222,473},size={160,20},proc=ChangeDisplayedPolData,title="Change Displayed Data" 344 Button button4,pos={620,18},size={30,20},proc=PolCorHelpParButtonProc,title="?" 345 Button button12,pos={440,473},size={120,20},proc=Display4XSButton,title="Display 4 XS" 346 Button button13,pos={440,446},size={120,20},proc=ClearPolCorEntries,title="Clear Entries" 347 348 349 350 TitleBox title0,pos={100,66},size={24,24},title="\\f01UU or + +",fSize=12 351 TitleBox title1,pos={430,66},size={24,24},title="\\f01DU or - +",fSize=12 352 TitleBox title2,pos={100,250},size={25,24},title="\\f01DD or - -",fSize=12 353 TitleBox title3,pos={430,250},size={24,24},title="\\f01UD or + -",fSize=12 354 Button button0,pos={23,396},size={80,20},proc=LoadRawPolarizedButton,title="Load ..." 355 Button button1,pos={136,397},size={130,20},proc=PolCorButton,title="Pol Correct Data" 356 Button button2,pos={546,92},size={130,20},proc=ShowPolMatrixButton,title="Show Coef Matrix" 357 Button button3,pos={546,151},size={160,20},proc=ChangeDisplayedPolData,title="Change Display Data" 358 Button button4,pos={503,9},size={30,20},proc=PolCorHelpParButtonProc,title="?" 359 Button button12,pos={546,121},size={120,20},proc=Display4XSButton,title="Display 4 XS" 360 Button button13,pos={360,9},size={110,20},proc=ClearPolCorEntries,title="Clear Entries" 361 362 363 TitleBox title0,pos={100,48},size={24,24},title="\\f01UU or + +",fSize=12 364 TitleBox title1,pos={380,48},size={24,24},title="\\f01DU or - +",fSize=12 365 TitleBox title2,pos={100,210},size={25,24},title="\\f01DD or - -",fSize=12 366 TitleBox title3,pos={380,210},size={24,24},title="\\f01UD or + -",fSize=12 354 367 355 368 // bits to set up reduction protocol 356 Button button5,pos={12 6,560},size={100,20},proc=PickDIVButton,title="set DIV file"369 Button button5,pos={129,458},size={100,20},proc=PickDIVButton,title="set DIV file" 357 370 Button button5,help={"This button will set the file selected in the File Catalog table to be the sensitivity file."} 358 Button button6,pos={12 6,590},size={100,20},proc=PickMASKButton,title="set MASK file"371 Button button6,pos={129,482},size={100,20},proc=PickMASKButton,title="set MASK file" 359 372 Button button6,help={"This button will set the file selected in the File Catalog table to be the mask file."} 360 Button button7,pos={12 6,620},size={110,20},proc=SetABSParamsButton,title="set ABS params"373 Button button7,pos={129,506},size={110,20},proc=SetABSParamsButton,title="set ABS params" 361 374 Button button7,help={"This button will prompt the user for absolute scaling parameters"} 362 Button button8,pos={12 6,650},size={150,20},proc=SetAverageParamsButtonProc,title="set AVERAGE params"375 Button button8,pos={129,530},size={150,20},proc=SetAverageParamsButtonProc,title="set AVERAGE params" 363 376 Button button8,help={"Prompts the user for the type of 1-D averaging to perform, as well as saving options"} 364 Button button9,pos={ 80,690},size={120,20},proc=ReducePolCorDataButton,title="Reduce Data"377 Button button9,pos={581,515},size={120,20},proc=ReducePolCorDataButton,title="Reduce Data" 365 378 Button button9,help={"Reduce PolCor data"} 366 Button button10,pos={ 226,690},size={120,20},proc=SavePolCorProtocolButton,title="Save Protocol"379 Button button10,pos={581,460},size={120,20},proc=SavePolCorProtocolButton,title="Save Protocol" 367 380 Button button10,help={"Save the PolCor protocol, within this experiment only"} 368 Button button11,pos={ 370,690},size={120,20},proc=RecallPolCorProtocolButton,title="Recall Protocol"369 Button button11,help={"Recall a PolCor protocol from memory"} 370 Button button14,pos={ 226,720},size={120,20},proc=ExportPolCorProtocolButton,title="Export Protocol"381 Button button11,pos={546,333},size={120,20},proc=RecallPolCorProtocolButton,title="Recall Protocol" 382 Button button11,help={"Recall a PolCor protocol from memory"} 383 Button button14,pos={546,303},size={120,20},proc=ExportPolCorProtocolButton,title="Export Protocol" 371 384 Button button14,help={"Export the PolCor protocol, saving it on disk"} 372 Button button15,pos={ 370,720},size={120,20},proc=ImportPolCorProtocolButton,title="Import Protocol"385 Button button15,pos={546,363},size={120,20},proc=ImportPolCorProtocolButton,title="Import Protocol" 373 386 Button button15,help={"Import a PolCor protocol from a protocol previously saved to disk"} 374 375 SetVariable setvar0,pos={322,560},size={250,15},title="file:" 387 Button button16,pos={546,216},size={110,20},proc=SavePolCorPanelButton,title="Save State" 388 Button button16,help={"Save the state of the panel for later recall"} 389 Button button17,pos={546,245},size={110,20},proc=RestorePolCorPanelButton,title="Restore State" 390 Button button17,help={"Recall a saved state of the Pol_Cor panel"} 391 392 SetVariable setvar0,pos={303,458},size={250,15},title="file:" 376 393 SetVariable setvar0,help={"Filename of the detector sensitivity file to be used in the data reduction"} 377 SetVariable setvar0,limits={- Inf,Inf,0},value= root:myGlobals:Protocols:gDIV378 SetVariable setvar1,pos={3 22,590},size={250,15},title="file:"394 SetVariable setvar0,limits={-inf,inf,0},value= root:myGlobals:Protocols:gDIV 395 SetVariable setvar1,pos={303,483},size={250,15},title="file:" 379 396 SetVariable setvar1,help={"Filename of the mask file to be used in the data reduction"} 380 SetVariable setvar1,limits={- Inf,Inf,0},value= root:myGlobals:Protocols:gMASK381 SetVariable setvar2,pos={3 22,620},size={250,15},title="parameters:"397 SetVariable setvar1,limits={-inf,inf,0},value= root:myGlobals:Protocols:gMASK 398 SetVariable setvar2,pos={303,509},size={250,15},title="parameters:" 382 399 SetVariable setvar2,help={"Keyword-string of values necessary for absolute scaling of data. Remaining parameters are taken from the sample file."} 383 SetVariable setvar2,limits={- Inf,Inf,0},value= root:myGlobals:Protocols:gAbsStr384 SetVariable setvar3,pos={3 22,650},size={250,15},title="parameters:"400 SetVariable setvar2,limits={-inf,inf,0},value= root:myGlobals:Protocols:gAbsStr 401 SetVariable setvar3,pos={303,535},size={250,15},title="parameters:" 385 402 SetVariable setvar3,help={"Keyword-string of choices used for averaging and saving the 1-D data files"} 386 SetVariable setvar3,limits={- Inf,Inf,0},value= root:myGlobals:Protocols:gAVE387 388 CheckBox check0,pos={1 0,560},size={72,14},title="Sensitivity"403 SetVariable setvar3,limits={-inf,inf,0},value= root:myGlobals:Protocols:gAVE 404 405 CheckBox check0,pos={13,463},size={63,14},title="Sensitivity" 389 406 CheckBox check0,help={"If checked, the specified detector sensitivity file will be included in the data reduction. If the file name is \"ask\", then the user will be prompted for the file"} 390 407 CheckBox check0,value= 1 391 CheckBox check1,pos={10,590},size={72,14},title="Mask" 392 CheckBox check1,help={""} 393 CheckBox check1,value= 1 394 CheckBox check2,pos={10,620},size={72,14},title="Absolute Scale" 395 CheckBox check2,help={""} 396 CheckBox check2,value= 1 397 CheckBox check3,pos={10,650},size={72,14},title="Average and Save" 398 CheckBox check3,help={""} 399 CheckBox check3,value= 1 400 CheckBox check4,pos={10,530},size={72,14},title="Use EMP?" 401 CheckBox check4,help={""} 402 CheckBox check4,value= 1 403 CheckBox check5,pos={100,530},size={72,14},title="Use BGD?" 404 CheckBox check5,help={""} 405 CheckBox check5,value= 1 406 408 CheckBox check1,pos={13,486},size={39,14},title="Mask",value= 1 409 CheckBox check2,pos={13,509},size={82,14},title="Absolute Scale",value= 1 410 CheckBox check3,pos={13,532},size={96,14},title="Average and Save",value= 1 411 CheckBox check4,pos={13,436},size={59,14},title="Use EMP?",value= 1 412 CheckBox check5,pos={103,436},size={60,14},title="Use BGD?",value= 1 407 413 408 414 409 415 // SAM Tab 410 PopupMenu popup_0_1,pos={ 230,60},size={102,20},title="Condition"416 PopupMenu popup_0_1,pos={190,45},size={102,20},title="Condition" 411 417 PopupMenu popup_0_1, mode=1,popvalue="none",value= #"P_GetConditionNameList()" 412 418 // UU 413 ListBox ListBox_0_UU,pos={34, 102},size={200,130},proc=PolCor_FileListBoxProc,frame=2419 ListBox ListBox_0_UU,pos={34,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 414 420 ListBox ListBox_0_UU,listWave=root:Packages:NIST:Polarization:ListWave_0_UU,titleWave=root:Packages:NIST:Polarization:lbTitles 415 421 ListBox ListBox_0_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_0_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 436 442 437 443 // DU 438 ListBox ListBox_0_DU,pos={3 68,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2444 ListBox ListBox_0_DU,pos={310,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 439 445 ListBox ListBox_0_DU,listWave=root:Packages:NIST:Polarization:ListWave_0_DU,titleWave=root:Packages:NIST:Polarization:lbTitles 440 446 ListBox ListBox_0_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_0_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 461 467 462 468 // DD 463 ListBox ListBox_0_DD,pos={33,2 86},size={200,130},proc=PolCor_FileListBoxProc,frame=2469 ListBox ListBox_0_DD,pos={33,245},size={200,120},proc=PolCor_FileListBoxProc,frame=2 464 470 ListBox ListBox_0_DD,listWave=root:Packages:NIST:Polarization:ListWave_0_DD,titleWave=root:Packages:NIST:Polarization:lbTitles 465 471 ListBox ListBox_0_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_0_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 486 492 487 493 // UD 488 ListBox ListBox_0_UD,pos={3 68,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2494 ListBox ListBox_0_UD,pos={310,245},size={200,120},proc=PolCor_FileListBoxProc,frame=2 489 495 ListBox ListBox_0_UD,listWave=root:Packages:NIST:Polarization:ListWave_0_UD,titleWave=root:Packages:NIST:Polarization:lbTitles 490 496 ListBox ListBox_0_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_0_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 512 518 513 519 // EMP Tab 514 PopupMenu popup_1_1,pos={ 230,60},size={102,20},title="Condition"520 PopupMenu popup_1_1,pos={190,45},size={102,20},title="Condition" 515 521 PopupMenu popup_1_1, mode=1,popvalue="none",value= #"P_GetConditionNameList()" 516 522 // UU 517 ListBox ListBox_1_UU,pos={34, 102},size={200,130},proc=PolCor_FileListBoxProc,frame=2523 ListBox ListBox_1_UU,pos={34,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 518 524 ListBox ListBox_1_UU,listWave=root:Packages:NIST:Polarization:ListWave_1_UU,titleWave=root:Packages:NIST:Polarization:lbTitles 519 525 ListBox ListBox_1_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_1_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 540 546 541 547 // DU 542 ListBox ListBox_1_DU,pos={3 68,102},size={200,130},proc=PolCor_FileListBoxProc,frame=2548 ListBox ListBox_1_DU,pos={310,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 543 549 ListBox ListBox_1_DU,listWave=root:Packages:NIST:Polarization:ListWave_1_DU,titleWave=root:Packages:NIST:Polarization:lbTitles 544 550 ListBox ListBox_1_DU,selWave=root:Packages:NIST:Polarization:lbSelWave_1_DU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 565 571 566 572 // DD 567 ListBox ListBox_1_DD,pos={33,2 86},size={200,130},proc=PolCor_FileListBoxProc,frame=2573 ListBox ListBox_1_DD,pos={33,245},size={200,120},proc=PolCor_FileListBoxProc,frame=2 568 574 ListBox ListBox_1_DD,listWave=root:Packages:NIST:Polarization:ListWave_1_DD,titleWave=root:Packages:NIST:Polarization:lbTitles 569 575 ListBox ListBox_1_DD,selWave=root:Packages:NIST:Polarization:lbSelWave_1_DD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 590 596 591 597 // UD 592 ListBox ListBox_1_UD,pos={3 68,286},size={200,130},proc=PolCor_FileListBoxProc,frame=2598 ListBox ListBox_1_UD,pos={310,245},size={200,120},proc=PolCor_FileListBoxProc,frame=2 593 599 ListBox ListBox_1_UD,listWave=root:Packages:NIST:Polarization:ListWave_1_UD,titleWave=root:Packages:NIST:Polarization:lbTitles 594 600 ListBox ListBox_1_UD,selWave=root:Packages:NIST:Polarization:lbSelWave_1_UD,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 618 624 // file is necessary - this is "incorrectly" labeled as UU. I'll get around to changing this in the future... 619 625 // 620 TitleBox title_2_UU,pos={ 350,100},size={400,48},title="\\f01BGD files are independent of polarization\rEnter all as UU",fSize=12626 TitleBox title_2_UU,pos={250,100},size={400,48},title="\\f01BGD files are independent of polarization\rEnter all as UU",fSize=12 621 627 622 628 623 629 // UU 624 ListBox ListBox_2_UU,pos={34, 102},size={200,130},proc=PolCor_FileListBoxProc,frame=2630 ListBox ListBox_2_UU,pos={34,80},size={200,120},proc=PolCor_FileListBoxProc,frame=2 625 631 ListBox ListBox_2_UU,listWave=root:Packages:NIST:Polarization:ListWave_2_UU,titleWave=root:Packages:NIST:Polarization:lbTitles 626 632 ListBox ListBox_2_UU,selWave=root:Packages:NIST:Polarization:lbSelWave_2_UU,mode= 6,selRow= 0,selCol= 0,editStyle= 2 … … 722 728 723 729 EndMacro 730 731 Function SavePolCorPanelButton(ba) : ButtonControl 732 STRUCT WMButtonAction &ba 733 734 switch( ba.eventCode ) 735 case 2: // mouse up 736 // click code here 737 SavePolCorPanelState() 738 break 739 case -1: // control being killed 740 break 741 endswitch 742 743 return 0 744 End 745 746 Function RestorePolCorPanelButton(ba) : ButtonControl 747 STRUCT WMButtonAction &ba 748 749 switch( ba.eventCode ) 750 case 2: // mouse up 751 // click code here 752 RestorePolCorPanelState() 753 break 754 case -1: // control being killed 755 break 756 endswitch 757 758 return 0 759 End 760 761 724 762 725 763 // action procedure for the list box that allows the popup menu -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf
r867 r915 144 144 DrawCellParamPanel() 145 145 endif 146 146 // be sure that the panel is onscreen 147 DoIgorMenu "Control","Retrieve Window" 147 148 end 148 149 … … 282 283 283 284 PauseUpdate; Silent 1 // building window... 284 NewPanel /W=( 775,44,1375,377)/N=CellParamPanel/K=1 as "Fundamental Cell Parameters"285 NewPanel /W=(150,44,750,377)/N=CellParamPanel/K=1 as "Fundamental Cell Parameters" 285 286 ModifyPanel cbRGB=(65535,49151,55704) 286 287 ModifyPanel fixedSize=1 … … 289 290 Button button_0,pos={10,10},size={90,20},proc=AddCellButtonProc,title="Add Cell" 290 291 Button button_1,pos={118,10},size={160,20},proc=SaveCellParButtonProc,title="Update Parameters" 291 Button button_2,pos={ 300,10},size={130,20},proc=RevertCellParButtonProc,title="Revert Parameters"292 Button button_2,pos={118,35},size={130,20},proc=RevertCellParButtonProc,title="Revert Parameters" 292 293 Button button_3,pos={520,10},size={35,20},proc=CellHelpParButtonProc,title="?" 293 294 294 295 Edit/W=(14,55,582,318)/HOST=# 295 Button button_4,pos={324,10},size={100,20},proc=SaveCellPanelButton,title="Save State" 296 Button button_5,pos={324,35},size={100,20},proc=RestoreCellPanelButton,title="Restore State" 297 298 Edit/W=(14,60,582,318)/HOST=# 296 299 ModifyTable width(Point)=0 297 300 RenameWindow #,T0 … … 306 309 return(0) 307 310 End 311 312 313 Function SaveCellPanelButton(ba) : ButtonControl 314 STRUCT WMButtonAction &ba 315 316 switch( ba.eventCode ) 317 case 2: // mouse up 318 // click code here 319 SaveCellParameterTable() 320 break 321 case -1: // control being killed 322 break 323 endswitch 324 325 return 0 326 End 327 328 Function RestoreCellPanelButton(ba) : ButtonControl 329 STRUCT WMButtonAction &ba 330 331 switch( ba.eventCode ) 332 case 2: // mouse up 333 // click code here 334 RestoreCellParameterTable() 335 break 336 case -1: // control being killed 337 break 338 endswitch 339 340 return 0 341 End 342 343 344 308 345 309 346 Function CellHelpParButtonProc(ba) : ButtonControl … … 415 452 DecayParamPanel() 416 453 endif 454 // be sure that the panel is onscreen 455 DoIgorMenu "Control","Retrieve Window" 417 456 end 418 457 … … 441 480 442 481 PauseUpdate; Silent 1 // building window... 443 NewPanel /W=( 759,44,1572,713)/N=DecayPanel/K=1 as "Cell Decay Parameters"482 NewPanel /W=(200,44,1013,664)/N=DecayPanel/K=1 as "Cell Decay Parameters" 444 483 ModifyPanel cbRGB=(32768,54615,65535) 445 484 // Button button_3,pos={505,16},size={35,20},proc=DecayHelpParButtonProc,title="?" 446 PopupMenu popup_0,pos={32, 18},size={49,20},title="Cell",proc=DecayPanelPopMenuProc485 PopupMenu popup_0,pos={32,8},size={49,20},title="Cell",proc=DecayPanelPopMenuProc 447 486 PopupMenu popup_0,mode=1,value= #"D_CellNameList()" 448 487 449 Button button_0,pos={5 84,365},size={70,20},proc=DecayFitButtonProc,title="Do Fit"450 451 GroupBox group_0,pos={5 50,399},size={230,149},title="FIT RESULTS",fSize=10488 Button button_0,pos={560,294},size={70,20},proc=DecayFitButtonProc,title="Do Fit" 489 490 GroupBox group_0,pos={560,329},size={230,149},title="FIT RESULTS",fSize=10 452 491 GroupBox group_0,fStyle=1 453 SetVariable setvar_0,pos={5 60,428},size={200,13},title="muPo of 3He"492 SetVariable setvar_0,pos={570,358},size={200,13},title="muPo of 3He" 454 493 SetVariable setvar_0,fStyle=1,limits={0,0,0},barmisc={0,1000} 455 494 SetVariable setvar_0,value= root:Packages:NIST:Polarization:Cells:gMuPo 456 SetVariable setvar_1,pos={5 60,460},size={200,13},title="Po of 3He"495 SetVariable setvar_1,pos={570,390},size={200,13},title="Po of 3He" 457 496 SetVariable setvar_1,fStyle=1,limits={0,0,0},barmisc={0,1000} 458 497 SetVariable setvar_1,value= root:Packages:NIST:Polarization:Cells:gPo 459 SetVariable setvar_2,pos={5 60,518},size={200,13},title="Gamma (h)",fStyle=1498 SetVariable setvar_2,pos={570,448},size={200,13},title="Gamma (h)",fStyle=1 460 499 SetVariable setvar_2,limits={0,0,0},barmisc={0,1000} 461 500 SetVariable setvar_2,value= root:Packages:NIST:Polarization:Cells:gGamma 462 SetVariable setvar_3,pos={5 60,488},size={200,15},title="T0",fStyle=1501 SetVariable setvar_3,pos={570,418},size={200,13},title="T0",fStyle=1 463 502 SetVariable setvar_3,limits={0,0,0},value= root:Packages:NIST:Polarization:Cells:gT0 464 503 465 504 466 Button button_1,pos={579,294},size={120,20},proc=CalcRowParamButton,title="Calculate Rows" 467 Button button_2,pos={307,18},size={110,20},proc=ClearDecayWavesButton,title="Clear Table" 468 Button button_3,pos={579,333},size={120,20},proc=ShowCalcRowButton,title="Show Calc" 469 Button button_4,pos={440,18},size={110,20},proc=ClearDecayWavesRowButton,title="Clear Row" 470 Button button_5,pos={620,18},size={40,20},proc=DecayHelpParButtonProc,title="?" 471 Button button_6,pos={620,620},size={100,20},proc=WindowSnapshotButton,title="Snapshot" 472 Button button_7,pos={620,580},size={130,20},proc=ManualEnterDecayButton,title="Manual Entry" 473 CheckBox check0,mode=0,pos={600,550},title="Overrride T0?",value=0 505 Button button_1,pos={560,262},size={120,20},proc=CalcRowParamButton,title="Calculate Rows" 506 Button button_2,pos={307,8},size={110,20},proc=ClearDecayWavesButton,title="Clear Table" 507 Button button_3,pos={560,519},size={110,20},proc=ShowCalcRowButton,title="Show Calc" 508 Button button_4,pos={440,8},size={110,20},proc=ClearDecayWavesRowButton,title="Clear Row" 509 Button button_5,pos={620,8},size={40,20},proc=DecayHelpParButtonProc,title="?" 510 Button button_6,pos={560,574},size={110,20},proc=WindowSnapshotButton,title="Snapshot" 511 Button button_7,pos={560,547},size={110,20},proc=ManualEnterDecayButton,title="Manual Entry" 512 Button button_8,pos={690,547},size={110,20},proc=SaveDecayPanelButton,title="Save State" 513 Button button_9,pos={690,574},size={110,20},proc=RestoreDecayPanelButton,title="Restore State" 514 CheckBox check0,mode=0,pos={560,480},title="Overrride T0?",value=0 474 515 475 516 476 517 // table 477 Edit/W=(14, 55,794,275)/HOST=#518 Edit/W=(14,35,794,240)/HOST=# 478 519 ModifyTable format=1,width=0 479 520 RenameWindow #,T0 … … 481 522 482 523 // graph 483 Display/W=(15,2 91,540,652)/HOST=# //root:yy vs root:xx524 Display/W=(15,250,540,610)/HOST=# //root:yy vs root:xx 484 525 ModifyGraph frameStyle=2 485 526 ModifyGraph mode=4 … … 1422 1463 End 1423 1464 1465 Function SaveDecayPanelButton(ba) : ButtonControl 1466 STRUCT WMButtonAction &ba 1467 1468 switch( ba.eventCode ) 1469 case 2: // mouse up 1470 // click code here 1471 SaveCellDecayTable() 1472 break 1473 case -1: // control being killed 1474 break 1475 endswitch 1476 1477 return 0 1478 End 1479 1480 Function RestoreDecayPanelButton(ba) : ButtonControl 1481 STRUCT WMButtonAction &ba 1482 1483 switch( ba.eventCode ) 1484 case 2: // mouse up 1485 // click code here 1486 RestoreCellDecayTable() 1487 break 1488 case -1: // control being killed 1489 break 1490 endswitch 1491 1492 return 0 1493 End 1494 1424 1495 // null condition is not right. if the loop fails, then the 1425 1496 // retStr will be ";;;;", not zero length. What's the proper test? -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/EventModeProcessing.ipf
r912 r915 96 96 // 97 97 98 Static Constant MODE_STREAM = 0 99 Static Constant MODE_OSCILL = 1 100 Static Constant MODE_TISANE = 2 101 Static Constant MODE_TOF = 3 102 98 103 //Menu "Macros" 99 104 // "Split Large File",SplitBigFile() … … 132 137 Variable/G root:Packages:NIST:gEvent_logint = 1 133 138 134 Variable/G root:Packages:NIST:gEvent_Mode = 0// ==0 for "stream", ==1 for Oscillatory139 Variable/G root:Packages:NIST:gEvent_Mode = MODE_OSCILL // ==0 for "stream", ==1 for Oscillatory 135 140 Variable/G root:Packages:NIST:gRemoveBadEvents = 1 // ==1 to remove "bad" events, ==0 to read "as-is" 136 141 Variable/G root:Packages:NIST:gSortStreamEvents = 0 // ==1 to sort the event stream, a last resort for a stream of data … … 146 151 Duplicate/O slicedData logslicedData 147 152 Duplicate/O slicedData dispsliceData 153 154 155 // for decimation 156 Variable/G root:Packages:NIST:Event:gDecimation = 100 157 Variable/G root:Packages:NIST:gEvent_t_longest_decimated = 0 158 159 // for large file splitting 160 String/G root:Packages:NIST:Event:gSplitFileList = "" // a list of the file names as split 148 161 149 162 SetDataFolder root: 150 163 End 151 164 165 // 166 // -- extra bits of buttons... not used 167 // 168 // Button button9 title="Decimation",size={100,20},pos={490,400},proc=E_ShowDecimateButton 169 // 170 // Button button11,pos={490,245},size={150,20},proc=LoadDecimateButtonProc,title="Load and Decimate" 171 // Button button12,pos={490,277},size={150,20},proc=ConcatenateButtonProc,title="Concatenate" 172 // Button button13,pos={490,305},size={150,20},proc=DisplayConcatenatedButtonProc,title="Display Concatenated" 173 // 174 // GroupBox group0 title="Manual Controls",size={185,112},pos={490,220} 175 // 176 // NewPanel /W=(82,44,854,664)/N=EventModePanel/K=2 177 // DoWindow/C EventModePanel 178 // ModifyPanel fixedSize=1,noEdit =1 152 179 Proc EventModePanel() 153 180 PauseUpdate; Silent 1 // building window... 154 NewPanel /W=( 100,50,600,840)/N=EventModePanel/K=2181 NewPanel /W=(82,44,854,664)/N=EventModePanel/K=2 155 182 DoWindow/C EventModePanel 156 183 ModifyPanel fixedSize=1,noEdit =1 157 //ShowTools/A 184 158 185 SetDrawLayer UserBack 159 Button button0,pos={10,10}, size={150,20},title="Load Event Log File",fSize=12 160 Button button0,proc=LoadEventLog_Button 161 162 TitleBox tb1,pos={20,650},size={460,80},fSize=12 163 TitleBox tb1,variable=root:Packages:NIST:gEventDisplayString 164 165 CheckBox chkbox1,pos={170,8},title="Oscillatory Mode?" 166 CheckBox chkbox1,variable = root:Packages:NIST:gEvent_mode 167 CheckBox chkbox3,pos={170,27},title="Remove Bad Events?" 168 CheckBox chkbox3,variable = root:Packages:NIST:gRemoveBadEvents 169 170 Button doneButton,pos={435,12}, size={50,20},title="Done",fSize=12 171 Button doneButton,proc=EventDone_Proc 172 173 Button button2,pos={20,122},size={140,20},proc=ShowEventDataButtonProc,title="Show Event Data" 174 Button button3,pos={20,147},size={140,20},proc=ShowBinDetailsButtonProc,title="Show Bin Details" 175 Button button4,pos={175,122},size={140,20},proc=UndoTimeSortButtonProc,title="Undo Time Sort" 176 Button button5,pos={175,147},size={140,20},proc=ExportSlicesButtonProc,title="Export Slices as VAX" 177 Button button6,pos={378,13},size={40,20},proc=EventModeHelpButtonProc,title="?" 178 179 Button button7,pos={175+155,122},size={140,20},proc=AdjustEventDataButtonProc,title="Adjust Events" 180 Button button8,pos={175+155,147},size={140,20},proc=CustomBinButtonProc,title="Custom Bins" 181 182 Button button1,pos = {10,50}, size={150,20},title="Process Data",fSize=12 183 Button button1,proc=ProcessEventLog_Button 184 SetVariable setvar1,pos={170,50},size={160,20},title="Number of slices",fSize=12,limits={1,1000,1} 185 SetVariable setvar1,value=root:Packages:NIST:gEvent_nslices 186 SetVariable setvar2,pos={330,50},size={160,20},title="Max Time (s)",fSize=12 187 SetVariable setvar2,value=root:Packages:NIST:gEvent_t_longest 188 189 PopupMenu popup0 title="Bin Spacing",pos={150,90},value="Equal;Fibonacci;Custom;" 190 PopupMenu popup0 proc=BinTypePopMenuProc 191 192 CheckBox chkbox2,pos={20,95},title="Log Intensity",value=1 193 CheckBox chkbox2,variable=root:Packages:NIST:gEvent_logint,proc=LogIntEvent_Proc 194 SetVariable setvar0,pos={320,90},size={160,20},title="Display Time Slice",fSize=12 195 SetVariable setvar0,limits={0,1000,1},value= root:Packages:NIST:gEvent_tsdisp 196 SetVariable setvar0,proc=sliceSelectEvent_Proc 197 Display/W=(20,180,480,640)/HOST=EventModePanel/N=Event_slicegraph 198 AppendImage/W=EventModePanel#Event_slicegraph/T root:Packages:NIST:Event:dispsliceData 199 ModifyImage/W=EventModePanel#Event_slicegraph ''#0 ctab= {*,*,ColdWarm,0} 200 ModifyImage/W=EventModePanel#Event_slicegraph ''#0 ctabAutoscale=3 186 DrawText 479,345,"Stream Data" 187 DrawLine 563,338,731,338 188 DrawText 479,419,"Oscillatory Data" 189 DrawLine 578,411,731,411 190 191 // ShowTools/A 192 Button button0,pos={14,87},size={150,20},proc=LoadEventLog_Button,title="Load Event Log File" 193 Button button0,fSize=12 194 TitleBox tb1,pos={475,500},size={135,24},fSize=10 195 TitleBox tb1,variable= root:Packages:NIST:gEventDisplayString 196 197 CheckBox chkbox2,pos={376,151},size={81,14},proc=LogIntEvent_Proc,title="Log Intensity" 198 CheckBox chkbox2,fSize=10,variable= root:Packages:NIST:gEvent_logint 199 CheckBox chkbox3,pos={14,125},size={119,14},title="Remove Bad Events?",fSize=10 200 CheckBox chkbox3,variable= root:Packages:NIST:gRemoveBadEvents 201 202 Button doneButton,pos={708,36},size={50,20},proc=EventDone_Proc,title="Done" 203 Button doneButton,fSize=12 204 Button button2,pos={419,28},size={140,20},proc=ShowEventDataButtonProc,title="Show Event Data" 205 Button button3,pos={419,56},size={140,20},proc=ShowBinDetailsButtonProc,title="Show Bin Details" 206 Button button4,pos={487,227},size={120,20},proc=UndoTimeSortButtonProc,title="Undo Time Sort" 207 Button button5,pos={419,85},size={140,20},proc=ExportSlicesButtonProc,title="Export Slices as VAX" 208 Button button6,pos={718,9},size={40,20},proc=EventModeHelpButtonProc,title="?" 209 Button button7,pos={487,197},size={120,20},proc=AdjustEventDataButtonProc,title="Adjust Events" 210 Button button8,pos={619,197},size={120,20},proc=CustomBinButtonProc,title="Custom Bins" 211 Button button1,pos={206,100},size={120,20},proc=ProcessEventLog_Button,title="Bin Event Data" 212 Button button1,fSize=12 213 214 SetVariable setvar0,pos={208,149},size={160,16},proc=sliceSelectEvent_Proc,title="Display Time Slice" 215 SetVariable setvar0,fSize=10 216 SetVariable setvar0,limits={0,1000,1},value= root:Packages:NIST:gEvent_tsdisp 217 SetVariable setvar1,pos={206,26},size={160,16},title="Number of slices",fSize=10 218 SetVariable setvar1,limits={1,1000,1},value= root:Packages:NIST:gEvent_nslices 219 SetVariable setvar2,pos={206,51},size={160,16},title="Max Time (s)",fSize=10 220 SetVariable setvar2,value= root:Packages:NIST:gEvent_t_longest 221 222 PopupMenu popup0,pos={206,74},size={119,20},proc=BinTypePopMenuProc,title="Bin Spacing" 223 PopupMenu popup0,fSize=10 224 PopupMenu popup0,mode=1,popvalue="Equal",value= #"\"Equal;Fibonacci;Custom;\"" 225 226 Button button10,pos={488,305},size={100,20},proc=SplitFileButtonProc,title="Split Big File" 227 Button button14,pos={488,350},size={130,20},proc=Stream_LoadDecim,title="Load From List" 228 SetVariable setvar3,pos={487,378},size={150,16},title="Decimation factor" 229 SetVariable setvar3,fSize=10 230 SetVariable setvar3,limits={1,inf,1},value= root:Packages:NIST:Event:gDecimation 231 232 Button button15_0,pos={488,425},size={110,20},proc=AccumulateSlicesButton,title="Add First Slice" 233 Button button16_1,pos={488,450},size={110,20},proc=AccumulateSlicesButton,title="Add Next Slice" 234 Button button17_2,pos={620,425},size={110,20},proc=AccumulateSlicesButton,title="Display Total" 235 236 237 CheckBox chkbox1_0,pos={25,34},size={69,14},title="Oscillatory",fSize=10 238 CheckBox chkbox1_0,mode=1,proc=EventModeRadioProc,value=1 239 CheckBox chkbox1_1,pos={25,59},size={53,14},title="Stream",fSize=10 240 CheckBox chkbox1_1,proc=EventModeRadioProc,value=0,mode=1 241 CheckBox chkbox1_2,pos={104,59},size={53,14},title="TISANE",fSize=10 242 CheckBox chkbox1_2,proc=EventModeRadioProc,value=0,mode=1 243 CheckBox chkbox1_3,pos={104,34},size={37,14},title="TOF",fSize=10 244 CheckBox chkbox1_3,proc=EventModeRadioProc,value=0,mode=1 245 246 GroupBox group0_0,pos={5,5},size={174,112},title="Mode",fSize=12,fStyle=1 247 GroupBox group0_1,pos={192,5},size={192,123},title="Binning",fSize=12,fStyle=1 248 GroupBox group0_2,pos={403,5},size={173,109},title="Viewing",fSize=12,fStyle=1 249 GroupBox group0_3,pos={476,169},size={277,92},title="Editing",fSize=12,fStyle=1 250 GroupBox group0_4,pos={474,278},size={279,200},title="Big Files",fSize=12 251 GroupBox group0_4,fStyle=1 252 253 Display/W=(10,170,460,610)/HOST=# 254 AppendImage/T :Packages:NIST:Event:dispsliceData 255 ModifyImage dispsliceData ctab= {*,*,ColdWarm,0} 256 ModifyImage dispsliceData ctabAutoscale=3 201 257 ModifyGraph margin(left)=14,margin(bottom)=14,margin(top)=14,margin(right)=14 202 258 ModifyGraph mirror=2 … … 208 264 ModifyGraph btLen=3 209 265 ModifyGraph tlOffset=-2 210 SetAxis/A left266 RenameWindow #,Event_slicegraph 211 267 SetActiveSubwindow ## 212 268 EndMacro 213 269 270 271 272 273 // mode selector 274 //Static Constant MODE_STREAM = 0 275 //Static Constant MODE_OSCILL = 1 276 //Static Constant MODE_TISANE = 2 277 //Static Constant MODE_TOF = 3 278 // 279 Function EventModeRadioProc(name,value) 280 String name 281 Variable value 282 283 NVAR gEventModeRadioVal= root:Packages:NIST:gEvent_mode 284 285 strswitch (name) 286 case "chkbox1_0": 287 gEventModeRadioVal= MODE_OSCILL 288 break 289 case "chkbox1_1": 290 gEventModeRadioVal= MODE_STREAM 291 break 292 case "chkbox1_2": 293 gEventModeRadioVal= MODE_TISANE 294 break 295 case "chkbox1_3": 296 gEventModeRadioVal= MODE_TOF 297 break 298 endswitch 299 CheckBox chkbox1_0,value= gEventModeRadioVal==MODE_OSCILL 300 CheckBox chkbox1_1,value= gEventModeRadioVal==MODE_STREAM 301 CheckBox chkbox1_2,value= gEventModeRadioVal==MODE_TISANE 302 CheckBox chkbox1_3,value= gEventModeRadioVal==MODE_TOF 303 304 return(0) 305 End 214 306 215 307 Function AdjustEventDataButtonProc(ba) : ButtonControl … … 363 455 NVAR mode=root:Packages:NIST:gEvent_Mode 364 456 365 if(mode == 0)457 if(mode == MODE_STREAM) 366 458 Stream_ProcessEventLog("") 367 459 endif 368 460 369 if(mode == 1)461 if(mode == MODE_OSCILL) 370 462 Osc_ProcessEventLog("") 371 463 endif … … 776 868 // 777 869 // Would TISANE or TOF need a different loader? 778 // 870 // 779 871 Function LoadEventLog_Button(ctrlName) : ButtonControl 780 872 String ctrlName … … 782 874 NVAR mode=root:Packages:NIST:gEvent_mode 783 875 Variable err=0 784 785 if(mode == 0) 786 err = Stream_LoadEventLog("") 787 if(err == 1) 788 return(0) // user cancelled from file load 789 endif 790 endif 791 792 if(mode == 1) 793 err = Osc_LoadEventLog("") 794 if(err == 1) 795 return(0) // user cancelled from file load 796 endif 797 endif 798 799 STRUCT WMButtonAction ba 800 ba.eventCode = 2 801 ShowEventDataButtonProc(ba) 802 803 return(0) 804 End 805 806 // for the mode of "one continuous exposure" 807 // 808 Function Stream_LoadEventLog(ctrlName) 809 String ctrlName 810 811 Variable fileref 876 Variable fileref,totBytes 877 Variable fileTooLarge = 150 //limit load to 150MB 812 878 813 879 SVAR filename = root:Packages:NIST:gEvent_logfile … … 816 882 817 883 String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 884 String abortStr 818 885 819 886 Open/R/D/F=fileFilters fileref … … 824 891 return(1) 825 892 endif 893 894 /// Abort if the files are too large 895 Open/R fileref as fileName 896 FStatus fileref 897 Close fileref 898 899 totBytes = V_logEOF/1e6 //in MB 900 if(totBytes > fileTooLarge) 901 sprintf abortStr,"File is %g MB, larger than the limit of %g MB. Split and Decimate.",totBytes,fileTooLarge 902 Abort abortStr 903 endif 904 826 905 827 906 #if (exists("EventLoadWave")==4) … … 833 912 SetDataFolder root:Packages:NIST:Event: 834 913 835 tic()914 //tic() 836 915 Wave timePt=timePt 837 916 Wave xLoc=xLoc 838 917 Wave yLoc=yLoc 839 CleanupTimes(xLoc,yLoc,timePt) //remove zeroes 840 841 toc() 842 843 Duplicate/O timePt rescaledTime 844 rescaledTime = 1e-7*(timePt-timePt[0]) //convert to seconds and start from zero 845 t_longest = waveMax(rescaledTime) //should be the last point 918 CleanupTimes(xLoc,yLoc,timePt) //remove zeroes 919 //toc() 920 921 922 ///// 923 // now do a little processing of the times based on the type of data 924 // 925 if(mode == MODE_STREAM) // continuous "Stream" mode - start from zero 926 Duplicate/O timePt rescaledTime 927 rescaledTime = 1e-7*(timePt-timePt[0]) //convert to seconds and start from zero 928 t_longest = waveMax(rescaledTime) //should be the last point 929 endif 930 931 if(mode == MODE_OSCILL) // oscillatory mode - don't adjust the times, we get periodic t0 to reset t=0 932 Duplicate/O timePt rescaledTime 933 rescaledTime *= 1e-7 //convert to seconds and that's all 934 t_longest = waveMax(rescaledTime) //if oscillatory, won't be the last point, so get it this way 935 936 KillWaves/Z OscSortIndex //to make sure that there is no old index hanging around 937 endif 938 939 846 940 847 941 SetDataFolder root: 848 942 943 STRUCT WMButtonAction ba 944 ba.eventCode = 2 945 ShowEventDataButtonProc(ba) 946 849 947 return(0) 850 948 End 851 949 852 // for the mode "oscillatory" 853 // 854 Function Osc_LoadEventLog(ctrlName) 855 String ctrlName 856 857 Variable fileref 858 859 SVAR filename = root:Packages:NIST:gEvent_logfile 860 NVAR nslices = root:Packages:NIST:gEvent_nslices 861 NVAR t_longest = root:Packages:NIST:gEvent_t_longest 862 863 String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 864 865 Open/R/D/F=fileFilters fileref 866 filename = S_filename 867 if(strlen(S_filename) == 0) 868 // user cancelled 869 DoAlert 0,"No file selected, no file loaded." 870 return(1) 871 endif 872 873 #if (exists("EventLoadWave")==4) 874 LoadEvents_XOP() 875 #else 876 LoadEvents() 877 #endif 878 879 SetDataFolder root:Packages:NIST:Event: 880 881 Wave timePt=timePt 882 Wave xLoc=xLoc 883 Wave yLoc=yLoc 884 CleanupTimes(xLoc,yLoc,timePt) //remove zeroes 885 886 Duplicate/O timePt rescaledTime 887 rescaledTime *= 1e-7 //convert to seconds and that's all 888 t_longest = waveMax(rescaledTime) //if oscillatory, won't be the last point, so get it this way 889 890 KillWaves/Z OscSortIndex //to make sure that there is no old index hanging around 891 892 SetDataFolder root: 893 894 return(0) 895 End 950 //// for the mode of "one continuous exposure" 951 //// 952 //Function Stream_LoadEventLog(ctrlName) 953 // String ctrlName 954 // 955 // Variable fileref 956 // 957 // SVAR filename = root:Packages:NIST:gEvent_logfile 958 // NVAR nslices = root:Packages:NIST:gEvent_nslices 959 // NVAR t_longest = root:Packages:NIST:gEvent_t_longest 960 // 961 // String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 962 // 963 // Open/R/D/F=fileFilters fileref 964 // filename = S_filename 965 // if(strlen(S_filename) == 0) 966 // // user cancelled 967 // DoAlert 0,"No file selected, no file loaded." 968 // return(1) 969 // endif 970 // 971 //#if (exists("EventLoadWave")==4) 972 // LoadEvents_XOP() 973 //#else 974 // LoadEvents() 975 //#endif 976 // 977 // SetDataFolder root:Packages:NIST:Event: 978 // 979 ////tic() 980 // Wave timePt=timePt 981 // Wave xLoc=xLoc 982 // Wave yLoc=yLoc 983 // CleanupTimes(xLoc,yLoc,timePt) //remove zeroes 984 // 985 ////toc() 986 // 987 // Duplicate/O timePt rescaledTime 988 // rescaledTime = 1e-7*(timePt-timePt[0]) //convert to seconds and start from zero 989 // t_longest = waveMax(rescaledTime) //should be the last point 990 // 991 // SetDataFolder root: 992 // 993 // return(0) 994 //End 995 // 996 //// for the mode "oscillatory" 997 //// 998 //Function Osc_LoadEventLog(ctrlName) 999 // String ctrlName 1000 // 1001 // Variable fileref 1002 // 1003 // SVAR filename = root:Packages:NIST:gEvent_logfile 1004 // NVAR nslices = root:Packages:NIST:gEvent_nslices 1005 // NVAR t_longest = root:Packages:NIST:gEvent_t_longest 1006 // 1007 // String fileFilters = "All Files:.*;Data Files (*.txt):.txt;" 1008 // 1009 // Open/R/D/F=fileFilters fileref 1010 // filename = S_filename 1011 // if(strlen(S_filename) == 0) 1012 // // user cancelled 1013 // DoAlert 0,"No file selected, no file loaded." 1014 // return(1) 1015 // endif 1016 // 1017 //#if (exists("EventLoadWave")==4) 1018 // LoadEvents_XOP() 1019 //#else 1020 // LoadEvents() 1021 //#endif 1022 // 1023 // SetDataFolder root:Packages:NIST:Event: 1024 // 1025 // Wave timePt=timePt 1026 // Wave xLoc=xLoc 1027 // Wave yLoc=yLoc 1028 // CleanupTimes(xLoc,yLoc,timePt) //remove zeroes 1029 // 1030 // Duplicate/O timePt rescaledTime 1031 // rescaledTime *= 1e-7 //convert to seconds and that's all 1032 // t_longest = waveMax(rescaledTime) //if oscillatory, won't be the last point, so get it this way 1033 // 1034 // KillWaves/Z OscSortIndex //to make sure that there is no old index hanging around 1035 // 1036 // SetDataFolder root: 1037 // 1038 // return(0) 1039 //End 896 1040 897 1041 … … 1015 1159 SVAR filepathstr = root:Packages:NIST:gEvent_logfile 1016 1160 SVAR dispStr = root:Packages:NIST:gEventDisplayString 1161 1162 1163 //// Variable decFac = 10 //decimation factor 1164 //// Variable jj,keep 1017 1165 1018 1166 SetDataFolder root:Packages:NIST:Event … … 1123 1271 Print "num2 = ",num2 1124 1272 Print "num3 = ",num3 1125 1273 1126 1274 // 1127 1275 // … … 1152 1300 Make/O/U/N=(numXYevents) xLoc,yLoc 1153 1301 Make/O/D/N=(numXYevents) timePt 1302 //// Make/O/U/N=(numXYevents/decFac) xLoc,yLoc 1303 //// Make/O/D/N=(numXYevents/decFac) timePt 1154 1304 // Make/O/U/N=(totBytes/4) xLoc,yLoc //too large, trim when done (bad idea) 1155 1305 // Make/O/D/N=(totBytes/4) timePt … … 1174 1324 tic() 1175 1325 1176 ii = 0 1326 ii = 0 //indexes the points in xLoc,yLoc,timePt 1327 //// keep = decFac //keep the first point 1328 1177 1329 1178 1330 Open/R fileref as filepathstr … … 1207 1359 endif 1208 1360 1209 // this is the first point, be sure that ii = 0 1210 ii = 0 1211 xLoc[ii] = xval 1212 yLoc[ii] = yval 1213 1361 // this is the first point, be sure that ii = 0, and always keep this point 1362 //// if(keep==decFac) 1363 ii = 0 1364 xLoc[ii] = xval 1365 yLoc[ii] = yval 1366 //// keep = 0 1367 //// endif 1214 1368 Print "At beginning of file, numBad = ",numBad 1215 1369 break // the next do loop processes the bulk of the file (** the next event == type 1 = MIR) … … 1224 1378 1225 1379 // now read the main portion of the file. 1380 //// // keep is = 0 if bad points were removed, or is decFac is I need to keep the first point 1226 1381 do 1227 1382 do … … 1229 1384 while(strlen(buffer) == 1) 1230 1385 1231 if (strlen(buffer) == 0) 1386 if (strlen(buffer) == 0) // this marks the end of the file and is our only way out 1232 1387 break 1233 1388 endif … … 1303 1458 else 1304 1459 // time_msw has been reset, points are good now, so keep this one 1460 //// if(keep==decFac) 1461 xLoc[ii] = xval 1462 yLoc[ii] = yval 1463 timePt[ii] = timeval 1464 1465 // if(xval == 127 && yval == 0) 1466 // // check bit 29 1467 // bit29 = (dataval & 0x20000000)/536870912 //bit 29 only , shift by 2^29 1468 // Print "XY=127,0 : bit29 = ",bit29 1469 // endif 1470 1471 ii+=1 1472 rolloverHappened = 0 1473 //// keep = 0 1474 //// else 1475 //// keep += 1 1476 //// endif 1477 endif 1478 else 1479 // normal processing of good point, keep it 1480 //// if(keep==decFac) 1305 1481 xLoc[ii] = xval 1306 1482 yLoc[ii] = yval 1307 1483 timePt[ii] = timeval 1308 1309 // if(xval == 127 && yval == 0) 1310 // // check bit 29 1311 // bit29 = (dataval & 0x20000000)/536870912 //bit 29 only , shift by 2^29 1312 // Print "XY=127,0 : bit29 = ",bit29 1313 // endif 1314 1484 1485 // if(xval == 127 && yval == 0) 1486 // // check bit 29 1487 // bit29 = (dataval & 0x20000000)/536870912 //bit 29 only , shift by 2^29 1488 // Printf "XY=127,0 : bit29 = %u : d=%u\r",bit29,dataval 1489 // endif 1315 1490 ii+=1 1316 rolloverHappened = 0 1317 endif 1318 else 1319 // normal processing of good point, keep it 1320 xLoc[ii] = xval 1321 yLoc[ii] = yval 1322 timePt[ii] = timeval 1323 1324 // if(xval == 127 && yval == 0) 1325 // // check bit 29 1326 // bit29 = (dataval & 0x20000000)/536870912 //bit 29 only , shift by 2^29 1327 // Printf "XY=127,0 : bit29 = %u : d=%u\r",bit29,dataval 1328 // endif 1329 ii+=1 1491 //// keep = 0 1492 //// else 1493 //// keep += 1 1494 //// endif 1330 1495 endif 1331 1496 … … 1366 1531 endif 1367 1532 1368 xLoc[ii] = xval 1369 yLoc[ii] = yval 1370 1533 //// if(keep==decFac) //don't reset keep yet, do this only when ii increments 1534 xLoc[ii] = xval 1535 yLoc[ii] = yval 1536 //// endif 1537 1371 1538 // don't fill in the time yet, or increment the index ii 1372 1539 // the next event MUST be ATMIR with the MSW time bits … … 1390 1557 1391 1558 // the XY position was in the previous event ATXYM 1392 timePt[ii] = timeval 1559 //// if(keep == decFac) 1560 timePt[ii] = timeval 1561 //// endif 1393 1562 1394 1563 bit29 = (dataval & 0x20000000)/536870912 //bit 29 only , shift by 2^29 … … 1401 1570 nRoll = 0 1402 1571 endif 1403 1404 ii+=1 1572 1573 //// if(keep == decFac) 1574 ii+=1 1575 //// keep = 0 1576 //// endif 1405 1577 // verbose = 0 1406 1578 break … … 1452 1624 Print "Events removed (Igor) = ",numRemoved 1453 1625 1454 sPrintf tmpStr,"\rBad Rollover Events = %d (% g %% of events)",numBad,numBad/numXYevents*1001626 sPrintf tmpStr,"\rBad Rollover Events = %d (%4.4g %% of events)",numBad,numBad/numXYevents*100 1455 1627 dispStr += tmpStr 1456 sPrintf tmpStr,"\rTotal Events Removed = %d (% g %% of events)",numRemoved,numRemoved/numXYevents*1001628 sPrintf tmpStr,"\rTotal Events Removed = %d (%4.4g %% of events)",numRemoved,numRemoved/numXYevents*100 1457 1629 dispStr += tmpStr 1458 1630 SetDataFolder root: … … 1626 1798 Print "Events removed (XOP) = ",numRemoved 1627 1799 1628 sPrintf tmpStr,"\rBad Rollover Events = %d (% g %% of events)",numBad,numBad/numXYevents*1001800 sPrintf tmpStr,"\rBad Rollover Events = %d (%4.4g %% of events)",numBad,numBad/numXYevents*100 1629 1801 dispStr += tmpStr 1630 sPrintf tmpStr,"\rTotal Events Removed = %d (% g %% of events)",numRemoved,numRemoved/numXYevents*1001802 sPrintf tmpStr,"\rTotal Events Removed = %d (%4.4g %% of events)",numRemoved,numRemoved/numXYevents*100 1631 1803 dispStr += tmpStr 1632 1804 … … 1949 2121 ControlBar 100 1950 2122 Button button0,pos={18,12},size={70,20},proc=EC_AddCursorButtonProc,title="Cursors" 1951 Button button1,pos={153,1 1},size={80,20},proc=EC_AddTimeButtonProc,title="Add time"1952 Button button2,pos={153,3 7},size={80,20},proc=EC_SubtractTimeButtonProc,title="Subtr time"2123 Button button1,pos={153,12},size={80,20},proc=EC_AddTimeButtonProc,title="Add time" 2124 Button button2,pos={153,38},size={80,20},proc=EC_SubtractTimeButtonProc,title="Subtr time" 1953 2125 Button button3,pos={153,64},size={90,20},proc=EC_TrimPointsButtonProc,title="Trim points" 1954 Button button4,pos={295 ,12},size={90,20},proc=EC_SaveWavesButtonProc,title="Save Waves"1955 Button button5,pos={29 4,38},size={100,20},proc=EC_ImportWavesButtonProc,title="Import Waves"1956 Button button6,pos={18,3 9},size={80,20},proc=EC_ShowAllButtonProc,title="All Data"1957 Button button7,pos={683, 9},size={30,20},proc=EC_HelpButtonProc,title="?"2126 Button button4,pos={295+200,12},size={90,20},proc=EC_SaveWavesButtonProc,title="Save Waves" 2127 Button button5,pos={295+200,38},size={100,20},proc=EC_ImportWavesButtonProc,title="Import Waves" 2128 Button button6,pos={18,38},size={80,20},proc=EC_ShowAllButtonProc,title="All Data" 2129 Button button7,pos={683,12},size={30,20},proc=EC_HelpButtonProc,title="?" 1958 2130 Button button8,pos={658,72},size={60,20},proc=EC_DoneButtonProc,title="Done" 2131 2132 Button button9,pos={295,12},size={110,20},proc=EC_FindStepButton_down,title="Find Step Down" 2133 Button button10,pos={295,38},size={110,20},proc=EC_FindStepButton_up,title="Find Step Up" 2134 Button button11,pos={295,64},size={110,20},proc=EC_DoDifferential,title="Differential" 1959 2135 1960 2136 SetDataFolder root: … … 2100 2276 Wave xLoc = xLoc 2101 2277 Wave yLoc = yLoc 2102 Save/T xLoc,yLoc,timePt //will ask for a name2278 Save/T xLoc,yLoc,timePt ,rescaledTime //will ask for a name 2103 2279 2104 2280 SetDataFolder root: … … 2139 2315 KillWaves/Z OscSortIndex 2140 2316 Wave timePt=timePt 2141 2142 Duplicate/O timePt rescaledTime 2143 if(mode==0) 2144 rescaledTime = 1e-7*(timePt-timePt[0]) //convert to seconds and start from zero 2145 else 2146 rescaledTime = timePt*1e-7 //just take the times as-is 2147 endif 2317 Wave rescaledTime=rescaledTime 2318 2319 // Duplicate/O timePt rescaledTime 2320 // if(mode==MODE_STREAM) 2321 // rescaledTime = 1e-7*(timePt-timePt[0]) //convert to seconds and start from zero 2322 // else 2323 // rescaledTime = timePt*1e-7 //just take the times as-is 2324 // endif 2148 2325 2149 2326 t_longest = waveMax(rescaledTime) //should be the last point … … 2208 2385 End 2209 2386 2210 2211 2387 //upDown 5 or -5 looks for spikes +5 or -5 std deviations from mean 2388 Function PutCursorsAtStep(upDown) 2389 Variable upDown 2390 2391 SetDataFolder root:Packages:NIST:Event: 2392 2393 Wave rescaledTime=rescaledTime 2394 Wave rescaledTime_DIF=rescaledTime_DIF 2395 Variable avg,pt,zoom 2396 2397 zoom = 200 //points in each direction 2398 2399 WaveStats/Q rescaledTime_DIF 2400 avg = V_avg 2401 2402 2403 FindLevel/P/Q rescaledTime_DIF avg*upDown 2404 if(V_flag==0) 2405 pt = V_levelX 2406 WaveStats/Q/R=[pt-zoom,pt+zoom] rescaledTime // find the max/min y-vallues within the point range 2407 else 2408 Print "Level not found" 2409 return(0) 2410 endif 2411 2412 Variable loLeft,hiLeft, loBottom,hiBottom 2413 loLeft = V_min*0.98 //+/- 2% 2414 hiLeft = V_max*1.02 2415 2416 SetAxis left loLeft,hiLeft 2417 SetAxis bottom pnt2x(rescaledTime,pt-zoom),pnt2x(rescaledTime,pt+zoom) 2418 2419 Cursor/P A rescaledTime pt+2 //at the point 2420 Cursor/P B rescaledTime numpnts(rescaledTime)-1 //at the end 2421 2422 SetDataFolder root: 2423 2424 return(0) 2425 End 2426 2427 2428 Function EC_FindStepButton_down(ctrlName) : ButtonControl 2429 String ctrlName 2430 2431 Variable upDown = -5 2432 PutCursorsAtStep(upDown) 2433 2434 return(0) 2435 end 2436 2437 2438 Function EC_FindStepButton_up(ctrlName) : ButtonControl 2439 String ctrlName 2440 2441 Variable upDown = 5 2442 PutCursorsAtStep(upDown) 2443 2444 return(0) 2445 end 2446 2447 2448 Function EC_DoDifferential(ctrlName) : ButtonControl 2449 String ctrlName 2450 2451 DifferentiatedTime() 2452 DoWindow/F EventCorrectionPanel 2453 2454 //if trace is not on graph, add it 2455 SetDataFolder root:Packages:NIST:Event: 2456 2457 String list = WaveList("*_DIF", ";", "WIN:EventCorrectionPanel") 2458 if(strlen(list) == 0) 2459 AppendToGraph/R rescaledTime_DIF 2460 ModifyGraph msize=1,rgb(rescaledTime_DIF)=(65535,0,0) 2461 ReorderTraces rescaledTime,{rescaledTime_DIF} // put the differential behind the event data 2462 endif 2463 SetDataFolder root: 2464 return(0) 2465 end 2212 2466 2213 2467 ////////////// Custom Bins ///////////////////// … … 2269 2523 SetVariable setvar1,pos={23,13},size={160,20},title="Number of slices",fSize=12 2270 2524 SetVariable setvar1,proc=CB_NumSlicesSetVarProc,value=root:Packages:NIST:gEvent_nslices 2271 SetVariable setvar2,pos={24,44},size={160,20},title="Max Time (s)",fSize=1 22525 SetVariable setvar2,pos={24,44},size={160,20},title="Max Time (s)",fSize=10 2272 2526 SetVariable setvar2,value=root:Packages:NIST:gEvent_t_longest 2273 2527 … … 2505 2759 Prompt baseStr,"File prefix, number will be appended" 2506 2760 2761 2507 2762 fSplitBigFile(splitSize, baseStr) 2508 End 2509 2510 Function fSplitBigFile(splitSize, baseStr) 2763 2764 End 2765 2766 Function/S fSplitBigFile(splitSize, baseStr) 2511 2767 Variable splitSize 2512 2768 String baseStr … … 2517 2773 Variable refNum 2518 2774 String str 2775 SVAR listStr = root:Packages:NIST:Event:gSplitFileList 2776 2777 listStr="" //initialize output list 2519 2778 2520 2779 Variable readSize=1e6 //1 MB … … 2522 2781 Variable numSplit 2523 2782 Variable num,ii,jj,outRef,frac 2524 String thePath 2783 String thePath, outStr 2525 2784 2526 2785 Printf "SplitSize = %u MB\r",splitSize … … 2530 2789 // Open file for read. 2531 2790 Open/R/Z=2/F="????"/P=$pathName refNum as fileName 2532 thePath = ParseFilePath(1, fileName, ":", 1, 0) 2791 thePath = ParseFilePath(1, S_fileName, ":", 1, 0) 2792 Print "thePath = ",thePath 2533 2793 2534 2794 // Store results from Open in a safe place. … … 2538 2798 if (err == -1) 2539 2799 Print "cancelled by user." 2540 return -12800 return ("") 2541 2801 endif 2542 2802 … … 2565 2825 Printf "frac = %u\r",frac 2566 2826 2567 baseStr = "split"2827 // baseStr = "split" 2568 2828 2569 2829 for(ii=0;ii<numSplit;ii+=1) 2570 Open outRef as (thePath+baseStr+num2str(ii)) 2830 outStr = (thePath+baseStr+num2str(ii)) 2831 // Print "outStr = ",outStr 2832 Open outRef as outStr 2571 2833 2572 2834 for(jj=0;jj<(splitSize/readSize);jj+=1) … … 2576 2838 2577 2839 Close outRef 2840 listStr += outStr+";" 2578 2841 endfor 2579 2842 2580 2843 Make/O/B/U/N=(frac) leftover 2581 2844 // ii was already incremented past the loop 2582 Open outRef as (thePath+baseStr+num2str(ii)) 2845 outStr = (thePath+baseStr+num2str(ii)) 2846 Open outRef as outStr 2583 2847 for(jj=0;jj<num;jj+=1) 2584 2848 FBinRead refNum,aBlob … … 2589 2853 2590 2854 Close outRef 2855 listStr += outStr+";" 2591 2856 2592 2857 … … 2594 2859 Close refNum 2595 2860 2596 2597 return 02861 KillWaves/Z aBlob,leftover 2862 return(listStr) 2598 2863 End 2599 2864 … … 2601 2866 2602 2867 //// save the sliced data, and accumulate slices 2603 // 2604 // need some way of ensuring that the slices match up since I' blindly adding them together. 2605 // 2606 // 2607 // 2868 // *** this works with sliced data -- that is data that has been PROCESSED 2869 // 2870 // need some way of ensuring that the slices match up since I'm blindly adding them together. 2608 2871 // 2609 2872 // mode = 0 wipe out the old accumulated, copy slicedData to accumulatedData 2610 2873 // mode = 1 add current slicedData to accumulatedData 2611 2874 // mode = 2 copy accumulatedData to slicedData in preparation of export or display 2612 // mode = 3 sing a song, dance a dance 2613 // 2875 // mode = 3 unused... 2876 // 2877 // "Split Large File",SplitBigFile() 2878 // "Accumulate First Slice",AccumulateSlices(0) 2879 // "Add Current Slice",AccumulateSlices(1) 2880 // "Display Accumulated Slices",AccumulateSlices(2) 2881 // 2882 Function AccumulateSlicesButton(ctrlName) : ButtonControl 2883 String ctrlName 2884 2885 Variable mode 2886 mode = str2num(ctrlName[strlen(ctrlName)-1]) 2887 // Print "mode=",mode 2888 AccumulateSlices(mode) 2889 2890 return(0) 2891 End 2892 2614 2893 Function AccumulateSlices(mode) 2615 2894 Variable mode … … 2640 2919 return(0) 2641 2920 end 2921 2922 2923 //////////////////////////////////////////// 2924 // 2925 // Panel and procedures for decimation 2926 // 2927 //////////////////////////////////////////// 2928 2929 //Function E_ShowDecimateButton(ctrlName) : ButtonControl 2930 // String ctrlName 2931 // 2932 // DoWindow/F DecimatePanel 2933 // if(V_flag ==0) 2934 // Execute "DecimatePanel()" 2935 // endif 2936 //End 2937 // 2938 // 2939 //Proc DecimatePanel() //: Panel 2940 // 2941 // PauseUpdate; Silent 1 // building window... 2942 // NewPanel /W=(1602,44,1961,380)/K=1 2943 //// ShowTools/A 2944 // Button button0,pos={29,15},size={100,20},proc=SplitFileButtonProc,title="Split Big File" 2945 // SetVariable setvar0,pos={182,55},size={150,15},title="Decimation factor",fsize=10 2946 // SetVariable setvar0,limits={1,inf,1},value= root:Packages:NIST:Event:gDecimation 2947 // Button button1,pos={26,245},size={150,20},proc=LoadDecimateButtonProc,title="Load and Decimate" 2948 // Button button2,pos={25,277},size={150,20},proc=ConcatenateButtonProc,title="Concatenate" 2949 // Button button3,pos={25,305},size={150,20},proc=DisplayConcatenatedButtonProc,title="Display Concatenated" 2950 // Button button4,pos={29,52},size={130,20},proc=Stream_LoadDecim,title="Load From List" 2951 // 2952 // GroupBox group0 title="Manual Controls",size={185,112},pos={14,220} 2953 //EndMacro 2954 2955 2956 Function SplitFileButtonProc(ctrlName) : ButtonControl 2957 String ctrlName 2958 2959 Execute "SplitBigFile()" 2960 End 2961 2962 2963 // show all of the data 2964 // 2965 Proc ShowDecimatedGraph() 2966 2967 DoWindow/F DecimatedGraph 2968 if(V_flag == 0) 2969 PauseUpdate; Silent 1 // building window... 2970 String fldrSav0= GetDataFolder(1) 2971 SetDataFolder root:Packages:NIST:Event: 2972 Display /W=(25,44,486,356)/K=1/N=DecimatedGraph rescaledTime_dec 2973 SetDataFolder fldrSav0 2974 ModifyGraph mode=4 2975 ModifyGraph marker=19 2976 ModifyGraph rgb(rescaledTime_dec)=(0,0,0) 2977 ModifyGraph msize=1 2978 ErrorBars rescaledTime_dec OFF 2979 Label left "\\Z14Time (seconds)" 2980 Label bottom "\\Z14Event number" 2981 ShowInfo 2982 endif 2983 2984 EndMacro 2985 2986 // data has NOT been processed 2987 // 2988 // so work with x,y,t, and rescaled time 2989 // variables -- t_longest 2990 Function ConcatenateButtonProc(ctrlName) : ButtonControl 2991 String ctrlName 2992 2993 DoAlert 1,"Is this the first file?" 2994 Variable first = V_flag 2995 2996 fConcatenateButton(first) 2997 2998 return(0) 2999 End 3000 3001 Function fConcatenateButton(first) 3002 Variable first 3003 3004 3005 SetDataFolder root:Packages:NIST:Event: 3006 3007 Wave timePt_dTmp=timePt_dTmp 3008 Wave xLoc_dTmp=xLoc_dTmp 3009 Wave yLoc_dTmp=yLoc_dTmp 3010 Wave rescaledTime_dTmp=rescaledTime_dTmp 3011 3012 NVAR t_longest_dec = root:Packages:NIST:gEvent_t_longest_decimated 3013 NVAR t_longest = root:Packages:NIST:gEvent_t_longest 3014 3015 3016 if(first==1) //1==yes, 2==no 3017 //then copy the files over, adjusting the time to start from zero 3018 // rescaledTime starts from zero (set by the loader) 3019 3020 timePt_dTmp -= timePt_dTmp[0] //subtract the first value 3021 3022 Duplicate/O timePt_dTmp timePt_dec 3023 Duplicate/O xLoc_dTmp xLoc_dec 3024 Duplicate/O yLoc_dTmp yLoc_dec 3025 Duplicate/O rescaledTime_dTmp rescaledTime_dec 3026 3027 t_longest_dec = t_longest 3028 3029 else 3030 // concatenate the files + adjust the time 3031 Wave timePt_dec=timePt_dec 3032 Wave xLoc_dec=xLoc_dec 3033 Wave yLoc_dec=yLoc_dec 3034 Wave rescaledTime_dec=rescaledTime_dec 3035 3036 // adjust the times -- assuming they add 3037 // rescaledTime starts from zero (set by the loader) 3038 // 3039 // 3040 rescaledTime_dTmp += rescaledTime_dec[numpnts(rescaledTime_dec)-1] 3041 rescaledTime_dTmp += abs(rescaledTime_dec[numpnts(rescaledTime_dec)-1] - rescaledTime_dec[numpnts(rescaledTime_dec)-2]) 3042 3043 timePt_dTmp -= timePt_dTmp[0] //subtract the first value 3044 3045 timePt_dTmp += timePt_dec[numpnts(timePt_dec)-1] // offset by the last point 3046 timePt_dTmp += abs(timePt_dec[numpnts(timePt_dec)-1] - timePt_dec[numpnts(timePt_dec)-2]) // plus delta so there's not a flat step 3047 3048 Concatenate/NP/O {timePt_dec,timePt_dTmp}, tmp 3049 Duplicate/O tmp timePt_dec 3050 3051 Concatenate/NP/O {xLoc_dec,xLoc_dTmp}, tmp 3052 Duplicate/O tmp xLoc_dec 3053 3054 Concatenate/NP/O {yLoc_dec,yLoc_dTmp}, tmp 3055 Duplicate/O tmp yLoc_dec 3056 3057 Concatenate/NP/O {rescaledTime_dec,rescaledTime_dTmp}, tmp 3058 Duplicate/O tmp rescaledTime_dec 3059 3060 3061 KillWaves tmp 3062 3063 t_longest_dec = rescaledTime_dec[numpnts(rescaledTime_dec)-1] 3064 3065 endif 3066 3067 3068 SetDataFolder root: 3069 3070 return(0) 3071 3072 End 3073 3074 Function DisplayConcatenatedButtonProc(ctrlName) : ButtonControl 3075 String ctrlName 3076 3077 //copy the files over to the display set for processing 3078 SetDataFolder root:Packages:NIST:Event: 3079 3080 Wave timePt_dec=timePt_dec 3081 Wave xLoc_dec=xLoc_dec 3082 Wave yLoc_dec=yLoc_dec 3083 Wave rescaledTime_dec=rescaledTime_dec 3084 3085 NVAR t_longest_dec = root:Packages:NIST:gEvent_t_longest_decimated 3086 NVAR t_longest = root:Packages:NIST:gEvent_t_longest 3087 3088 Duplicate/O timePt_dec timePt 3089 Duplicate/O xLoc_dec xLoc 3090 Duplicate/O yLoc_dec yLoc 3091 Duplicate/O rescaledTime_dec rescaledTime 3092 3093 t_longest = t_longest_dec 3094 3095 SetDataFolder root: 3096 3097 return(0) 3098 3099 End 3100 3101 3102 3103 3104 Function LoadDecimateButtonProc(ctrlName) : ButtonControl 3105 String ctrlName 3106 3107 LoadEventLog_Button("") 3108 3109 // now decimate 3110 SetDataFolder root:Packages:NIST:Event: 3111 3112 Wave timePt=timePt 3113 Wave xLoc=xLoc 3114 Wave yLoc=yLoc 3115 NVAR t_longest_dec = root:Packages:NIST:gEvent_t_longest_decimated 3116 3117 NVAR decimation = root:Packages:NIST:Event:gDecimation 3118 3119 3120 Duplicate/O timePt, timePt_dTmp 3121 Duplicate/O xLoc, xLoc_dTmp 3122 Duplicate/O yLoc, yLoc_dTmp 3123 Resample/DOWN=(decimation)/N=1 timePt_dTmp 3124 Resample/DOWN=(decimation)/N=1 xLoc_dTmp 3125 Resample/DOWN=(decimation)/N=1 yLoc_dTmp 3126 3127 3128 Duplicate/O timePt_dTmp rescaledTime_dTmp 3129 rescaledTime_dTmp = 1e-7*(timePt_dTmp - timePt_dTmp[0]) //convert to seconds and start from zero 3130 t_longest_dec = waveMax(rescaledTime_dTmp) //should be the last point 3131 3132 SetDataFolder root: 3133 3134 3135 End 3136 3137 // functions that take file names as arguments so that the loading an be done in batch mode 3138 // for the mode of "one continuous exposure" 3139 // 3140 Function Stream_LoadDecim(ctrlName) 3141 String ctrlName 3142 3143 Variable fileref 3144 3145 SVAR filename = root:Packages:NIST:gEvent_logfile 3146 NVAR t_longest = root:Packages:NIST:gEvent_t_longest 3147 3148 SVAR listStr = root:Packages:NIST:Event:gSplitFileList 3149 3150 NVAR t_longest_dec = root:Packages:NIST:gEvent_t_longest_decimated 3151 NVAR decimation = root:Packages:NIST:Event:gDecimation 3152 3153 3154 3155 //loop through everything in the list 3156 Variable num,ii 3157 num = ItemsInList(listStr) 3158 3159 for(ii=0;ii<num;ii+=1) 3160 3161 // (1) load the file 3162 filename = StringFromList(ii, listStr ,";") 3163 3164 3165 #if (exists("EventLoadWave")==4) 3166 LoadEvents_XOP() 3167 #else 3168 LoadEvents() 3169 #endif 3170 3171 SetDataFolder root:Packages:NIST:Event: //LoadEvents sets back to root: 3172 3173 Wave timePt=timePt 3174 Wave xLoc=xLoc 3175 Wave yLoc=yLoc 3176 CleanupTimes(xLoc,yLoc,timePt) //remove zeroes 3177 3178 Duplicate/O timePt rescaledTime 3179 rescaledTime = 1e-7*(timePt-timePt[0]) //convert to seconds and start from zero 3180 t_longest = waveMax(rescaledTime) //should be the last point 3181 3182 // (2) do the decimation, just on timePt. Ignore rescaledTime for now 3183 3184 Duplicate/O timePt, timePt_dTmp 3185 Duplicate/O xLoc, xLoc_dTmp 3186 Duplicate/O yLoc, yLoc_dTmp 3187 Resample/DOWN=(decimation)/N=1 timePt_dTmp 3188 Resample/DOWN=(decimation)/N=1 xLoc_dTmp 3189 Resample/DOWN=(decimation)/N=1 yLoc_dTmp 3190 3191 3192 Duplicate/O timePt_dTmp rescaledTime_dTmp 3193 rescaledTime_dTmp = 1e-7*(timePt_dTmp - timePt_dTmp[0]) //convert to seconds and start from zero 3194 t_longest_dec = waveMax(rescaledTime_dTmp) //should be the last point 3195 3196 3197 // (3) concatenate 3198 fConcatenateButton(ii+1) //passes 1 for the first time, >1 each other time 3199 3200 endfor 3201 3202 //// Now that everything is decimated and concatenated, create the rescaled time wave 3203 // SetDataFolder root:Packages:NIST:Event: //LoadEvents sets back to root: 3204 // Wave timePt_dec = timePt_dec 3205 // Duplicate/O timePt_dec rescaledTime_dec 3206 // rescaledTime_dec = 1e-7*(timePt_dec - timePt_dec[0]) //convert to seconds and start from zero 3207 // t_longest_dec = waveMax(rescaledTime_dec) //should be the last point 3208 3209 DisplayConcatenatedButtonProc("") 3210 3211 SetDataFolder root: 3212 3213 return(0) 3214 End 3215 3216 /////////////////////////////////////
Note: See TracChangeset
for help on using the changeset viewer.