Ignore:
Timestamp:
Mar 6, 2012 5:40:08 PM (11 years ago)
Author:
srkline
Message:

fixed model wave listings to allow save/freeze of the FFT-generated waves.

updated Real-space help file

load/save of FFT matrix buttons on main panel

Location:
sans/Dev/trunk/NCNR_User_Procedures/Analysis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Fit_MixedDumbbell.ipf

    r843 r844  
    176176End 
    177177 
     178 
     179 
     180// 
    178181//Function MixTest() 
    179182// 
     
    182185//      NVAR FFT_N = root:FFT_N 
    183186//      NVAR FFT_SolventSLD = root:FFT_SolventSLD 
     187//      NVAR FFT_delRho = root:FFT_delRho               //the SLD multiplier, should have been initialized to 1e-7 
    184188//       
    185189//      Variable rho1,rho2,rhos,radius1,radius2,ctr,separation,fill1,fill2 
     
    193197//      separation = radius1 + radius2 
    194198//       
    195 //      FFT_SolventSLD = trunc(rhos*1e6)                //spits back an integer, maybe not correct 
     199//      FFT_SolventSLD = trunc(rhos/FFT_delRho)         //spits back an integer, maybe not correct 
    196200// 
    197201//// generate the matrix and erase it 
     
    205209//// with the input parameters, build the structure 
    206210//      ctr = trunc(FFT_N/2) 
    207 //      fill1 = trunc(rho1*1e6) 
    208 //      fill2 = trunc(rho2*1e6) 
     211//      fill1 = trunc(rho1/FFT_delRho) 
     212//      fill2 = trunc(rho2/FFT_delRho) 
    209213//       
    210214//      FillSphereRadius(m,FFT_T,radius1,ctr,ctr,ctr,fill1) 
     
    212216//       
    213217//End 
     218// 
    214219// 
    215220//Function CoreShellTest() 
     
    219224//      NVAR FFT_N = root:FFT_N 
    220225//      NVAR FFT_SolventSLD = root:FFT_SolventSLD 
     226//      NVAR FFT_delRho = root:FFT_delRho               //the SLD multiplier, should have been initialized to 1e-7 
    221227//       
    222228//      Variable rho1,rho2,rhos,radius1,radius2,ctr,separation,fill1,fill2 
     
    233239//      ctr=50 
    234240//       
    235 //      FFT_SolventSLD = trunc(rhos*1e6)                //spits back an integer, maybe not correct 
     241//      FFT_SolventSLD = trunc(rhos/FFT_delRho)         //spits back an integer, maybe not correct 
    236242// 
    237243//// generate the matrix and erase it 
     
    245251//// with the input parameters, build the structure 
    246252//      ctr = trunc(FFT_N/2) 
    247 //      fill1 = trunc(rho1*1e6) 
    248 //      fill2 = trunc(rho2*1e6) 
     253//      fill1 = trunc(rho1/FFT_delRho) 
     254//      fill2 = trunc(rho2/FFT_delRho) 
    249255//       
    250256//      FillSphereRadius(m,FFT_T,radius2,ctr,ctr,ctr,fill2) 
     
    259265//      NVAR FFT_N = root:FFT_N 
    260266//      NVAR FFT_SolventSLD = root:FFT_SolventSLD 
     267//      NVAR FFT_delRho = root:FFT_delRho               //the SLD multiplier, should have been initialized to 1e-7 
    261268//       
    262269//      Variable rcore,rhocore,thick1,rhoshel1,thick2,rhoshel2,thick3,rhoshel3,rhos,fill1,fill2,fill3,fillc,ctr 
     
    277284////    rhos += 3e-6 
    278285//               
    279 //      FFT_SolventSLD = trunc(rhos*1e6)                //spits back an integer, maybe not correct 
     286//      FFT_SolventSLD = trunc(rhos/FFT_delRho)         //spits back an integer, maybe not correct 
    280287// 
    281288//// generate the matrix and erase it 
     
    289296//// with the input parameters, build the structure 
    290297//      ctr = trunc(FFT_N/2) 
    291 //      fillc = trunc(rhocore*1e6) 
    292 //      fill1 = trunc(rhoshel1*1e6) 
    293 //      fill2 = trunc(rhoshel2*1e6) 
    294 //      fill3 = trunc(rhoshel3*1e6) 
     298//      fillc = trunc(rhocore/FFT_delRho) 
     299//      fill1 = trunc(rhoshel1/FFT_delRho) 
     300//      fill2 = trunc(rhoshel2/FFT_delRho) 
     301//      fill3 = trunc(rhoshel3/FFT_delRho) 
    295302//       
    296303//      FillSphereRadius(m,FFT_T,rcore+thick1+thick2+thick3,ctr,ctr,ctr,fill3)          //outer size (shell 3) 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Alpha/Tinker/FFT_Panel.ipf

    r840 r844  
    11#pragma rtGlobals=1             // Use modern global access method. 
    22 
     3// 
    34// utility functions and procedures for displaying information 
    45// setting the matrix, and doing the calculations 
     
    67 
    78 
    8  
    9 /////////// 
    10 // 
    11 // put the SLD multiplier on the panel somewhere - only 2 values are allowed - so use 
    12 // radio buttons, or just display the value of the global, make the change at the command 
    13 // line -- or keep the multiplier at 10^-7 and always use 2 digits (10^-7 is probably 
    14 // better to use, just to allow more flexibility from the start).  
    15  
     9// 
    1610// TO DO: 
    17 // -- I need to change a lot of routines (most notably Gizmo) to take "10" as the default SLD 
     11// x- I need to change a lot of routines (most notably Gizmo) to take "10" as the default SLD 
    1812//               rather than "1" 
    1913// 
     
    3731//// if it all goes blank after the log transform get rid of the INF 
    3832//dmatView = numtype(dmatView)== 0 ? dmatView : 0 
     33// 
    3934//************* 
    4035 
     
    6964End 
    7065 
     66 
    7167Proc FFT_Panel()  
    7268        PauseUpdate; Silent 1           // building window... 
     
    9187        Button FFTButton_4,pos={180,264},size={130,20},proc=FFT_PlotResultsButtonProc,title="Plot FFT Results" 
    9288        Button FFTButton_5,pos={13,218},size={120,20},proc=FFTDrawZCylinderButtonProc,title="Draw Cylinder" 
    93         Button FFTButton_6,pos={134,79},size={90,20},proc=FFTEraseMatrixButtonProc,title="Erase Matrix" 
     89//      Button FFTButton_6,pos={134,79},size={90,20},proc=FFTEraseMatrixButtonProc,title="Erase Matrix" 
     90        Button FFTButton_6a,pos={160,79},size={60,20},proc=FFTSaveMatrixButtonProc,title="Save" 
     91        Button FFTButton_6b,pos={240,79},size={60,20},proc=FFTLoadMatrixButtonProc,title="Load" 
    9492        Button FFTButton_7,pos={13,329},size={130,20},proc=FFT_BinnedSpheresButtonProc,title="Do Binned Debye" 
    9593        Button FFTButton_7a,pos={180,329},size={130,20},proc=FFT_PlotResultsButtonProc,title="Plot Binned Results" 
     
    114112        Button FFTButton_16,pos={14,460},size={70,20},proc=FFTHelpButton,title="Help" 
    115113EndMacro 
     114 
     115// Save a matrix wave, plus the N, T, and solvent values in the wave note for reloading 
     116Function FFTSaveMatrixButtonProc(ba) : ButtonControl 
     117        STRUCT WMButtonAction &ba 
     118         
     119        String win = ba.win 
     120 
     121        switch (ba.eventCode) 
     122                case 2: 
     123                        // click code here 
     124                        String fileStr="" 
     125                        SaveMyMatrix(fileStr) 
     126                         
     127                        break 
     128        endswitch 
     129 
     130        return 0 
     131End 
     132 
     133// this will wave as Igor Binary, so be sure to use the ".ibw extension. 
     134// - this could possibly be enforced, but that's maybe not necessary at this stage. 
     135// 
     136Function SaveMyMatrix(fileStr) 
     137        String fileStr 
     138         
     139        WAVE mat=root:mat 
     140        NVAR FFT_T = root:FFT_T 
     141        NVAR FFT_N = root:FFT_N 
     142        NVAR FFT_SolventSLD = root:FFT_SolventSLD 
     143        String str="" 
     144        sprintf str,"FFT_T=%g;FFT_N=%d;FFT_SolventSLD=%d;",FFT_T,FFT_N,FFT_SolventSLD 
     145        Note mat,str 
     146        Save/C/P=home mat as fileStr    //will ask for a file name, save as Igor Binary 
     147        Note/K mat                      //kill wave note on exiting since I don't properly update this anywhere else 
     148                         
     149        return(0) 
     150end 
     151 
     152 
     153// load in a previously saved matrix, and reset FFT_N, FFT_T and solvent 
     154// from the wave note when saved 
     155Function FFTLoadMatrixButtonProc(ba) : ButtonControl 
     156        STRUCT WMButtonAction &ba 
     157         
     158        String win = ba.win 
     159 
     160        switch (ba.eventCode) 
     161                case 2: 
     162                        // click code here 
     163                        String fileStr="" 
     164                        ReloadMatrix(fileStr) 
     165                         
     166                        break 
     167        endswitch 
     168 
     169        return 0 
     170End 
     171 
     172 
     173Function ReloadMatrix(fileStr) 
     174        String fileStr 
     175         
     176                LoadWave/M/O/W/P=home           fileStr         //will ask for a file, Igor Binary format is assumed here 
     177                String str 
     178                str=note(mat) 
     179                NVAR FFT_T = root:FFT_T 
     180                NVAR FFT_N = root:FFT_N 
     181                NVAR FFT_SolventSLD = root:FFT_SolventSLD 
     182                 
     183                FFT_T = NumberByKey("FFT_T", str, "=" ,";") 
     184                FFT_N = NumberByKey("FFT_N", str, "=" ,";") 
     185                FFT_SolventSLD = NumberByKey("FFT_SolventSLD", str, "=" ,";") 
     186 
     187// if I got bad values, put in default values                    
     188                if(numtype(FFT_T) != 0 ) 
     189                        FFT_T = 5 
     190                endif 
     191                if(numtype(FFT_N) != 0 ) 
     192                        FFT_N = DimSize(mat,0) 
     193                endif 
     194                if(numtype(FFT_SolventSLD) != 0 ) 
     195                        FFT_SolventSLD = 0 
     196                endif                    
     197                 
     198                Execute "NumberOfPoints()" 
     199                         
     200        return(0) 
     201end 
    116202 
    117203Function FFTHelpButton(ba) : ButtonControl 
     
    622708End 
    623709 
     710 
     711 
     712 
     713 
     714 
    624715// The matrix is not necessarily 0|1, this reports the number of filled voxels 
    625716// - needed to estimate the time required for the AltiVec_Spheres calculation 
     
    629720        Print "Fraction occupied = ",VolumeFraction_Occ(root:mat) 
    630721        Print "Overall Cube Edge [A] = ",root:FFT_T * root:FFT_N 
     722        Print "Found values in matrix = ",ListOfValues(root:mat) 
    631723         
    632724End 
     
    679771        return(num) 
    680772End 
     773 
     774// 
     775// return a list of the different values of the voxels in the matrix 
     776// 
     777Function/S ListOfValues(m) 
     778        Wave m 
     779         
     780        String list="" 
     781        Variable done 
     782 
     783        Duplicate/O m,mz 
     784         
     785        done=0 
     786        do 
     787                WaveStats/Q/M=1 mz              // NaN and Inf are not reported in V_npnts 
     788                if(V_max == V_min) 
     789                        list += num2str(V_min) + ";" 
     790                        done = 1 
     791                else 
     792                        list += num2str(V_max) + ";" 
     793                        MultiThread mz = mz[p][q] == V_max ? V_min : mz[p][q]           // replace the max with min                      
     794                endif 
     795        while(!done)     
     796         
     797//      Print "Found values in matrix = ",list 
     798        KillWaves/Z mz 
     799 
     800        return(list) 
     801End 
     802 
     803 
    681804 
    682805// returns estimate in seconds 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/ModelPicker/SANSModelPicker_v40.ipf

    r821 r844  
    953953                Prompt newNameStr,"new name for the waves, _q and _i will be appended" 
    954954        else 
    955                 Prompt xwave,"X data",popup,WaveList("x*",";","") 
    956                 Prompt ywave,"Y data",popup,WaveList("y*",";","") 
     955                Prompt xwave,"X data",popup,PossibleModelWaves("x*") 
     956                Prompt ywave,"Y data",popup,PossibleModelWaves("y*") 
    957957                Prompt newNameStr,"new name for the waves, _q and _i will be appended" 
    958958        endif 
  • sans/Dev/trunk/NCNR_User_Procedures/Analysis/WriteModelData_v40.ipf

    r734 r844  
    2323        //waves in root 
    2424        list = WaveList(filterStr,";","") 
     25         
     26        // get the real-space model waves, if present 
     27        if(cmpstr(filterStr,"x*")==0) 
     28                list += WaveList("qBin*",";","") 
     29        else 
     30                list += WaveList("iBin*",";","") 
     31        endif 
    2532         
    2633        //add possble smeared models that are housed in data folders 
Note: See TracChangeset for help on using the changeset viewer.