Ignore:
Timestamp:
Jan 28, 2013 5:23:14 PM (10 years ago)
Author:
srkline
Message:

Changes so that the simulation in SASCALC will work well together - it makes sure that the analysis package is loaded if the simulation checkbox is selected.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/Wrapper_v40.ipf

    r876 r891  
    444444        return 0 
    445445End 
    446  
    447  
    448 // always pass this the function string 
    449 // 
    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 function 
    453 // to fill in the strings. (Being sure to save the coefficients) 
    454 // 
    455 // using method (1) to fill in what I need with no intervention 
    456 // 
    457 Function/S getFunctionParams(funcStr) 
    458         String funcStr 
    459  
    460         String paramStr="" 
    461         SVAR/Z listStr=root:Packages:NIST:paramKWStr 
    462  
    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 found 
    466                         return(paramStr) 
    467                 endif 
    468         else    //global string does not exist, create it and fill it in 
    469                 Variable/G root:Pacakges:NIST:gReconstructStrings = 1                   //coefficients old style and must be rebuilt too 
    470                 String/G root:Packages:NIST:paramKWStr="" 
    471                 SVAR/Z listStr=root:Packages:NIST:paramKWStr 
    472         endif    
    473          
    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 string 
    478                 return(paramStr) 
    479         endif 
    480          
    481         ///// NEED TO BE IN PROPER DATA FOLDER FOR SMEARED FUNCTIONS 
    482         // FUNCTION POP MENU WILL LOOK IN ROOT OTHERWISE 
    483         ControlInfo/W=WrapperPanel popup_0 
    484         String folderStr=S_Value 
    485         // this if/else/endif should not ever return an error alert      
    486         // it should simply set the data folder properly         
    487         if(Stringmatch(funcStr,"Smear*"))               //simple test for smeared function 
    488                 if(DataFolderExists("root:"+folderStr)) 
    489                         SetDataFolder $("root:"+folderStr) 
    490                 else 
    491                         SetDataFolder root: 
    492                 endif 
    493         else 
    494                 SetDataFolder root: 
    495         endif 
    496          
    497         // model was plotted, find the suffix to fill in the parameter wave 
    498         SVAR suffListStr=root:Packages:NIST:suffixKWStr 
    499         String suffix = StringByKey(coef, suffListStr  ,"=",";",0) 
    500          
    501         String paramWave = WaveList("*par*"+suffix,"","TEXT:1")         //should be one wave name, no trailing semicolon 
    502         listStr += funcStr+"="+paramWave+";" 
    503  
    504         //now look it up again 
    505         paramStr = StringByKey(funcStr, listStr  ,"=",";",0) 
    506  
    507         return(paramStr) 
    508 End 
    509  
    510 // always pass this the function string 
    511 // 
    512 Function/S getFunctionCoef(funcStr) 
    513         String funcStr 
    514  
    515         SVAR listStr=root:Packages:NIST:coefKWStr 
    516         String coefStr = StringByKey(funcStr, listStr  ,"=",";",0) 
    517  
    518         return(coefStr) 
    519 End 
    520  
    521 // always pass this the Function string 
    522 // 
    523 // does NOT return the leading "_" as part of the suffix 
    524 // may need to set the string correctly - so lost of messing around for back-compatibility 
    525 Function/S getModelSuffix(funcStr) 
    526         String funcStr 
    527  
    528         SVAR listStr=root:Packages:NIST:suffixKWStr 
    529         String suffixStr = StringByKey(funcStr, listStr  ,"=",";",0) 
    530  
    531         if(strlen(suffixStr) !=0)               //found it, get out 
    532                 return(suffixStr) 
    533         endif 
    534          
    535         // was the model plotted? 
    536         String coef = getFunctionCoef(funcStr) 
    537         if(strlen(coef)==0)              
    538                 //nothing plotted 
    539                 return("") 
    540         else 
    541                 //plotted, find the coeff 
    542                 String suffix = StringByKey(coef, ListStr  ,"=",";",0) 
    543          
    544                 // add to the suffix list in the new style, if it was found 
    545                 if(strlen(suffix) !=0) 
    546                         listStr += funcStr+"="+suffix+";" 
    547                 endif 
    548                 return(suffix) 
    549         endif 
    550          
    551         return("") 
    552 End 
    553  
    554446 
    555447 
Note: See TracChangeset for help on using the changeset viewer.