Changeset 891
- Timestamp:
- Jan 28, 2013 5:23:14 PM (10 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/Wrapper_v40.ipf
r876 r891 444 444 return 0 445 445 End 446 447 448 // always pass this the function string449 //450 // this is new in the 2009 release, so make sure that it generates itself as needed.451 // Two options: (1) search and construct as needed, ask for intervention if I need it.452 // (2) since I'm passed the function, try to replot it to re-run the function453 // to fill in the strings. (Being sure to save the coefficients)454 //455 // using method (1) to fill in what I need with no intervention456 //457 Function/S getFunctionParams(funcStr)458 String funcStr459 460 String paramStr=""461 SVAR/Z listStr=root:Packages:NIST:paramKWStr462 463 if(SVAR_Exists(listStr))464 paramStr = StringByKey(funcStr, listStr ,"=",";",0)465 if(strlen(paramStr)!=0) //will drop out of loop if string can't be found466 return(paramStr)467 endif468 else //global string does not exist, create it and fill it in469 Variable/G root:Pacakges:NIST:gReconstructStrings = 1 //coefficients old style and must be rebuilt too470 String/G root:Packages:NIST:paramKWStr=""471 SVAR/Z listStr=root:Packages:NIST:paramKWStr472 endif473 474 // find everything to rebuild only if the model has been plotted (if so, coefficients will exist)475 String coef = getFunctionCoef(funcStr)476 if(strlen(coef)==0)477 //model not plotted, don't reconstruct, return null string478 return(paramStr)479 endif480 481 ///// NEED TO BE IN PROPER DATA FOLDER FOR SMEARED FUNCTIONS482 // FUNCTION POP MENU WILL LOOK IN ROOT OTHERWISE483 ControlInfo/W=WrapperPanel popup_0484 String folderStr=S_Value485 // this if/else/endif should not ever return an error alert486 // it should simply set the data folder properly487 if(Stringmatch(funcStr,"Smear*")) //simple test for smeared function488 if(DataFolderExists("root:"+folderStr))489 SetDataFolder $("root:"+folderStr)490 else491 SetDataFolder root:492 endif493 else494 SetDataFolder root:495 endif496 497 // model was plotted, find the suffix to fill in the parameter wave498 SVAR suffListStr=root:Packages:NIST:suffixKWStr499 String suffix = StringByKey(coef, suffListStr ,"=",";",0)500 501 String paramWave = WaveList("*par*"+suffix,"","TEXT:1") //should be one wave name, no trailing semicolon502 listStr += funcStr+"="+paramWave+";"503 504 //now look it up again505 paramStr = StringByKey(funcStr, listStr ,"=",";",0)506 507 return(paramStr)508 End509 510 // always pass this the function string511 //512 Function/S getFunctionCoef(funcStr)513 String funcStr514 515 SVAR listStr=root:Packages:NIST:coefKWStr516 String coefStr = StringByKey(funcStr, listStr ,"=",";",0)517 518 return(coefStr)519 End520 521 // always pass this the Function string522 //523 // does NOT return the leading "_" as part of the suffix524 // may need to set the string correctly - so lost of messing around for back-compatibility525 Function/S getModelSuffix(funcStr)526 String funcStr527 528 SVAR listStr=root:Packages:NIST:suffixKWStr529 String suffixStr = StringByKey(funcStr, listStr ,"=",";",0)530 531 if(strlen(suffixStr) !=0) //found it, get out532 return(suffixStr)533 endif534 535 // was the model plotted?536 String coef = getFunctionCoef(funcStr)537 if(strlen(coef)==0)538 //nothing plotted539 return("")540 else541 //plotted, find the coeff542 String suffix = StringByKey(coef, ListStr ,"=",";",0)543 544 // add to the suffix list in the new style, if it was found545 if(strlen(suffix) !=0)546 listStr += funcStr+"="+suffix+";"547 endif548 return(suffix)549 endif550 551 return("")552 End553 554 446 555 447 -
sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtilsMacro_v40.ipf
r888 r891 27 27 28 28 if(exists("root:Packages:NIST:paramKWStr")==0) 29 //String/G root:Packages:NIST:coefKWStr=""29 String/G root:Packages:NIST:coefKWStr="" 30 30 String/G root:Packages:NIST:paramKWStr="" 31 //String/G root:Packages:NIST:suffixKWStr=""31 String/G root:Packages:NIST:suffixKWStr="" 32 32 endif 33 33 SVAR coefKWStr = root:Packages:NIST:coefKWStr … … 38 38 suffixKWStr += funcStr+"="+suffix+";" 39 39 end 40 41 // always pass this the function string 42 // 43 // this is new in the 2009 release, so make sure that it generates itself as needed. 44 // Two options: (1) search and construct as needed, ask for intervention if I need it. 45 // (2) since I'm passed the function, try to replot it to re-run the function 46 // to fill in the strings. (Being sure to save the coefficients) 47 // 48 // using method (1) to fill in what I need with no intervention 49 // 50 Function/S getFunctionParams(funcStr) 51 String funcStr 52 53 String paramStr="" 54 SVAR/Z listStr=root:Packages:NIST:paramKWStr 55 56 if(SVAR_Exists(listStr)) 57 paramStr = StringByKey(funcStr, listStr ,"=",";",0) 58 if(strlen(paramStr)!=0) //will drop out of loop if string can't be found 59 return(paramStr) 60 endif 61 else //global string does not exist, create it and fill it in 62 Variable/G root:Pacakges:NIST:gReconstructStrings = 1 //coefficients old style and must be rebuilt too 63 String/G root:Packages:NIST:paramKWStr="" 64 SVAR/Z listStr=root:Packages:NIST:paramKWStr 65 endif 66 67 // find everything to rebuild only if the model has been plotted (if so, coefficients will exist) 68 String coef = getFunctionCoef(funcStr) 69 if(strlen(coef)==0) 70 //model not plotted, don't reconstruct, return null string 71 return(paramStr) 72 endif 73 74 ///// NEED TO BE IN PROPER DATA FOLDER FOR SMEARED FUNCTIONS 75 // FUNCTION POP MENU WILL LOOK IN ROOT OTHERWISE 76 ControlInfo/W=WrapperPanel popup_0 77 String folderStr=S_Value 78 // this if/else/endif should not ever return an error alert 79 // it should simply set the data folder properly 80 if(Stringmatch(funcStr,"Smear*")) //simple test for smeared function 81 if(DataFolderExists("root:"+folderStr)) 82 SetDataFolder $("root:"+folderStr) 83 else 84 SetDataFolder root: 85 endif 86 else 87 SetDataFolder root: 88 endif 89 90 // model was plotted, find the suffix to fill in the parameter wave 91 SVAR suffListStr=root:Packages:NIST:suffixKWStr 92 String suffix = StringByKey(coef, suffListStr ,"=",";",0) 93 94 String paramWave = WaveList("*par*"+suffix,"","TEXT:1") //should be one wave name, no trailing semicolon 95 listStr += funcStr+"="+paramWave+";" 96 97 //now look it up again 98 paramStr = StringByKey(funcStr, listStr ,"=",";",0) 99 100 return(paramStr) 101 End 102 103 // always pass this the function string 104 // 105 Function/S getFunctionCoef(funcStr) 106 String funcStr 107 108 SVAR listStr=root:Packages:NIST:coefKWStr 109 String coefStr = StringByKey(funcStr, listStr ,"=",";",0) 110 111 return(coefStr) 112 End 113 114 // always pass this the Function string 115 // 116 // does NOT return the leading "_" as part of the suffix 117 // may need to set the string correctly - so lost of messing around for back-compatibility 118 Function/S getModelSuffix(funcStr) 119 String funcStr 120 121 SVAR listStr=root:Packages:NIST:suffixKWStr 122 String suffixStr = StringByKey(funcStr, listStr ,"=",";",0) 123 124 if(strlen(suffixStr) !=0) //found it, get out 125 return(suffixStr) 126 endif 127 128 // was the model plotted? 129 String coef = getFunctionCoef(funcStr) 130 if(strlen(coef)==0) 131 //nothing plotted 132 return("") 133 else 134 //plotted, find the coeff 135 String suffix = StringByKey(coef, ListStr ,"=",";",0) 136 137 // add to the suffix list in the new style, if it was found 138 if(strlen(suffix) !=0) 139 listStr += funcStr+"="+suffix+";" 140 endif 141 return(suffix) 142 endif 143 144 return("") 145 End 146 147 148 ///////////////////////////// 149 150 151 40 152 41 153 // loads a 1-d (ascii) datafile and plots the data -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf
r890 r891 166 166 167 167 PlotEC_Empirical(100,0.001,0.7) // plot an empirical empty cell, only used for the simulation, not needed for SASCALC 168 KillTopGraphAndTable(1) // then kill the graph and table that the macro generates 168 // KillTopGraphAndTable(1) // then kill the graph and table that the macro generates (but the function is in Wrapper, which is often not loaded 169 String topGraph= WinName(0,1) //this is the topmost graph 170 String topTable= WinName(0,2) //this is the topmost table 171 KillWindow $topGraph 172 KillWindow $topTable 173 169 174 170 175 //tick labels for SDD slider … … 1023 1028 // 1024 1029 // depending on the state of the 2D flag, open the 1d or 2d control panel 1030 // AND - if doing simulation, check first that the Analysis package is loaded - otheriwse lots of errors 1025 1031 Function SimCheckProc(CB_Struct) : CheckBoxControl 1026 1032 STRUCT WMCheckboxAction &CB_Struct … … 1028 1034 1029 1035 if(CB_Struct.checked) 1036 if(exists("SANS_ANA_VERSION")!=2) //if the analysis package is not loaded 1037 // be sure that the SANS Analysis is loaded and compiles 1038 NCNR_AnalysisLoader("Load NCNR Analysis Macros") 1039 endif 1040 1030 1041 NVAR do2D = root:Packages:NIST:SAS:gDoMonteCarlo 1031 1042
Note: See TracChangeset
for help on using the changeset viewer.