Changeset 394 for sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis
- Timestamp:
- Jul 23, 2008 1:11:58 PM (15 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis/Models
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis/Models/Packages/GlobalFit/GlobalFit2_NCNR_v40.ipf
r393 r394 3400 3400 if (V_value) 3401 3401 GFUI_AddMaskWavesToDataSets(DataSets) //SRK - if masking, recalculate the matrix for the USANS data if necessary 3402 else 3403 // if masking is not selected, be sure to reset the USANS matrices (if any) to their original, full dimensions 3404 // new function 3405 GFUI_ResetUSANSMatrices(DataSets) //SRK - if NOT masking, reset any USANS matrices 3402 3406 endif 3403 3407 … … 4076 4080 // return -1 4077 4081 4082 // this will signal the AAOFitFunction to use the full matrix without recalculation 4083 4078 4084 DataSets[i][startingNCols] = "No Mask" 4079 4085 //eSRK 4080 4086 endif 4087 endfor 4088 4089 return 0 4090 end 4091 4092 // if masking is not checked at all, make sure that the full matrix is used for the USANS data sets 4093 // force a recalculate 4094 // set all of the data sets to "no mask", even the SANS data 4095 // SRK July 2008 4096 static Function GFUI_ResetUSANSMatrices(DataSets) 4097 Wave/T DataSets 4098 4099 Wave/T/Z MaskingListWave=root:Packages:NewGlobalFit:MaskingListWave 4100 4101 Variable startingNCols = DimSize(DataSets, 1) 4102 Redimension/N=(-1, startingNCols+1) DataSets 4103 SetDimLabel 1, startingNCols, Masks, DataSets 4104 4105 Variable numSets = DimSize(DataSets, 0) 4106 Variable i 4107 Variable pt1,pt2,mPt1,mPt2 4108 String str,noteStr,DF 4109 4110 for (i = 0; i < NumSets; i += 1) 4111 4112 str=DataSets[i][0] //this seems to work 4113 DF=ParseFilePath(1, str, ":", 1, 0) 4114 // 4115 str=str[0,strlen(str)-3] //remove the "_i" = DataFolder:name 4116 WAVE resW = $(str+"_res") 4117 if((dimsize(resW,1) > 4)) //USANS, NxN 4118 // always force a recalculation, even though the weights_saved exists 4119 // seems easier than shuffling. 4120 Wave data = $(str+"_i") 4121 Variable len=numpnts(data) 4122 USANS_RE_CalcWeights(ParseFilePath(0, str, ":", 1, 0),0,len-1) 4123 4124 // noteStr = note(resW) 4125 // mPt1 = NumberByKey("P1",noteStr,"=",";") 4126 // mPt2 = NumberByKey("P2",noteStr,"=",";") 4127 // Wave/Z mw = $(DataSets[i][startingNCols]) 4128 // 4129 // //find the first 1, then find the zero 4130 // pt1 = 0 4131 // do 4132 // if(mw[pt1]==1) 4133 // break 4134 // endif 4135 // pt1+=1 4136 // while(pt1<numpnts(mw)) 4137 // 4138 // pt2 = pt1 4139 // do 4140 // if(mw[pt2]==0) 4141 // break 4142 // endif 4143 // pt2+=1 4144 // while(pt2<numpnts(mw)) 4145 // pt2 -= 1 4146 // if((mPt1 != pt1) || (mPt2 != pt2) ) 4147 // // need to recalculate 4148 // USANS_RE_CalcWeights(ParseFilePath(0, str, ":", 1, 0),pt1,pt2) 4149 // endif 4150 endif 4151 4152 DataSets[i][startingNCols] = "No Mask" //no mask for any data set 4153 4081 4154 endfor 4082 4155 -
sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis/Models/Packages/Wrapper_v40.ipf
r393 r394 153 153 ControlUpdate/W=WrapperPanel popup_0 154 154 155 // fake mouse up 155 // fake mouse up to pop the menu 156 156 Struct WMPopupAction ps 157 157 ps.eventCode = 2 //fake mouse up 158 // ps.popStr = str159 158 DataSet_PopMenuProc(ps) 160 161 // new data set has been selected, always uncheck the "use cursors", other checkboxes are benign.162 CheckBox check_0,win=WrapperPanel,value=0163 159 endif 164 160 break 165 161 endswitch 166 167 162 168 163 return 0 169 164 End 170 165 171 166 172 // is there a simpler way to do this? 167 // is there a simpler way to do this? I don't think so. 173 168 Function/S W_DataSetPopupList() 174 169 175 String str=GetAList(4),tmp="",onTargetStr="" 176 Variable ii 177 // ControlInfo/W=WrapperPanel check_3 178 // if(V_Value==1) //if "from target" checked 179 // //ther must be a better way to do this 180 // onTargetStr = TraceNameList("",";",1) 181 // onTargetStr = ReplaceString("_i",onTargetStr,"") //get rid of the "_i" 182 // for(ii=0;ii<ItemsInList(onTargetStr);ii+=1) 183 // if(WhichListItem(StringFromList(ii,onTargetStr,";"), str , ";") != -1) 184 // tmp = Addlistitem(StringFromList(ii,onTargetStr,";"),tmp) //only keep the matches w/data folder listing 185 // endif 186 // endfor 187 // return(tmp) 188 // endif 170 String str=GetAList(4) 189 171 190 172 if(strlen(str)==0) … … 383 365 // default epsilon values, sometimes needed for the fit 384 366 385 386 367 WAVE/T LoLim = $("LoLim_"+suffix) 387 368 WAVE/T HiLim = $("HiLim_"+suffix) … … 451 432 Function DataSet_PopMenuProc(pa) : PopupMenuControl 452 433 STRUCT WMPopupAction &pa 453 434 454 435 switch( pa.eventCode ) 455 436 case 2: // mouse up 456 // make sure that the cursors are on/off appropriately 457 // check to make sure there really is a "topmost" graph 458 // String topGraph= WinName(0,1) //this is the topmost graph 459 // if(cmpstr(topGraph,"")==0) //no graphs, uncheck and exit 460 // CheckBox check_0,value=0 461 // else 462 // String ciStr = CsrInfo(A , topGraph) 463 // 464 // ControlInfo/W=wrapperpanel popup_0 465 // String folderStr=S_Value 466 // String traceList = TraceNameList(topGraph, ";", 1 ) 467 // 468 // endif 469 437 // make sure that the cursors are on/off appropriately 438 // let the cursors checkbox decide what to do, sending the current state 439 ControlInfo/W=WrapperPanel check_0 440 STRUCT WMCheckboxAction cba 441 cba.eventCode = 2 442 cba.checked = V_Value 443 UseCursorsWrapperProc(cba) 444 470 445 // then cascade the function/coefficient popups 471 446 Struct WMPopupAction ps … … 782 757 783 758 // 20JUN if useCursors is true, and there are no cursors on the specified data set, uncheck and set to false 759 // this is a last line of defense, and should never actually do anything... 784 760 if(useCursors) 785 761 useCursors = AreCursorsCorrect(folderStr) … … 804 780 // need to recalculate 805 781 USANS_RE_CalcWeights(folderStr,pt1,pt2) 806 endif 782 Print "Done recalculating the matrix" 783 endif 784 807 785 Wave trimResW=$(DF+folderStr+"_res"+"t") //put the trimmed resW in the struct for the fit! 808 786 Wave fs.resW=trimResW 809 810 Print "Done recalculating the matrix" 811 //////WRONG WAY 812 // Make/O/D/N=(newN,newN) $(DF+"crsrResW") 813 // WAVE crsrResW = $(DF+"crsrResW") 814 // crsrResW = resW[p+pt1][q+pt1] 815 // //assign to the struct 816 // WAVE fs.resW = crsrResW 817 ///////////// 818 endif 819 820 if(!useCursors && (dimsize(resW,1) > 4) ) 821 // avoid an odd sequence of y/n cursors that can lead to a truncated res matrix, but useCursors is not selected 822 if(waveExists($("root:"+folderStr+":weights_save"))) 823 Duplicate/O $("root:"+folderStr+":weights_save"), $("root:"+folderStr+":"+folderStr+"_res") 824 endif 825 endif 826 787 788 endif 789 827 790 // create these variables so that FuncFit will set them on exit 828 791 Variable/G V_FitError=0 //0=no err, 1=error,(2^1+2^0)=3=singular matrix … … 1192 1155 switch( cba.eventCode ) 1193 1156 case 2: // mouse up 1157 1194 1158 // check to make sure there really is a "topmost" graph 1195 1159 String topGraph= WinName(0,1) //this is the topmost graph … … 1215 1179 Cursor/P/W=$topGraph/A=0 B, $(folderStr+"_i"),numpnts(yw)-1 //deactivate the one at the high Q end 1216 1180 DoUpdate 1217 // else //if (strlen(ciStr)!=0 && strsearch(traceList, folderStr, 0) != -1 ) //cursors present, but on wrong data1218 //Wave yw=$("root:"+folderStr+":"+folderStr+"_i")1219 //Cursor/P/W=$topGraph A, $(folderStr+"_i"),0 //move the cursors1220 //Cursor/P/W=$topGraph/A=0 B, $(folderStr+"_i"),numpnts(yw)-11221 //DoUpdate1181 elseif (strlen(ciStr)!=0 && strsearch(traceList, folderStr, 0) != -1 ) //cursors present, but on wrong data 1182 Wave yw=$("root:"+folderStr+":"+folderStr+"_i") 1183 Cursor/P/W=$topGraph A, $(folderStr+"_i"),0 //move the cursors 1184 Cursor/P/W=$topGraph/A=0 B, $(folderStr+"_i"),numpnts(yw)-1 1185 DoUpdate 1222 1186 endif 1223 1187 1188 AreCursorsCorrect(folderStr) 1224 1189 else 1225 1190 //print "unchecked, remove the cursors" 1226 1191 // go back to the full matrix for the resolution calculation (not if SANS data...) 1227 1192 if(waveExists($("root:"+folderStr+":weights_save"))) 1228 Duplicate/O $("root:"+folderStr+":weights_save"), $("root:"+folderStr+":"+folderStr+"_res") 1193 Duplicate/O $("root:"+folderStr+":weights_save"), $("root:"+folderStr+":"+folderStr+"_res"),$("root:"+folderStr+":"+folderStr+"_rest") 1229 1194 endif 1195 1230 1196 HideInfo 1231 1197 Cursor/K A … … 1256 1222 if( strsearch(traceAisOn, folderStr, 0) == -1) //data and cursors don't match 1257 1223 CheckBox check_0,win=wrapperpanel,value=0 1224 HideInfo 1225 Cursor/K A 1226 Cursor/K B 1258 1227 return(0) 1259 1228 endif -
sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis/Models/USANS_SlitSmearing_v40.ipf
r347 r394 14 14 // - pass N to CalcR to avoid globals 15 15 16 // 16 ////////////// 17 // 18 //// July 2008 SRK 19 // 20 // For fitting withe cursors, the matrix must be recalculated for the exact range of the data 21 // - but the inital dependency of the model (any number of them) was (were) set up to use the full matrix 22 // -- so: 23 // $_res is the resolution for the dependencies. It is always the full size of the data set. If cursors are used, 24 // it is padded with zeroes at the edges to fill. 25 // 26 // weights_save: is a pristine copy of the resolution matrix for the full data set, as when loaded 27 // $_qt, $_qi, $_qs, $_rest: are "trimmed" sets that use the range specified by the cursors. They are created 28 // at load time and are initially the full data range. 29 // 30 // there is a wave note attached to $_res that has the current point range for the matrix. This is what the 31 // $_rest matrix is expected to be too, so keep these two matrices in sync. 32 // 33 // during fitting, $_rest is used in the structure if cursors are used, since the matrix must be the same dimension (N) 34 // as the (trimmed) data range. It may be the full data range if the cursors are at the ends of the data set. 35 // If no cursors are used, then the $_res wave is used in the structure 36 ////////// 37 38 39 17 40 18 41 // called only by the main file loader … … 69 92 Note weights ,nStr 70 93 94 // make a set of "trimmed" data that is currently the full data set 95 // but will be trimmed as needed for use with cursors 96 // this is necessary to handle the base case of cursors that use the full range of the data! 97 Duplicate/O $(baseStr+"_q") $(baseStr+"_qt") 98 Duplicate/O $(baseStr+"_i") $(baseStr+"_it") 99 Duplicate/O $(baseStr+"_s") $(baseStr+"_st") 100 Duplicate/O weights, $(basestr+"_res"+"t") 101 71 102 // save a copy of the untainted matrix to return to... 72 103 Duplicate/O weights, weights_save
Note: See TracChangeset
for help on using the changeset viewer.