- Timestamp:
- Jan 28, 2013 5:23:14 PM (10 years ago)
- File:
-
- 1 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
Note: See TracChangeset
for help on using the changeset viewer.