Changeset 76 for sans/SANSReduction/branches
- Timestamp:
- Apr 9, 2007 3:42:39 PM (16 years ago)
- Location:
- sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/AvgGraphics.ipf
r40 r76 845 845 Wave yErrWave=$(curPath+"yErrWave") 846 846 847 DoWindow/F Plot_1d848 // If(V_flag == 1) //the graph window already exists849 // //kill the old graph and make a new one850 // //easier than adjusting the old one851 // DoWindow/K Plot_1d852 // Endif853 // Init_Plot1d()854 847 Variable/G root:myGlobals:Plot_1d:isPhiAve=0 //0 signifies (normal) x=qvals 855 848 //make a completely new graph 856 849 Draw_Plot1D(xAxisWave,yAxisWave,YErrWave) 857 858 // OLD graph creation routines859 // Display /W=(412,51,727,302)/K=1 yAxisWave vs xAxisWave860 // ModifyGraph log=1861 // ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,0)862 // ErrorBars yAxisWave Y,wave=(yErrWave,yErrWave)863 // Label left "Counts"864 // Label bottom "q\\U"865 // SVAR angst = root:myGlobals:gAngstStr866 // Label bottom "q ("+angst+"\\S-1\\M)"867 // DoWindow/C Plot_1d868 850 869 851 return(0) … … 894 876 Wave yErrWave=$(curPath+"yErrWave") 895 877 896 DoWindow/F Plot_1d897 // If(V_flag == 1) //the graph window already exists898 //kill the old graph and make a new one899 //easier than adjusting the old one900 // DoWindow/K Plot_1d901 // Endif902 // Init_Plot1d()903 878 Variable/G root:myGlobals:Plot_1d:isPhiAve=1 //1 signifies x=phival 904 879 //make a completely new graph 905 880 Draw_Plot1D(xAxisWave,yAxisWave,YErrWave) 906 907 // OLD graph creation routines908 // Display /W=(412,51,727,302)/K=1 yAxisWave vs xAxisWave909 // ModifyGraph log=0910 // ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,0)911 // ErrorBars yAxisWave Y,wave=(yErrWave,yErrWave)912 // Label left "Counts"913 // Label bottom "Angle (degrees)"914 // DoWindow/C Plot_1d915 881 916 882 return(0) … … 1186 1152 break 1187 1153 endif 1188 //more ifs for each case 1154 //more ifs for each case as they are added 1189 1155 1190 1156 // if selection not found, abort … … 1258 1224 ModifyGraph log(bottom)=(logBottom) 1259 1225 1260 // SetDataFolder dfSav //didn't change the data folder 1261 End 1262 1226 End 1227 -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Buttons.ipf
r47 r76 183 183 End 184 184 185 //sets the low cutoff of the color mapping (threshold)186 //Function LowThreshSetVarProc(ctrlName,varNum,varStr,varName) : SetVariableControl187 // String ctrlName188 // Variable varNum189 // String varStr190 // String varName191 //192 // ControlInfo/W=SANS_Data lowThresh193 // Variable loScale = V_Value194 //195 // ControlInfo/W=SANS_Data highThresh196 // Variable hiScale = V_Value197 //198 // String result = ImageInfo("SANS_Data","data",0)199 // String fullPath = StringByKey("ZWAVEDF", result, ":", ";")200 // fullpath += "data"201 // //Print fullpath202 // WaveStats/Q $fullpath203 // Variable maxData=V_max204 //205 // WAVE NIHColors = $"root:myGlobals:NIHColors"206 // ScaleColorsToData((loScale*maxData),(hiScale*maxData),NIHColors)207 // ModifyImage/W=SANS_Data data cindex=NIHColors208 //// ModifyImage/W=SANS_Data vlegend cindex=NIHColors209 //210 //End211 212 //sets the high cutoff of the color mapping (threshold)213 //Function HighThreshSetVarProc(ctrlName,varNum,varStr,varName) : SetVariableControl214 // String ctrlName215 // Variable varNum216 // String varStr217 // String varName218 //219 // ControlInfo/W=SANS_Data lowThresh220 // Variable loScale = V_Value221 //222 // ControlInfo/W=SANS_Data highThresh223 // Variable hiScale = V_Value224 //225 // String result = ImageInfo("SANS_Data","data",0)226 // String fullPath = StringByKey("ZWAVEDF", result, ":", ";")227 // fullpath += "data"228 // //Print fullpath229 // WaveStats/Q $fullpath230 // Variable maxData=V_max231 //232 // WAVE NIHColors = $"root:myGlobals:NIHColors"233 // ScaleColorsToData((loScale*maxData),(hiScale*maxData),NIHColors)234 // ModifyImage/W=SANS_Data data cindex=NIHColors235 //// ModifyImage/W=SANS_Data vlegend cindex=NIHColors236 //237 //End238 239 185 //button procedure to display previous RAW data file 240 186 //incremented by run number, not dependent on file prefix … … 328 274 329 275 330 //invoked by function key, (if menu declared)or the arrow button 331 //on Raw data display 276 //invoked by function key, (if menu declared) 332 277 // if no window, or if display type is not RAW, do nothing 333 278 Function NextRawFile() … … 344 289 LoadPlotAndDisplayRAW(1) //go to next file 345 290 346 // //do the average (either the default, or what is on the panel currently347 // if(!DataFolderExists("root:myGlobals:Drawing"))348 // Execute "InitializeAveragePanel()"349 // endif350 // Panel_DoAverageButtonProc("") //the avg panel does not need to be open, folders must exist351 291 return 0 352 292 end 353 293 354 //invoked by function key, (if menu declared)or the arrow button 355 //on Raw data display 294 //invoked by function key, (if menu declared) 356 295 // if no window, or if display type is not RAW, do nothing 357 296 Function PreviousRawFile() … … 368 307 LoadPlotAndDisplayRAW(-1) //go to previous file 369 308 370 // //do the average (either the default, or what is on the panel currently371 // if(!DataFolderExists("root:myGlobals:Drawing"))372 // Execute "InitializeAveragePanel()"373 // endif374 // Panel_DoAverageButtonProc("") //the avg panel does not need to be open, folders must exist375 309 return 0 376 310 end 377 378 311 379 312 //test function invoked by F5 … … 388 321 endif 389 322 GetSelection table,CatVSTable,3 390 // Print V_startRow391 323 392 324 Wave/T fWave = $"root:myGlobals:CatVSHeaderInfo:Filenames" … … 400 332 fRawWindowHook() 401 333 402 //do the average (either the default, or what is on the panel currently 334 // if you want a plot, too 335 //do the average and plot (either the default, or what is on the panel currently 403 336 if(!DataFolderExists("root:myGlobals:Drawing")) 404 337 Execute "InitializeAveragePanel()" 405 338 endif 406 339 Panel_DoAverageButtonProc("") //the avg panel does not need to be open, folders must exist 340 407 341 return(0) 408 342 End -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/CatVSTable.ipf
r74 r76 2 2 #pragma version=5.0 3 3 #pragma IgorVersion=4.0 4 5 4 6 5 // -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/CircSectAve.ipf
r47 r76 329 329 DDet = DetectorPixelResolution(fileStr,detStr) //needs detector type and beamline 330 330 331 //print fileStr332 // do333 // if(strsearch(fileStr, "NG5", 0) != -1)334 // //string was found, it's an NG5 file335 // DDet = 1.0336 // break337 // Endif338 // if(strsearch(fileStr, "NG3", 0) != -1)339 // //string was found, it's an NG3 file340 // DDet = 0.5341 // break342 // Endif343 // if(strsearch(fileStr, "NG7", 0) != -1)344 // //string was found, it's an NG7 file345 // DDet = 0.5346 // break347 // Endif348 // while(0)349 350 331 //Width of annulus used for the average is gotten from the 351 332 //input dialog before. This also must be passed to the resolution … … 356 337 357 338 ii=0 358 // String res_string="root:myGlobals:Res_vals" 359 // Make/O/D/N=3 $res_string 360 // Wave res_wave=$res_string 339 361 340 Variable ret1,ret2,ret3 362 341 do 363 342 getResolution(qval[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,ddr,ret1,ret2,ret3) 364 sigmaq[ii] = ret1 //res_wave[0]365 qbar[ii] = ret2 //res_wave[1]366 fsubs[ii] = ret3 //res_wave[2]343 sigmaq[ii] = ret1 344 qbar[ii] = ret2 345 fsubs[ii] = ret3 367 346 ii+=1 368 347 while(ii<nq) … … 374 353 //Plot the data in the Plot_1d window 375 354 Avg_1D_Graph(aveint,qval,sigave) 376 // DoWindow/F Plot_1d 377 // If(V_flag == 1) //the graph window already exists 378 // //kill the old graph and make a new one 379 // //easier than adjusting the old one 380 // DoWindow/K Plot_1d 381 // Endif 382 // //make a completely new graph 383 // Display /W=(412,51,727,302)/K=1 aveint vs qval 384 // ModifyGraph log=1 385 // ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,0) 386 // ErrorBars aveint Y,wave=(sigave,sigave) 387 // Label left "Counts";DelayUpdate 388 // Label bottom "q\\U" 389 // SVAR angst = root:myGlobals:gAngstStr 390 // Label bottom "q ("+angst+"\\S-1\\M)" 391 // DoWindow/C Plot_1d 392 355 393 356 //get rid of the default mask, if one was created (it is in the current folder) 394 357 //don't just kill "mask" since it might be pointing to the one in the MSK folder … … 493 456 //rename the button to reflect "isLin" - the displayed name must have been isLog 494 457 Button bisLog,title="isLin",rename=bisLin 495 496 458 Endif 497 459 … … 522 484 Return 0 523 485 End 524 //above is unused function -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Correct.ipf
r47 r76 31 31 //******************************** 32 32 33 34 33 //unused test procedure for Correct() function 35 34 //must be updated to include "mode" parameter before re-use … … 57 56 End 58 57 59 //mode describes the type of subtraction that is to be done60 //1 = both emp and bgd subtraction61 //2 = only bgd subtraction62 //3 = only emp subtraction63 //4 = no subtraction (handled by ExecuteProtocol(), but implemented here as well)64 //65 // + 10 indicates that WORK.DRK is to be used66 //**********unused***********67 //**worse yet, only partially converted to use DRK files!***********68 //69 Function OLD_Correct(mode)70 Variable mode71 72 //Print "mode = ",mode73 if(mode==4)74 Print "no subtraction required - Correct(mode) should not have been called"75 return(1) //error - correct should not have been called76 Endif77 78 // always check for existence of data in SAM79 // if the desired workfile doesn't exist, let the user know, and abort80 String destPath81 String type = "SAM"82 //check for SAM83 destPath = "root:"+Type + ":data"84 if(WaveExists($destpath) == 0)85 Print "There is no work file in "+type+"--Aborting"86 Return(1) //error condition87 else88 //check for log-scaling of the "SAM" data and adjust if necessary89 ConvertFolderToLinearScale(type)90 Wave sam_data = $"root:SAM:data"91 Endif92 93 //check for BGD if mode = 1 or 2 or 11 or 1294 if( (mode ==1) || (mode==2) || (mode==11) || (mode==12) )95 type = "BGD"96 destPath = "root:"+Type + ":data"97 if(WaveExists($destpath) == 0)98 Print "There is no work file in "+type+"--Aborting"99 Return(1) //error condition100 else101 //check for log-scaling of the "BGD" data and adjust if necessary102 ConvertFolderToLinearScale(type)103 Wave bgd_data = $"root:BGD:data"104 Endif105 Endif106 107 // check for EMP data if type 3 or 1 or 13 or 11108 if( (mode==1) || (mode==3) || (mode==11) || (mode==13) )109 type = "EMP"110 destPath = "root:"+Type + ":data"111 if(WaveExists($destpath) == 0)112 Print "There is no work file in "+type+"--Aborting"113 Return(1) //error condition114 else115 //check for log-scaling of the "EMP" data and adjust if necessary116 ConvertFolderToLinearScale(type)117 Wave emp_data = $"root:EMP:data"118 Endif119 Endif120 121 // check for DRK data if type 11,12,13, or 14122 if( (mode==11) || (mode==12) || (mode==13) || (mode==14) )123 type = "DRK"124 destPath = "root:"+Type + ":data"125 if(WaveExists($destpath) == 0)126 Print "There is no work file in "+type+"--Aborting"127 Return(1) //error condition128 else129 //check for log-scaling of the "EMP" data and adjust if necessary130 ConvertFolderToLinearScale(type)131 Wave drk_data = $"root:DRK:data"132 Endif133 Endif134 135 //necessary files exist, proceed136 137 //make needed wave references to other folders138 //NOTE that these references MAY NOT EXIST, depending on the mode139 WAVE sam_reals = $"root:SAM:realsread"140 WAVE sam_ints = $"root:SAM:integersread"141 WAVE/T sam_text = $"root:SAM:textread"142 WAVE/Z emp_reals = $"root:EMP:realsread"143 WAVE/Z emp_ints = $"root:EMP:integersread"144 WAVE/T/Z emp_text = $"root:EMP:textread"145 WAVE/Z bgd_reals = $"root:BGD:realsread"146 WAVE/Z bgd_ints = $"root:BGD:integersread"147 WAVE/T/Z bgd_text = $"root:BGD:textread"148 149 //find the attenuation of the sample (if any)150 Variable SamAttenFactor,lambda,attenNo,err=0151 String samfileStr=""152 samfileStr = sam_text[3]153 lambda = sam_reals[26]154 attenNo = sam_reals[3]155 SamAttenFactor = AttenuationFactor(samFileStr,lambda,AttenNo)156 //if sample trans is zero, do only SAM-BGD subtraction (notify the user)157 Variable sam_trans = sam_reals[4]158 159 //copy SAM information to COR, wiping out the old contents of the COR folder first160 err = CopyWorkContents("SAM","COR")161 if(err==1)162 Abort "No data in SAM, abort from Correct()"163 endif164 165 //now switch to COR folder166 DestPath="root:COR"167 //make appropriate wave references168 WAVE data=$(destPath + ":data") // these wave references point to the SAM data in COR169 WAVE/T textread=$(destPath + ":textread") //that are to be directly operated on170 WAVE integersread=$(destPath + ":integersread")171 WAVE realsread=$(destPath + ":realsRead")172 173 NVAR pixelsX = root:myGlobals:gNPixelsX174 NVAR pixelsY = root:myGlobals:gNPixelsY175 176 //Print "done copying data, starting the correct calculations"177 178 // Start the actual "correct" step here179 Variable wcen=0.001,numsam,tmonsam,tsam,rsam,csam,fsam180 Variable tmonbgd,fbgd,xshift,yshift,rbgd,cbgd,sh_sum,ii,jj,trans,tmonemp,temp,femp181 Variable cemp,remp182 //make temporary waves to hold the intermediate results and the shifted arrays183 Duplicate/O data cor1,cor2184 cor1 = 0 //initialize to zero185 cor2 = 0186 187 //make needed wave references to other folders188 Wave sam_reals = $"root:SAM:realsread"189 Wave bgd_reals = $"root:BGD:realsread"190 Wave emp_reals = $"root:EMP:realsread"191 192 //get counts, trans, etc. from file headers193 numsam = sam_ints[3] //number of runs in SAM file194 tmonsam = sam_reals[0] //monitor count in SAM195 tsam = sam_reals[4] //SAM transmission196 csam = sam_reals[16] //x center197 rsam = sam_reals[17] //beam (x,y) define center of corrected field198 //Print "rsam,csam = ",rsam,csam199 200 //201 //do sam-bgd subtraction if mode (1) or (2)202 //else (mode 3), set cor1 = sam_data203 if( (mode==1) || (mode==2) )204 fsam = 1205 tmonbgd = bgd_reals[0] //monitor count in BGD206 fbgd = tmonsam/tmonbgd //this should be ==1 since normalized files207 208 //set up center shift, relative to SAM209 cbgd = bgd_reals[16]210 rbgd = bgd_reals[17]211 //Print "rbgd,cbgd = ",rbgd,cbgd212 xshift = cbgd-csam213 yshift = rbgd-rsam214 if(abs(xshift) <= wcen)215 xshift = 0216 Endif217 if(abs(yshift) <= wcen)218 yshift = 0219 Endif220 221 If((xshift != 0) || (yshift != 0))222 DoAlert 1,"Do you want to ignore the beam center mismatch?"223 if(V_flag==1) //yes -> just go on224 xshift=0225 yshift=0226 endif227 endif228 //do the sam-bgd subtraction, deposit result in cor1[][]229 If((xshift == 0) && (yshift == 0))230 //great, no shift required231 cor1 = fsam*sam_data - fbgd*bgd_data*SamAttenFactor232 else233 //shift required, very time-consuming234 Print "sam-bgd shift x,y = ",xshift,yshift235 Make/O/N=1 noadd //needed to get noadd condition back from ShiftSum()236 ii=0237 do238 jj=0239 do240 //get the contribution of shifted data241 sh_sum = ShiftSum(bgd_data,ii,jj,xshift,yshift,noadd)242 if(noadd[0])243 cor1[ii][jj]=0244 else245 //add the sam_data + shifted sum246 cor1[ii][jj] = fsam*sam_data[ii][jj] - fbgd*sh_sum*SamAttenFactor247 Endif248 jj+=1249 while(jj<pixelsY)250 ii+=1251 while(ii<pixelsX)252 Endif253 else //switch on mode254 cor1 = sam_data //setup for just EMP subtraction255 Endif256 257 //Print "sam-bgd done"258 259 if(mode == 2) //just a BGD subtraction260 //we're done, get out w/no error261 //set the COR data to the result262 data = cor1263 //update COR header264 textread[1] = date() + " " + time() //date + time stamp265 SetDataFolder root:266 KillWaves/Z cor1,cor2267 Return(0)268 Endif269 270 //if mode ==1 (ONLY choice left) do the empty-background subtraction271 //else mode = 3, set cor2 to emp_data272 if(mode==1) //full subtraction273 trans = emp_reals[4] //EMP transmission274 if(trans == 0)275 trans = 1276 DoAlert 0,"Empty cell transmission was zero. It has been reset to one for the calculation"277 endif278 tmonemp = emp_reals[0]279 femp = tmonsam/tmonemp280 temp = trans281 282 //set up center shift, relative to EMP283 cemp = emp_reals[16]284 remp = emp_reals[17]285 //Print "remp,cemp ",remp,cemp286 xshift = cbgd - cemp287 yshift = rbgd - remp288 if(abs(xshift) <= wcen )289 xshift = 0290 endif291 if(abs(yshift) <= wcen)292 yshift = 0293 endif294 295 If((xshift != 0) || (yshift != 0))296 DoAlert 1,"Do you want to ignore the beam center mismatch?"297 if(V_flag==1)298 xshift=0299 yshift=0300 endif301 endif302 //do the emp-bgd subtraction, deposit result in cor2[][]303 If((xshift == 0) && (yshift == 0))304 //great, no shift required, DON'T scale this by the attenuation gfactor305 cor2 = femp*emp_data - fbgd*bgd_data306 else307 //shift required, very time-consuming308 Print "emp-bgd shift x,y = ",xshift,yshift309 Make/O/N=1 noadd //needed to get noadd condition back from ShiftSum()310 ii=0311 do312 jj=0313 do314 //get the contribution of shifted data315 sh_sum = ShiftSum(bgd_data,ii,jj,xshift,yshift,noadd)316 if(noadd[0])317 cor2[ii][jj]=0318 else319 //add the sam_data + shifted sum320 cor2[ii][jj] = femp*emp_data[ii][jj] - fbgd*sh_sum321 Endif322 jj+=1323 while(jj<pixelsY)324 ii+=1325 while(ii<pixelsX)326 Endif327 else //switch on mode==1 for full subtraction328 cor2 = emp_data329 //be sure to set the empty center location... for the shift330 trans = emp_reals[4] //EMP transmission331 if(trans == 0)332 trans = 1333 DoAlert 0,"Empty cell transmission was zero. It has been reset to one for the calculation"334 endif335 tmonemp = emp_reals[0]336 femp = tmonsam/tmonemp337 temp = trans338 339 //set up center shift, relative to EMP340 cemp = emp_reals[16]341 remp = emp_reals[17]342 Endif343 344 //Print "emp-bgd done"345 346 //mode 2 exited, either 1 or 3 apply from here, and are setup properly.347 348 //set up for final step, data(COR) = cor1 - Tsam/Temp*cor2349 //set up shift, relative to SAM350 xshift = cemp - csam351 yshift = remp - rsam352 if(abs(xshift) <= wcen )353 xshift = 0354 endif355 if(abs(yshift) <= wcen)356 yshift = 0357 endif358 359 If((xshift != 0) || (yshift != 0))360 DoAlert 1,"Do you want to ignore the beam center mismatch?"361 if(V_flag==1)362 xshift=0363 yshift=0364 endif365 endif366 //do the cor1-a*cor2 subtraction, deposit result in data[][] (in the COR folder)367 If((xshift == 0) && (yshift == 0))368 //great, no shift required369 data = cor1 - (tsam/temp)*cor2*SamAttenFactor370 else371 //shift required, very time-consuming372 Print "sam-emp shift x,y = ",xshift,yshift373 Make/O/N=1 noadd //needed to get noadd condition back from ShiftSum()374 ii=0375 do376 jj=0377 do378 //get the contribution of shifted data379 sh_sum = ShiftSum(cor2,ii,jj,xshift,yshift,noadd)380 if(noadd[0])381 data[ii][jj]=0382 else383 //add the sam_data + shifted sum384 data[ii][jj] = cor1[ii][jj] - (tsam/temp)*sh_sum*SamAttenFactor385 Endif386 jj+=1387 while(jj<pixelsY)388 ii+=1389 while(ii<pixelsX)390 Endif391 392 //Print "all done"393 394 //update COR header395 textread[1] = date() + " " + time() //date + time stamp396 397 //clean up398 SetDataFolder root:COR399 SetDataFolder root:400 KillWaves/Z cor1,cor2,noadd401 402 Return(0) //all is ok, if you made it to this point403 End404 58 405 59 //mode describes the type of subtraction that is to be done … … 1385 1039 1386 1040 ////////////////////////// 1041 //**********unused*********** 1042 //mode describes the type of subtraction that is to be done 1043 //1 = both emp and bgd subtraction 1044 //2 = only bgd subtraction 1045 //3 = only emp subtraction 1046 //4 = no subtraction (handled by ExecuteProtocol(), but implemented here as well) 1047 // 1048 // + 10 indicates that WORK.DRK is to be used 1049 //**********unused*********** 1050 //**worse yet, only partially converted to use DRK files!*********** 1051 // 1052 Function OLD_Correct(mode) 1053 Variable mode 1054 1055 //Print "mode = ",mode 1056 if(mode==4) 1057 Print "no subtraction required - Correct(mode) should not have been called" 1058 return(1) //error - correct should not have been called 1059 Endif 1060 1061 // always check for existence of data in SAM 1062 // if the desired workfile doesn't exist, let the user know, and abort 1063 String destPath 1064 String type = "SAM" 1065 //check for SAM 1066 destPath = "root:"+Type + ":data" 1067 if(WaveExists($destpath) == 0) 1068 Print "There is no work file in "+type+"--Aborting" 1069 Return(1) //error condition 1070 else 1071 //check for log-scaling of the "SAM" data and adjust if necessary 1072 ConvertFolderToLinearScale(type) 1073 Wave sam_data = $"root:SAM:data" 1074 Endif 1075 1076 //check for BGD if mode = 1 or 2 or 11 or 12 1077 if( (mode ==1) || (mode==2) || (mode==11) || (mode==12) ) 1078 type = "BGD" 1079 destPath = "root:"+Type + ":data" 1080 if(WaveExists($destpath) == 0) 1081 Print "There is no work file in "+type+"--Aborting" 1082 Return(1) //error condition 1083 else 1084 //check for log-scaling of the "BGD" data and adjust if necessary 1085 ConvertFolderToLinearScale(type) 1086 Wave bgd_data = $"root:BGD:data" 1087 Endif 1088 Endif 1089 1090 // check for EMP data if type 3 or 1 or 13 or 11 1091 if( (mode==1) || (mode==3) || (mode==11) || (mode==13) ) 1092 type = "EMP" 1093 destPath = "root:"+Type + ":data" 1094 if(WaveExists($destpath) == 0) 1095 Print "There is no work file in "+type+"--Aborting" 1096 Return(1) //error condition 1097 else 1098 //check for log-scaling of the "EMP" data and adjust if necessary 1099 ConvertFolderToLinearScale(type) 1100 Wave emp_data = $"root:EMP:data" 1101 Endif 1102 Endif 1103 1104 // check for DRK data if type 11,12,13, or 14 1105 if( (mode==11) || (mode==12) || (mode==13) || (mode==14) ) 1106 type = "DRK" 1107 destPath = "root:"+Type + ":data" 1108 if(WaveExists($destpath) == 0) 1109 Print "There is no work file in "+type+"--Aborting" 1110 Return(1) //error condition 1111 else 1112 //check for log-scaling of the "EMP" data and adjust if necessary 1113 ConvertFolderToLinearScale(type) 1114 Wave drk_data = $"root:DRK:data" 1115 Endif 1116 Endif 1117 1118 //necessary files exist, proceed 1119 1120 //make needed wave references to other folders 1121 //NOTE that these references MAY NOT EXIST, depending on the mode 1122 WAVE sam_reals = $"root:SAM:realsread" 1123 WAVE sam_ints = $"root:SAM:integersread" 1124 WAVE/T sam_text = $"root:SAM:textread" 1125 WAVE/Z emp_reals = $"root:EMP:realsread" 1126 WAVE/Z emp_ints = $"root:EMP:integersread" 1127 WAVE/T/Z emp_text = $"root:EMP:textread" 1128 WAVE/Z bgd_reals = $"root:BGD:realsread" 1129 WAVE/Z bgd_ints = $"root:BGD:integersread" 1130 WAVE/T/Z bgd_text = $"root:BGD:textread" 1131 1132 //find the attenuation of the sample (if any) 1133 Variable SamAttenFactor,lambda,attenNo,err=0 1134 String samfileStr="" 1135 samfileStr = sam_text[3] 1136 lambda = sam_reals[26] 1137 attenNo = sam_reals[3] 1138 SamAttenFactor = AttenuationFactor(samFileStr,lambda,AttenNo) 1139 //if sample trans is zero, do only SAM-BGD subtraction (notify the user) 1140 Variable sam_trans = sam_reals[4] 1141 1142 //copy SAM information to COR, wiping out the old contents of the COR folder first 1143 err = CopyWorkContents("SAM","COR") 1144 if(err==1) 1145 Abort "No data in SAM, abort from Correct()" 1146 endif 1147 1148 //now switch to COR folder 1149 DestPath="root:COR" 1150 //make appropriate wave references 1151 WAVE data=$(destPath + ":data") // these wave references point to the SAM data in COR 1152 WAVE/T textread=$(destPath + ":textread") //that are to be directly operated on 1153 WAVE integersread=$(destPath + ":integersread") 1154 WAVE realsread=$(destPath + ":realsRead") 1155 1156 NVAR pixelsX = root:myGlobals:gNPixelsX 1157 NVAR pixelsY = root:myGlobals:gNPixelsY 1158 1159 //Print "done copying data, starting the correct calculations" 1160 1161 // Start the actual "correct" step here 1162 Variable wcen=0.001,numsam,tmonsam,tsam,rsam,csam,fsam 1163 Variable tmonbgd,fbgd,xshift,yshift,rbgd,cbgd,sh_sum,ii,jj,trans,tmonemp,temp,femp 1164 Variable cemp,remp 1165 //make temporary waves to hold the intermediate results and the shifted arrays 1166 Duplicate/O data cor1,cor2 1167 cor1 = 0 //initialize to zero 1168 cor2 = 0 1169 1170 //make needed wave references to other folders 1171 Wave sam_reals = $"root:SAM:realsread" 1172 Wave bgd_reals = $"root:BGD:realsread" 1173 Wave emp_reals = $"root:EMP:realsread" 1174 1175 //get counts, trans, etc. from file headers 1176 numsam = sam_ints[3] //number of runs in SAM file 1177 tmonsam = sam_reals[0] //monitor count in SAM 1178 tsam = sam_reals[4] //SAM transmission 1179 csam = sam_reals[16] //x center 1180 rsam = sam_reals[17] //beam (x,y) define center of corrected field 1181 //Print "rsam,csam = ",rsam,csam 1182 1183 // 1184 //do sam-bgd subtraction if mode (1) or (2) 1185 //else (mode 3), set cor1 = sam_data 1186 if( (mode==1) || (mode==2) ) 1187 fsam = 1 1188 tmonbgd = bgd_reals[0] //monitor count in BGD 1189 fbgd = tmonsam/tmonbgd //this should be ==1 since normalized files 1190 1191 //set up center shift, relative to SAM 1192 cbgd = bgd_reals[16] 1193 rbgd = bgd_reals[17] 1194 //Print "rbgd,cbgd = ",rbgd,cbgd 1195 xshift = cbgd-csam 1196 yshift = rbgd-rsam 1197 if(abs(xshift) <= wcen) 1198 xshift = 0 1199 Endif 1200 if(abs(yshift) <= wcen) 1201 yshift = 0 1202 Endif 1203 1204 If((xshift != 0) || (yshift != 0)) 1205 DoAlert 1,"Do you want to ignore the beam center mismatch?" 1206 if(V_flag==1) //yes -> just go on 1207 xshift=0 1208 yshift=0 1209 endif 1210 endif 1211 //do the sam-bgd subtraction, deposit result in cor1[][] 1212 If((xshift == 0) && (yshift == 0)) 1213 //great, no shift required 1214 cor1 = fsam*sam_data - fbgd*bgd_data*SamAttenFactor 1215 else 1216 //shift required, very time-consuming 1217 Print "sam-bgd shift x,y = ",xshift,yshift 1218 Make/O/N=1 noadd //needed to get noadd condition back from ShiftSum() 1219 ii=0 1220 do 1221 jj=0 1222 do 1223 //get the contribution of shifted data 1224 sh_sum = ShiftSum(bgd_data,ii,jj,xshift,yshift,noadd) 1225 if(noadd[0]) 1226 cor1[ii][jj]=0 1227 else 1228 //add the sam_data + shifted sum 1229 cor1[ii][jj] = fsam*sam_data[ii][jj] - fbgd*sh_sum*SamAttenFactor 1230 Endif 1231 jj+=1 1232 while(jj<pixelsY) 1233 ii+=1 1234 while(ii<pixelsX) 1235 Endif 1236 else //switch on mode 1237 cor1 = sam_data //setup for just EMP subtraction 1238 Endif 1239 1240 //Print "sam-bgd done" 1241 1242 if(mode == 2) //just a BGD subtraction 1243 //we're done, get out w/no error 1244 //set the COR data to the result 1245 data = cor1 1246 //update COR header 1247 textread[1] = date() + " " + time() //date + time stamp 1248 SetDataFolder root: 1249 KillWaves/Z cor1,cor2 1250 Return(0) 1251 Endif 1252 1253 //if mode ==1 (ONLY choice left) do the empty-background subtraction 1254 //else mode = 3, set cor2 to emp_data 1255 if(mode==1) //full subtraction 1256 trans = emp_reals[4] //EMP transmission 1257 if(trans == 0) 1258 trans = 1 1259 DoAlert 0,"Empty cell transmission was zero. It has been reset to one for the calculation" 1260 endif 1261 tmonemp = emp_reals[0] 1262 femp = tmonsam/tmonemp 1263 temp = trans 1264 1265 //set up center shift, relative to EMP 1266 cemp = emp_reals[16] 1267 remp = emp_reals[17] 1268 //Print "remp,cemp ",remp,cemp 1269 xshift = cbgd - cemp 1270 yshift = rbgd - remp 1271 if(abs(xshift) <= wcen ) 1272 xshift = 0 1273 endif 1274 if(abs(yshift) <= wcen) 1275 yshift = 0 1276 endif 1277 1278 If((xshift != 0) || (yshift != 0)) 1279 DoAlert 1,"Do you want to ignore the beam center mismatch?" 1280 if(V_flag==1) 1281 xshift=0 1282 yshift=0 1283 endif 1284 endif 1285 //do the emp-bgd subtraction, deposit result in cor2[][] 1286 If((xshift == 0) && (yshift == 0)) 1287 //great, no shift required, DON'T scale this by the attenuation gfactor 1288 cor2 = femp*emp_data - fbgd*bgd_data 1289 else 1290 //shift required, very time-consuming 1291 Print "emp-bgd shift x,y = ",xshift,yshift 1292 Make/O/N=1 noadd //needed to get noadd condition back from ShiftSum() 1293 ii=0 1294 do 1295 jj=0 1296 do 1297 //get the contribution of shifted data 1298 sh_sum = ShiftSum(bgd_data,ii,jj,xshift,yshift,noadd) 1299 if(noadd[0]) 1300 cor2[ii][jj]=0 1301 else 1302 //add the sam_data + shifted sum 1303 cor2[ii][jj] = femp*emp_data[ii][jj] - fbgd*sh_sum 1304 Endif 1305 jj+=1 1306 while(jj<pixelsY) 1307 ii+=1 1308 while(ii<pixelsX) 1309 Endif 1310 else //switch on mode==1 for full subtraction 1311 cor2 = emp_data 1312 //be sure to set the empty center location... for the shift 1313 trans = emp_reals[4] //EMP transmission 1314 if(trans == 0) 1315 trans = 1 1316 DoAlert 0,"Empty cell transmission was zero. It has been reset to one for the calculation" 1317 endif 1318 tmonemp = emp_reals[0] 1319 femp = tmonsam/tmonemp 1320 temp = trans 1321 1322 //set up center shift, relative to EMP 1323 cemp = emp_reals[16] 1324 remp = emp_reals[17] 1325 Endif 1326 1327 //Print "emp-bgd done" 1328 1329 //mode 2 exited, either 1 or 3 apply from here, and are setup properly. 1330 1331 //set up for final step, data(COR) = cor1 - Tsam/Temp*cor2 1332 //set up shift, relative to SAM 1333 xshift = cemp - csam 1334 yshift = remp - rsam 1335 if(abs(xshift) <= wcen ) 1336 xshift = 0 1337 endif 1338 if(abs(yshift) <= wcen) 1339 yshift = 0 1340 endif 1341 1342 If((xshift != 0) || (yshift != 0)) 1343 DoAlert 1,"Do you want to ignore the beam center mismatch?" 1344 if(V_flag==1) 1345 xshift=0 1346 yshift=0 1347 endif 1348 endif 1349 //do the cor1-a*cor2 subtraction, deposit result in data[][] (in the COR folder) 1350 If((xshift == 0) && (yshift == 0)) 1351 //great, no shift required 1352 data = cor1 - (tsam/temp)*cor2*SamAttenFactor 1353 else 1354 //shift required, very time-consuming 1355 Print "sam-emp shift x,y = ",xshift,yshift 1356 Make/O/N=1 noadd //needed to get noadd condition back from ShiftSum() 1357 ii=0 1358 do 1359 jj=0 1360 do 1361 //get the contribution of shifted data 1362 sh_sum = ShiftSum(cor2,ii,jj,xshift,yshift,noadd) 1363 if(noadd[0]) 1364 data[ii][jj]=0 1365 else 1366 //add the sam_data + shifted sum 1367 data[ii][jj] = cor1[ii][jj] - (tsam/temp)*sh_sum*SamAttenFactor 1368 Endif 1369 jj+=1 1370 while(jj<pixelsY) 1371 ii+=1 1372 while(ii<pixelsX) 1373 Endif 1374 1375 //Print "all done" 1376 1377 //update COR header 1378 textread[1] = date() + " " + time() //date + time stamp 1379 1380 //clean up 1381 SetDataFolder root:COR 1382 SetDataFolder root: 1383 KillWaves/Z cor1,cor2,noadd 1384 1385 Return(0) //all is ok, if you made it to this point 1386 End -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/FIT_Ops.ipf
r70 r76 732 732 End 733 733 734 //function returning a string (list) of semicolon separated filenames 735 //that are not version numbers, and not raw data files 736 //(can't really pare out other files any better - trying to just get ascii I vs. q) 737 //works in folder specified by catPathName, (abort if it doesn't exist) 738 // 739 //** not used anymore - simpler file filter is used instead 740 // 741 //Function/S GetValidFITRPAPopupList() 742 // 743 // String list = "none;something;" 744 // 745 // PathInfo catPathName 746 // String path = S_path 747 // if(V_flag == 0) 748 // Abort "path does not exist - use Pick Path button" 749 // Endif 750 // 751 // list = IndexedFile(catPathName,-1,"????") //get all files in folder 752 // 753 // //trim version numbers from list 754 // Variable num = ItemsInList(list,";") 755 // Variable ii,isRAW 756 // String item = "",listCopy = "", fullName = "",partialName = "" 757 // 758 // ii=1 759 // do 760 // item = num2str(ii) 761 // list = RemoveFromList(item,list,";") 762 // ii+=1 763 // while (ii<12) 764 // 765 // //trim raw data files from list 766 // listCopy = list //scan through items in copy, change list 767 // num = ItemsInList(listCopy,";") //get the new number of items in the list 768 // ii=0 769 // do 770 // //build valid fileName 771 // item = StringFromList(ii,listCopy,";") 772 // if (strlen(item) !=0 ) 773 // partialName = FindValidFileName(item) 774 // if(strlen(partialName) !=0) //non-null return from FindValidFileName() 775 // fullName = path + partialName 776 // //check if RAW, if so, remove from list 777 // isRAW = CheckIfRAWData(fullName) 778 // if(isRAW) 779 // list = RemoveFromList(item,list,";") 780 // Endif 781 // Endif 782 // Endif 783 // ii+=1 784 // While(ii<num) 785 // 786 // return list 787 //End 734 788 735 789 736 // window recreation macro to draw the fit/rpa panel … … 1107 1054 qrgh = x*sqrt(nh*ap2/6) 1108 1055 qrgd = x*sqrt(nd*ap2/6) 1109 iabs_rpa = kn/(1/(ch* dbf(qrgh)) + 1/(cd*dbf(qrgd)) - chiv)1056 iabs_rpa = kn/(1/(ch*FIT_dbf(qrgh)) + 1/(cd*FIT_dbf(qrgd)) - chiv) 1110 1057 iabs = corr*iabs_rpa + inc 1111 1058 … … 1133 1080 qrgh = x*sqrt(nh*ap2/6) 1134 1081 qrgd = x*sqrt(nd*ap2/6) 1135 iabs_rpa = kn/(1/(ch* dbf(qrgh)) + 1/(cd*dbf(qrgd)) - chiv)1082 iabs_rpa = kn/(1/(ch*FIT_dbf(qrgh)) + 1/(cd*FIT_dbf(qrgd)) - chiv) 1136 1083 iabs = corr*iabs_rpa + inc 1137 1084 … … 1159 1106 //The following lines were commented out in the fortran function 1160 1107 //qrgd = x*sqrt(nd*ap2/6) 1161 //iabs_rpa = kn/(1/(ch* dbf(qrgh)) + 1/(cd*dbf(qrgd)) - chiv)1162 1163 iabs_rpa = kn* dbf(qrgh)1108 //iabs_rpa = kn/(1/(ch*FIT_dbf(qrgh)) + 1/(cd*FIT_dbf(qrgd)) - chiv) 1109 1110 iabs_rpa = kn*FIT_dbf(qrgh) 1164 1111 iabs = iabs_rpa + inc 1165 1112 … … 1170 1117 1171 1118 //Debye Function used for polymer standards 1172 Function dbf(rgq)1119 Function FIT_dbf(rgq) 1173 1120 Variable rgq 1174 1121 Variable x -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/MainPanel.ipf
r41 r76 361 361 //************* OLD version of Main Panel ************* 362 362 //Window Main_Panel() 363 Window Main_Panel_OLD()363 Window OLD_Main_Panel() 364 364 PauseUpdate; Silent 1 // building window... 365 365 NewPanel /K=2 /W=(630,75,938,408) as "SANS Reduction Controls" -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Marquee.ipf
r75 r76 79 79 return(1) 80 80 endif 81 82 83 84 81 //printf "marquee left in bottom axis terms: %g\r",round(V_left) 82 //printf "marquee right in bottom axis terms: %g\r",round(V_right) 83 //printf "marquee top in left axis terms: %g\r",round(V_top) 84 //printf "marquee bottom in left axis terms: %g\r",round(V_bottom) 85 85 Variable x1,x2,y1,y2 86 86 x1 = round(V_left) … … 145 145 WriteXYBoxToHeader(filename,x1,x2,y1,y2) 146 146 147 //ReWriteReal() takes care of open/close on its own148 147 Print counts, " counts in XY box" 149 148 WriteBoxCountsToHeader(filename,counts) … … 361 360 return(0) 362 361 End 362 363 // 363 364 // promts the user for a range of file numbers to perform the sum over 364 365 // list must be comma delimited numbers (or dashes) just as in the BuildProtocol panel … … 418 419 419 420 //testing function, not used 420 Function testKeep (x1,x2,y1,y2)421 Function testKeepInBounds(x1,x2,y1,y2) 421 422 Variable x1,x2,y1,y2 422 423 -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/MaskUtils.ipf
r47 r76 39 39 maskButtonProc("maskButton") 40 40 // OverlayMask(1) 41 42 43 // Display/W=(10,50,400,400); AppendImage $waveStr44 41 45 42 //back to root folder (redundant) -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/MultipleReduce.ipf
r41 r76 15 15 //************************** 16 16 17 //panel to allow reduction of a series of files using a selected protocol 18 // 19 //main entry procedure to open the panel, initializing if necessary 20 Proc ReduceMultipleFiles() 21 22 DoWindow/F Multiple_Reduce_Panel 23 If(V_flag == 0) 24 InitializeMultReducePanel() 25 //draw panel 26 Multiple_Reduce_Panel() 27 //pop the protocol list 28 MRProtoPopMenuProc("",1,"") 29 Endif 30 End 31 32 //create the global variables needed to run the MReduce Panel 33 //all are kept in root:myGlobals:MRED 34 // 35 Proc InitializeMultReducePanel() 36 37 If(DataFolderExists("root:myGlobals:MRED")) 38 //ok, do nothing 39 else 40 //no, create the folder and the globals 41 NewDataFolder/O root:myGlobals:MRED 42 // String/G root:myGlobals:MRED:gMRedMatchStr = "*" 43 PathInfo catPathName 44 If(V_flag==1) 45 String dum = S_path 46 String/G root:myGlobals:MRED:gCatPathStr = dum 47 else 48 String/G root:myGlobals:MRED:gCatPathStr = "no path selected" 49 endif 50 String/G root:myGlobals:MRED:gMRedList = "none" 51 String/G root:myGlobals:MRED:gMRProtoList = "none" 52 String/G root:myGlobals:MRED:gFileNumList="" 53 // String/G root:myGlobals:MRED:gMRS1 = "no file selected" 54 // String/G root:myGlobals:MRED:gMRS2 = "no file selected" 55 // String/G root:myGlobals:MRED:gMRS3 = "no box selected" 56 // Variable/G root:myGlobals:MRED:gMRV1 =0 57 // Variable/G root:myGlobals:MRED:gMRV2 = 999 58 Endif 59 End 60 61 //panel recreation macro for the MRED panel 62 // 63 Window Multiple_Reduce_Panel() 64 PauseUpdate; Silent 1 // building window... 65 NewPanel /W=(535,72,951,228) /K=1 as "Multiple File Reduction" 66 ModifyPanel cbRGB=(65535,49151,29490) 67 ModifyPanel fixedSize=1 68 SetDrawLayer UserBack 69 DrawLine 7,30,422,30 70 SetVariable PathDisplay,pos={77,7},size={300,13},title="Path" 71 SetVariable PathDisplay,help={"This is the path to the folder that will be used to find the SANS data while reducing. If no files appear in the popup, make sure that this folder is set correctly"} 72 SetVariable PathDisplay,limits={-Inf,Inf,0},value= root:myGlobals:MRED:gCatPathStr 73 Button PathButton,pos={3,3},size={70,20},proc=PickMRPathButton,title="Pick Path" 74 Button PathButton,help={"Select the folder containing the raw SANS data files"} 75 Button helpButton,pos={385,3},size={25,20},proc=ShowMRHelp,title="?" 76 Button helpButton,help={"Show the help file for reducing multiple files using the same protocol"} 77 PopupMenu MRFilesPopup,pos={3,72},size={167,19},proc=MRedPopMenuProc,title="File(s) to Reduce" 78 PopupMenu MRFilesPopup,help={"The displayed file is the one that will be reduced. The entire list will be reduced if \"Reduce All..\" is selected. \r If no items, or the wrong items appear, click on the popup to refresh."} 79 PopupMenu MRFilesPopup,mode=1,popvalue="none",value= #"root:myGlobals:MRED:gMRedList" 80 SetVariable MRList,pos={3,48},size={350,13},proc=FileNumberListProc,title="File number list: " 81 SetVariable MRList,help={"Enter a comma delimited list of file numbers to reduce. Ranges can be entered using a dash."} 82 SetVariable MRList,limits={-Inf,Inf,1},value= root:myGlobals:MRED:gFileNumList 83 Button ReduceAllButton,pos={3,128},size={180,20},proc=ReduceAllPopupFiles,title="Reduce All Files in Popup" 84 Button ReduceAllButton,help={"This will reduce ALL of the files in the popup list, not just the top file."} 85 Button DoneButton,pos={292,128},size={110,20},proc=MRDoneButtonProc,title="Done Reducing" 86 Button DoneButton,help={"When done reducing files, this will close this control panel."} 87 Button cat_short,pos={310,72},size={90,20},proc=DoCatShort,title="File Catalog" 88 Button cat_short,help={"Use this button to generate a table with file header information. Very useful for identifying files."} 89 Button show_cat_short,pos={280,98},size={120,20},proc=ShowCatShort_MRED,title="Show File Catalog" 90 Button show_cat_short,help={"Use this button to bring the File Catalog window to the front."} 91 PopupMenu MRProto_pop,pos={3,98},size={119,19},proc=MRProtoPopMenuProc,title="Protocol " 92 PopupMenu MRProto_pop,help={"All of the data files in the popup will be reduced using this protocol"} 93 PopupMenu MRProto_pop,mode=1,popvalue="none",value= #"root:myGlobals:MRED:gMRProtoList" 94 EndMacro 17 95 18 96 //simple procedure to bring the CAT TABLE to the front if it is present … … 107 185 End 108 186 109 110 //panel to allow reduction of a series of files using a selected protocol111 //112 //main entry procedure to open the panel, initializing if necessary113 Proc ReduceMultipleFiles()114 115 DoWindow/F Multiple_Reduce_Panel116 If(V_flag == 0)117 InitializeMultReducePanel()118 //draw panel119 Multiple_Reduce_Panel()120 //pop the protocol list121 MRProtoPopMenuProc("",1,"")122 Endif123 End124 125 //create the global variables needed to run the MReduce Panel126 //all are kept in root:myGlobals:MRED127 //128 Proc InitializeMultReducePanel()129 130 If(DataFolderExists("root:myGlobals:MRED"))131 //ok, do nothing132 else133 //no, create the folder and the globals134 NewDataFolder/O root:myGlobals:MRED135 // String/G root:myGlobals:MRED:gMRedMatchStr = "*"136 PathInfo catPathName137 If(V_flag==1)138 String dum = S_path139 String/G root:myGlobals:MRED:gCatPathStr = dum140 else141 String/G root:myGlobals:MRED:gCatPathStr = "no path selected"142 endif143 String/G root:myGlobals:MRED:gMRedList = "none"144 String/G root:myGlobals:MRED:gMRProtoList = "none"145 String/G root:myGlobals:MRED:gFileNumList=""146 // String/G root:myGlobals:MRED:gMRS1 = "no file selected"147 // String/G root:myGlobals:MRED:gMRS2 = "no file selected"148 // String/G root:myGlobals:MRED:gMRS3 = "no box selected"149 // Variable/G root:myGlobals:MRED:gMRV1 =0150 // Variable/G root:myGlobals:MRED:gMRV2 = 999151 Endif152 End153 154 //panel recreation macro for the MRED panel155 //156 Window Multiple_Reduce_Panel()157 PauseUpdate; Silent 1 // building window...158 NewPanel /W=(535,72,951,228) /K=1 as "Multiple File Reduction"159 ModifyPanel cbRGB=(65535,49151,29490)160 ModifyPanel fixedSize=1161 SetDrawLayer UserBack162 DrawLine 7,30,422,30163 SetVariable PathDisplay,pos={77,7},size={300,13},title="Path"164 SetVariable PathDisplay,help={"This is the path to the folder that will be used to find the SANS data while reducing. If no files appear in the popup, make sure that this folder is set correctly"}165 SetVariable PathDisplay,limits={-Inf,Inf,0},value= root:myGlobals:MRED:gCatPathStr166 Button PathButton,pos={3,3},size={70,20},proc=PickMRPathButton,title="Pick Path"167 Button PathButton,help={"Select the folder containing the raw SANS data files"}168 Button helpButton,pos={385,3},size={25,20},proc=ShowMRHelp,title="?"169 Button helpButton,help={"Show the help file for reducing multiple files using the same protocol"}170 PopupMenu MRFilesPopup,pos={3,72},size={167,19},proc=MRedPopMenuProc,title="File(s) to Reduce"171 PopupMenu MRFilesPopup,help={"The displayed file is the one that will be reduced. The entire list will be reduced if \"Reduce All..\" is selected. \r If no items, or the wrong items appear, click on the popup to refresh."}172 PopupMenu MRFilesPopup,mode=1,popvalue="none",value= #"root:myGlobals:MRED:gMRedList"173 SetVariable MRList,pos={3,48},size={350,13},proc=FileNumberListProc,title="File number list: "174 SetVariable MRList,help={"Enter a comma delimited list of file numbers to reduce. Ranges can be entered using a dash."}175 SetVariable MRList,limits={-Inf,Inf,1},value= root:myGlobals:MRED:gFileNumList176 // SetVariable MRLow,pos={3,72},size={150,13},proc=SetLowFileNumProc,title="File range: "177 // SetVariable MRLow,help={"Enter the first file number to reduce. Files must be consecutively numbered."}178 // SetVariable MRLow,limits={-Inf,Inf,0},value= root:myGlobals:MRED:gMRV1179 Button ReduceAllButton,pos={3,128},size={180,20},proc=ReduceAllPopupFiles,title="Reduce All Files in Popup"180 Button ReduceAllButton,help={"This will reduce ALL of the files in the popup list, not just the top file."}181 Button DoneButton,pos={292,128},size={110,20},proc=MRDoneButtonProc,title="Done Reducing"182 Button DoneButton,help={"When done reducing files, this will close this control panel."}183 Button cat_short,pos={310,72},size={90,20},proc=DoCatShort,title="File Catalog"184 Button cat_short,help={"Use this button to generate a table with file header information. Very useful for identifying files."}185 Button show_cat_short,pos={280,98},size={120,20},proc=ShowCatShort_MRED,title="Show File Catalog"186 Button show_cat_short,help={"Use this button to bring the File Catalog window to the front."}187 // SetVariable MRHigh,pos={160,73},size={90,13},proc=SetHighFileNumProc,title=" to: "188 // SetVariable MRHigh,help={"Enter the last file number to reduce. Files must be consecutively numbered."}189 // SetVariable MRHigh,limits={-Inf,Inf,0},value= root:myGlobals:MRED:gMRV2190 PopupMenu MRProto_pop,pos={3,98},size={119,19},proc=MRProtoPopMenuProc,title="Protocol "191 PopupMenu MRProto_pop,help={"All of the data files in the popup will be reduced using this protocol"}192 PopupMenu MRProto_pop,mode=1,popvalue="none",value= #"root:myGlobals:MRED:gMRProtoList"193 EndMacro194 195 187 //executed when a list of filenumbers is entered in the box 196 188 //responds as if the file popup was hit, to update the popup list contents … … 219 211 ShowCATWindow() 220 212 End 221 222 //obsolete procedure - unused223 //224 //procedure for setVar box to set the low file number (forced to be >=0)225 //sets the global variable, then forces an update of the popup226 //227 //Function SetLowFileNumProc(ctrlName,varNum,varStr,varName) : SetVariableControl228 // String ctrlName229 // Variable varNum230 // String varStr231 // String varName232 //233 // ControlInfo MRLow234 // //low value must be >=0235 // Variable test = v_value236 // if (test < 0 )237 // test = 0238 // Endif239 // Variable/G root:myGlobals:MRED:gMRV1 = test240 // //then update the popup list241 // MRedPopMenuProc("MRFilesPopup",1,"")242 //243 //End244 245 //obsolete procedure - unused246 //247 //procedure for setVar box to set the high file number (forced to be <=999)248 //sets the global variable, then forces an update of the popup249 //250 //Function SetHighFileNumProc(ctrlName,varNum,varStr,varName) : SetVariableControl251 // String ctrlName252 // Variable varNum253 // String varStr254 // String varName255 //256 // ControlInfo MRHigh257 // //high value must be <=999258 // Variable test = V_value259 // if(test > 999)260 // test = 999261 // Endif262 // Variable/G root:myGlobals:MRED:gMRV2 = test263 // //then update the popup list264 // MRedPopMenuProc("MRFilesPopup",1,"")265 //End266 213 267 214 //allows the user to set the path to the local folder that contains the SANS data … … 294 241 // range of file numbers entered in the text box 295 242 // 296 Function MR edPopMenuProc(MRFilesPopup,popNum,popStr) : PopupMenuControl243 Function MREDPopMenuProc(MRFilesPopup,popNum,popStr) : PopupMenuControl 297 244 String MRFilesPopup 298 245 Variable popNum … … 300 247 301 248 String list = GetValidMRedPopupList() 302 // Wave/T redList = redList303 // String list = Wave2SemiList(redWave)304 249 // 305 250 String/G root:myGlobals:MRED:gMredList = list … … 330 275 semiList = SortList(semiList,";",0) 331 276 return(semiList) 332 333 // //make sure that path exists334 // PathInfo catPathName335 // String path = S_path336 // if (V_flag == 0)337 // Abort "folder path does not exist - use Pick Path button"338 // Endif339 // String list=""340 //341 // list = IndexedFile(catPathName,-1,"????") //get all files in folder342 //343 // NVAR lownum = root:myGlobals:MRED:gMRV1344 // NVAR highnum = root:myGlobals:MRED:gMRV2345 //346 // //trim list to include only selected files that are RAW SANS files347 // //this will exclude version numbers, .AVE, .ABS files, etc. from the popup (which can't be reduced)348 // Variable ii,isRAW,num,runNum=-1349 // String item="",newList = "",fullName = "",partialName=""350 //351 // //get rid of version numbers first (up to 11)352 // list = RemoveVersNumsFromList(list)353 //354 // //then filter out only the raw data files within the range lownum to highnum355 // num = ItemsInList(list,";") //get the new number of items in the list356 // ii=0357 // do358 // //parse through the list in this order:359 // // 1 - get the run number from the file (AAAAANNN.SAn_asdfasdfasdf) by finding the "dot"360 // // 2 - exclude by lownum/highnum361 // // 3 - exclude by isRaw? (to minimize disk access)362 // item = StringFromList(ii, list ,";" )363 // if(strlen(item) != 0)364 // //find the run number, if it exists365 // runNum = GetRunNumFromFile(item)366 // //is the runNum in the selected range?367 // if( (runNum >= lowNum) && (runNum <= highnum) )368 // //valid number, continue369 // //build valid filename370 // partialName = FindValidFileName(item)371 // if(strlen(partialName) != 0) //non-null return from FindValidFileName()372 // fullName = path + partialName373 // //check if RAW, if so, add original item to newList374 // isRAW = CheckIfRawData(fullName)375 // if(isRaw)376 // newList += item + ";"377 // Endif378 // Endif379 // Endif380 // Endif381 // ii+=1382 // while(ii<num) //process all items in list383 //384 // Return(newList)385 277 End 386 278 … … 463 355 Return 0 464 356 End 465 466 467 //*************************************468 //under construction MRED function469 470 //testing - unused471 //Macro Init_NEW_MRED()472 // Make/O/T/N=1 fileWave,redWave473 // Make/O/N=1 selWave474 //End475 476 //testing - unused477 //478 //returns a list of raw data files from catPathName479 //Function/S RawDataList()480 // //make sure that path exists481 // PathInfo catPathName482 // String path = S_path483 // if (V_flag == 0)484 // Abort "folder path does not exist - use Pick Path button"485 // Endif486 // String list=IndexedFile(catPathName,-1,"????") //get all files in folder487 //488 // //trim list to include only selected files that are RAW SANS files489 // //this will exclude version numbers, .AVE, .ABS files, etc. from the popup (which can't be reduced)490 // Variable ii,isRAW,num,runNum=-1491 // String item="",newList = "",fullName = "",partialName=""492 //493 // //get rid of version numbers first (up to 11)494 // list = RemoveVersNumsFromList(list)495 //496 // //then filter out only the raw data files within the range lownum to highnum497 // num = ItemsInList(list,";") //get the new number of items in the list498 // ii=0499 // do500 // // exclude by isRaw? (to minimize disk access)501 // item = StringFromList(ii, list ,";" )502 // if(strlen(item) != 0)503 // partialName = FindValidFileName(item)504 // if(strlen(partialName) != 0) //non-null return from FindValidFileName()505 // fullName = path + partialName506 // //check if RAW, if so, add original item to newList507 // isRAW = CheckIfRawData(fullName)508 // if(isRaw)509 // newList += item + ";"510 // Endif511 // Endif512 // Endif513 // ii+=1514 // while(ii<num) //process all items in list515 //516 // Return(newList)517 //End518 519 //testing - unused520 //521 //Function/S RunNumList2FileNameList(NumList)522 // String numList //text list of run numbers523 //524 // //find a valid file name if possible, return null otherwise525 // String retList = "",str=""526 // Variable numRuns,ii,r_index527 // numRuns = ItemsInList(numList,";")528 // for(ii=0;ii<numRuns;ii+=1)529 // r_index = str2num(StringFromList(ii,numList,";"))530 // str= FindFileFromRunNumber(r_index)531 // if(cmpstr(str,"")!=0)532 // retList += str + ";"533 // Endif534 // EndFor535 // return(retList)536 //End537 538 //testing - unused539 //540 //Window panel0() : Panel541 // PauseUpdate; Silent 1 // building window...542 // NewPanel /W=(501,97,929,307) /K=1543 // ListBox fileList,pos={0,0},size={179,146},listWave=root:fileWave544 // ListBox fileList,selWave=root:selWave,mode= 4545 // ListBox redList,pos={219,0},size={179,146},listWave=root:redWave,mode= 1546 // ListBox redList,selRow= -1547 // Button button0,pos={114,148},size={50,20},proc=AddButtonProc,title="Add"548 // Button button1,pos={219,148},size={50,20},proc=ClearButtonProc,title="Clear"549 // Button button2,pos={337,148},size={50,20},proc=PopButtonProc,title="Pop"550 // Button button3,pos={4,148},size={50,20},proc=NewListButtonProc551 // Button button4,pos={279,148},size={50,20},proc=DelButtonProc,title="Del"552 //EndMacro553 554 //testing - unused555 //556 //Function DelButtonProc(ctrlName) : ButtonControl557 // String ctrlName558 //559 // ControlInfo redList560 // Variable selRow=V_Value561 // Wave lw=$S_Value562 // DeletePoints selRow,1,lw563 //564 //End565 566 //testing - unused567 //568 //Function NewListButtonProc(ctrlName) : ButtonControl569 // String ctrlName570 //571 // String list=IndexedFile(catPathName,-1,"????")572 // String newList="",item=""573 // Variable num=ItemsInList(list,";"),ii574 // for(ii=0;ii<num;ii+=1)575 // item = StringFromList(ii, list ,";")576 // if( stringmatch(item,"*.sa1*") )577 // newlist += item + ";"578 // endif579 // if( stringmatch(item,"*.sa2*") )580 // newlist += item + ";"581 // endif582 // if( stringmatch(item,"*.sa3*") )583 // newlist += item + ";"584 // endif585 // //print "ii=",ii586 // endfor587 // newList = SortList(newList,";",0)588 // num=ItemsInList(newlist,";")589 // Make/O/T/N=(num) fileWave590 // Make/O/N=(num) selWave591 // fileWave = StringFromList(p,newlist,";")592 // Sort filewave,filewave593 //End594 595 //testing - unused596 //597 //Function AddButtonProc(ctrlName) : ButtonControl598 // String ctrlName599 //600 // Wave/T fileWave=fileWave601 // Wave/T redWave=redWave602 // Wave sel=selWave603 //604 // Variable num=numpnts(sel),ii=0605 // variable lastPt=numpnts(redwave)606 // do607 // if(sel[ii] == 1)608 // InsertPoints lastPt,1, redWave609 // redWave[lastPt]=filewave[ii]610 // lastPt +=1611 // endif612 // ii+=1613 // while(ii<num)614 // return(0)615 //End616 617 //testing - unused618 //619 //Function ClearButtonProc(ctrlName) : ButtonControl620 // String ctrlName621 // Make/O/T/N=1 redWave622 //End623 624 //testing - unused625 //626 //Function PopButtonProc(ctrlName) : ButtonControl627 // String ctrlName628 // MRedPopMenuProc("MRFilesPopup",0,"")629 //End630 357 631 358 -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_Utils.ipf
r74 r76 1041 1041 return newlist 1042 1042 End 1043 1044 // returns a list of raw data files in the catPathName directory on disk 1045 // - list is SEMICOLON-delimited 1046 // 1047 // does it the "cheap" way, simply finding the ".SAn" in the file name 1048 // = does not check for proper byte length. 1049 Function/S GetRawDataFileList() 1050 1051 //make sure that path exists 1052 PathInfo catPathName 1053 if (V_flag == 0) 1054 Abort "Folder path does not exist - use Pick Path button on Main Panel" 1055 Endif 1056 1057 String list=IndexedFile(catPathName,-1,"????") 1058 String newList="",item="" 1059 Variable num=ItemsInList(list,";"),ii 1060 for(ii=0;ii<num;ii+=1) 1061 item = StringFromList(ii, list ,";") 1062 if( stringmatch(item,"*.sa1*") ) 1063 newlist += item + ";" 1064 endif 1065 if( stringmatch(item,"*.sa2*") ) 1066 newlist += item + ";" 1067 endif 1068 if( stringmatch(item,"*.sa3*") ) 1069 newlist += item + ";" 1070 endif 1071 //print "ii=",ii 1072 endfor 1073 newList = SortList(newList,";",0) 1074 return(newList) 1075 End -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NSORT.ipf
r74 r76 345 345 End 346 346 347 //unused tesing procedure348 //349 Proc AskToStripPoints(nb,ne)350 Variable nb=7,ne=0351 Prompt nb,"Points to strip from beginning of file"352 Prompt ne,"Points to strip from end of file"353 354 gBegPts = nb355 gEndPts = ne356 357 End358 359 347 //gets the scaling constant to make (best) overlap of the specified datasets 360 348 //the scaling value is an average value of the individual scaling values for … … 380 368 ii+=1 381 369 while(ii<=num2) 382 Variable norm383 norm= ratio/(num2+1) // +1 counts for point zero384 //Print " norm = ",norm385 386 Return norm370 Variable val 371 val = ratio/(num2+1) // +1 counts for point zero 372 //Print "val = ",val 373 374 Return val 387 375 End 388 376 … … 593 581 //when a value is entered, the global value is set, and the corresponding dataset 594 582 //is updated on the plot, showing the new result of removing this number of points 583 // 584 // SetVar boxes are named beg_N and end_N (so 4th element is the number) 585 // 586 // 1 == LowQ 587 // 2 == MedQ 588 // 3 == HighQ 589 // 595 590 //"Plot_1" is the low-q button name 596 591 //"Plot_2" is the med-q button name 597 592 //"Plot_3" is the high-q button name 593 // 598 594 //calling plot_0_Button() responds as if that named button were pressed 595 // and gets the proper number to trim directly from the SetVar 599 596 // 600 597 Function SetBegOrEnd(ctrlName,varNum,varStr,varName) : SetVariableControl … … 609 606 DoWindow/F NSORT_Panel 610 607 End 611 612 //Function SetEnd_1(ctrlName,varNum,varStr,varName) : SetVariableControl613 // String ctrlName614 // Variable varNum615 // String varStr616 // String varName617 //618 // //Variable/G root:myGlobals:NSORT:gPtsEnd1 = varNum619 // print str2num(ctrlName[4]),ctrlName,varNum,varStr,varName620 // Plot_0_Button("Plot_1")621 // DoWindow/F NSORT_Panel622 //End623 //624 ////see comments on SetEnd_1()625 ////626 //Function SetEnd_2(ctrlName,varNum,varStr,varName) : SetVariableControl627 // String ctrlName628 // Variable varNum629 // String varStr630 // String varName631 //632 // Variable/G root:myGlobals:NSORT:gPtsEnd2 = varNum633 // Plot_0_Button("Plot_2")634 // DoWindow/F NSORT_Panel635 //End636 //637 ////see comments on SetEnd_1()638 ////639 //Function SetEnd_3(ctrlName,varNum,varStr,varName) : SetVariableControl640 // String ctrlName641 // Variable varNum642 // String varStr643 // String varName644 //645 // Variable/G root:myGlobals:NSORT:gPtsEnd3 = varNum646 // Plot_0_Button("Plot_3")647 // DoWindow/F NSORT_Panel648 //End649 //650 ////see comments on SetEnd_1()651 ////652 //Function SetBeg_1(ctrlName,varNum,varStr,varName) : SetVariableControl653 // String ctrlName654 // Variable varNum655 // String varStr656 // String varName657 //658 // Variable/G root:myGlobals:NSORT:gPtsBeg1 = varNum659 // Plot_0_Button("Plot_1")660 // DoWindow/F NSORT_Panel661 //End662 //663 ////see comments on SetEnd_1()664 ////665 //Function SetBeg_2(ctrlName,varNum,varStr,varName) : SetVariableControl666 // String ctrlName667 // Variable varNum668 // String varStr669 // String varName670 //671 // Variable/G root:myGlobals:NSORT:gPtsBeg2 = varNum672 // Plot_0_Button("Plot_2")673 // DoWindow/F NSORT_Panel674 //End675 //676 ////see comments on SetEnd_1()677 ////678 //Function SetBeg_3(ctrlName,varNum,varStr,varName) : SetVariableControl679 // String ctrlName680 // Variable varNum681 // String varStr682 // String varName683 //684 // Variable/G root:myGlobals:NSORT:gPtsBeg3 = varNum685 // Plot_0_Button("Plot_3")686 // DoWindow/F NSORT_Panel687 //End688 689 ////obsolete button control690 //Function ManualScaleButton(ctrlName) : ButtonControl691 // String ctrlName692 //693 // Execute "ManualScalePrompt()"694 //695 //End696 //697 ////obsolete missing param dialog698 //Proc ManualScalePrompt(s12,s23)699 // Variable s12 = 1700 // Variable s23 = 1701 // Prompt s12,"enter the multiplier for medium q set"702 // Prompt s23,"enter the multiplier for high q set"703 //704 // Variable/G root:myGlobals:NSORT:gScale1_2 = s12705 // Variable/G root:myGlobals:NSORT:gScale2_3 = s23706 //End707 608 708 609 //this will--- … … 781 682 return(0) 782 683 End 783 784 684 785 685 //window recreation macro for NSORT Panel … … 869 769 CheckBox AutoCheck,pos={14,310},size={100,20},title="Auto Scale",value=1 870 770 CheckBox AutoCheck,help={"If checked, the scale factor will be automatically determined, if not checked, the current values in the fields will be used"} 871 // CheckBox check_0,pos={282,91},size={80,20},title="Update ?",value=1872 // CheckBox check_0,help={"If checked, the list of data files will be updated from disk, unchecked (faster) will not refresh the list"}873 // CheckBox check_1,pos={282,174},size={80,20},title="Update ?",value=1874 // CheckBox check_1,help={"If checked, the list of data files will be updated from disk, unchecked (faster) will not refresh the list"}875 // CheckBox check_2,pos={282,257},size={80,20},title="Update ?",value=1876 // CheckBox check_2,help={"If checked, the list of data files will be updated from disk, unchecked (faster) will not refresh the list"}877 771 EndMacro 878 772 … … 941 835 942 836 //when menu is popped, it gets a valid list to display and updates the control 943 //**for speed, refreshes list only if checkbox is checked944 837 // 945 838 // 2002- always refreshes, as new (fast) filter is used … … 949 842 String popStr 950 843 951 //only update the popup if the "update" checkbox is checked 952 //to improve speed 953 // Variable checked = 0 954 // ControlInfo check_0 955 // checked = V_value 956 957 // If(checked) 958 String/G root:myGlobals:NSORT:gDataPopList = ReducedDataFileList("") 959 ControlUpdate popup_1 960 // Endif 961 844 String/G root:myGlobals:NSORT:gDataPopList = ReducedDataFileList("") 845 ControlUpdate popup_1 846 847 return(0) 962 848 End 963 849 964 850 //when menu is popped, it gets a valid list to display and updates the control 965 //**for speed, refreshes list only if checkbox is checked966 851 // 967 852 Function MedQPopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl … … 969 854 Variable popNum 970 855 String popStr 971 972 //only update the popup if the "update" checkbox is checked 973 //to improve speed 974 // Variable checked = 0 975 // ControlInfo check_1 976 // checked = V_value 977 978 // If(checked) 979 String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" + ReducedDataFileList("") 980 ControlUpdate popup_2 981 if(cmpstr(popStr,"none")==0) 982 PopupMenu popup_3,mode=1 //force "none" (item #1) to be the selection 983 CheckBox AutoCheck,value=0 //un-check the auto-scale checkbox 984 DoAlert 0,"You have only one data set. Auto Scaling has been unchecked and Mult Factor 1-2 will be applied to your data. Remember to re-check this as needed"// remind the user of this fact 985 RemoveFromGraph/Z MedQSet_i,TrimMedQSet_i,HighQSet_i,TrimHighQSet_i //remove the data from the graph 986 Endif 987 //endif 856 857 String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" + ReducedDataFileList("") 858 ControlUpdate popup_2 859 if(cmpstr(popStr,"none")==0) 860 PopupMenu popup_3,mode=1 //force "none" (item #1) to be the selection 861 CheckBox AutoCheck,value=0 //un-check the auto-scale checkbox 862 DoAlert 0,"You have only one data set. Auto Scaling has been unchecked and Mult Factor 1-2 will be applied to your data. Remember to re-check this as needed"// remind the user of this fact 863 RemoveFromGraph/Z MedQSet_i,TrimMedQSet_i,HighQSet_i,TrimHighQSet_i //remove the data from the graph 864 Endif 865 return(0) 988 866 End 989 867 … … 991 869 // - will be different, since set 3 can also be "none" if only 2 sets 992 870 //are to be NSORTed 993 //**for speed, refreshes list only if checkbox is checked994 871 // 995 872 Function HighQPopMenuProc(ctrlName,popNum,popStr) : PopupMenuControl … … 998 875 String popStr 999 876 1000 //only update the popup if the "update" checkbox is checked 1001 //to improve speed 1002 // Variable checked = 0 1003 // ControlInfo check_2 1004 // checked = V_value 1005 1006 // If(checked) 1007 //add the option "none" to the file list (which should already end with a semicolon) 1008 String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" + ReducedDataFileList("") 1009 1010 ControlUpdate popup_3 1011 if(cmpstr(popStr,"none")==0) 1012 RemoveFromGraph/Z HighQSet_i,TrimHighQSet_i //remove the data from the graph 1013 Endif 1014 ControlInfo popup_2 1015 if(cmpstr(S_Value,"none")==0) 1016 PopupMenu popup_3,mode=1 //force "none" (item #1) to be the selection if medium is none 1017 endif 1018 // Endif 1019 1020 End 1021 1022 ////function returning a string (list) of semicolon separated filenames 1023 ////that are not version numbers, and not raw data files 1024 ////(can't really pare out other files any better - trying to just get ascii I vs. q) 1025 ////works in folder specified by catPathName, (abort if it doesn't exist) 1026 //// 1027 ////***** UNUSED ******** - simpler fileFilter is used to simply filter out the raw data 1028 //// 1029 //Function/S GetValidNSORTPopupList() 1030 // 1031 // String list = "none;something;" 1032 // 1033 // PathInfo catPathName 1034 // String path = S_path 1035 // if(V_flag == 0) 1036 // Abort "path does not exist - use Pick Path button" 1037 // Endif 1038 // 1039 // list = IndexedFile(catPathName,-1,"????") //get all files in folder 1040 // 1041 // //trim version numbers from list 1042 // Variable num = ItemsInList(list,";") 1043 // Variable ii,isRAW 1044 // String item = "",listCopy = "", fullName = "",partialName = "" 1045 // 1046 // ii=1 1047 // do 1048 // item = num2str(ii) 1049 // list = RemoveFromList(item,list,";") 1050 // ii+=1 1051 // while (ii<12) 1052 // 1053 // //trim raw data files from list 1054 // listCopy = list //scan through items in copy, change list 1055 // num = ItemsInList(listCopy,";") //get the new number of items in the list 1056 // ii=0 1057 // do 1058 // //build valid fileName 1059 // item = StringFromList(ii,listCopy,";") 1060 // if (strlen(item) !=0 ) 1061 // partialName = FindValidFileName(item) 1062 // if(strlen(partialName) !=0) //non-null return from FindValidFileName() 1063 // fullName = path + partialName 1064 // //check if RAW, if so, remove from list 1065 // isRAW = CheckIfRAWData(fullName) 1066 // if(isRAW) 1067 // list = RemoveFromList(item,list,";") 1068 // Endif 1069 // Endif 1070 // Endif 1071 // ii+=1 1072 // While(ii<num) 1073 // 1074 // return list 1075 //End 877 //add the option "none" to the file list (which should already end with a semicolon) 878 String/G root:myGlobals:NSORT:gDataPopList_3 = "none;" + ReducedDataFileList("") 879 880 ControlUpdate popup_3 881 if(cmpstr(popStr,"none")==0) 882 RemoveFromGraph/Z HighQSet_i,TrimHighQSet_i //remove the data from the graph 883 Endif 884 ControlInfo popup_2 885 if(cmpstr(S_Value,"none")==0) 886 PopupMenu popup_3,mode=1 //force "none" (item #1) to be the selection if medium is none 887 endif 888 return(0) 889 End 890 1076 891 1077 892 //be sure to use the "Trim.." datasets that have had the bad points removed … … 1271 1086 Sort q123, q123,i123,sig123 1272 1087 ///////////////// 1273 1274 //old method1275 //first point of overlap region (from set 3)1276 //FindLevel/P/Q q123,(highq[0])1277 //Variable firstOverlapPt = V_levelX1278 //last point of overlap region (from set 12)1279 //FindLevel/P/Q q123,(q12[n12-1])1280 //Variable lastOverlapPt = V_levelX1281 //end old method, not used1282 1088 1283 1089 //find the maximum point number of set 2 in the overlap region … … 1476 1282 ///////////////// 1477 1283 1478 //old method1479 //first point of overlap region (from set 3)1480 //FindLevel/P/Q q123,(highq[0])1481 //Variable firstOverlapPt = V_levelX1482 //last point of overlap region (from set 12)1483 //FindLevel/P/Q q123,(q12[n12-1])1484 //Variable lastOverlapPt = V_levelX1485 //end old method, not used1486 1487 1284 //find the maximum point number of set 2 in the overlap region 1488 1285 FindLevel/P/Q highq,(q12[n12-1]) … … 1553 1350 1554 1351 ///////////////////////////////////////////////////////////// 1555 //testing, may speed up NSORT 1352 // testing, may speed up NSORT, NCNR-specific naming scheme of 1353 // run numbers and a run prefix 1556 1354 Proc Set3NSORTFiles(low,med,hi,pref) 1557 1355 Variable low=1,med=2,hi=3 … … 1579 1377 End 1580 1378 1379 //make a three character string of the run number 1581 1380 Function/S ThreeDigitString(num) 1582 1381 Variable num 1583 1382 1584 //make a three character string of the run number1585 1383 String numStr="" 1586 1384 if(num<10) … … 1866 1664 1867 1665 1868 1869 1870 1666 // Commentized lines here are incomplete - and NON-FUNCTIONING 1871 1667 // -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/PatchFiles.ipf
r75 r76 121 121 Abort "folder path does not exist - use Pick Path button" 122 122 Endif 123 String list 124 list = IndexedFile(catPathName,-1,"????") //get all files in folder 123 124 String newList = "" 125 126 newList = GetRawDataFileList() 127 125 128 //trim list to include only selected files 126 129 SVAR match = root:myGlobals:Patch:gPatchMatchStr 127 list = MyMatchList(match,list,";") 128 //further trim list to include only RAW SANS files 129 //this will exclude version numbers, .AVE, .ABS files, etc. from the popup (which can't be patched) 130 Variable num = ItemsInList(list,";") 131 Variable ii,isRAW 132 String item="",newList = "",fullName = "",partialName="" 133 134 //get rid of version numbers first (up to 11) 135 ii=1 136 do 137 item = num2str(ii) 138 list = RemoveFromList(item, list ,";" ) 139 ii+=1 140 while(ii<12) 141 142 //then filter out only the raw data files 143 num = ItemsInList(list,";") //get the new number of items in the list 144 ii=0 145 do 146 //build valid filename 147 item = StringFromList(ii, list ,";" ) 148 if(strlen(item) != 0) 149 partialName = FindValidFileName(item) 150 if(strlen(partialName) != 0) //non-null return from FindValidFileName() 151 fullName = path + partialName 152 //check if RAW, if so, add original item to newList 153 isRAW = CheckIfRawData(fullName) 154 if(isRaw) 155 newList += item + ";" 156 Endif 157 Endif 158 Endif 159 ii+=1 160 while(ii<num) //process all items in list 161 130 newlist = MyMatchList(match,newlist,";") 131 162 132 newList = SortList(newList,";",0) 163 133 Return(newList) … … 664 634 //just reset the global variables that are on the patch panel 665 635 666 // Variable refNum,integer,realval667 // String textstr=""668 // Variable countTime669 //670 // //full filename with path is passed in671 // //actually open the file672 // Open/R refNum as fname673 //674 // // read the sample.label text field675 // FSetPos refNum,98 //will start reading at byte 99676 // FReadLine/N=60 refNum,textstr677 // FSetPos refNum,31678 // FBinRead/B=3/F=3 refnum,countTime679 //680 // Close refNum681 //682 // //Print "countTime = ",countTime683 //684 // //now get all of the reals685 // //686 // //Do all the GBLoadWaves at the end687 // //688 // //FBinRead Cannot handle 32 bit VAX floating point689 // //GBLoadWave, however, can properly read it690 // String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q"691 // String strToExecute692 // //append "/S=offset/U=numofreals" to control the read693 // // then append fname to give the full file path694 // // then execute695 //696 // // NEW reads697 // Variable moncnt,savmon,detcnt,atten,trans,thick,temp,field698 // Variable dis,ang,bstop,ap1,ap2,ap12dis,lmda,dlmda,beamx,beamy,trnscnt699 //700 // strToExecute = GBLoadStr + "/S=39/U=4" + "\"" + fname + "\""701 // Execute strToExecute702 // Wave w=$"tempGBWave0"703 // moncnt = w[0]704 // savmon = w[1]705 // detcnt = w[2]706 // atten = w[3]707 // //printf "moncnt = %g,savmon = %g,detcnt = %g,atten = %g\r",moncnt,savmon,detcnt,atten708 //709 // strToExecute = GBLoadStr + "/S=158/U=2" + "\"" + fname + "\""710 // Execute strToExecute711 // trans = w[0]712 // thick = w[1]713 // //printf "trans = %g, thick = %g\r",trans,thick714 //715 // strToExecute = GBLoadStr + "/S=186/U=2" + "\"" + fname + "\""716 // Execute strToExecute717 // temp = w[0]718 // field = w[1]719 // //printf "temp = %g, field = %g\r",temp,field720 //721 // strToExecute = GBLoadStr + "/S=252/U=12" + "\"" + fname + "\""722 // Execute strToExecute723 // beamx = w[0]724 // beamy = w[1]725 // dis = w[2]726 // ang = w[3]727 // // w[4] det size728 // bstop = w[5]729 // // w[6] blank730 // ap1 = w[7]731 // ap2 = w[8]732 // ap12dis = w[9]733 // lmda = w[10]734 // dlmda = w[11]735 // //printf "beamx = %g, beamy = %g\r",beamx,beamy736 // //printf "dis = %g,ang = %g, bstop = %g,ap1= %g,ap2 = %g\r",dis,ang,bstop,ap1,ap2737 // //printf "ap12dis = %g, lmda = %g, dlmda = %g\r",ap12dis,lmda,dlmda738 //739 // strToExecute = GBLoadStr + "/S=388/U=1" + "\"" + fname + "\""740 // Execute strToExecute741 // trnscnt = w[0]742 // //printf "trnscnt = %g\r",trnscnt743 //744 // //assign to the globals for display in the panel745 // String/G root:myGlobals:Patch:gPS1= textstr746 // Variable/G root:myGlobals:Patch:gPV1 = trans747 // Variable/G root:myGlobals:Patch:gPV2 = thick748 // Variable/G root:myGlobals:Patch:gPV3 = beamx749 // Variable/G root:myGlobals:Patch:gPV4 = beamy750 // Variable/G root:myGlobals:Patch:gPV5 = atten751 // Variable/G root:myGlobals:Patch:gPV6 = countTime752 // Variable/G root:myGlobals:Patch:gPV7 = moncnt753 // Variable/G root:myGlobals:Patch:gPV8 = detcnt754 // Variable/G root:myGlobals:Patch:gPV9 = trnscnt755 // Variable/G root:myGlobals:Patch:gPV10 = lmda756 // Variable/G root:myGlobals:Patch:gPV11 = dlmda757 // Variable/G root:myGlobals:Patch:gPV12 = temp758 // Variable/G root:myGlobals:Patch:gPV13 = field759 // Variable/G root:myGlobals:Patch:gPV14 = ap1760 // Variable/G root:myGlobals:Patch:gPV15 = ap2761 // Variable/G root:myGlobals:Patch:gPV16 = ap12dis762 // Variable/G root:myGlobals:Patch:gPV17 = ang763 // Variable/G root:myGlobals:Patch:gPV18 = bstop764 // Variable/G root:myGlobals:Patch:gPV19 = dis765 //766 // //clean up - get rid of w = $"tempGBWave0"767 // KillWaves/Z w768 769 636 // each "get" is an individual call to GBLoadWave... 770 637 // test for acceptable speed over a network... … … 879 746 880 747 //simple action for button to close the panel 881 //closes all file that may accidently be open at this point882 //(but none are open)883 //884 748 Function DoneButtonProc(ctrlName) : ButtonControl 885 749 String ctrlName 886 887 // this button will make sure all files are closed 888 //and close the panel 889 890 Close/A 750 891 751 DoWindow/K Patch_Panel 892 752 … … 903 763 904 764 //reset the global variable to the entered text so that it can be relayed to the 905 //write() routine. Only the TEXT SetVariable control needs to be handle sthis way765 //write() routine. Only the TEXT SetVariable control needs to be handled this way 906 766 907 767 String/G root:myGlobals:Patch:gPS1 = varStr 908 768 909 769 End 910 911 912 //button action function to set the XY box for the empty beam file (or reset it)913 //this function is called by the button on the Patch Panel to set the XY box914 //panel, but is nearly identical. This function resets the string used in the Patch915 //panel to list the current empty beam file916 //917 //depends on the user slecting and setting the box with the marquee (see marquee.ipf)918 //then reads the set coordinates from the global keyword string919 //920 //**********UNUSED******************921 //Function SetXYBoxButton(ctrlName) : ButtonControl922 // String ctrlName923 //924 // String msgStr = "Select the Empty Beam FIle"925 // String filename,shortName926 //927 // //get the filename, then read it in928 // filename = PromptForPath(msgStr)929 // //check for cancel from dialog930 // if(strlen(filename)==0)931 // //user cancelled, abort932 // SetDataFolder root:933 // Abort "No file selected, action aborted"934 // Endif935 // shortName = GetFileNameFromPathKeepSemi(filename)936 // String/G root:myGlobals:Patch:gPS2 = filename //(reset the string for the patch panel)937 //938 // ReadHeaderAndData(filename)939 // //data is displayed here (go htrough the normal display steps, so all is created properly940 // String/G root:myGlobals:gDataDisplayType="RAW"941 // fRawWindowHook()942 //943 // // check the empty beam file for previously selected coordinates944 // //if they exist, set the xy string , save the normalized counts somewhere945 // //the value was written to an unused r*4 header analysis.factor (@b494)946 // Variable refnum,x1,x2,y1,y2,err947 // Open/R refnum as filename948 // FSetPos refnum,478949 // FBinRead/F=3/B=3 refnum, x1950 // FBinRead/F=3/B=3 refnum, x2951 // FBinRead/F=3/B=3 refnum, y1952 // FBinRead/F=3/B=3 refnum, y2953 // Close refnum954 // //read the real count value955 // String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q"956 // String strToExecute957 // strToExecute = GBLoadStr + "/S=494/U=1" + "\"" + filename + "\""958 // Execute strToExecute959 // Wave w=$"tempGBWave0"960 // Variable/G root:myGlobals:Patch:gTransCts = w[0]961 // //962 // if( ((x1-x2)==0) || ((y1-y2)==0) ) //zero width marquee in either direction963 // //no region selected964 //965 // //add the empty beam file to work.SAM966 // err = Raw_to_work("SAM")967 //968 // //the calling macro must change the display type969 // String/G root:myGlobals:gDataDisplayType="SAM" //displayed data type is sam970 //971 // //data is displayed here972 // fRawWindowHook()973 //974 // //prompt user to select box w/marquee975 // DoAlert 0,"Select the region to sum with the Marquee"976 //977 // //from here the Marquee menu selection must handle the task of setting the box978 // //and updating the information in the file header979 // else980 // // region already selected, just put up the values from the file header981 // //allow user the option of overriding the current box region982 // msgStr = "X1="+num2str(x1)+";"983 // msgStr += "X2="+num2str(x2)+";"984 // msgStr += "Y1="+num2str(y1)+";"985 // msgStr += "Y2="+num2str(y2)+";"986 // String textStr987 // textStr = "Override current box "+msgStr+" ?"988 // DoAlert 1,textStr989 // If((V_flag)==1)990 // //get new box coordinates, same procedure as above991 // //add the empty beam file to work.SAM992 // err = Raw_to_work("SAM")993 //994 // //the calling macro must change the display type995 // String/G root:myGlobals:gDataDisplayType="SAM" //displayed data type is sam996 //997 // //data is displayed here998 // fRawWindowHook()999 //1000 // //prompt user to select box w/marquee1001 // DoAlert 0,"Select the region to sum with the Marquee"1002 //1003 // //from here the Marquee menu selection must handle the task of setting the box1004 // //and updating the information in the file header1005 // else1006 // String/G root:myGlobals:Patch:gPS3 = msgStr1007 // Endif1008 // Endif1009 //1010 // KillWaves/Z w1011 // Return (0)1012 //End1013 -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/PlotUtils.ipf
r70 r76 483 483 PM_doAppend(S_Value) 484 484 485 485 DoWindow/F Plot_Manager 486 486 End 487 487 … … 520 520 Endif 521 521 PM_doNewGraph(S_Value) 522 522 DoWindow/F Plot_Manager 523 523 End 524 524 -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/ProtocolAsPanel.ipf
r72 r76 80 80 String waveStr="tempProtocol" 81 81 SetDataFolder root:myGlobals:Protocols 82 Make/O/T/N=(nsteps) $"root:myGlobals:Protocols:tempProtocol" 83 do 84 $"root:myGlobals:Protocols:tempProtocol"[ii] = "" 85 ii+=1 86 while(ii<nsteps) 82 Make/O/T/N=(nsteps) $"root:myGlobals:Protocols:tempProtocol" = "" 83 87 84 String/G root:myGlobals:Protocols:gSAM="ask" 88 85 String/G root:myGlobals:Protocols:gBGD="ask" … … 203 200 checked = 0 204 201 Endif 205 // numItems = ItemsInList(list,comma) 206 // nameList = "" 207 // ii=0 208 // checked = 1 209 // do 210 // fullPath = StringFromList(ii,list,comma) 211 // PathStr = GetPathStrFromFullName(fullPath) 212 // item = GetFileNameFromPathKeepSemi(fullPath) 213 // nameList += item+comma 214 // If(cmpstr(item,"none") ==0) 215 // nameList = item 216 // checked = 0 217 // break 218 // Endif 219 // If(cmpstr(item,"ask") ==0) 220 // nameList = item 221 // checked = 1 222 // break 223 // Endif 224 // if((cmpstr(pathStr,catPathStr) != 0) %& !(specialProtocol)) 225 // Print "pathstr = ",pathStr 226 // Print "catPathStr = ",catPathStr 227 // Abort "saved protocol path and CAT path do not match - reset CAT/SHORT to pathStr" 228 // Endif 229 // ii+=1 230 // while(ii<numItems) 202 231 203 //set the global string to display and checkbox 232 204 String/G root:myGlobals:Protocols:gBGD = nameList … … 239 211 checked = 0 240 212 Endif 241 // numItems = ItemsInList(list,comma) 242 // nameList = "" 243 // ii=0 244 // checked = 1 245 // do 246 // fullPath = StringFromList(ii,list,comma) 247 // PathStr = GetPathStrFromFullName(fullPath) 248 // item = GetFileNameFromPathKeepSemi(fullPath) 249 // nameList += item+comma 250 // If(cmpstr(item,"none") ==0) 251 // nameList = item 252 // checked = 0 253 // break 254 // Endif 255 // If(cmpstr(item,"ask") ==0) 256 // nameList = item 257 // checked = 1 258 // break 259 // Endif 260 // if((cmpstr(pathStr,catPathStr) != 0) %& !(specialProtocol)) 261 // Print "pathstr = ",pathStr 262 // Print "catPathStr = ",catPathStr 263 // Abort "saved protocol path and CAT path do not match" 264 // Endif 265 // ii+=1 266 // while(ii<numItems) 213 267 214 //set the global string to display and checkbox 268 215 String/G root:myGlobals:Protocols:gEMP = nameList … … 275 222 checked = 0 276 223 Endif 277 // list = w[2] 278 // numItems = ItemsInList(list,comma) 279 // nameList = "" 280 // ii=0 281 // checked = 1 282 // do 283 // fullPath = StringFromList(ii,list,comma) 284 // PathStr = GetPathStrFromFullName(fullPath) 285 // item = GetFileNameFromPathKeepSemi(fullPath) 286 // nameList += item+comma 287 // If(cmpstr(item,"none") ==0) 288 // nameList = item 289 // checked = 0 290 // break 291 // Endif 292 // If(cmpstr(item,"ask") ==0) 293 // nameList = item 294 // checked = 1 295 // break 296 // Endif 297 // if((cmpstr(pathStr,catPathStr) != 0) %& !(specialProtocol)) 298 // Print "pathstr = ",pathStr 299 // Print "catPathStr = ",catPathStr 300 // Abort "saved protocol path and CAT path do not match" 301 // Endif 302 // ii+=1 303 // while(ii<numItems) 224 304 225 //set the global string to display and checkbox 305 226 String/G root:myGlobals:Protocols:gDIV = nameList … … 312 233 checked = 0 313 234 Endif 314 // list = w[3] 315 // numItems = ItemsInList(list,comma) 316 // nameList = "" 317 // ii=0 318 // checked = 1 319 // do 320 // fullPath = StringFromList(ii,list,comma) 321 // PathStr = GetPathStrFromFullName(fullPath) 322 // item = GetFileNameFromPathKeepSemi(fullPath) 323 // nameList += item+comma 324 // If(cmpstr(item,"none") ==0) 325 // nameList = item 326 // checked = 0 327 // break 328 // Endif 329 // If(cmpstr(item,"ask") ==0) 330 // nameList = item 331 // checked = 1 332 // break 333 // Endif 334 // if((cmpstr(pathStr,catPathStr) != 0) %& !(specialProtocol)) 335 // Print "pathstr = ",pathStr 336 // Print "catPathStr = ",catPathStr 337 // Abort "saved protocol path and CAT path do not match" 338 // Endif 339 // ii+=1 340 // while(ii<numItems) 235 341 236 //set the global string to display and checkbox 342 237 String/G root:myGlobals:Protocols:gMASK = nameList … … 606 501 607 502 return(0) 608 End609 610 //********UNUSED************611 //7/2001 - plan to modify this function to parse the comma-delimited list, (possibly just run numbers)612 //and return a valid comma-delimited list of full filenames (no paths)613 //614 //function that takes a comma separated list of filenames (without path or version)615 //and returns a full list of path;name;vers (comma delimited)616 //that is needed for the protocol, which is expecting the full path617 //to directly open the file(s) in the list618 //this function checks for the existence of files before adding to the list619 //pathStr (input) is the path (as returned by pathInfo)620 //621 Function/S BuildList(list,pathstr)622 String list,pathstr623 624 //input list is probably just filename, no version number625 //COMMA separated lists, since file names will (MAY) include semicolon version numbers626 //find the file and version number - so that full path:file;vers for each item627 //trailing comma OK at end of list, ExecuteProtocol() treats all as lists628 629 String newList="",separator=",",tempstr="",partialName=""630 Variable ii=0,numitems631 632 numitems = ItemsInList(list,separator)633 do634 tempstr = StringFromList(ii,list,separator)635 if(cmpstr(tempstr,"ask")==0)636 newList = tempstr //don't prepend path to "ask" option, no comma637 break //get out - don't add anything else to list638 endif639 if(strlen(tempStr)!=0) //skip any null items640 //add version number (if needed) and make sure the filename is valid641 partialName = FindValidFilename(tempStr)642 //can't check for RAW here - may be dealing with mask, div ... or other filetypes643 newList += pathstr+partialName+separator644 endif645 ii+=1646 while(ii<numitems)647 648 Return(newlist)649 650 503 End 651 504 … … 1098 951 End 1099 952 1100 //procedure called by protocol panel to ask user for a gerage type choices953 //procedure called by protocol panel to ask user for average type choices 1101 954 // somewhat confusing and complex, but may be as good as it gets. 1102 955 // … … 1175 1028 // Procedure files for creating and executing a data reduction protocol 1176 1029 // 1177 //**** ONLY invoked from the MAIN PANEL**** 1030 //**** ONLY invoked from the MAIN PANEL**** NOT REALLY EVER USED ****** 1178 1031 //Procedure for reducing a sample file (multiple added files) with a specified 1179 1032 //protocol. User may create a new protocol, and will be prompted … … 1209 1062 //samStr is set at top to "ask", since this is the action always desired from "ReduceAFile" 1210 1063 1211 //////1212 //PathInfo catPathName //this is where the files came from1213 //String pathstr=S_path,samStr1214 //samStr = BuildList(tempStr,pathStr) //ExecuteProtocol() needs full path for SAM files1215 /////1216 1217 1064 ExecuteProtocol(waveStr,samStr) 1218 1065 … … 1256 1103 return(list) 1257 1104 End 1258 //missing paramater dialog to solicit user for a waveStr for the protocal 1105 1106 //missing paramater dialog to solicit user for a waveStr for the protocol 1259 1107 //about to be created 1260 1108 //name is passed back as a global string and calling procedure is responsible for … … 1272 1120 //ensures that a valid protocol name was chosen, then fills out each "item" 1273 1121 //(6 total) needed for reduction 1274 //it the user cancels at nay point, the partial protocol will be deleted1122 //it the user cancels at any point, the partial protocol will be deleted 1275 1123 // 1276 1124 Function ProtocolQuestionnare() -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/RawWindowHook.ipf
r41 r76 34 34 String/G root:myGlobals:gCurDispFile = "default string" 35 35 String/G root:myGlobals:gCurTitle = "" 36 // Variable/G root:myGlobals:gMapLow=0.37 // Variable/G root:myGlobals:gMapHigh=138 36 Make/O/N=2 root:myGlobals:q_x_axis,root:myGlobals:q_y_axis 39 37 … … 94 92 Button Print_status,pos={170,23},size={50,20},proc=StatusButton,title="Status" 95 93 Button Print_status,help={"Print out information about the currently displayed file into the history window"} 96 // SetVariable lowThresh,pos={170,55},size={110,17},proc=LowThreshSetVarProc,title="Map low"97 // SetVariable lowThresh,limits={0,1,0.01},value= root:myGlobals:gMapLow98 // SetVariable lowThresh,help={"Low limit of threshold as a fraction of maximum data value"}99 // SetVariable highThresh,pos={285,55},size={120,17},proc=HighThreshSetVarProc,title="Map high"100 // SetVariable highThresh,limits={0,1,0.01},value= root:myGlobals:gMapHigh101 // SetVariable highThresh,help={"High limit of threshold as a fraction of maximum data value"}102 94 Button maskButton size={84,20}, pos={170,53}, proc=maskButtonProc,title="Show Mask" 103 95 Button maskButton help={"If a mask has been loaded this will overlay it on the current plot"} … … 235 227 xaxval= AxisValFromPixel("","bottom",xpix) 236 228 yaxval= AxisValFromPixel("","left",ypix) 237 //xint = trunc(xaxval)238 //yint = trunc(yaxval)239 229 xint = round(xaxval) 240 230 yint = round(yaxval) … … 352 342 // - needs the location of the currently displayed data to get the header information 353 343 // to be able to calculate q-values at the edges of the detector 354 //** assumes a linear corre cpondence between pixel->q-values (which should bea a really344 //** assumes a linear correspondence between pixel->q-values (which should bea a really 355 345 // safe bet, since we're using the small -angle approximation...) 356 346 // -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/RectAnnulAvg.ipf
r47 r76 59 59 60 60 // center of detector, for non-linear corrections 61 xcenter = 64.5 62 ycenter = 64.5 61 NVAR pixelsX = root:myGlobals:gNPixelsX 62 NVAR pixelsY = root:myGlobals:gNPixelsY 63 64 xcenter = pixelsX/2 + 0.5 // == 64.5 for 128x128 Ordela 65 ycenter = pixelsY/2 + 0.5 // == 64.5 for 128x128 Ordela 63 66 64 67 // beam center, in pixels … … 325 328 Variable DDet, apOff=0.0 326 329 DDet = DetectorPixelResolution(fileStr,detStr) //needs detector type and beamline 327 // do 328 // if(strsearch(fileStr, "NG5", 0) != -1) 329 // //string was found, it's an NG5 file 330 // DDet = 1.0 331 // break 332 // Endif 333 // if(strsearch(fileStr, "NG3", 0) != -1) 334 // //string was found, it's an NG3 file 335 // DDet = 1.0 336 // break 337 // Endif 338 // if(strsearch(fileStr, "NG7", 0) != -1) 339 // //string was found, it's an NG7 file 340 // DDet = 0.5 341 // break 342 // Endif 343 // while(0) 330 344 331 345 332 //Width of annulus used for the average is gotten from the … … 351 338 352 339 ii=0 353 // String res_string="root:myGlobals:Res_vals" 354 // Make/O/D/N=3 $res_string 355 // Wave res_wave=$res_string 340 356 341 Variable ret1,ret2,ret3 357 342 do 358 343 getResolution(qval[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,ddr,ret1,ret2,ret3) 359 sigmaq[ii] = ret1 //res_wave[0]360 qbar[ii] = ret2 //res_wave[1]361 fsubs[ii] = ret3 //res_wave[2]344 sigmaq[ii] = ret1 345 qbar[ii] = ret2 346 fsubs[ii] = ret3 362 347 ii+=1 363 348 while(ii<nq) … … 372 357 373 358 Avg_1D_Graph(aveint,qval,sigave) 374 // DoWindow/F Plot_1d 375 // If(V_flag == 1) //the graph window already exists 376 // //kill the old graph and make a new one 377 // //easier than adjusting the old one 378 // DoWindow/K Plot_1d 379 // Endif 380 // Display /W=(412,51,727,302)/K=1 aveint vs qval 381 // ModifyGraph log=1 382 // ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,0) 383 // ErrorBars aveint Y,wave=(sigave,sigave) 384 // Label left "Counts";DelayUpdate 385 // Label bottom "q\\U" 386 // SVAR angst = root:myGlobals:gAngstStr 387 // Label bottom "q ("+angst+"\\S-1\\M)" 388 // DoWindow/C Plot_1d 389 359 390 360 //get rid of the default mask, if one was created (it is in the current folder) 391 361 //don't just kill "mask" since it might be pointing to the one in the MSK folder … … 490 460 Wave reals = $(destPath + ":RealsRead") 491 461 462 // center of detector, for non-linear corrections 492 463 NVAR pixelsX = root:myGlobals:gNPixelsX 493 464 NVAR pixelsY = root:myGlobals:gNPixelsY 494 465 495 // center of detector, for non-linear corrections 496 xcenter = 64.5 497 ycenter = 64.5 466 xcenter = pixelsX/2 + 0.5 // == 64.5 for 128x128 Ordela 467 ycenter = pixelsY/2 + 0.5 // == 64.5 for 128x128 Ordela 498 468 499 469 // beam center, in pixels … … 517 487 nphi = numPhiSteps //number of anular sectors is set by users 518 488 519 rcentr = 150 //pixels within rcentr of beam center are broken into 9 parts520 489 rc = 2*dtdist*asin(qc*lambda/4/Pi) //in mm 521 490 delr = nw*sx/2 … … 673 642 //angle dependent transmission correction is not done in phiave 674 643 Ann_1D_Graph(aveint,phival,sigave) 675 // DoWindow/F Plot_1d676 // If(V_flag == 1) //the graph window already exists677 // //kill the old graph and make a new one678 // //easier than adjusting the old one679 // DoWindow/K Plot_1d680 // Endif681 // Display /W=(412,51,727,302)/K=1 aveint vs phival682 // ModifyGraph log=0683 // ModifyGraph mode=3,marker=19,msize=1,rgb=(0,0,0)684 // ErrorBars aveint Y,wave=(sigave,sigave)685 // Label left "Counts";DelayUpdate686 // Label bottom "Angle (degrees)"687 // DoWindow/C Plot_1d688 644 689 645 //get rid of the default mask, if one was created (it is in the current folder) -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Schematic.ipf
r70 r76 102 102 text2 = "Using Protocol: "+protocolName 103 103 text3 = "Sample file: "+ root:SAM:fileList 104 text5 = "T\\BSAM\\M = " + GetTrans("SAM") //trans and thickness of the sample105 text5 += " d\\BSAM\\M = " + GetThick("SAM") + " cm"106 text7 = "T\\BEMP\\M = " + GetTrans("EMP") //transmission of the empty cell104 text5 = "T\\BSAM\\M = " + getTransStrFromReals("SAM") //trans and thickness of the sample 105 text5 += " d\\BSAM\\M = " + getThickStrFromReals("SAM") + " cm" 106 text7 = "T\\BEMP\\M = " + getTransStrFromReals("EMP") //transmission of the empty cell 107 107 //attenuators used in sample measurement 108 108 109 text23 = "SAM Attenuator = "+GetAttenNum ("SAM")109 text23 = "SAM Attenuator = "+GetAttenNumStrFromReals("SAM") 110 110 111 111 text11 = "Final 1-D Dataset" … … 433 433 text2 = "Using Protocol: "+protocolName 434 434 text3 = "Sample file: "+ root:SAM:fileList 435 text5 = "T\\BSAM\\M = " + GetTrans("SAM") //trans and thickness of the sample436 text5 += " d\\BSAM\\M = " + GetThick("SAM") + " cm"437 text7 = "T\\BEMP\\M = " + GetTrans("EMP") //transmission of the empty cell435 text5 = "T\\BSAM\\M = " + getTransStrFromReals("SAM") //trans and thickness of the sample 436 text5 += " d\\BSAM\\M = " + getThickStrFromReals("SAM") + " cm" 437 text7 = "T\\BEMP\\M = " + getTransStrFromReals("EMP") //transmission of the empty cell 438 438 //attenuators used in sample measurement 439 439 440 text23 = "SAM Attenuator = "+GetAttenNum ("SAM")440 text23 = "SAM Attenuator = "+GetAttenNumStrFromReals("SAM") 441 441 442 442 text11 = "Final 1-D Dataset" … … 623 623 //returns "none" if the value (in RealsRead) cannot be found 624 624 // 625 Function/S GetTrans(type)625 Function/S getTransStrFromReals(type) 626 626 String type 627 627 … … 639 639 //returns "none" if the value (in RealsRead) cannot be found 640 640 // 641 Function/S GetThick(type)641 Function/S getThickStrFromReals(type) 642 642 String type 643 643 … … 655 655 //returns "none" if the value (in RealsRead) cannot be found 656 656 // 657 Function/S GetAttenNum (type)657 Function/S GetAttenNumStrFromReals(type) 658 658 String type 659 659 -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Tile_2D.ipf
r41 r76 328 328 Endif 329 329 330 String list=IndexedFile(catPathName,-1,"????") 331 String newList="",item="" 332 Variable num=ItemsInList(list,";"),ii 333 for(ii=0;ii<num;ii+=1) 334 item = StringFromList(ii, list ,";") 335 if( stringmatch(item,"*.sa1*") ) 336 newlist += item + ";" 337 endif 338 if( stringmatch(item,"*.sa2*") ) 339 newlist += item + ";" 340 endif 341 if( stringmatch(item,"*.sa3*") ) 342 newlist += item + ";" 343 endif 344 //print "ii=",ii 345 endfor 346 newList = SortList(newList,";",0) 330 String newList="" 331 Variable num 332 333 newList = GetRawDataFileList() 334 347 335 num=ItemsInList(newlist,";") 348 336 WAVE/T fileWave=$"root:myGlobals:Tile_2D:fileWave" … … 528 516 Endif 529 517 530 String list=IndexedFile(catPathName,-1,"????") 531 String newList="",item="" 532 Variable num=ItemsInList(list,";"),ii 533 for(ii=0;ii<num;ii+=1) 534 item = StringFromList(ii, list ,";") 535 if( stringmatch(item,"*.sa1*") ) 536 newlist += item + ";" 537 endif 538 if( stringmatch(item,"*.sa2*") ) 539 newlist += item + ";" 540 endif 541 if( stringmatch(item,"*.sa3*") ) 542 newlist += item + ";" 543 endif 544 //print "ii=",ii 545 endfor 546 newList = SortList(newList,";",0) 518 Variable num 519 String newList = GetRawDataFileList() 520 547 521 num=ItemsInList(newlist,";") 548 522 WAVE/T fileWave=$"root:myGlobals:RAW2ASCII:fileWave" -
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/WriteQIS.ipf
r69 r76 653 653 End 654 654 655 656 ////***this function is not used - WriteWaves_W_Protocol() is used instead657 ////658 ////for writing out data (q-i-s) from the "type" folder659 ////if fullpath is a complete HD path:filename, no dialog will be presented660 ////if fullpath is just a filename, the save dialog will be presented (forced if dialog =1)661 ////writes ONLY the standard header information (no protocol information)662 ////663 //Function WriteWaves(type,fullpath,dialog)664 // String type,fullpath665 // Variable dialog //=1 will present dialog for name666 //667 // String destStr=""668 // destStr = "root:"+type669 //670 // Variable refNum671 // String formatStr = "%15.4g %15.4g %15.4g %15.4g %15.4g %15.4g\r\n"672 // String fname,ave="C",headerFormat = "%10.4g %8.2g %8.2g %8.2g %8.3g %8.3g %8s %5.0g\r\n"673 // Variable step=1674 //675 // //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error****676 // WAVE intw=$(destStr + ":integersRead")677 // WAVE rw=$(destStr + ":realsRead")678 // WAVE/T textw=$(destStr + ":textRead")679 // WAVE qvals =$(destStr + ":qval")680 // WAVE inten=$(destStr + ":aveint")681 // WAVE sig=$(destStr + ":sigave")682 // WAVE qbar = $(destStr + ":QBar")683 // WAVE sigmaq = $(destStr + ":SigmaQ")684 // WAVE fsubs = $(destStr + ":fSubS")685 //686 // //check each wave687 // If(!(WaveExists(intw)))688 // Abort "intw DNExist BinaryWrite()"689 // Endif690 // If(!(WaveExists(rw)))691 // Abort "rw DNExist BinaryWrite()"692 // Endif693 // If(!(WaveExists(textw)))694 // Abort "textw DNExist BinaryWrite()"695 // Endif696 // If(!(WaveExists(qvals)))697 // Abort "qvals DNExist BinaryWrite()"698 // Endif699 // If(!(WaveExists(inten)))700 // Abort "inten DNExist BinaryWrite()"701 // Endif702 // If(!(WaveExists(sig)))703 // Abort "sig DNExist BinaryWrite()"704 // Endif705 // If(!(WaveExists(qbar)))706 // Abort "qbar DNExist BinaryWrite()"707 // Endif708 // If(!(WaveExists(sigmaq)))709 // Abort "sigmaq DNExist BinaryWrite()"710 // Endif711 // If(!(WaveExists(fsubs)))712 // Abort "fsubs DNExist BinaryWrite()"713 // Endif714 //715 // if(dialog)716 // PathInfo/S catPathName717 // fullPath = DoSaveFileDialog("Save data as")718 // If(cmpstr(fullPath,"")==0)719 // //user cancel, don't write out a file720 // Close/A721 // Abort "no data file was written"722 // Endif723 // //Print "dialog fullpath = ",fullpath724 // Endif725 //726 // //actually open the file727 // Open refNum as fullpath728 //729 // fprintf refnum,"FILE: %s\t\t CREATED: %s\r\n",textw[0],textw[1]730 // fprintf refnum,"LABEL: %s\r\n",textw[6]731 // fprintf refnum,"MON CNT LAMBDA DET ANG DET DIST TRANS THICK AVE STEP\r\n"732 // fprintf refnum,headerFormat,rw[0],rw[26],rw[19],rw[18],rw[4],rw[5],ave,step733 // wfprintf refnum, formatStr, qvals,inten,sig,sigmaq,qbar,fsubs734 //735 // Close refnum736 //737 // SetDataFolder root: //(redundant)738 //739 // Return(0)740 //End
Note: See TracChangeset
for help on using the changeset viewer.