- Timestamp:
- Jul 14, 2011 4:55:08 PM (12 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_FlipperPanel.ipf
r816 r817 10 10 // 11 11 // TODO: 12 // -- add a way to manually enter the P values into a "blank" condition, in case that the users12 // X- add a way to manually enter the P values into a "blank" condition, in case that the users 13 13 // calculate the values in a different way. This should be as simple as a dialog to enter values and 14 14 // change the wave note (and displayed strings). -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationCorrection.ipf
r816 r817 62 62 // first three panels into one w/ tabs would help a lot, but that is rather complex to implement. 63 63 // 64 // X- mathod to save and restore the panel state - especially the popup selections 64 65 65 66 Macro ShowPolCorSetup() 66 67 68 Variable restore=0 67 69 DoWindow/F PolCor_Panel 68 70 if(V_flag==0) 69 Initialize_PolCorPanel() 71 72 InitProtocolPanel() //this will reset the strings. 73 74 restore=Initialize_PolCorPanel() 70 75 PolCor_Panel() 76 SetWindow PolCor_Panel hook(kill)=PolCorPanelHook //to save the state when panel is killed 77 //disable the controls on other tabs 78 ToggleSelControls("_1_",1) 79 ToggleSelControls("_2_",1) 80 81 //restore the entries 82 if(restore) 83 RestorePolCorPanel() 84 endif 85 86 71 87 endif 72 88 End 73 89 90 91 Function RestorePolCorPanel() 92 //restore the popup state 93 Wave/T/Z w=root:Packages:NIST:Polarization:PolCor_popState 94 95 Variable ii,num 96 String name,popStr,list 97 98 list = P_GetConditionNameList() //list of conditions 99 if(WaveExists(w)) 100 num = DimSize(w,0) 101 for(ii=0;ii<num;ii+=1) 102 name = w[ii][0] 103 popStr = w[ii][1] 104 if(cmpstr("none",popStr) !=0 ) 105 PopupMenu $name,win=PolCor_Panel,mode=WhichListItem(popStr, list,";",0,0),popvalue=popStr 106 endif 107 endfor 108 endif 109 return(0) 110 End 111 112 74 113 // 75 114 // TODO: … … 78 117 Function Initialize_PolCorPanel() 79 118 119 120 Variable ii,num 121 String name,popStr 122 80 123 DoAlert 1,"Do you want to initialize, wiping out all of your entries?" 81 if(V_flag != 1) //1== yes , everything else, get out82 return( 0)124 if(V_flag != 1) //1== yes initialize, so everything else, restore the entries 125 return(1) 83 126 endif 84 127 85 128 //initialize all of the strings for the input 86 Variable ii87 129 SetDataFolder root:Packages:NIST:Polarization 88 130 … … 108 150 endfor 109 151 110 // blank matrix of coefficients 111 Make/O/D/N=(4,4) PolMatrix = 0 152 // blank matrix of coefficients is not generated here, but as each set is loaded 153 // Print " *** PolMatrix is not being generated in the correct folder(s)" 154 // Make/O/D/N=(4,4) PolMatrix = 0 112 155 113 156 SetDataFolder root: … … 119 162 120 163 end 164 165 121 166 122 167 … … 127 172 // 128 173 // TODO: 129 // - tabs for SAM, EMP, and BGD 130 // - input fields for the other protocol items, like the Protocol Panel 131 // - need a way of saving the "protocol" since the setup is so complex. 174 // X- tabs for SAM, EMP, and BGD 175 // X- input fields for the other protocol items, like the Protocol Panel 176 // X- save the popup state 177 // X- need a way of saving the "protocol" since the setup is so complex. 132 178 // - generate a report of the setup. 133 179 // - 4-panel display (maybe a layout with labels?) Maybe a panel with 4 subwindows. Can I use color bars in them? … … 136 182 Window PolCor_Panel() 137 183 PauseUpdate; Silent 1 // building window... 138 NewPanel /W=(554,44,1265,770) 184 NewPanel /W=(925,44,1662,800) /K=1 185 ModifyPanel cbRGB=(64349,63913,44660) 139 186 // ShowTools/A 140 ModifyPanel cbRGB=(64349,63913,44660) 141 TitleBox title_0,pos={116,21},size={24,24},title="\\f01UU",fSize=12 142 143 SetVariable setvar_0_UU_0,pos={34,57},size={70,16},title="File",fSize=10 187 SetDrawEnv linethick= 2.00 188 DrawLine 10,510,600,510 189 190 TabControl PolCorTab,pos={15,27},size={708,401},proc=PolCorTabProc 191 TabControl PolCorTab,tabLabel(0)="SAM",tabLabel(1)="EMP",tabLabel(2)="BGD" 192 TabControl PolCorTab,value= 0 193 194 // always visible 195 Button button0,pos={26,445},size={80,20},proc=LoadRawPolarizedButton,title="Load ..." 196 Button button1,pos={26,473},size={130,20},proc=PolCorButton,title="Pol Correct Data" 197 Button button2,pos={222,445},size={130,20},proc=ShowPolMatrixButton,title="Show Coef Matrix" 198 Button button3,pos={222,473},size={160,20},proc=ChangeDisplayedPolData,title="Change Displayed Data" 199 Button button4,pos={620,18},size={30,20},proc=PolCorHelpParButtonProc,title="?" 200 201 TitleBox title0,pos={116,66},size={24,24},title="\\f01UU",fSize=12 202 TitleBox title1,pos={450,66},size={24,24},title="\\f01DU",fSize=12 203 TitleBox title2,pos={115,250},size={25,24},title="\\f01DD",fSize=12 204 TitleBox title3,pos={450,250},size={24,24},title="\\f01UD",fSize=12 205 206 // bits to set up reduction protocol 207 Button button5,pos={126,560},size={100,20},proc=PickDIVButton,title="set DIV file" 208 Button button5,help={"This button will set the file selected in the File Catalog table to be the sensitivity file."} 209 Button button6,pos={126,590},size={100,20},proc=PickMASKButton,title="set MASK file" 210 Button button6,help={"This button will set the file selected in the File Catalog table to be the mask file."} 211 Button button7,pos={126,620},size={110,20},proc=SetABSParamsButton,title="set ABS params" 212 Button button7,help={"This button will prompt the user for absolute scaling parameters"} 213 Button button8,pos={126,650},size={150,20},proc=SetAverageParamsButtonProc,title="set AVERAGE params" 214 Button button8,help={"Prompts the user for the type of 1-D averaging to perform, as well as saving options"} 215 Button button9,pos={80,690},size={120,20},proc=ReducePolCorDataButton,title="Reduce Data" 216 Button button9,help={"Reduce PolCor data"} 217 Button button10,pos={226,690},size={120,20},proc=SavePolCorProtocolButton,title="Save Protocol" 218 Button button10,help={"Save the PolCor protocol"} 219 Button button11,pos={370,690},size={120,20},proc=RecallPolCorProtocolButton,title="Recall Protocol" 220 Button button11,help={"Recall the PolCor protocol"} 221 222 SetVariable setvar0,pos={322,560},size={250,15},title="file:" 223 SetVariable setvar0,help={"Filename of the detector sensitivity file to be used in the data reduction"} 224 SetVariable setvar0,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gDIV 225 SetVariable setvar1,pos={322,590},size={250,15},title="file:" 226 SetVariable setvar1,help={"Filename of the mask file to be used in the data reduction"} 227 SetVariable setvar1,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gMASK 228 SetVariable setvar2,pos={322,620},size={250,15},title="parameters:" 229 SetVariable setvar2,help={"Keyword-string of values necessary for absolute scaling of data. Remaining parameters are taken from the sample file."} 230 SetVariable setvar2,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gAbsStr 231 SetVariable setvar3,pos={322,650},size={250,15},title="parameters:" 232 SetVariable setvar3,help={"Keyword-string of choices used for averaging and saving the 1-D data files"} 233 SetVariable setvar3,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gAVE 234 235 CheckBox check0,pos={10,560},size={72,14},title="Sensitivity" 236 CheckBox check0,help={"If checked, the specified detector sensitivity file will be included in the data reduction. If the file name is \"ask\", then the user will be prompted for the file"} 237 CheckBox check0,value= 1 238 CheckBox check1,pos={10,590},size={72,14},title="Mask" 239 CheckBox check1,help={""} 240 CheckBox check1,value= 1 241 CheckBox check2,pos={10,620},size={72,14},title="Absolute Scale" 242 CheckBox check2,help={""} 243 CheckBox check2,value= 1 244 CheckBox check3,pos={10,650},size={72,14},title="Average and Save" 245 CheckBox check3,help={""} 246 CheckBox check3,value= 1 247 CheckBox check4,pos={10,530},size={72,14},title="Use EMP?" 248 CheckBox check4,help={""} 249 CheckBox check4,value= 1 250 CheckBox check5,pos={100,530},size={72,14},title="Use BGD?" 251 CheckBox check5,help={""} 252 CheckBox check5,value= 1 253 254 255 256 // SAM Tab 257 // UU 258 SetVariable setvar_0_UU_0,pos={34,102},size={70,16},title="File",fSize=10 144 259 SetVariable setvar_0_UU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_0 145 SetVariable setvar_0_UU_1,pos={34, 80},size={70,16},title="File",fSize=10260 SetVariable setvar_0_UU_1,pos={34,125},size={70,16},title="File",fSize=10 146 261 SetVariable setvar_0_UU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_1 147 SetVariable setvar_0_UU_2,pos={34,1 04},size={70,16},title="File",fSize=10262 SetVariable setvar_0_UU_2,pos={34,149},size={70,16},title="File",fSize=10 148 263 SetVariable setvar_0_UU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_2 149 SetVariable setvar_0_UU_3,pos={34,1 28},size={70,16},title="File",fSize=10264 SetVariable setvar_0_UU_3,pos={34,173},size={70,16},title="File",fSize=10 150 265 SetVariable setvar_0_UU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_3 151 SetVariable setvar_0_UU_4,pos={34,1 52},size={70,16},title="File",fSize=10266 SetVariable setvar_0_UU_4,pos={34,197},size={70,16},title="File",fSize=10 152 267 SetVariable setvar_0_UU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UU_4 153 PopupMenu popup_0_UU_0,pos={142, 54},size={102,20},title="Condition"154 PopupMenu popup_0_UU_0,mode= 1,popvalue="none",value= #"P_GetConditionNameList()"155 PopupMenu popup_0_UU_1,pos={142, 77},size={102,20},title="Condition"268 PopupMenu popup_0_UU_0,pos={142,99},size={210,20},title="Condition" 269 PopupMenu popup_0_UU_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 270 PopupMenu popup_0_UU_1,pos={142,122},size={102,20},title="Condition" 156 271 PopupMenu popup_0_UU_1,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 157 PopupMenu popup_0_UU_2,pos={142,1 01},size={102,20},title="Condition"272 PopupMenu popup_0_UU_2,pos={142,146},size={102,20},title="Condition" 158 273 PopupMenu popup_0_UU_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 159 PopupMenu popup_0_UU_3,pos={142,1 25},size={102,20},title="Condition"274 PopupMenu popup_0_UU_3,pos={142,170},size={102,20},title="Condition" 160 275 PopupMenu popup_0_UU_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 161 PopupMenu popup_0_UU_4,pos={142,1 49},size={102,20},title="Condition"276 PopupMenu popup_0_UU_4,pos={142,194},size={102,20},title="Condition" 162 277 PopupMenu popup_0_UU_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 163 164 165 TitleBox title_1,pos={450,21},size={24,24},title="\\f01DU",fSize=12 166 SetVariable setvar_0_DU_0,pos={368,57},size={70,16},title="File",fSize=10 278 // DU 279 SetVariable setvar_0_DU_0,pos={368,102},size={70,16},title="File",fSize=10 167 280 SetVariable setvar_0_DU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_0 168 SetVariable setvar_0_DU_1,pos={368, 80},size={70,16},title="File",fSize=10281 SetVariable setvar_0_DU_1,pos={368,125},size={70,16},title="File",fSize=10 169 282 SetVariable setvar_0_DU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_1 170 SetVariable setvar_0_DU_2,pos={368,1 04},size={70,16},title="File",fSize=10283 SetVariable setvar_0_DU_2,pos={368,149},size={70,16},title="File",fSize=10 171 284 SetVariable setvar_0_DU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_2 172 SetVariable setvar_0_DU_3,pos={368,1 28},size={70,16},title="File",fSize=10285 SetVariable setvar_0_DU_3,pos={368,173},size={70,16},title="File",fSize=10 173 286 SetVariable setvar_0_DU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_3 174 SetVariable setvar_0_DU_4,pos={368,1 52},size={70,16},title="File",fSize=10287 SetVariable setvar_0_DU_4,pos={368,197},size={70,16},title="File",fSize=10 175 288 SetVariable setvar_0_DU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DU_4 176 PopupMenu popup_0_DU_0,pos={476, 54},size={102,20},title="Condition"177 PopupMenu popup_0_DU_0,mode= 1,popvalue="none",value= #"P_GetConditionNameList()"178 PopupMenu popup_0_DU_1,pos={476, 77},size={102,20},title="Condition"179 PopupMenu popup_0_DU_1,mode= 1,popvalue="none",value= #"P_GetConditionNameList()"180 PopupMenu popup_0_DU_2,pos={476,1 01},size={102,20},title="Condition"289 PopupMenu popup_0_DU_0,pos={476,99},size={210,20},title="Condition" 290 PopupMenu popup_0_DU_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 291 PopupMenu popup_0_DU_1,pos={476,122},size={210,20},title="Condition" 292 PopupMenu popup_0_DU_1,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 293 PopupMenu popup_0_DU_2,pos={476,146},size={102,20},title="Condition" 181 294 PopupMenu popup_0_DU_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 182 PopupMenu popup_0_DU_3,pos={476,1 25},size={102,20},title="Condition"295 PopupMenu popup_0_DU_3,pos={476,170},size={102,20},title="Condition" 183 296 PopupMenu popup_0_DU_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 184 PopupMenu popup_0_DU_4,pos={476,1 49},size={102,20},title="Condition"297 PopupMenu popup_0_DU_4,pos={476,194},size={102,20},title="Condition" 185 298 PopupMenu popup_0_DU_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 186 187 TitleBox title_2,pos={115,205},size={25,24},title="\\f01DD",fSize=12 188 SetVariable setvar_0_DD_0,pos={33,241},size={70,16},title="File",fSize=10 299 // DD 300 SetVariable setvar_0_DD_0,pos={33,286},size={70,16},title="File",fSize=10 189 301 SetVariable setvar_0_DD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_0 190 SetVariable setvar_0_DD_1,pos={33, 264},size={70,16},title="File",fSize=10302 SetVariable setvar_0_DD_1,pos={33,309},size={70,16},title="File",fSize=10 191 303 SetVariable setvar_0_DD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_1 192 SetVariable setvar_0_DD_2,pos={33, 288},size={70,16},title="File",fSize=10304 SetVariable setvar_0_DD_2,pos={33,333},size={70,16},title="File",fSize=10 193 305 SetVariable setvar_0_DD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_2 194 SetVariable setvar_0_DD_3,pos={33,3 12},size={70,16},title="File",fSize=10306 SetVariable setvar_0_DD_3,pos={33,357},size={70,16},title="File",fSize=10 195 307 SetVariable setvar_0_DD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_3 196 SetVariable setvar_0_DD_4,pos={33,3 36},size={70,16},title="File",fSize=10308 SetVariable setvar_0_DD_4,pos={33,381},size={70,16},title="File",fSize=10 197 309 SetVariable setvar_0_DD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_DD_4 198 PopupMenu popup_0_DD_0,pos={141,2 38},size={102,20},title="Condition"199 PopupMenu popup_0_DD_0,mode= 1,popvalue="none",value= #"P_GetConditionNameList()"200 PopupMenu popup_0_DD_1,pos={141, 261},size={102,20},title="Condition"310 PopupMenu popup_0_DD_0,pos={141,283},size={210,20},title="Condition" 311 PopupMenu popup_0_DD_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 312 PopupMenu popup_0_DD_1,pos={141,306},size={102,20},title="Condition" 201 313 PopupMenu popup_0_DD_1,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 202 PopupMenu popup_0_DD_2,pos={141, 285},size={102,20},title="Condition"314 PopupMenu popup_0_DD_2,pos={141,330},size={102,20},title="Condition" 203 315 PopupMenu popup_0_DD_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 204 PopupMenu popup_0_DD_3,pos={141,3 09},size={102,20},title="Condition"316 PopupMenu popup_0_DD_3,pos={141,354},size={102,20},title="Condition" 205 317 PopupMenu popup_0_DD_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 206 PopupMenu popup_0_DD_4,pos={141,3 33},size={102,20},title="Condition"318 PopupMenu popup_0_DD_4,pos={141,378},size={102,20},title="Condition" 207 319 PopupMenu popup_0_DD_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 208 209 TitleBox title_3,pos={450,205},size={24,24},title="\\f01UD",fSize=12 210 SetVariable setvar_0_UD_0,pos={368,241},size={70,16},title="File",fSize=10 320 // UD 321 SetVariable setvar_0_UD_0,pos={368,286},size={70,16},title="File",fSize=10 211 322 SetVariable setvar_0_UD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_0 212 SetVariable setvar_0_UD_1,pos={368, 264},size={70,16},title="File",fSize=10323 SetVariable setvar_0_UD_1,pos={368,309},size={70,16},title="File",fSize=10 213 324 SetVariable setvar_0_UD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_1 214 SetVariable setvar_0_UD_2,pos={368, 288},size={70,16},title="File",fSize=10325 SetVariable setvar_0_UD_2,pos={368,333},size={70,16},title="File",fSize=10 215 326 SetVariable setvar_0_UD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_2 216 SetVariable setvar_0_UD_3,pos={368,3 12},size={70,16},title="File",fSize=10327 SetVariable setvar_0_UD_3,pos={368,357},size={70,16},title="File",fSize=10 217 328 SetVariable setvar_0_UD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_3 218 SetVariable setvar_0_UD_4,pos={368,3 36},size={70,16},title="File",fSize=10329 SetVariable setvar_0_UD_4,pos={368,381},size={70,16},title="File",fSize=10 219 330 SetVariable setvar_0_UD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_0_UD_4 220 PopupMenu popup_0_UD_0,pos={476,2 38},size={102,20},title="Condition"221 PopupMenu popup_0_UD_0,mode= 1,popvalue="none",value= #"P_GetConditionNameList()"222 PopupMenu popup_0_UD_1,pos={476, 261},size={102,20},title="Condition"223 PopupMenu popup_0_UD_1,mode= 1,popvalue="none",value= #"P_GetConditionNameList()"224 PopupMenu popup_0_UD_2,pos={476, 285},size={102,20},title="Condition"331 PopupMenu popup_0_UD_0,pos={476,283},size={210,20},title="Condition" 332 PopupMenu popup_0_UD_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 333 PopupMenu popup_0_UD_1,pos={476,306},size={210,20},title="Condition" 334 PopupMenu popup_0_UD_1,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 335 PopupMenu popup_0_UD_2,pos={476,330},size={102,20},title="Condition" 225 336 PopupMenu popup_0_UD_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 226 PopupMenu popup_0_UD_3,pos={476,3 09},size={102,20},title="Condition"337 PopupMenu popup_0_UD_3,pos={476,354},size={102,20},title="Condition" 227 338 PopupMenu popup_0_UD_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 228 PopupMenu popup_0_UD_4,pos={476,3 33},size={102,20},title="Condition"339 PopupMenu popup_0_UD_4,pos={476,378},size={102,20},title="Condition" 229 340 PopupMenu popup_0_UD_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 230 341 231 232 // always visible 233 Button button0,pos={26,485},size={80,20},proc=LoadRawPolarizedButton,title="Load ..." 234 Button button1,pos={26,513},size={130,20},proc=PolCorButton,title="Pol Correct Data" 235 Button button2,pos={222,488},size={130,20},proc=ShowPolMatrixButton,title="Show Coef Matrix" 236 Button button3,pos={222,518},size={160,20},proc=ChangeDisplayedPolData,title="Change Displayed Data" 237 238 342 343 // EMP Tab 344 // UU 345 SetVariable setvar_1_UU_0,pos={34,102},size={70,16},title="File",fSize=10 346 SetVariable setvar_1_UU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_0 347 SetVariable setvar_1_UU_1,pos={34,125},size={70,16},title="File",fSize=10 348 SetVariable setvar_1_UU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_1 349 SetVariable setvar_1_UU_2,pos={34,149},size={70,16},title="File",fSize=10 350 SetVariable setvar_1_UU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_2 351 SetVariable setvar_1_UU_3,pos={34,173},size={70,16},title="File",fSize=10 352 SetVariable setvar_1_UU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_3 353 SetVariable setvar_1_UU_4,pos={34,197},size={70,16},title="File",fSize=10 354 SetVariable setvar_1_UU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UU_4 355 PopupMenu popup_1_UU_0,pos={142,99},size={210,20},title="Condition" 356 PopupMenu popup_1_UU_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 357 PopupMenu popup_1_UU_1,pos={142,122},size={102,20},title="Condition" 358 PopupMenu popup_1_UU_1,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 359 PopupMenu popup_1_UU_2,pos={142,146},size={102,20},title="Condition" 360 PopupMenu popup_1_UU_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 361 PopupMenu popup_1_UU_3,pos={142,170},size={102,20},title="Condition" 362 PopupMenu popup_1_UU_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 363 PopupMenu popup_1_UU_4,pos={142,194},size={102,20},title="Condition" 364 PopupMenu popup_1_UU_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 365 // DU 366 SetVariable setvar_1_DU_0,pos={368,102},size={70,16},title="File",fSize=10 367 SetVariable setvar_1_DU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_0 368 SetVariable setvar_1_DU_1,pos={368,125},size={70,16},title="File",fSize=10 369 SetVariable setvar_1_DU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_1 370 SetVariable setvar_1_DU_2,pos={368,149},size={70,16},title="File",fSize=10 371 SetVariable setvar_1_DU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_2 372 SetVariable setvar_1_DU_3,pos={368,173},size={70,16},title="File",fSize=10 373 SetVariable setvar_1_DU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_3 374 SetVariable setvar_1_DU_4,pos={368,197},size={70,16},title="File",fSize=10 375 SetVariable setvar_1_DU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DU_4 376 PopupMenu popup_1_DU_0,pos={476,99},size={210,20},title="Condition" 377 PopupMenu popup_1_DU_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 378 PopupMenu popup_1_DU_1,pos={476,122},size={210,20},title="Condition" 379 PopupMenu popup_1_DU_1,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 380 PopupMenu popup_1_DU_2,pos={476,146},size={102,20},title="Condition" 381 PopupMenu popup_1_DU_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 382 PopupMenu popup_1_DU_3,pos={476,170},size={102,20},title="Condition" 383 PopupMenu popup_1_DU_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 384 PopupMenu popup_1_DU_4,pos={476,194},size={102,20},title="Condition" 385 PopupMenu popup_1_DU_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 386 // DD 387 SetVariable setvar_1_DD_0,pos={33,286},size={70,16},title="File",fSize=10 388 SetVariable setvar_1_DD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_0 389 SetVariable setvar_1_DD_1,pos={33,309},size={70,16},title="File",fSize=10 390 SetVariable setvar_1_DD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_1 391 SetVariable setvar_1_DD_2,pos={33,333},size={70,16},title="File",fSize=10 392 SetVariable setvar_1_DD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_2 393 SetVariable setvar_1_DD_3,pos={33,357},size={70,16},title="File",fSize=10 394 SetVariable setvar_1_DD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_3 395 SetVariable setvar_1_DD_4,pos={33,381},size={70,16},title="File",fSize=10 396 SetVariable setvar_1_DD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_DD_4 397 PopupMenu popup_1_DD_0,pos={141,283},size={210,20},title="Condition" 398 PopupMenu popup_1_DD_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 399 PopupMenu popup_1_DD_1,pos={141,306},size={102,20},title="Condition" 400 PopupMenu popup_1_DD_1,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 401 PopupMenu popup_1_DD_2,pos={141,330},size={102,20},title="Condition" 402 PopupMenu popup_1_DD_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 403 PopupMenu popup_1_DD_3,pos={141,354},size={102,20},title="Condition" 404 PopupMenu popup_1_DD_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 405 PopupMenu popup_1_DD_4,pos={141,378},size={102,20},title="Condition" 406 PopupMenu popup_1_DD_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 407 // UD 408 SetVariable setvar_1_UD_0,pos={368,286},size={70,16},title="File",fSize=10 409 SetVariable setvar_1_UD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_0 410 SetVariable setvar_1_UD_1,pos={368,309},size={70,16},title="File",fSize=10 411 SetVariable setvar_1_UD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_1 412 SetVariable setvar_1_UD_2,pos={368,333},size={70,16},title="File",fSize=10 413 SetVariable setvar_1_UD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_2 414 SetVariable setvar_1_UD_3,pos={368,357},size={70,16},title="File",fSize=10 415 SetVariable setvar_1_UD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_3 416 SetVariable setvar_1_UD_4,pos={368,381},size={70,16},title="File",fSize=10 417 SetVariable setvar_1_UD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_1_UD_4 418 PopupMenu popup_1_UD_0,pos={476,283},size={210,20},title="Condition" 419 PopupMenu popup_1_UD_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 420 PopupMenu popup_1_UD_1,pos={476,306},size={210,20},title="Condition" 421 PopupMenu popup_1_UD_1,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 422 PopupMenu popup_1_UD_2,pos={476,330},size={102,20},title="Condition" 423 PopupMenu popup_1_UD_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 424 PopupMenu popup_1_UD_3,pos={476,354},size={102,20},title="Condition" 425 PopupMenu popup_1_UD_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 426 PopupMenu popup_1_UD_4,pos={476,378},size={102,20},title="Condition" 427 PopupMenu popup_1_UD_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 428 429 430 // BKG Tab 431 // UU 432 SetVariable setvar_2_UU_0,pos={34,102},size={70,16},title="File",fSize=10 433 SetVariable setvar_2_UU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_0 434 SetVariable setvar_2_UU_1,pos={34,125},size={70,16},title="File",fSize=10 435 SetVariable setvar_2_UU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_1 436 SetVariable setvar_2_UU_2,pos={34,149},size={70,16},title="File",fSize=10 437 SetVariable setvar_2_UU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_2 438 SetVariable setvar_2_UU_3,pos={34,173},size={70,16},title="File",fSize=10 439 SetVariable setvar_2_UU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_3 440 SetVariable setvar_2_UU_4,pos={34,197},size={70,16},title="File",fSize=10 441 SetVariable setvar_2_UU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UU_4 442 PopupMenu popup_2_UU_0,pos={142,99},size={210,20},title="Condition" 443 PopupMenu popup_2_UU_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 444 PopupMenu popup_2_UU_1,pos={142,122},size={102,20},title="Condition" 445 PopupMenu popup_2_UU_1,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 446 PopupMenu popup_2_UU_2,pos={142,146},size={102,20},title="Condition" 447 PopupMenu popup_2_UU_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 448 PopupMenu popup_2_UU_3,pos={142,170},size={102,20},title="Condition" 449 PopupMenu popup_2_UU_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 450 PopupMenu popup_2_UU_4,pos={142,194},size={102,20},title="Condition" 451 PopupMenu popup_2_UU_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 452 // DU 453 SetVariable setvar_2_DU_0,pos={368,102},size={70,16},title="File",fSize=10 454 SetVariable setvar_2_DU_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_0 455 SetVariable setvar_2_DU_1,pos={368,125},size={70,16},title="File",fSize=10 456 SetVariable setvar_2_DU_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_1 457 SetVariable setvar_2_DU_2,pos={368,149},size={70,16},title="File",fSize=10 458 SetVariable setvar_2_DU_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_2 459 SetVariable setvar_2_DU_3,pos={368,173},size={70,16},title="File",fSize=10 460 SetVariable setvar_2_DU_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_3 461 SetVariable setvar_2_DU_4,pos={368,197},size={70,16},title="File",fSize=10 462 SetVariable setvar_2_DU_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DU_4 463 PopupMenu popup_2_DU_0,pos={476,99},size={210,20},title="Condition" 464 PopupMenu popup_2_DU_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 465 PopupMenu popup_2_DU_1,pos={476,122},size={210,20},title="Condition" 466 PopupMenu popup_2_DU_1,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 467 PopupMenu popup_2_DU_2,pos={476,146},size={102,20},title="Condition" 468 PopupMenu popup_2_DU_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 469 PopupMenu popup_2_DU_3,pos={476,170},size={102,20},title="Condition" 470 PopupMenu popup_2_DU_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 471 PopupMenu popup_2_DU_4,pos={476,194},size={102,20},title="Condition" 472 PopupMenu popup_2_DU_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 473 // DD 474 SetVariable setvar_2_DD_0,pos={33,286},size={70,16},title="File",fSize=10 475 SetVariable setvar_2_DD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_0 476 SetVariable setvar_2_DD_1,pos={33,309},size={70,16},title="File",fSize=10 477 SetVariable setvar_2_DD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_1 478 SetVariable setvar_2_DD_2,pos={33,333},size={70,16},title="File",fSize=10 479 SetVariable setvar_2_DD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_2 480 SetVariable setvar_2_DD_3,pos={33,357},size={70,16},title="File",fSize=10 481 SetVariable setvar_2_DD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_3 482 SetVariable setvar_2_DD_4,pos={33,381},size={70,16},title="File",fSize=10 483 SetVariable setvar_2_DD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_DD_4 484 PopupMenu popup_2_DD_0,pos={141,283},size={210,20},title="Condition" 485 PopupMenu popup_2_DD_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 486 PopupMenu popup_2_DD_1,pos={141,306},size={102,20},title="Condition" 487 PopupMenu popup_2_DD_1,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 488 PopupMenu popup_2_DD_2,pos={141,330},size={102,20},title="Condition" 489 PopupMenu popup_2_DD_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 490 PopupMenu popup_2_DD_3,pos={141,354},size={102,20},title="Condition" 491 PopupMenu popup_2_DD_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 492 PopupMenu popup_2_DD_4,pos={141,378},size={102,20},title="Condition" 493 PopupMenu popup_2_DD_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 494 // UD 495 SetVariable setvar_2_UD_0,pos={368,286},size={70,16},title="File",fSize=10 496 SetVariable setvar_2_UD_0,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_0 497 SetVariable setvar_2_UD_1,pos={368,309},size={70,16},title="File",fSize=10 498 SetVariable setvar_2_UD_1,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_1 499 SetVariable setvar_2_UD_2,pos={368,333},size={70,16},title="File",fSize=10 500 SetVariable setvar_2_UD_2,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_2 501 SetVariable setvar_2_UD_3,pos={368,357},size={70,16},title="File",fSize=10 502 SetVariable setvar_2_UD_3,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_3 503 SetVariable setvar_2_UD_4,pos={368,381},size={70,16},title="File",fSize=10 504 SetVariable setvar_2_UD_4,limits={-inf,inf,0},value= root:Packages:NIST:Polarization:gStr_PolCor_2_UD_4 505 PopupMenu popup_2_UD_0,pos={476,283},size={210,20},title="Condition" 506 PopupMenu popup_2_UD_0,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 507 PopupMenu popup_2_UD_1,pos={476,306},size={210,20},title="Condition" 508 PopupMenu popup_2_UD_1,mode=3,popvalue="none",value= #"P_GetConditionNameList()" 509 PopupMenu popup_2_UD_2,pos={476,330},size={102,20},title="Condition" 510 PopupMenu popup_2_UD_2,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 511 PopupMenu popup_2_UD_3,pos={476,354},size={102,20},title="Condition" 512 PopupMenu popup_2_UD_3,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 513 PopupMenu popup_2_UD_4,pos={476,378},size={102,20},title="Condition" 514 PopupMenu popup_2_UD_4,mode=1,popvalue="none",value= #"P_GetConditionNameList()" 515 239 516 EndMacro 240 517 241 // Loading of the polarized scattering data 242 // 243 // with the file numbers set 244 // and the conditions specified 245 // 246 // -- For the specified pType of data (=UU, DU, DD, UD) 247 // 248 // -the time midpoint is found from the list of runs (needed for PCell(t) later) 249 // -raw data is loaded (from a list of run numbers) 250 // -data and loaded waves are tagged with a suffix (_UU, _DU, etc.) 251 // -the PolMatrix of coefficients is filled (the specified row) 252 // 253 // TODO: 254 // X- pre-parsing is not done to check for valid file numbers. This should be done gracefully. 255 // -- SAM folder is currently hard-wired 256 // X- if all of the conditions are "none" - stop and report the error 257 // 258 Function LoadRawPolarizedButton(ba) : ButtonControl 518 519 Function PolCorPanelHook(s) 520 STRUCT WMWinHookStruct &s 521 522 Variable hookResult = 0 523 524 switch(s.eventCode) 525 // case 0: // Activate 526 // // Handle activate 527 // break 528 // 529 // case 1: // Deactivate 530 // // Handle deactivate 531 // break 532 case 2: // kill 533 // Handle kill 534 535 // the variables with the run numbers are automatically saved and restored if not re-initialized 536 // get a list of all of the popups 537 String popList="",item 538 Variable num,ii 539 popList=ControlNameList("PolCor_Panel",";","popup_*") 540 num=ItemsInList(popList,";") 541 Make/O/T/N=(num,2) root:Packages:NIST:Polarization:PolCor_popState 542 Wave/T w=root:Packages:NIST:Polarization:PolCor_popState 543 for(ii=0;ii<num;ii+=1) 544 item=StringFromList(ii, popList,";") 545 ControlInfo/W=PolCor_Panel $item 546 w[ii][0] = item 547 w[ii][1] = S_Value 548 endfor 549 550 break 551 552 endswitch 553 554 return hookResult // 0 if nothing done, else 1 555 End 556 557 // val = 1 to disable 558 // val = 0 to show 559 Function ToggleSelControls(str,val) 560 String str 561 Variable val 562 563 String listStr 564 listStr = ControlNameList("PolCor_Panel", ";", "*"+str+"*") 565 // print listStr 566 567 ModifyControlList/Z listStr , disable=(val) 568 return(0) 569 end 570 571 572 Function PolCorTabProc(tca) : TabControl 573 STRUCT WMTabControlAction &tca 574 575 switch( tca.eventCode ) 576 case 2: // mouse up 577 Variable tab = tca.tab 578 Variable val 579 // Print "Selected tab = ",tab 580 581 val = (tab != 0) 582 // Print "tab 0 val = ",val 583 ToggleSelControls("_0_",val) 584 585 val = (tab != 1) 586 // Print "tab 1 val = ",val 587 ToggleSelControls("_1_",val) 588 589 val = (tab != 2) 590 // Print "tab 2 val = ",val 591 ToggleSelControls("_2_",val) 592 593 break 594 case -1: // control being killed 595 break 596 endswitch 597 598 return 0 599 End 600 601 602 603 Function PolCorHelpParButtonProc(ba) : ButtonControl 259 604 STRUCT WMButtonAction &ba 260 605 … … 262 607 case 2: // mouse up 263 608 // click code here 264 265 String listStr="",runList="",parsedRuns,condStr 266 Variable ii,num,err 267 609 DoAlert 0,"Help for PolCor Panel not written yet" 610 break 611 case -1: // control being killed 612 break 613 endswitch 614 615 return 0 616 End 617 618 619 620 Function LoadRawPolarizedButton(ba) : ButtonControl 621 STRUCT WMButtonAction &ba 622 623 switch( ba.eventCode ) 624 case 2: // mouse up 625 // click code here 626 268 627 // depends on which tab you're on 269 628 // (maybe) select UD type 270 629 String pType 271 Prompt pType,"Pol Type",popup,"UU;DU;DD;UD; "630 Prompt pType,"Pol Type",popup,"UU;DU;DD;UD;All;" 272 631 DoPrompt "Type to load",pType 273 632 if (V_Flag) … … 276 635 // Print pType 277 636 278 // get a list of the file numbers to load, must be in proper data folder 279 SetDataFolder root:Packages:NIST:Polarization 280 listStr = StringList("gStr_PolCor*"+pType+"*", ";" ) 281 282 // print listStr 283 for(ii=0;ii<itemsinlist(listStr);ii+=1) 284 SVAR str=$StringFromList(ii, listStr ,";") 285 if(cmpstr(str, "none" ) != 0) 286 runList += str + "," 287 288 // and check that the condition is not "none" 289 Print "ControlInfo call is hard-wired for tab=0 = SAM" 290 291 ControlInfo/W=PolCor_Panel $("popup_0_"+pType+"_"+num2str(ii)) 292 condStr = S_Value 293 if(cmpstr(condStr, "none" ) == 0) 294 DoAlert 0,"Condition for file index "+num2str(ii)+" is not set." 295 SetDataFolder root: 296 return(0) 297 endif 298 endif 299 endfor 300 301 // Print runList 302 // check for errors 303 parsedRuns =ParseRunNumberList(runlist) 304 if(strlen(parsedRuns) == 0) 305 Print "enter a valid file number before proceeding" 306 SetDataFolder root: 307 return(0) 637 if(cmpstr(pType,"All") == 0) 638 LoadPolarizedData("UU") 639 LoadPolarizedData("DU") 640 LoadPolarizedData("DD") 641 LoadPolarizedData("UD") 642 else 643 LoadPolarizedData(pType) 308 644 endif 309 SetDataFolder root:310 311 312 // find time midpoint for the files to load313 Variable tMid314 tMid = getTimeMidpoint(runList)315 Print/D "time midpoint",tmid316 317 // this adds multiple raw data files, as specified by the list318 err = AddFilesInList("SAM",ParseRunNumberList(runlist)) // adds to a work file, not RAW319 UpdateDisplayInformation("SAM")320 321 TagLoadedData("SAM",pType) //see also DisplayTaggedData()322 323 // now add the appropriate bits to the matrix324 325 WAVE matA = root:Packages:NIST:Polarization:PolMatrix326 // listStr = ControlNameList("PolCor_Panel",";","*"+pType+"*")327 328 // the PolMatrix rows are cleared on pass 0 as each pType data is loaded.329 // this way repeated loading will always result in the correct fill330 AddToPolMatrix(matA,pType,tMid)331 332 645 333 646 break … … 339 652 End 340 653 654 // Loading of the polarized scattering data 655 // 656 // with the file numbers set 657 // and the conditions specified 658 // 659 // -- For the specified pType of data (=UU, DU, DD, UD) 660 // 661 // -the time midpoint is found from the list of runs (needed for PCell(t) later) 662 // -raw data is loaded (from a list of run numbers) 663 // -data and loaded waves are tagged with a suffix (_UU, _DU, etc.) 664 // -the PolMatrix of coefficients is filled (the specified row) 665 // 666 // TODO: 667 // X- pre-parsing is not done to check for valid file numbers. This should be done gracefully. 668 // X- SAM folder is currently hard-wired 669 // X- if all of the conditions are "none" - stop and report the error 670 // 671 Function LoadPolarizedData(pType) 672 String pType 673 674 675 String listStr="",runList="",parsedRuns,condStr 676 Variable ii,num,err 677 678 // get the current tab 679 String type 680 Variable tabNum 681 ControlInfo/W=PolCor_Panel PolCorTab 682 type = S_value 683 Print "selected data type = ",type 684 tabNum = V_Value 685 686 687 // get a list of the file numbers to load, must be in proper data folder 688 SetDataFolder root:Packages:NIST:Polarization 689 // Print "Searching "+"gStr_PolCor_"+num2str(tabNum)+"_*"+pType+"*" 690 listStr = StringList("gStr_PolCor_"+num2str(tabNum)+"_*"+pType+"*", ";" ) 691 692 // print listStr 693 for(ii=0;ii<itemsinlist(listStr);ii+=1) 694 SVAR str=$StringFromList(ii, listStr ,";") 695 if(cmpstr(str, "none" ) != 0) 696 runList += str + "," 697 698 // and check that the condition is not "none" 699 Print "ControlInfo call is for "+"popup_"+num2str(tabNum)+"_"+pType+"_"+num2str(ii) 700 701 ControlInfo/W=PolCor_Panel $("popup_"+num2str(tabNum)+"_"+pType+"_"+num2str(ii)) 702 703 condStr = S_Value 704 if(cmpstr(condStr, "none" ) == 0) 705 DoAlert 0,"Condition for file index "+num2str(ii)+" is not set." 706 SetDataFolder root: 707 return(0) 708 endif 709 endif 710 endfor 711 712 Print runList 713 // check for errors 714 parsedRuns =ParseRunNumberList(runlist) 715 if(strlen(parsedRuns) == 0) 716 Print "enter a valid file number before proceeding" 717 SetDataFolder root: 718 return(0) 719 endif 720 SetDataFolder root: 721 722 723 // find time midpoint for the files to load 724 Variable tMid 725 tMid = getTimeMidpoint(runList) 726 Print/D "time midpoint",tmid 727 728 // this adds multiple raw data files, as specified by the list 729 err = AddFilesInList(type,parsedRuns) // adds to a work file = type, not RAW 730 UpdateDisplayInformation(type) 731 732 TagLoadedData(type,pType) //see also DisplayTaggedData() 733 734 // now add the appropriate bits to the matrix 735 if(!WaveExists($("root:Packages:NIST:"+type+":PolMatrix"))) 736 Make/O/D/N=(4,4) $("root:Packages:NIST:"+type+":PolMatrix") 737 endif 738 WAVE matA = $("root:Packages:NIST:"+type+":PolMatrix") 739 740 // listStr = ControlNameList("PolCor_Panel",";","*"+pType+"*") 741 742 // the PolMatrix rows are cleared on pass 0 as each pType data is loaded. 743 // this way repeated loading will always result in the correct fill 744 AddToPolMatrix(matA,pType,tMid) 745 746 747 End 341 748 // by definition-- the rows are: 342 749 // … … 362 769 363 770 String listStr,fname="",condStr,condNote,decayNote,cellStr,t0Str,t1Str 364 771 772 // get the current tab 773 String type 774 Variable tabNum 775 ControlInfo/W=PolCor_Panel PolCorTab 776 type = S_value 777 Print "selected data type = ",type 778 tabNum = V_Value 365 779 366 780 SetDataFolder root:Packages:NIST:Polarization 367 listStr = StringList("gStr_PolCor *"+pType+"*", ";" )368 369 781 listStr = StringList("gStr_PolCor_"+num2str(tabNum)+"_*"+pType+"*", ";" ) 782 783 370 784 // loop over the (5) fields 371 785 for(ii=0;ii<itemsinlist(listStr);ii+=1) … … 377 791 // get condition from popup 378 792 // 379 Print "ControlInfo call is hard-wired for tab=0 = SAM" 380 381 ControlInfo/W=PolCor_Panel $("popup_ 0_"+pType+"_"+num2str(ii))793 // Print "ControlInfo call is for " + "popup_"+num2str(tabNum)+"_"+pType+"_"+num2str(ii) 794 795 ControlInfo/W=PolCor_Panel $("popup_"+num2str(tabNum)+"_"+pType+"_"+num2str(ii)) 382 796 condStr = S_Value 383 797 Wave condition = $("root:Packages:NIST:Polarization:Cells:"+condStr) … … 392 806 // get the cell string to get the Decay wave 393 807 cellStr = StringFromList(2, condStr ,"_") // treat the name as a list 394 print "Cell = ",cellStr808 // print "Cell = ",cellStr 395 809 // get info to calc Pcell (from the Decay wave) 396 810 Wave decay = $("root:Packages:NIST:Polarization:Cells:Decay_"+cellStr) … … 490 904 491 905 492 493 494 495 496 906 SetDataFolder root: 497 907 return(0) … … 524 934 String type,pType 525 935 936 ConvertFolderToLinearScale(type) 937 526 938 ptype = "_" + pType // add an extra underscore 527 939 String destPath = "root:Packages:NIST:" + type … … 541 953 String type="SAM",pType="UU" 542 954 955 String/G root:myGlobals:gDataDisplayType=type 956 ConvertFolderToLinearScale(type) 957 543 958 ptype = "_" + pType // add an extra underscore 544 959 String destPath = "root:Packages:NIST:" + type 545 $(destPath + ":data") = $(destPath + ":data"+pType)546 960 $(destPath + ":linear_data") = $(destPath + ":linear_data"+pType) 547 961 $(destPath + ":linear_data_error") = $(destPath + ":linear_data_error"+pType) … … 550 964 $(destPath + ":realsread") = $(destPath + ":realsread"+pType) 551 965 552 UpdateDisplayInformation("SAM") 966 // make the data equal to linear data 967 $(destPath + ":data") = $(destPath + ":linear_data"+pType) 968 969 UpdateDisplayInformation(type) 970 // using fRawWindowHook() gets the log/lin correct 971 // fRawWindowHook() 972 553 973 554 974 End … … 571 991 Variable ii,jj,numRows,numCols 572 992 993 // get the current tab 994 String type 995 Variable tabNum 996 ControlInfo/W=PolCor_Panel PolCorTab 997 type = S_value 998 Print "selected data type = ",type 999 tabNum = V_Value 1000 573 1001 // make waves for the result 574 Print "@@ PolCor is hard-wired for SAM --- this must be fixed"1002 // Print "@@ PolCor is hard-wired for SAM --- this must be fixed" 575 1003 // these duplicate the data and add "_pc" for later use 576 MakePCResultWaves("SAM","UU") 577 MakePCResultWaves("SAM","DU") 578 MakePCResultWaves("SAM","DD") 579 MakePCResultWaves("SAM","UD") 580 581 582 SetDataFolder root:Packages:NIST:SAM 1004 MakePCResultWaves(type,"UU") 1005 MakePCResultWaves(type,"DU") 1006 MakePCResultWaves(type,"DD") 1007 MakePCResultWaves(type,"UD") 1008 1009 1010 SetDataFolder $("root:Packages:NIST:"+type) 1011 583 1012 WAVE linear_data_UU_pc = linear_data_UU_pc 584 1013 WAVE linear_data_DU_pc = linear_data_DU_pc … … 596 1025 597 1026 // the coefficient matrix and the experimental data 598 WAVE matA = root:Packages:NIST:Polarization:PolMatrix1027 WAVE matA = $("root:Packages:NIST:"+type+":PolMatrix") 599 1028 WAVE linear_data_UU = linear_data_UU 600 1029 WAVE linear_data_DU = linear_data_DU … … 683 1112 case 2: // mouse up 684 1113 // click code here 685 Edit root:Packages:NIST:Polarization:PolMatrix 1114 1115 // get the current tab 1116 String type 1117 Variable tabNum 1118 ControlInfo/W=PolCor_Panel PolCorTab 1119 type = S_value 1120 Print "selected data type = ",type 1121 tabNum = V_Value 1122 1123 Edit $("root:Packages:NIST:"+type+":PolMatrix") 1124 686 1125 break 687 1126 case -1: // control being killed … … 736 1175 tMid = t_first + elap/2 737 1176 return(tMid) 1177 End 1178 1179 // options to reduce one or all types, in the same manner as the load. 1180 // 1181 // largely copied from ReduceAFile() 1182 // 1183 Function ReducePolCorDataButton(ctrlName) : ButtonControl 1184 String ctrlName 1185 1186 // depends on which tab you're on 1187 // (maybe) select UD type 1188 String pType 1189 Prompt pType,"Pol Type",popup,"UU;DU;DD;UD;All;" 1190 DoPrompt "Type to load",pType 1191 if (V_Flag) 1192 return 0 // user canceled 1193 endif 1194 // Print pType 1195 1196 1197 // get the protocol to use 1198 // this is pulled from ReduceAFile() 1199 Variable err 1200 String waveStr 1201 1202 //pick a protocol wave from the Protocols folder 1203 //must switch to protocols folder to get wavelist (missing parameter) 1204 SetDataFolder root:myGlobals:Protocols 1205 Execute "PickAProtocol()" 1206 1207 //get the selected protocol wave choice through a global string variable 1208 SVAR protocolName = root:myGlobals:Protocols:gProtoStr 1209 1210 //If "CreateNew" was selected, go to the questionnare, to make a new set 1211 //and put the name of the new Protocol wave in gProtoStr 1212 if(cmpstr("CreateNew",protocolName) == 0) 1213 return(0) 1214 Endif 1215 1216 //give the full path:name to the executeProtocol function 1217 waveStr = "root:myGlobals:Protocols:"+protocolName 1218 //samStr is set at top to "ask", since this is the action always desired from "ReduceAFile" 1219 1220 //return data folder to root before Macro is done 1221 SetDataFolder root: 1222 1223 if(cmpstr(pType,"All") == 0) 1224 ExecutePolarizedProtocol(waveStr,"UU") 1225 ExecutePolarizedProtocol(waveStr,"DU") 1226 ExecutePolarizedProtocol(waveStr,"DD") 1227 ExecutePolarizedProtocol(waveStr,"UD") 1228 else 1229 ExecutePolarizedProtocol(waveStr,pType) 1230 endif 1231 1232 1233 return(0) 1234 End 1235 1236 // very similar to ExecuteProtocol 1237 // 1238 // -- SAM, EMP, and BGD do not need to be loaded 1239 // -- but they do need to be "moved" into the regular data positions 1240 // rather then their tagged locations. 1241 // 1242 Function ExecutePolarizedProtocol(protStr,pType) 1243 String protStr,pType 1244 1245 //protStr is the full path to the selected protocol wave 1246 WAVE/T prot = $protStr 1247 SetDataFolder root:myGlobals:Protocols 1248 1249 Variable filesOK,err,notDone 1250 String activeType, msgStr, junkStr, pathStr="", samStr="" 1251 PathInfo catPathName //this is where the files are 1252 pathStr=S_path 1253 1254 NVAR useXMLOutput = root:Packages:NIST:gXML_Write 1255 1256 //Parse the instructions in the prot wave 1257 //0 - bkg 1258 //1 - emp 1259 //2 - div 1260 //3 - mask 1261 //4 - abs params c2-c5 1262 //5 - average params 1263 //6 = DRK file (**out of sequence) 1264 1265 // don't load the SAM data, just re-tag it 1266 // the Polarization corrected data is UU_pc, DU_pc, etc. 1267 // this tags it for display, and puts it in the correctly named waves 1268 String dataType,str 1269 1270 dataType="SAM" 1271 sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType+"_pc" 1272 Execute str 1273 1274 // don't load the EMP data, just re-tag it 1275 dataType="EMP" 1276 sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType+"_pc" 1277 Execute str 1278 1279 // don't load the BGD data, just re-tag it 1280 dataType="BGD" 1281 sprintf str,"DisplayTaggedData(\"%s\",\"%s\")",dataType,pType+"_pc" 1282 Execute str 1283 1284 // 1285 // from here down, the steps are identical 1286 // 1287 // - with the exceptions of: 1288 // - file naming. Names are additionally tagged with pType 1289 // - if the protocol[0] or [1] are "" <null>, then the step will be used 1290 // the step is only skipped if the protocol is "none" 1291 // 1292 1293 1294 //do the CORRECT step based on the answers to emp and bkg subtraction 1295 //by setting the proper"mode" 1296 //1 = both emp and bgd subtraction 1297 //2 = only bgd subtraction 1298 //3 = only emp subtraction 1299 //4 = no subtraction 1300 //additional modes 091301 1301 // ------currently, for polarized reduction, DRK mode is not allowed or recognized at all... 1302 //11 = emp, bgd, drk 1303 //12 = bgd and drk 1304 //13 = emp and drk 1305 //14 = no subtractions 1306 //work.drk is from proto[6] 1307 // 1308 //subtracting just the DRK data is NOT an option - it doesnt' really make any physical sense 1309 // - in this case, DRK is skipped (equivalent to mode==4) 1310 // automatically accounts for attenuators given the lookup tables and the 1311 //desired subtractions 1312 //Attenuator lookup tables are alredy implemented (NG1 = NG7) 1313 // 1314 1315 //dispatch to the proper "mode" of Correct() 1316 Variable mode=4,val 1317 do 1318 if( (cmpstr("none",prot[0]) == 0) && (cmpstr("none",prot[1]) == 0) ) 1319 //no subtraction (mode = 4), 1320 mode = 4 1321 Endif 1322 If((cmpstr(prot[0],"none") != 0) && (cmpstr(prot[1],"none") == 0)) 1323 //subtract BGD only 1324 mode=2 1325 Endif 1326 If((cmpstr(prot[0],"none") == 0) && (cmpstr(prot[1],"none") != 0)) 1327 //subtract EMP only 1328 mode=3 1329 Endif 1330 If((cmpstr(prot[0],"none") != 0) && (cmpstr(prot[1],"none") != 0)) 1331 // bkg and emp subtraction are to be done (BOTH not "none") 1332 mode=1 1333 Endif 1334 activeType = "COR" 1335 // //add in DRK mode (0= no used, 10 = used) 1336 // val = NumberByKey("DRKMODE",prot[6],"=","," ) 1337 // mode += val 1338 // print "Correct mode = ",mode 1339 err = Correct(mode) 1340 if(err) 1341 SetDataFolder root: 1342 Abort "error in Correct, called from executeprotocol, normal cor" 1343 endif 1344 UpdateDisplayInformation(ActiveType) //update before breaking from loop 1345 While(0) 1346 1347 //check for work.div file (prot[2]) 1348 //add if needed 1349 // can't properly check the filename - so for now add and divide, if anything other than "none" 1350 //do/skip divide step based on div answer 1351 If(cmpstr("none",prot[2])!=0) // if !0, then there's a file requested 1352 If(cmpstr("ask",prot[2]) == 0) 1353 //ask user for file 1354 junkStr = PromptForPath("Select the detector sensitivity file") 1355 If(strlen(junkStr)==0) 1356 SetDataFolder root: 1357 Abort "No file selected, data reduction aborted" 1358 Endif 1359 ReadHeaderAndWork("DIV", junkStr) 1360 else 1361 //assume it's a path, and that the first (and only) item is the path:file 1362 //list processing is necessary to remove any final comma 1363 junkStr = pathStr + StringFromList(0, prot[2],"," ) 1364 ReadHeaderAndWork("DIV",junkStr) 1365 Endif 1366 //got a DIV file, select the proper type of work data to DIV (= activeType) 1367 err = Divide_work(activeType) //returns err = 1 if data doesn't exist in specified folders 1368 If(err) 1369 SetDataFolder root: 1370 Abort "data missing in DIV step, call from executeProtocol" 1371 Endif 1372 activeType = "CAL" 1373 UpdateDisplayInformation(ActiveType) //update before breaking from loop 1374 Endif 1375 1376 Variable c2,c3,c4,c5,kappa_err 1377 //do absolute scaling if desired 1378 if(cmpstr("none",prot[4])!=0) 1379 if(cmpstr("ask",prot[4])==0) 1380 //get the params from the user 1381 Execute "AskForAbsoluteParams_Quest()" 1382 //then from the list 1383 SVAR junkAbsStr = root:myGlobals:Protocols:gAbsStr 1384 c2 = NumberByKey("TSTAND", junkAbsStr, "=", ";") //parse the list of values 1385 c3 = NumberByKey("DSTAND", junkAbsStr, "=", ";") 1386 c4 = NumberByKey("IZERO", junkAbsStr, "=", ";") 1387 c5 = NumberByKey("XSECT", junkAbsStr, "=", ";") 1388 kappa_err = NumberByKey("SDEV", junkAbsStr, "=", ";") 1389 else 1390 //get the parames from the list 1391 c2 = NumberByKey("TSTAND", prot[4], "=", ";") //parse the list of values 1392 c3 = NumberByKey("DSTAND", prot[4], "=", ";") 1393 c4 = NumberByKey("IZERO", prot[4], "=", ";") 1394 c5 = NumberByKey("XSECT", prot[4], "=", ";") 1395 kappa_err = NumberByKey("SDEV", prot[4], "=", ";") 1396 Endif 1397 //get the sample trans and thickness from the activeType folder 1398 String destStr = "root:Packages:NIST:"+activeType+":realsread" 1399 Wave dest = $destStr 1400 Variable c0 = dest[4] //sample transmission 1401 Variable c1 = dest[5] //sample thickness 1402 1403 err = Absolute_Scale(activeType,c0,c1,c2,c3,c4,c5,kappa_err) 1404 if(err) 1405 SetDataFolder root: 1406 Abort "Error in Absolute_Scale(), called from executeProtocol" 1407 endif 1408 activeType = "ABS" 1409 UpdateDisplayInformation(ActiveType) //update before breaking from loop 1410 Endif 1411 1412 //check for mask 1413 //add mask if needed 1414 // can't properly check the filename - so for now always add 1415 //doesn't change the activeType 1416 if(cmpstr("none",prot[3])!=0) 1417 If(cmpstr("ask",prot[3])==0) 1418 //get file from user 1419 junkStr = PromptForPath("Select Mask file") 1420 If(strlen(junkStr)==0) 1421 //no selection of mask file is not a fatal error, keep going, and let cirave() 1422 //make a "null" mask 1423 //if none desired, make sure that the old mask is deleted 1424 //junkStr = GetDataFolder(1) 1425 //SetDataFolder root:Packages:NIST:MSK 1426 KillWaves/Z root:Packages:NIST:MSK:data 1427 //SetDataFolder junkStr 1428 DoAlert 0,"No Mask file selected, data not masked" 1429 else 1430 //read in the file from the dialog 1431 ReadMCID_MASK(junkStr) 1432 Endif 1433 else 1434 //just read it in from the protocol 1435 //list processing is necessary to remove any final comma 1436 junkStr = pathStr + StringFromList(0, prot[3],"," ) 1437 ReadMCID_MASK(junkStr) 1438 Endif 1439 else 1440 //if none desired, make sure that the old mask is deleted 1441 //junkStr = GetDataFolder(1) 1442 //SetDataFolder root:Packages:NIST:MSK 1443 KillWaves/Z root:Packages:NIST:MSK:data 1444 //SetDataFolder junkStr 1445 Endif 1446 1447 //mask data if desired (this is done automatically in the average step) and is 1448 //not done explicitly here (if no mask in MSK folder, a null mask is created and "used") 1449 1450 // average/save data as specified 1451 1452 //Parse the keyword=<Value> string as needed, based on AVTYPE 1453 1454 //average/plot first 1455 String av_type = StringByKey("AVTYPE",prot[5],"=",";") 1456 If(cmpstr(av_type,"none") != 0) 1457 If (cmpstr(av_type,"")==0) //if the key could not be found... (if "ask" the string) 1458 //get the averaging parameters from the user, as if the set button was hit 1459 //in the panel 1460 SetAverageParamsButtonProc("dummy") //from "ProtocolAsPanel" 1461 SVAR tempAveStr = root:myGlobals:Protocols:gAvgInfoStr 1462 av_type = StringByKey("AVTYPE",tempAveStr,"=",";") 1463 else 1464 //there is info in the string, use the protocol 1465 //set the global keyword-string to prot[5] 1466 String/G root:myGlobals:Protocols:gAvgInfoStr = prot[5] 1467 Endif 1468 Endif 1469 1470 //convert the folder to linear scale before averaging, then revert by calling the window hook 1471 ConvertFolderToLinearScale(activeType) 1472 1473 strswitch(av_type) //dispatch to the proper routine to average to 1D data 1474 case "none": 1475 //still do nothing 1476 break 1477 case "2D_ASCII": 1478 //do nothing 1479 break 1480 case "QxQy_ASCII": 1481 //do nothing 1482 break 1483 case "PNG_Graphic": 1484 //do nothing 1485 break 1486 case "Rectangular": 1487 RectangularAverageTo1D(activeType) 1488 break 1489 case "Annular": 1490 AnnularAverageTo1D(activeType) 1491 break 1492 case "Circular": 1493 CircularAverageTo1D(activeType) 1494 break 1495 case "Sector": 1496 CircularAverageTo1D(activeType) 1497 break 1498 case "Sector_PlusMinus": 1499 Sector_PlusMinus1D(activeType) 1500 break 1501 default: 1502 //do nothing 1503 endswitch 1504 ///// end of averaging dispatch 1505 // put data back on log or lin scale as set by default 1506 fRawWindowHook() 1507 1508 //save data if desired 1509 String fullpath = "", newfileName="" 1510 String item = StringByKey("SAVE",prot[5],"=",";") //does user want to save data? 1511 If( (cmpstr(item,"Yes")==0) && (cmpstr(av_type,"none") != 0) ) 1512 //then save 1513 //get name from textwave of the activeType dataset 1514 String textStr = "root:Packages:NIST:"+activeType+":textread" 1515 Wave/T textPath = $textStr 1516 String tempFilename = samStr 1517 If(WaveExists(textPath) == 1) 1518 #if (exists("QUOKKA")==6) 1519 newFileName = ReplaceString(".nx.hdf", tempFilename, "") 1520 #elif (exists("HFIR")==6) 1521 // newFileName = ReplaceString(".xml",textPath[0],"") //removes 4 chars 1522 // newFileName = ReplaceString("SANS",newFileName,"") //removes 4 more chars = 8 1523 // newFileName = ReplaceString("exp",newFileName,"") //removes 3 more chars = 11 1524 // newFileName = ReplaceString("scan",newFileName,"") //removes 4 more chars = 15, should be enough? 1525 newFileName = GetPrefixStrFromFile(textPath[0])+GetRunNumStrFromFile(textPath[0]) 1526 #else 1527 newFileName = UpperStr(GetNameFromHeader(textPath[0])) //NCNR data drops here, trims to 8 chars 1528 #endif 1529 else 1530 newFileName = "" //if the header is missing? 1531 //Print "can't read the header - newfilename is null" 1532 Endif 1533 1534 //pick ABS or AVE extension 1535 String exten = activeType 1536 if(cmpstr(exten,"ABS") != 0) 1537 exten = "AVE" 1538 endif 1539 if(cmpstr(av_type,"2D_ASCII") == 0) 1540 exten = "ASC" 1541 endif 1542 if(cmpstr(av_type,"QxQy_ASCII") == 0) 1543 exten = "DAT" 1544 endif 1545 1546 // add an "x" to the file extension if the output is XML 1547 // currently (2010), only for ABS and AVE (1D) output 1548 if( cmpstr(exten,"ABS") == 0 || cmpstr(exten,"AVE") == 0 ) 1549 if(useXMLOutput == 1) 1550 exten += "x" 1551 endif 1552 endif 1553 1554 //Path is catPathName, symbolic path 1555 //if this doesn't exist, a dialog will be presented by setting dialog = 1 1556 // 1557 // -- add in pType tag to the name 1558 // 1559 Variable dialog = 0 1560 PathInfo/S catPathName 1561 item = StringByKey("NAME",prot[5],"=",";") //Auto or Manual naming 1562 String autoname = StringByKey("AUTONAME",prot[5],"=",";") //autoname - will get empty string if not present 1563 If((cmpstr(item,"Manual")==0) || (cmpstr(newFileName,"") == 0)) 1564 //manual name if requested or if no name can be derived from header 1565 fullPath = newfileName + pType + "."+ exten //puts possible new name or null string in dialog 1566 dialog = 1 //force dialog for user to enter name 1567 else 1568 //auto-generate name and prepend path - won't put up any dialogs since it has all it needs 1569 //use autoname if present 1570 if (cmpstr(autoname,"") != 0) 1571 fullPath = S_Path + autoname + pType + "." +exten 1572 else 1573 fullPath = S_Path + newFileName + pType + "." + exten 1574 endif 1575 Endif 1576 // 1577 strswitch(av_type) 1578 case "Annular": 1579 WritePhiave_W_Protocol(activeType,fullPath,dialog) 1580 break 1581 case "2D_ASCII": 1582 Fast2DExport(activeType,fullPath,dialog) 1583 break 1584 case "QxQy_ASCII": 1585 QxQy_Export(activeType,fullPath,dialog) 1586 break 1587 case "PNG_Graphic": 1588 SaveAsPNG(activeType,fullpath,dialog) 1589 break 1590 default: 1591 if (useXMLOutput == 1) 1592 WriteXMLWaves_W_Protocol(activeType,fullPath,dialog) 1593 else 1594 WriteWaves_W_Protocol(activeType,fullpath,dialog) 1595 endif 1596 endswitch 1597 1598 //Print "data written to: "+ fullpath 1599 Endif 1600 1601 //done with everything in protocol list 1602 return(0) 1603 End 1604 1605 1606 // just like the RecallProtocolButton 1607 // - the reset function is different 1608 // 1609 Function RecallPolCorProtocolButton(ctrlName) : ButtonControl 1610 String ctrlName 1611 1612 //will reset panel values based on a previously saved protocol 1613 //pick a protocol wave from the Protocols folder 1614 //MUST move to Protocols folder to get wavelist 1615 SetDataFolder root:myGlobals:Protocols 1616 Execute "PickAProtocol()" 1617 1618 //get the selected protocol wave choice through a global string variable 1619 SVAR protocolName = root:myGlobals:Protocols:gProtoStr 1620 1621 //If "CreateNew" was selected, ask user to try again 1622 if(cmpstr("CreateNew",protocolName) == 0) 1623 Abort "CreateNew is for making a new Protocol. Select a previously saved Protocol" 1624 Endif 1625 1626 //reset the panel based on the protocol textwave (currently a string) 1627 ResetToSavedPolProtocol(protocolName) 1628 1629 SetDataFolder root: 1630 return(0) 1631 end 1632 1633 //function that actually parses the protocol specified by nameStr 1634 //which is just the name of the wave, without a datafolder path 1635 // 1636 Function ResetToSavedPolProtocol(nameStr) 1637 String nameStr 1638 1639 //allow special cases of Base and DoAll Protocols to be recalled to panel - since they "ask" 1640 //and don't need paths 1641 1642 String catPathStr 1643 PathInfo catPathName 1644 catPathStr=S_path 1645 1646 //SetDataFolder root:myGlobals:Protocols //on windows, data folder seems to get reset (erratically) to root: 1647 Wave/T w=$("root:myGlobals:Protocols:" + nameStr) 1648 1649 String fullPath="",comma=",",list="",nameList="",PathStr="",item="" 1650 Variable ii=0,numItems,checked,specialProtocol=0 1651 1652 if((cmpstr(nameStr,"Base")==0) || (cmpstr(nameStr,"DoAll")==0)) 1653 return(0) //don't allow these 1654 Endif 1655 1656 //background = check5 1657 checked = 1 1658 nameList = w[0] 1659 If(cmpstr(nameList,"none") ==0) 1660 checked = 0 1661 Endif 1662 1663 //set the global string to display and checkbox 1664 CheckBox check5 win=PolCor_Panel,value=checked 1665 1666 //EMP = check4 1667 checked = 1 1668 nameList = w[1] 1669 If(cmpstr(nameList,"none") ==0) 1670 checked = 0 1671 Endif 1672 1673 //set the global string to display and checkbox 1674 CheckBox check4 win=PolCor_Panel,value=checked 1675 1676 1677 //DIV file 1678 checked = 1 1679 nameList = w[2] 1680 If(cmpstr(nameList,"none") ==0) 1681 checked = 0 1682 Endif 1683 1684 //set the global string to display and checkbox 1685 String/G root:myGlobals:Protocols:gDIV = nameList 1686 CheckBox check0 win=PolCor_Panel,value=checked 1687 1688 //Mask file 1689 checked = 1 1690 nameList = w[3] 1691 If(cmpstr(nameList,"none") ==0) 1692 checked = 0 1693 Endif 1694 1695 //set the global string to display and checkbox 1696 String/G root:myGlobals:Protocols:gMASK = nameList 1697 CheckBox check1 win=PolCor_Panel,value=checked 1698 1699 //4 = abs parameters 1700 list = w[4] 1701 numItems = ItemsInList(list,";") 1702 checked = 1 1703 if(numitems == 4 || numitems == 5) //allow for protocols with no SDEV list item 1704 //correct number of parameters, assume ok 1705 String/G root:myGlobals:Protocols:gAbsStr = list 1706 CheckBox check2 win=PolCor_Panel,value=checked 1707 else 1708 item = StringFromList(0,list,";") 1709 if(cmpstr(item,"none")==0) 1710 checked = 0 1711 list = "none" 1712 String/G root:myGlobals:Protocols:gAbsStr = list 1713 CheckBox check2 win=PolCor_Panel,value=checked 1714 else 1715 //force to "ask" 1716 checked = 1 1717 String/G root:myGlobals:Protocols:gAbsStr = "ask" 1718 CheckBox check2 win=PolCor_Panel,value=checked 1719 Endif 1720 Endif 1721 1722 //5 = averaging choices 1723 list = w[5] 1724 item = StringByKey("AVTYPE",list,"=",";") 1725 if(cmpstr(item,"none") == 0) 1726 checked = 0 1727 String/G root:myGlobals:Protocols:gAVE = "none" 1728 CheckBox check3 win=PolCor_Panel,value=checked 1729 else 1730 checked = 1 1731 String/G root:myGlobals:Protocols:gAVE = list 1732 CheckBox check3 win=PolCor_Panel,value=checked 1733 Endif 1734 1735 //6 = DRK choice 1736 1737 //7 = unused 1738 1739 //all has been reset, get out 1740 Return (0) 1741 End 1742 1743 // at a first pass, uses the regular reduction protocol SaveProtocolButton(ctrlName) 1744 // 1745 // -- won't work, as it uses the MakeProtocolFromPanel function... so replace this 1746 // 1747 Function SavePolCorProtocolButton(ctrlName) : ButtonControl 1748 String ctrlName 1749 1750 1751 Variable notDone=1, newProto=1 1752 //will prompt for protocol name, and save the protocol as a text wave 1753 //prompt for name of new protocol wave to save 1754 do 1755 Execute "AskForName()" 1756 SVAR newProtocol = root:myGlobals:Protocols:gNewStr 1757 1758 //make sure it's a valid IGOR name 1759 newProtocol = CleanupName(newProtocol,0) //strict naming convention 1760 String/G root:myGlobals:Protocols:gNewStr=newProtocol //reassign, if changed 1761 Print "newProtocol = ",newProtocol 1762 1763 SetDataFolder root:myGlobals:Protocols 1764 if(WaveExists( $("root:myGlobals:Protocols:" + newProtocol) ) == 1) 1765 //wave already exists 1766 DoAlert 1,"That name is already in use. Do you wish to overwrite the existing protocol?" 1767 if(V_Flag==1) 1768 notDone = 0 1769 newProto = 0 1770 else 1771 notDone = 1 1772 endif 1773 else 1774 //name is good 1775 notDone = 0 1776 Endif 1777 while(notDone) 1778 1779 //current data folder is root:myGlobals:Protocols 1780 if(newProto) 1781 Make/O/T/N=8 $("root:myGlobals:Protocols:" + newProtocol) 1782 Endif 1783 1784 // MakeProtocolFromPanel( $("root:myGlobals:Protocols:" + newProtocol) ) 1785 MakePolProtocolFromPanel( $("root:myGlobals:Protocols:" + newProtocol) ) 1786 String/G root:myGlobals:Protocols:gProtoStr = newProtocol 1787 1788 //the data folder WAS changed above, this must be reset to root: 1789 SetDatafolder root: 1790 1791 return(0) 1792 End 1793 1794 //function that does the guts of reading the panel controls and globals 1795 //to create the necessary text fields for a protocol 1796 //Wave/T w (input) is an empty text wave of 8 elements for the protocol 1797 //on output, w[] is filled with the protocol strings as needed from the panel 1798 // 1799 Function MakePolProtocolFromPanel(w) 1800 Wave/T w 1801 1802 //construct the protocol text wave form the panel 1803 //it is to be parsed by ExecuteProtocol() for the actual data reduction 1804 PathInfo catPathName //this is where the files came from 1805 String pathstr=S_path,tempStr,curList 1806 Variable checked,ii,numItems 1807 1808 //look for checkboxes, then take each item in list and prepend the path 1809 //w[0] = background 1810 ControlInfo/W=PolCor_Panel check5 1811 checked = V_Value 1812 if(checked) 1813 w[0] = "" // BKG will be used 1814 else 1815 w[0] = "none" // BKG will not be used 1816 endif 1817 1818 //w[1] = empty 1819 ControlInfo/W=PolCor_Panel check4 1820 checked = V_Value 1821 if(checked) 1822 w[1] = "" // EMP will be used 1823 else 1824 w[1] = "none" // EMP will not be used 1825 endif 1826 1827 1828 //w[2] = div file 1829 ControlInfo/W=PolCor_Panel check0 1830 checked = V_value 1831 if(checked) 1832 //build the list 1833 //just read the global 1834 SVAR str=root:myGlobals:Protocols:gDIV 1835 if(cmpstr(str,"ask")==0) 1836 w[2] = str 1837 else 1838 tempStr = ParseRunNumberList(str) 1839 if(strlen(tempStr)==0) 1840 return(1) 1841 else 1842 w[2] = tempstr 1843 str=tempstr 1844 endif 1845 endif 1846 else 1847 //none used - set textwave (and global?) 1848 w[2] = "none" 1849 String/G root:myGlobals:Protocols:gDIV = "none" 1850 endif 1851 1852 //w[3] = mask file 1853 ControlInfo/W=PolCor_Panel check1 1854 checked = V_value 1855 if(checked) 1856 //build the list 1857 //just read the global 1858 SVAR str=root:myGlobals:Protocols:gMASK 1859 if(cmpstr(str,"ask")==0) 1860 w[3] = str 1861 else 1862 tempstr = ParseRunNumberList(str) 1863 if(strlen(tempstr)==0) 1864 return(1) 1865 else 1866 w[3] = tempstr 1867 str = tempstr 1868 endif 1869 endif 1870 else 1871 //none used - set textwave (and global?) 1872 w[3] = "none" 1873 String/G root:myGlobals:Protocols:gMASK = "none" 1874 endif 1875 1876 //w[4] = abs parameters 1877 ControlInfo/W=PolCor_Panel check2 1878 checked = V_value 1879 if(checked) 1880 //build the list 1881 //just read the global 1882 SVAR str=root:myGlobals:Protocols:gAbsStr 1883 w[4] = str 1884 else 1885 //none used - set textwave (and global?) 1886 w[4] = "none" 1887 String/G root:myGlobals:Protocols:gAbsStr = "none" 1888 endif 1889 1890 //w[5] = averaging choices 1891 ControlInfo/W=PolCor_Panel check3 1892 checked = V_value 1893 if(checked) 1894 //just read the global 1895 SVAR avestr=root:myGlobals:Protocols:gAVE 1896 w[5] = avestr 1897 else 1898 //none used - set textwave 1899 w[5] = "AVTYPE=none;" 1900 endif 1901 1902 //w[6] 1903 //work.DRK information 1904 SVAR drkStr=root:myGlobals:Protocols:gDRK 1905 w[6] = "" 1906 1907 //w[7] 1908 //currently unused 1909 w[7] = "" 1910 1911 return(0) 738 1912 End 739 1913 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/Polarization/Pol_PolarizationPanels.ipf
r816 r817 279 279 280 280 281 // 282 // TODO: 283 // - parsing routines 284 // - write the results to a waveNote 285 // --- where to store the intermediate results of trans values? 286 // make a wave behind the scenes to 287 // 288 // 281 289 282 // Decay parameters for each cell. Results are stored in a wave note for each cell 290 283 // … … 410 403 case 2: // mouse up 411 404 // click code here 412 Variable gamma_val,err_gamma,muPo, err_muPo, Po, err_Po 405 Variable gamma_val,err_gamma,muPo, err_muPo, Po, err_Po, runNum 413 406 414 407 ControlInfo/W=DecayPanel popup_0 … … 426 419 Prompt err_muPo, "Enter err_muPo: " 427 420 Prompt gamma_val, "Enter gamma: " 428 Prompt err_gamma, "Enter err_gamma: " 429 DoPrompt "Enter Cell Decay Parameters", Po, err_Po, muPo, err_muPo, gamma_val, err_gamma 421 Prompt err_gamma, "Enter err_gamma: " 422 Prompt runNum,"Run number for time=0 of decay" 423 DoPrompt "Enter Cell Decay Parameters", Po, err_Po, muPo, err_muPo, gamma_val, err_gamma, runNum 430 424 if (V_Flag) 431 425 return -1 // User canceled 432 426 endif 433 427 428 fname = FindFileFromRunNumber(runNum) 429 t0str = getFileCreationDate(fname) 430 434 431 // for the wave note 435 432 noteStr = note(decay) … … 440 437 noteStr = ReplaceNumberByKey("gamma", noteStr, gamma_val ,"=", ",", 0) 441 438 noteStr = ReplaceNumberByKey("err_gamma", noteStr, err_gamma ,"=", ",", 0) 442 439 noteStr = ReplaceStringByKey("T0", noteStr, t0Str ,"=", ",", 0) 443 440 // replace the string 444 441 Note/K decay … … 448 445 SVAR gGamma = root:Packages:NIST:Polarization:Cells:gGamma 449 446 SVAR gMuPo = root:Packages:NIST:Polarization:Cells:gMuPo 450 SVAR gPo = root:Packages:NIST:Polarization:Cells:gPo 447 SVAR gPo = root:Packages:NIST:Polarization:Cells:gPo 448 SVAR gT0 = root:Packages:NIST:Polarization:Cells:gT0 449 450 gT0 = t0Str //for display 451 451 sprintf gMuPo, "%g +/- %g",muPo, err_muPo 452 452 sprintf gPo, "%g +/- %g",Po,err_Po
Note: See TracChangeset
for help on using the changeset viewer.