Changeset 1171


Ignore:
Timestamp:
Dec 29, 2021 2:25:52 PM (7 months ago)
Author:
ilavsky
Message:

Add Search for optimal solution to 3D aggregates

Location:
trunk/User Procedures
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/User Procedures/Indra 2/IN3_Main.ipf

    r1143 r1171  
    117117        NewPanel /K=1 /W=(22.25,43.25,445,860) as "USAXS data reduction"
    118118        DoWindow/C USAXSDataReduction
    119         TitleBox Title title="\Zr170USAXS data reduction panel",pos={5,3},frame=0,fstyle=3,size={300,24},fColor=(1,4,52428), anchor=MC
     119        TitleBox Title title="\Zr170USAXS data reduction",pos={5,3},frame=0,fstyle=3,size={300,24},fColor=(1,4,52428), anchor=MC
    120120        TitleBox Info1 title="\Zr100To limit range of data being used for subtraction, set cursor A",pos={10,708},frame=0,fstyle=1,anchor=MC, size={380,20},fColor=(1,4,52428)
    121121        TitleBox Info2 title="\Zr100 on first point and B on last point of either sample of blank data",pos={10,723},frame=0,fstyle=1, anchor=MC,size={380,20},fColor=(1,4,52428)
     
    136136        Button GetReadme,pos={315,27},size={80,15}, proc=IN3_InputPanelButtonProc,title="Read me", help={"Open Read me short instructions"}
    137137               
    138         CheckBox IsBlank,pos={265,113},size={90,14},proc=IN3_MainPanelCheckBox,title="Proces as blank"
     138        CheckBox IsBlank,pos={265,113},size={90,14},proc=IN3_MainPanelCheckBox,title="Process as blank"
    139139        CheckBox IsBlank,variable= root:Packages:Indra3:IsBlank, help={"Check, if you want to process this run as blank"}
    140140        CheckBox SmoothRCurveData,pos={360,113},size={90,14},proc=IN3_MainPanelCheckBox,title="Smooth"
     
    154154                TitleBox SavedData pos={261,217}, title="  Data   are   saved  ", fColor=(0,0,0),labelBack=(47872,47872,47872),  frame=2,fixedSize=1,size={160,18}
    155155        endif
    156         TitleBox RemoveFromNameTbx pos={260,240}, title="Remove From name (str):",size={150,15}
     156        TitleBox RemoveFromNameTbx pos={260,240}, title="Remove from name (str):",size={150,15}
    157157        SetVariable RemoveFromNameString,pos={260,260},size={157,15},noproc,title=" "
    158158        SetVariable RemoveFromNameString,help={"String which will be removed from data name"}
     
    11131113        TitleBox Info2 title="\Zr100 on first point and B on last point of either sample of blank data",pos={5,580},frame=0,fstyle=1, anchor=MC,size={380,20},fColor=(1,4,52428)
    11141114        //some local controls
    1115         CheckBox IsBlank,pos={20,35},size={90,14},proc=IN3_MainPanelCheckBox,title="Proces as blank"
     1115        CheckBox IsBlank,pos={20,35},size={90,14},proc=IN3_MainPanelCheckBox,title="Process as blank"
    11161116        CheckBox IsBlank,variable= root:Packages:Indra3:IsBlank, help={"Check, if you want to process this run as blank"}
    11171117        Button GetHelp,pos={290,25},size={80,15},fColor=(65535,32768,32768), proc=IN3_InputPanelButtonProc,title="Get Help", help={"Open www manual page for this tool"}
  • trunk/User Procedures/Irena/IR3_3DModels.ipf

    r1169 r1171  
    11#pragma TextEncoding = "UTF-8"
    22#pragma rtGlobals=3             // Use modern global access method and strict wave access.
    3 #pragma version=1.01
    4 
    5 Constant IR3AMassFrAggVersionNumber     = 1.02
     3#pragma version=1.03
     4
     5Constant IR3AMassFrAggVersionNumber     = 1.03
    66Constant IR3TPOVPDBVersionNumber                = 1.00
    77Constant IR3TTwoPhaseVersionNumber      = 1.00
     
    1414//*************************************************************************/
    1515
    16 
     16//1.03 added Optimized growth - gorws number of aggregates and searches for best matching one...
    1717//1.02 added MultiParticleAttraction parameter.
    1818//1.01 3dAggregate added ability ot grow N aggregates and Compare Stored graph
     
    251251        //and this is new code
    252252        TitleBox Info1 title="\Zr160Unified results",pos={40,26},frame=0,fstyle=1, fixedSize=1,size={280,18},fColor=(0,0,52224)
    253         TitleBox FakeLine1 title=" ",fixedSize=1,size={350,3},pos={16,215},frame=0,fColor=(0,0,52224), labelBack=(0,0,52224)
    254         TitleBox Info2 title="\Zr160Model input parameters",pos={40,230},frame=0,fstyle=1, fixedSize=1,size={280,18},fColor=(0,0,52224)
    255         SetVariable AggregateModeling,pos={10,260},size={190,16},noproc,title="Deg. of Agg. \"z\" (250) ", help={"Size of aggregate, degree of aggregation"}
     253        TitleBox FakeLine1 title=" ",fixedSize=1,size={350,3},pos={16,205},frame=0,fColor=(0,0,52224), labelBack=(0,0,52224)
     254        TitleBox Info2 title="\Zr160Model input parameters",pos={10,215},frame=0,fstyle=1, fixedSize=1,size={280,18},fColor=(0,0,52224)
     255        SetVariable AggregateModeling,pos={10,240},size={190,16},noproc,title="Deg. of Agg. \"z\" (250) ", help={"Size of aggregate, degree of aggregation"}
    256256        SetVariable AggregateModeling,limits={10,Inf,0},variable= root:Packages:AggregateModeling:DegreeOfAggregation, bodyWidth=50
    257         SetVariable StickingProbability,pos={10,285},size={190,16},noproc,title="Sticking prob. (10-100) ", help={"Sticking probablility, 100 for DLA, less for RLA"}
     257        SetVariable StickingProbability,pos={10,265},size={190,16},noproc,title="Sticking prob. (10-100) ", help={"Sticking probablility, 100 for DLA, less for RLA"}
    258258        SetVariable StickingProbability,limits={10,100,0},variable= root:Packages:AggregateModeling:StickingProbability, bodyWidth=50
    259         SetVariable NumberOfTestPaths,pos={10,310},size={190,16},noproc,title="Max paths/end (1k-10k) ", help={"Max measured paths per end point for parameter evaluation. Larger = possibly longer times but is more precise"}
     259        SetVariable NumberOfTestPaths,pos={10,290},size={190,16},noproc,title="Max paths/end (1k-10k) ", help={"Max measured paths per end point for parameter evaluation. Larger = possibly longer times but is more precise"}
    260260        SetVariable NumberOfTestPaths,limits={1000,100000,0},variable= root:Packages:AggregateModeling:NumberOfTestPaths, bodyWidth=50
    261261
    262         SetVariable RgPrimary,pos={210,260},size={170,16},noproc,title="Primary Rg[A] (10) ", help={"Size of primary particle from which Aggregate is created"}
     262        SetVariable RgPrimary,pos={210,240},size={170,16},noproc,title="Primary Rg[A] (10) ", help={"Size of primary particle from which Aggregate is created"}
    263263        SetVariable RgPrimary,limits={10,Inf,0},variable= root:Packages:AggregateModeling:RgPrimary, bodyWidth=50
    264 
    265         PopupMenu AllowedNearDistance,pos={220,290},size={150,20},proc=IR3A_PopMenuProc,title="Sticking method:"
     264        PopupMenu AllowedNearDistance,pos={230,260},size={150,20},proc=IR3A_PopMenuProc,title="Sticking method:"
    266265        PopupMenu AllowedNearDistance,help={"Which neighbors are allowed to stick"}
    267266        NVAR AllowedNearDistance=root:Packages:AggregateModeling:AllowedNearDistance
    268267        PopupMenu AllowedNearDistance,mode=1,popvalue=num2str(AllowedNearDistance), value="1;2;3;"
    269268
    270         PopupMenu MParticleAttraction,pos={220,310},size={150,20},proc=IR3A_PopMenuProc,title="Multi Part. attr:"
     269        PopupMenu MParticleAttraction,pos={230,280},size={150,20},proc=IR3A_PopMenuProc,title="Multi Part. attr:"
    271270        PopupMenu MParticleAttraction,help={"If there are more particles neaby, is chance of attaching? "}
    272271        SVAR MultiParticleAttraction=root:Packages:AggregateModeling:MultiParticleAttraction
    273272        PopupMenu MParticleAttraction,mode=1,popvalue=MultiParticleAttraction, value="Neutral;Attractive;Repulsive;Not allowed;"
    274273       
    275         Button Grow1AggAll,pos={5,338},size={150,20}, proc=IR3A_PanelButtonProc,title="Grow 1 Agg, graph", help={"Perform all steps and generate 3D graph"}
    276         Button GrowNAggAll,pos={165,338},size={150,20}, proc=IR3A_PanelButtonProc,title="Grow N Agg.", help={"Generate N aggregates randomly"}
    277 
    278         PopupMenu NUmberOfTestAggregates,pos={320,338},size={150,20},proc=IR3A_PopMenuProc,title="N ="
     274
     275        //Growth Tabs definition
     276        TabControl GrowthTabs,pos={2,310},size={387,170},proc=IR3A_GrowthTabProc
     277        TabControl GrowthTabs,tabLabel(0)=" Grow One ",tabLabel(1)=" Grow many "
     278        TabControl GrowthTabs,tabLabel(2)=" Find Best Growth "
     279
     280        Button Grow1AggAll,pos={15,335},size={150,18}, proc=IR3A_PanelButtonProc,title="Grow 1 Agg, graph", help={"Perform all steps and generate 3D graph"}
     281        Button GrowNAggAll,pos={15,335},size={150,18}, proc=IR3A_PanelButtonProc,title="Grow N Agg.", help={"Generate N aggregates randomly"}
     282        PopupMenu NUmberOfTestAggregates,pos={195,335},size={150,20},proc=IR3A_PopMenuProc,title="N ="
    279283        PopupMenu NUmberOfTestAggregates,help={"How many test aggregates to grow"}
    280284        NVAR NUmberOfTestAggregates=root:Packages:AggregateModeling:NUmberOfTestAggregates
    281285        PopupMenu NUmberOfTestAggregates,mode=1,popvalue=num2str(NUmberOfTestAggregates), value="5;10;20;30;50;"
    282286
    283 
    284 
     287        Button GrowOptimizedAgg,pos={15,335},size={150,18}, proc=IR3A_PanelButtonProc,title="Grow Best Match Agg", help={"Try to find best aggregate for parameters below"}
     288
     289        SetVariable CurrentMisfitValue, pos={250,338}, size={120,20}, title="Misfit = ", help={"Current misfit between dmin/c of model and target"}, format="%.4f", fColor=(1,16019,65535),valueColor=(16385,16388,65535)
     290        SetVariable CurrentMisfitValue, variable=root:Packages:AggregateModeling:CurrentMisfitValue, limits={-inf,inf,0},  disable=0,noedit=1,frame=0, bodyWidth=50,fstyle=1, fsize=11
    285291        //repeat the target values
    286         SetVariable Target_dmin, pos={10,360}, size={100,20}, title="Target dmin = ", help={"Minimum dimension of the aggregate"}, format="%.2g",fColor=(1,16019,65535),valueColor=(16385,16388,65535)
    287         SetVariable Target_dmin, variable=root:Packages:AggregateModeling:BrFract_dmin, noedit=1,limits={-inf,inf,0},  disable=0,noedit=1,frame=0, bodyWidth=50
    288         SetVariable Target_c, pos={150,360}, size={100,20}, title="Target c =  ", help={"Connectivity dimension of the aggregate"}, format="%.2g", fColor=(1,16019,65535),valueColor=(16385,16388,65535)
    289         SetVariable Target_c, variable=root:Packages:AggregateModeling:BrFract_c, noedit=1,limits={-inf,inf,0},  disable=0,noedit=1,frame=0, bodyWidth=50
    290         SetVariable Target_df, pos={280,360}, size={100,20}, title="Target df = ", help={"Mass fractal dimension of the aggregate"}, format="%.2g", fColor=(1,16019,65535),valueColor=(16385,16388,65535)
    291         SetVariable Target_df, variable=root:Packages:AggregateModeling:BrFract_df, noedit=1,limits={-inf,inf,0},  disable=0,noedit=1,frame=0, bodyWidth=50
     292        SetVariable Target_dmin, pos={10,360}, size={120,20}, title="Target dmin = ", help={"Minimum dimension of the aggregate"}, format="%.3g",fColor=(1,16019,65535),valueColor=(16385,16388,65535)
     293        SetVariable Target_dmin, variable=root:Packages:AggregateModeling:BrFract_dmin, noedit=1,limits={-inf,inf,0},  disable=0,noedit=1,frame=0, bodyWidth=50, proc=IR3A_SetVarProc
     294        SetVariable Target_c, pos={125,360}, size={120,20}, title="Target c =  ", help={"Connectivity dimension of the aggregate"}, format="%.3g", fColor=(1,16019,65535),valueColor=(16385,16388,65535)
     295        SetVariable Target_c, variable=root:Packages:AggregateModeling:BrFract_c, limits={-inf,inf,0},  disable=0,noedit=1,frame=0, bodyWidth=50, proc=IR3A_SetVarProc
     296        SetVariable Target_df, pos={265,360}, size={120,20}, title="Target df =  ", help={"Df value for target"}, format="%.3g", fColor=(1,16019,65535),valueColor=(16385,16388,65535)
     297        SetVariable Target_df, variable=root:Packages:AggregateModeling:BrFract_df, limits={-inf,inf,0},  disable=0,noedit=1,frame=0, bodyWidth=50, proc=IR3A_SetVarProc
    292298
    293299        // here are resulting values
    294300        SetVariable dminValue,pos={40,380},size={100,20},noproc,title="dmin = ", help={"Minimum dimension of the aggregate"},limits={10,100,0}
    295         SetVariable dminValue,variable= root:Packages:AggregateModeling:dminValue, bodyWidth=80, disable=0,noedit=1,frame=0, format="%.4f"
     301        SetVariable dminValue,variable= root:Packages:AggregateModeling:dminValue, bodyWidth=80, disable=0,noedit=1,frame=0, format="%.3g"
    296302        SetVariable cValue,pos={150,380},size={100,20},noproc,title="c = ", help={"Connectivity dimension of the aggregate"},limits={10,100,0}
    297         SetVariable cValue,variable= root:Packages:AggregateModeling:cValue, bodyWidth=80, disable=0,noedit=1,frame=0, format="%.4f"
    298         SetVariable dfValue,pos={280,380},size={100,20},noproc,title="df = ", help={"Mass fractal dimension of the aggregate"},limits={10,100,0}, format="%.4f"
     303        SetVariable cValue,variable= root:Packages:AggregateModeling:cValue, bodyWidth=80, disable=0,noedit=1,frame=0, format="%.3g"
     304        SetVariable dfValue,pos={280,380},size={100,20},noproc,title="df = ", help={"Mass fractal dimension of the aggregate"},limits={0,3,0}, format="%.3g"
    299305        SetVariable dfValue,variable= root:Packages:AggregateModeling:dfValue, bodyWidth=80, disable=0,noedit=1,frame=0
     306
     307        SetVariable MaxNumTests,pos={60,380},size={100,20},proc=IR3A_SetVarProc,title="Max tries =   ", help={"Maximum number of tries"},limits={10,500,10}
     308        SetVariable MaxNumTests,variable= root:Packages:AggregateModeling:MaxNumTests, bodyWidth=80, disable=0,frame=1, format="%.0f"
     309        SetVariable MinSearchTargetValue,pos={250,380},size={100,20},noproc,title="Max misfit =   ", help={"Target fit value (see manual)"},limits={0.0001,1,0}, format="%.4f"
     310        SetVariable MinSearchTargetValue,variable= root:Packages:AggregateModeling:MinSearchTargetValue, bodyWidth=80, disable=0,frame=1
     311
     312        Checkbox  VaryStickingProbability, pos={20,400}, size={50,15}, variable =root:packages:AggregateModeling:VaryStickingProbability
     313        Checkbox  VaryStickingProbability, title="Vary Sticking Prob",mode=0, proc=IR3A_CheckProc
     314        Checkbox  VaryStickingProbability, help={"Vary Sticking probability"}
     315
     316        SetVariable StickingProbMin,pos={150,400},size={100,20},noproc,title="Min = ", help={"Low limit of sticking probability"},limits={5,80,5}
     317        SetVariable StickingProbMin,variable= root:Packages:AggregateModeling:StickingProbMin, bodyWidth=80, disable=0,frame=1, format="%.0f"
     318        SetVariable StickingProbMax,pos={280,400},size={100,20},noproc,title="Max = ", help={"High limit of sticking probability"},limits={10,90,5}, format="%.0f"
     319        SetVariable StickingProbMax,variable= root:Packages:AggregateModeling:StickingProbMax, bodyWidth=80, disable=0,frame=1
     320
     321        PopupMenu StickProbNumSteps,pos={20,420},size={150,20},proc=IR3A_PopMenuProc,title="N ="
     322        PopupMenu StickProbNumSteps,help={"How many steps in Sticking Probability? "}
     323        NVAR StickProbNumStepsNum=root:Packages:AggregateModeling:StickProbNumSteps
     324        PopupMenu StickProbNumSteps,mode=1,popvalue=num2str(StickProbNumStepsNum), value="5;10;15;20;"
     325        SetVariable TotalGrowthsPlanned,pos={20,445},size={210,16},noproc,title="Total number of growths = ", help={"How many growths will be tried... "},limits={0,inf,0}
     326        SetVariable TotalGrowthsPlanned,variable= root:Packages:AggregateModeling:TotalGrowthsPlanned, disable=0,noedit=1,frame=0
    300327
    301328
     
    304331        SetVariable pValue,pos={150,400},size={100,16},noproc,title="p = ", help={"Short circuit path length"},limits={10,100,0}, format="%6.0f"
    305332        SetVariable pValue,variable= root:Packages:AggregateModeling:pValue, bodyWidth=80, disable=0,noedit=1,frame=0
    306 
    307333        SetVariable sValue,pos={280,400},size={100,16},noproc,title="s = ", help={"Connective path length of the aggregate"},limits={10,100,0}
    308334        SetVariable sValue,variable= root:Packages:AggregateModeling:sValue, bodyWidth=80, disable=0,noedit=1,frame=0, format="%6.0f"
     
    311337        SetVariable TrueStickingProbability variable=root:Packages:AggregateModeling:TrueStickingProbability, noedit=1,frame=0,limits={10,100,0}, format="%2.2d"
    312338
    313         Button Display3DMFASummary,pos={220,425},size={150,20}, proc=IR3A_PanelButtonProc,title="Summary Table", help={"Display summary for 3D Mass Fractal Aggregate"}
    314         Button SaveAggregateData,pos={220,445},size={150,20}, proc=IR3A_PanelButtonProc,title="Store Current Aggregate", help={"Copy this aggregate with parameters in a folder"}
     339        Button Display3DMFASummary,pos={220,423},size={150,18}, proc=IR3A_PanelButtonProc,title="Summary Notebook", help={"Display summary notebook for 3D Mass Fractal Aggregate"}
     340        Button SaveAggregateData,pos={220,447},size={150,18}, proc=IR3A_PanelButtonProc,title="Store Current Aggregate", help={"Copy this aggregate with parameters in a folder"}
    315341        TitleBox FakeLine2 title=" ",fixedSize=1,size={330,3},pos={16,469},frame=0,fColor=(0,0,52224), labelBack=(0,0,52224)
    316342
     
    321347        ListBox StoredAggregates listWave=Stored3DAggregates,mode=1,selRow=-1,selWave=Stored3DAggSelections
    322348       
    323         Button Display1DData,pos={262,480},size={120,20}, proc=IR3A_PanelButtonProc,title="Display 1D Graph", help={"Display 1 D graph with Intensity vs Q for these data"}
    324         Button Display3DMassFracGizmo,pos={262,505},size={120,20}, proc=IR3A_PanelButtonProc,title="Display 3D Graph", help={"Display Gizmo with 3D Mass Fractal Aggregate"}
    325         Button Calculate1DIntensity,pos={262,530},size={120,20}, proc=IR3A_PanelButtonProc,title="Calculate 1D Int.", help={"Calculate using UF 1D intensity and append to graph"}
    326         Button Model1DIntensity,pos={262,555},size={120,20}, proc=IR3A_PanelButtonProc,title="Monte Carlo 1D Int.", help={"Calculate using Monte Carlo 1D intensity and append to graph"}
    327         Button CompareStoredResults,pos={262,580},size={120,20}, proc=IR3A_PanelButtonProc,title="Compare Stored", help={"Present statistcs on stored results"}
     349        Button Display1DData,pos={262,480},size={120,18}, proc=IR3A_PanelButtonProc,title="Display 1D Graph", help={"Display 1 D graph with Intensity vs Q for these data"}
     350        Button Display3DMassFracGizmo,pos={262,505},size={120,18}, proc=IR3A_PanelButtonProc,title="Display 3D Graph", help={"Display Gizmo with 3D Mass Fractal Aggregate"}
     351        Button Calculate1DIntensity,pos={262,530},size={120,18}, proc=IR3A_PanelButtonProc,title="Calculate 1D Int.", help={"Calculate using UF 1D intensity and append to graph"}
     352        Button Model1DIntensity,pos={262,555},size={120,18}, proc=IR3A_PanelButtonProc,title="Monte Carlo 1D Int.", help={"Calculate using Monte Carlo 1D intensity and append to graph"}
     353        Button CompareStoredResults,pos={262,580},size={120,18}, proc=IR3A_PanelButtonProc,title="Compare Stored", help={"Present statistcs on stored results"}
    328354        Button DeleteStoredResults,pos={262,635},size={100,15}, proc=IR3A_PanelButtonProc,title="Delete all Stored", help={"Delete all stored results"}
    329355        //the above button works, but the results seem to take forever and do not look too good. 
    330         IR3A_SetControlsInPanel()
     356        //IR3A_SetControlsInPanel() - this is done by function called above anyway.
    331357        IR3A_Create3DAggListForListbox()
    332358end
     
    334360//******************************************************************************************************************************************************
    335361//******************************************************************************************************************************************************
    336 //******************************************************************************************************************************************************
    337 //******************************************************************************************************************************************************
     362Function IR3A_GrowthTabProc(tca) : TabControl
     363        STRUCT WMTabControlAction &tca
     364
     365        switch( tca.eventCode )
     366                case 2: // mouse up
     367                        Variable tab = tca.tab
     368                        IR3A_CalculateAggValues()
     369                        Button Grow1AggAll win=FractalAggregatePanel, disable=Tab!=0
     370                        Button GrowNAggAll win=FractalAggregatePanel, disable=Tab!=1
     371                        PopupMenu NUmberOfTestAggregates win=FractalAggregatePanel, disable=Tab!=1
     372                        Button GrowOptimizedAgg win=FractalAggregatePanel, disable=Tab!=2
     373                        if(tab==0 || tab==1)
     374                                SetVariable Target_dmin win=FractalAggregatePanel, noedit=1, disable=0, frame=0
     375                                SetVariable Target_c win=FractalAggregatePanel, noedit=1, disable=0,frame=0
     376                                SetVariable Target_df win=FractalAggregatePanel, noedit=1, disable=0,frame=0
     377                                SetVariable dminValue win=FractalAggregatePanel, disable=0
     378                                SetVariable cValue win=FractalAggregatePanel, disable=0
     379                                SetVariable dfValue win=FractalAggregatePanel, disable=0
     380                                SetVariable RValue win=FractalAggregatePanel, disable=0
     381                                SetVariable pValue win=FractalAggregatePanel, disable=0
     382                                SetVariable sValue win=FractalAggregatePanel, disable=0
     383                                SetVariable TrueStickingProbability  win=FractalAggregatePanel, disable=0
     384                                Button Display3DMFASummary  win=FractalAggregatePanel, disable=0
     385                                Button SaveAggregateData  win=FractalAggregatePanel, disable=0
     386                                SetVariable MaxNumTests  win=FractalAggregatePanel, disable=1
     387                                SetVariable MinSearchTargetValue  win=FractalAggregatePanel, disable=1
     388                                Checkbox  VaryStickingProbability  win=FractalAggregatePanel, disable=1
     389                                SetVariable StickingProbMin  win=FractalAggregatePanel, disable=1
     390                                SetVariable StickingProbMax  win=FractalAggregatePanel, disable=1
     391                                SetVariable TotalGrowthsPlanned  win=FractalAggregatePanel, disable=1
     392                                PopupMenu StickProbNumSteps  win=FractalAggregatePanel, disable=1
     393                        elseif(tab==2)
     394                                NVAR Target_C=root:Packages:AggregateModeling:BrFract_c
     395                                NVAR Target_dmin = root:Packages:AggregateModeling:BrFract_dmin
     396                                if(numtype(Target_C)!=0)
     397                                        Target_C = 1.6
     398                                endif
     399                                if(numtype(Target_dmin)!=0)
     400                                        Target_dmin = 1.2
     401                                endif
     402                                SetVariable Target_dmin win=FractalAggregatePanel, noedit=0, disable=0,frame=1
     403                                SetVariable Target_c win=FractalAggregatePanel, noedit=0, disable=0,frame=1
     404                                SetVariable Target_df win=FractalAggregatePanel, noedit=1, disable=1,frame=0
     405                                SetVariable dminValue win=FractalAggregatePanel, disable=1
     406                                SetVariable cValue win=FractalAggregatePanel, disable=1
     407                                SetVariable dfValue win=FractalAggregatePanel, disable=1
     408                                SetVariable RValue win=FractalAggregatePanel, disable=1
     409                                SetVariable pValue win=FractalAggregatePanel, disable=1
     410                                SetVariable sValue win=FractalAggregatePanel, disable=1
     411                                SetVariable TrueStickingProbability  win=FractalAggregatePanel, disable=1
     412                                Button Display3DMFASummary  win=FractalAggregatePanel, disable=1
     413                                Button SaveAggregateData  win=FractalAggregatePanel, disable=1
     414
     415
     416                                SetVariable MaxNumTests  win=FractalAggregatePanel, disable=0
     417                                SetVariable MinSearchTargetValue  win=FractalAggregatePanel, disable=0
     418                                Checkbox  VaryStickingProbability  win=FractalAggregatePanel, disable=0
     419                                SetVariable TotalGrowthsPlanned  win=FractalAggregatePanel, disable=0
     420                                NVAR Showme = root:packages:AggregateModeling:VaryStickingProbability
     421                                SetVariable StickingProbMin  win=FractalAggregatePanel, disable=!Showme
     422                                SetVariable StickingProbMax  win=FractalAggregatePanel, disable=!Showme
     423                                PopupMenu StickProbNumSteps  win=FractalAggregatePanel, disable=!Showme
     424                               
     425                        endif
     426                       
     427                        break
     428                case -1: // control being killed
     429                        break
     430        endswitch
     431
     432        return 0
     433End
     434
     435//******************************************************************************************************************************************************
     436//******************************************************************************************************************************************************
     437
     438Function IR3A_SetVarProc(sva) : SetVariableControl
     439        STRUCT WMSetVariableAction &sva
     440
     441        switch( sva.eventCode )
     442                case 1: // mouse up
     443                case 2: // Enter key
     444                case 3: // Live update
     445                        Variable dval = sva.dval
     446                        String sval = sva.sval
     447//                      NVAR dmin = root:Packages:AggregateModeling:BrFract_dmin
     448//                      NVAR cval = root:Packages:AggregateModeling:BrFract_c
     449//                      NVAR df = root:Packages:AggregateModeling:BrFract_df
     450//                      if(StringMatch(sva.ctrlName, "Target_dmin") || StringMatch(sva.ctrlName, "Target_c"))
     451//                              df = dmin * cval
     452//                      endif
     453                        //MaxNumTests needs simply this below run anyway...
     454                        IR3A_CalculateAggValues()
     455                       
     456                        break
     457                case -1: // control being killed
     458                        break
     459        endswitch
     460
     461        return 0
     462End
     463
    338464//******************************************************************************************************************************************************
    339465//******************************************************************************************************************************************************
     
    371497                For(i=0;i<NumOfFolders-1;i+=1)
    372498                        tempStr = StringFromList(i, CurrentList, ",")
    373                         Stored3DAggregatesPaths [i+1] ="root:MassFractalAggregates:"+tempStr
    374                         Stored3DAggregates      [i+1] = num2str(i)+" : "+IR3A_BuildUser3DAggNames("root:MassFractalAggregates:"+tempStr)
     499                        Stored3DAggregatesPaths [i+1] ="root:MassFractalAggregates:"+possiblyQUoteName(tempStr)
     500                        Stored3DAggregates      [i+1] = num2str(i)+" : "+IR3A_BuildUser3DAggNames("root:MassFractalAggregates:"+possiblyQUoteName(tempStr))
    375501                endfor 
    376502        endif
     
    9861112                NVAR Target_c=root:Packages:AggregateModeling:BrFract_c
    9871113                NVAR Target_df=root:Packages:AggregateModeling:BrFract_df
     1114                NVAR Misfit = root:Packages:AggregateModeling:CurrentMisfitValue
    9881115                string ResultsLocation = GetWavesDataFolder(MassFractalAggregate, 1 )
    9891116                string OldNote=note(MassFractalAggregate)
     
    10131140                Notebook $nb ruler=Normal, text="c : \t\t Target : "+num2str(IN2G_roundSignificant(Target_c,3))+"\t\tResult : "+StringByKey("c", OldNote, "=", ";")+"\r"
    10141141                Notebook $nb ruler=Normal, text="df : \t\t Target : "+num2str(IN2G_roundSignificant(Target_df,3))+"\t\tResult : "+StringByKey("df", OldNote, "=", ";")+"\r"
     1142                Notebook $nb ruler=Normal, text="Final Misfit value : "+num2str(IN2G_roundSignificant(Misfit,3))+"\r"
    10151143                Notebook $nb ruler=Normal, text="*************************************************************************************************   \r"
    10161144                //      NoteText="Mass Fractal Aggregate created="+date()+", "+time()+";z="+num2str(DegreeOfAggregation)+";StickingProbability="+num2str(StickingProbability)+";StickingMethod="+num2str(AllowedNearDistance)
     
    10471175
    10481176
    1049 static Function IR3A_Grow1MassFractAgreg()
     1177static Function IR3A_Grow1MassFractAgreg(Display3D)
     1178        variable Display3D
    10501179
    10511180        DFref oldDf= GetDataFolderDFR()
    10521181
    1053         IR3A_InitializeMassFractAgg()
     1182        //IR3A_InitializeMassFractAgg()
    10541183        SetDataFolder root:Packages:AggregateModeling
    10551184        KillWIndow/Z MassFractalAggregateView
     
    10671196        variable StartTicks=ticks
    10681197        variable Failed
    1069         print time()+"  Started Growing Aggregate and evaluation its structure "
     1198        //print time()+"  Started Growing Aggregate and evaluation its structure "
    10701199        IR3A_MakeAgg(DegreeOfAggregation,MassFractalAggregate,StickingProbability,AllowedNearDistance)          // Agg is made with DegreeOfAggregation particles
    10711200        //Failed = IR3A_Ends(MassFractalAggregate, breakOnFail)
     
    10751204        IR3A_EvaluateAggregateUsingMT()
    10761205        Failed = IR3A_CalculateParametersMT()
    1077         if(!failed)
     1206        if(!failed && Display3D)
    10781207                IR3A_GizmoViewScatterPlot(MassFractalAggregate)
    10791208        else
    10801209                Print "Failed to grow meaningful aggregate)"
    10811210        endif
    1082         print time()+"  Finished, done in "+num2str((ticks-StartTicks)/60)+" seconds"   
     1211        //print time()+"  Finished, done in "+num2str((ticks-StartTicks)/60)+" seconds"         
    10831212        //else
    10841213        //      print time()+"  Failed, Aggregate is too compact "     
     
    10971226        DFref oldDf= GetDataFolderDFR()
    10981227        SetDataFolder root:Packages:AggregateModeling
    1099         print "****   Evaluating Aggregate structure    *****"
    1100         print "This may take anywhere from seconds to hours, depending on size and complexity of the aggregate."
     1228        //print "****   Evaluating Aggregate structure    *****"
     1229        print "Evaluating Aggregate - This may take anywhere from seconds to hours, depending on size and complexity of the aggregate."
    11011230        wave ListOfNeighbors
    11021231        wave NumberOfNeighbors
     
    11611290        NVAR RxRgPrimaryValue=root:Packages:AggregateModeling:RxRgPrimaryValue
    11621291        NVAR DegreeOfAggregation=root:Packages:AggregateModeling:DegreeOfAggregation
     1292        NVAR Misfit = root:Packages:AggregateModeling:CurrentMisfitValue
    11631293        SVAR MultiParticleAttraction = root:Packages:AggregateModeling:MultiParticleAttraction //"Neutral;Attractive;Repulsive;Not allowed;"
    11641294
     
    12351365        endif   
    12361366
     1367        IR3A_CalculateAggValues()
     1368       
    12371369        TrueStickingProbability = 100*DegreeOfAggregation/AttemptValue
    12381370        variable PrimaryDiameter = 2*sqrt(5/3)*RgPrimary
     
    12401372        RxRgPrimaryValue = RValue*PrimaryDiameter
    12411373        print "***** Results listing ******"
    1242         print "Total number of end points is : "+num2str(NumStarts)
     1374        //print "Total number of end points is : "+num2str(NumStarts)
    12431375        if(NumStarts<4)
    12441376                print "Warning : This particle is too compact (too few ends) to make any sense"
     
    12461378        endif
    12471379        //print "Possible number of paths is : " +num2str(NumStarts*(NumStarts-1))
    1248         print "Total number of evaluated paths is : "+num2str(NumPathsFound)
    1249         print "Paths per end point is : "+num2str(PathperEndPoint)
     1380        //print "Total number of evaluated paths is : "+num2str(NumPathsFound)
     1381        //print "Paths per end point is : "+num2str(PathperEndPoint)
    12501382        if(MaxNumPaths > NumberOfTestPaths-2)
    12511383                print "Warning : Some path/end point numbers were limited by max endpoint choice. Results may not be valid, increase No of test paths for these conditions"
    12521384        endif
    1253         print "Maximum length path is: "+num2str(MaxPathLength)
    1254         print "Weighted Average Path ="+num2str(pValue)
    1255         Print "Aggregate Rg [relative] = "+num2str(REnd)
    1256         Print "R primary particles [A] = "+num2str(PrimaryDiameter/2)
    1257         Print "Aggregate R [Angstroms] = "+num2str(RValue*PrimaryDiameter)
    1258         Print "z = "+num2str(DegreeOfAggregation)
    1259         Print "p = "+num2str(pValue)
    1260         Print "c = "+num2str(cValue)
    1261         Print "s = "+num2str(sValue)
    1262         Print "df = "+num2str(dfValue)
    1263         Print "dmin = "+num2str(dminValue)
    1264         Print "True Sticking Probability = "+num2str(100*DegreeOfAggregation/AttemptValue)+"%"
    1265         //Print "R [primary particles]= "+num2str(REnd)
     1385        print "Maximum length path is: \t\t\t\t"+num2str(MaxPathLength)
     1386        print "Weighted Average Path = \t\t\t\t"+num2str(pValue)
     1387        Print "Aggregate Rg [relative] = \t\t\t\t"+num2str(REnd)
     1388        Print "R primary particles [A] = \t\t\t\t"+num2str(PrimaryDiameter/2)
     1389        Print "Aggregate R [Angstroms] = \t\t\t\t"+num2str(RValue*PrimaryDiameter)
     1390        Print "z = \t\t\t\t\t"+num2str(DegreeOfAggregation)
     1391        Print "p = \t\t\t\t\t"+num2str(pValue)
     1392        Print "c = \t\t\t\t\t"+num2str(cValue)
     1393        Print "s = \t\t\t\t\t"+num2str(sValue)
     1394        Print "df = \t\t\t\t"+num2str(dfValue)
     1395        Print "dmin = \t\t\t\t"+num2str(dminValue)
     1396        Print "True Sticking Probability = \t\t"+num2str(100*DegreeOfAggregation/AttemptValue)+"%"
     1397        Print "Misfit value = \t\t\t\t"+num2str(Misfit)
    12661398
    12671399        //appned note to MassFractalAggregate
     
    12721404        NoteText+=";c="+num2str(IN2G_roundSignificant(cValue,4))+";True Sticking Probability="+num2str(100*DegreeOfAggregation/AttemptValue)
    12731405        NoteText+=";MultiParticleAttraction="+MultiParticleAttraction+";MaximumPathLength="+num2str(MaxPathLength)+";MaxNumberOfPathsPerEnd="+num2str(MaxNumPaths)+";NumberOfEnds="+num2str(NumStarts)+";"
     1406        NoteText+=";Misfti="+num2str(Misfit)+";"
    12741407
    12751408        Wave MassFractalAggregate
     
    14011534        DFref oldDf= GetDataFolderDFR()
    14021535
    1403         IR3A_InitializeMassFractAgg()
     1536        //IR3A_InitializeMassFractAgg()
    14041537        SetDataFolder root:Packages:AggregateModeling
    14051538
     
    14371570        ListOfVariables+="SelectedLevel;SelectedQlevel;SelectedBlevel;CurrentResults;StoredResults;"
    14381571        ListOfVariables+="BrFract_G2;BrFract_Rg2;BrFract_B2;BrFract_P2;BrFract_G1;BrFract_Rg1;BrFract_B1;BrFract_P1;BrFract_dmin;"
    1439         ListOfVariables+="BrFract_c;BrFract_z;BrFract_fBr;BrFract_fM;BrFract_df;"
     1572        ListOfVariables+="BrFract_c;BrFract_z;BrFract_fBr;BrFract_fM;BrFract_df;CurrentMisfitValue;"
     1573        ListOfVariables+="MaxNumTests;VaryStickingProbability;StickingProbMin;StickingProbMax;MinSearchTargetValue;StickProbNumSteps;TotalGrowthsPlanned;"
    14401574        ListOfStrings="SlectedBranchedLevels;Model;BrFract_ErrorMessage;MultiParticleAttraction;"
    14411575        Make/O/N=1/T Stored3DAggregates, Stored3DAggregatesPaths
     
    14841618        endif
    14851619
    1486 
    14871620        NVAR NUmberOfTestAggregates
    14881621        if(NUmberOfTestAggregates<5)
    14891622                NUmberOfTestAggregates = 5
     1623        endif
     1624        NVAR MaxNumTests
     1625        if(MaxNumTests<1)
     1626                MaxNumTests = 10
     1627        endif
     1628        NVAR StickingProbMin
     1629        if(StickingProbMin<5)
     1630                StickingProbMin = 10
     1631        endif
     1632        NVAR StickingProbMax
     1633        if(StickingProbMax<10)
     1634                StickingProbMax = 90
     1635        endif
     1636        NVAR MinSearchTargetValue
     1637        if(MinSearchTargetValue<0.001)
     1638                MinSearchTargetValue = 0.05
     1639        endif
     1640        NVAR StickProbNumSteps
     1641        if(StickProbNumSteps<5)
     1642                StickProbNumSteps = 5
    14901643        endif
    14911644//      NVAR gdf, gR
     
    18071960                        steps = max(steps,100)
    18081961                        if(stuck==1 && IR3A_IsPXYZNOTinList3DWave(MassFractalAggregate,px,py,pz, aggct))        //added here to make sure we do not accidentally add existing particle.
    1809                                 if(mod(aggct,steps)<1) ///round(DegreeOfAggregation/50))==aggct/round(DegreeOfAggregation/50))
    1810                                         Print time()+"  Added "+num2str(aggct)+" particles to the aggregate  "  //takes needless time..
    1811                                 endif
     1962                                //if(mod(aggct,steps)<1) ///round(DegreeOfAggregation/50))==aggct/round(DegreeOfAggregation/50))
     1963                                //      Print time()+"  Added "+num2str(aggct)+" particles to the aggregate  "  //takes needless time..
     1964                                //endif
    18121965                                MassFractalAggregate[aggct][0]=px
    18131966                                MassFractalAggregate[aggct][1]=py
     
    25142667                                SlectedBranchedLevels=popStr
    25152668                                IR3A_CalculateBranchedMassFr()
     2669                                IR3A_CalculateAggValues()
    25162670                        endif
    25172671                        if(stringMatch(CtrlName,"IntensityDataName")||stringMatch(CtrlName,"SelectDataFolder"))
     
    25212675                                IR3A_ClearVariables()
    25222676                                IR3A_CalculateBranchedMassFr()
     2677                                IR3A_CalculateAggValues()
    25232678                        endif   
    25242679                        if(stringMatch(CtrlName,"AllowedNearDistance"))
     
    25302685                                NUmberOfTestAggregates = str2num(popStr)
    25312686                        endif
     2687                        if(stringMatch(CtrlName,"StickProbNumSteps"))
     2688                                NVAR StickProbNumSteps=root:Packages:AggregateModeling:StickProbNumSteps
     2689                                StickProbNumSteps = str2num(popStr)
     2690                                IR3A_CalculateAggValues()
     2691                        endif
    25322692                       
    25332693                        if(stringMatch(CtrlName,"MParticleAttraction"))
     
    25352695                                MultiParticleAttraction = popStr
    25362696                        endif
     2697
    25372698                        break
    25382699        endswitch
     
    28062967                        if(stringMatch(cba.ctrlName,"CurrentResults"))
    28072968                                StoredResults=!CurrentResults
     2969                                IR3A_UpdatePanelValues()
    28082970                        endif
    28092971                        if(stringMatch(cba.ctrlName,"StoredResults"))
    28102972                                CurrentResults=!StoredResults
    2811                         endif
    2812                         IR3A_UpdatePanelValues()
     2973                                IR3A_UpdatePanelValues()
     2974                        endif
     2975                        if(stringMatch(cba.ctrlName,"VaryStickingProbability"))
     2976                                IR3A_SetControlsInPanel()
     2977                        endif
    28132978                        break
    28142979        endswitch
     
    28473012                PopupMenu IntensityDataName, win=FractalAggregatePanel, disable=CurrentResults
    28483013                Setvariable FolderMatchStr, win=FractalAggregatePanel, disable=CurrentResults
     3014               
     3015                ControlInfo/W=FractalAggregatePanel  GrowthTabs
     3016                STRUCT WMTabControlAction tca
     3017                tca.eventCode = 2
     3018                tca.tab=V_Value
     3019                IR3A_GrowthTabProc(tca)
    28493020
    28503021end
     
    28993070//******************************************************************************************************************************************************
    29003071//******************************************************************************************************************************************************
    2901 //******************************************************************************************************************************************************
    2902 //******************************************************************************************************************************************************
     3072Function IR3A_FindBestFitGrowth()
     3073        //will try to find best fit growth using random method...
     3074       
     3075       
     3076        NVAR CurrentMisfitValue=root:Packages:AggregateModeling:CurrentMisfitValue              //misfit value of existing growth               
     3077        NVAR MaxNumTests=root:Packages:AggregateModeling:MaxNumTests                                    //max growth at specific condition
     3078        NVAR VaryStickingProbability=root:Packages:AggregateModeling:VaryStickingProbability
     3079        NVAR StickingProbMin=root:Packages:AggregateModeling:StickingProbMin
     3080        NVAR StickingProbMax=root:Packages:AggregateModeling:StickingProbMax
     3081        NVAR StickProbNumSteps=root:Packages:AggregateModeling:StickProbNumSteps
     3082        NVAR MinSearchTargetValue=root:Packages:AggregateModeling:MinSearchTargetValue
     3083        NVAR TotalGrowthsPlanned=root:Packages:AggregateModeling:TotalGrowthsPlanned
     3084        NVAR StickingProbability = root:Packages:AggregateModeling:StickingProbability
     3085        //NVAR MinSearchTargetValue=root:Packages:AggregateModeling:MinSearchTargetValue
     3086        variable MinMisfitFound=1e5
     3087        variable i, j, failed, NumStickProbSteps=0
     3088        variable StickProbStepValu=0
     3089        variable StickingProbabilityStart
     3090        variable OriginalStickingProbability
     3091        variable NumberOftestedAggregates=0
     3092        OriginalStickingProbability = StickingProbability
     3093        StickingProbabilityStart = StickingProbability
     3094        if(VaryStickingProbability)
     3095                NumStickProbSteps = StickProbNumSteps-1
     3096                StickProbStepValu = abs(StickingProbMax-StickingProbMin)/NumStickProbSteps
     3097                StickingProbabilityStart = StickingProbMin
     3098        endif
     3099        Variable timerRefNum, microSeconds
     3100        timerRefNum = StartMSTimer
     3101        print "Starting run at : "+time()
     3102        For(j=0;j<=NumStickProbSteps;j+=1)
     3103                StickingProbability = StickingProbabilityStart+j*StickProbStepValu              //set new Sticking probability...
     3104                sleep/T 1
     3105                //DoUpdate /W=FractalAggregatePanel
     3106                For(i=0;i<MaxNumTests;i+=1)                                                                                                                     //iterate over number of growth as needed...
     3107                        failed = IR3A_Grow1MassFractAgreg(0)                                                                                    //grow the aggregate
     3108                        if(!failed)
     3109                                NumberOftestedAggregates += 1
     3110                                IR3A_CalculateAggValues()
     3111                                if(CurrentMisfitValue < MinMisfitFound)                                         //found better fit than before...
     3112                                        MinMisfitFound = CurrentMisfitValue
     3113                                        IR3A_StoreCurrentMassFractAgreg()
     3114                                        IR3A_Create3DAggListForListbox()
     3115                                        //print "Current misfit is : "+num2str(CurrentMisfitValue)
     3116                                        if(CurrentMisfitValue < MinSearchTargetValue)                   //found fit better than what user wants, abort here and save it for user.
     3117                                                IR3A_Calculate1DIntensity()
     3118                                                IR3A_Display3DAggregate(1)
     3119                                                DoUpdate /W=FractalAggregatePanel
     3120                                                microSeconds = StopMSTimer(timerRefNum)
     3121                                                print "End run at : "+time()
     3122                                                print "   >>>>     SUCCESS!   FOUND RESULT WITH MISFIT LOWER THAN REQUESTED.  <<<<    "
     3123                                                print "   >>>>     Found Aggregate which matches the requested conditions <<<<    "
     3124                                                print "Tested "+num2str(NumberOftestedAggregates) +" aggregates, total time run [minutes]: "+num2str(microSeconds/1000000/60)
     3125                                                StickingProbability = OriginalStickingProbability
     3126                                                return 1
     3127                                        endif
     3128                                endif
     3129                        endif
     3130                endfor
     3131        endfor
     3132        microSeconds = StopMSTimer(timerRefNum)
     3133        //Print microSeconds/10000, "microseconds per iteration"
     3134        print "End run at : "+time()
     3135
     3136        if(NumberOftestedAggregates)
     3137                //last selected one is the best...
     3138                wave/T Stored3DAggregates= root:Packages:AggregateModeling:Stored3DAggregates
     3139                ListBox StoredAggregates win=FractalAggregatePanel, selRow= numpnts(Stored3DAggregates)-1
     3140                //ControlInfo /W=FractalAggregatePanel StoredAggregates
     3141                IR3A_CalculateAggValues()
     3142                IR3A_Calculate1DIntensity()
     3143                IR3A_Display3DAggregate(1)
     3144                DoUpdate /W=FractalAggregatePanel
     3145                print "   >>>>     FAILURE!      DID NOT FOUND RESULT WITH LOW ENOUGH MISFIT.  <<<<    "
     3146                print "   >>>>     Finished search, the best fit found is "+num2str(CurrentMisfitValue)+" Could not find better fit.  <<<<    "
     3147                print "Tested "+num2str(NumberOftestedAggregates) +" aggregates, total time run [minutes]: "+num2str(microSeconds/1000000/60)
     3148        else            //did not find any...
     3149                print "   >>>>     Finished search, Could not grow any Aggregate, something si wrong.  <<<<    "
     3150        endif
     3151        StickingProbability = OriginalStickingProbability
     3152        return 0
     3153end
     3154
     3155//******************************************************************************************************************************************************
     3156//******************************************************************************************************************************************************
     3157
     3158static Function IR3A_CalculateAggValues()
     3159       
     3160        NVAR Misfit = root:Packages:AggregateModeling:CurrentMisfitValue
     3161        NVAR Target_C=root:Packages:AggregateModeling:BrFract_c
     3162        NVAR Target_dmin = root:Packages:AggregateModeling:BrFract_dmin
     3163        NVAR Model_Dmin=root:Packages:AggregateModeling:dminValue
     3164        NVAR Model_c = root:Packages:AggregateModeling:cValue
     3165        Misfit = (Target_C-Model_c)^2/(Target_C)^2 + (Target_dmin-Model_Dmin)^2/(Target_dmin)^2
     3166        NVAR TotalGrowthsPlanned = root:Packages:AggregateModeling:TotalGrowthsPlanned
     3167        NVAR MaxNumTests = root:Packages:AggregateModeling:MaxNumTests
     3168        NVAR StickProbNumSteps =root:Packages:AggregateModeling:StickProbNumSteps
     3169        TotalGrowthsPlanned = MaxNumTests * StickProbNumSteps
     3170        NVAR dmin = root:Packages:AggregateModeling:BrFract_dmin
     3171        NVAR cval = root:Packages:AggregateModeling:BrFract_c
     3172        NVAR df = root:Packages:AggregateModeling:BrFract_df
     3173        //if(StringMatch(sva.ctrlName, "Target_dmin") || StringMatch(sva.ctrlName, "Target_c"))
     3174        df = dmin * cval
     3175        //endif
     3176
     3177end
     3178
     3179
     3180//******************************************************************************************************************************************************
     3181//******************************************************************************************************************************************************
     3182
    29033183
    29043184
     
    29113191                        // click code here
    29123192                        if(stringmatch(ba.ctrlName,"Grow1AggAll"))
    2913                                 failed = IR3A_Grow1MassFractAgreg()
     3193                                failed = IR3A_Grow1MassFractAgreg(0)
    29143194                                if(!failed)
     3195                                        IR3A_CalculateAggValues()
    29153196                                        IR3A_Calculate1DIntensity()
    29163197                                        IR3A_Display3DAggregate(1)
     
    29223203                                variable i
    29233204                                For(i=0;i<NUmberOfTestAggregates;i+=1)
    2924                                         failed = IR3A_Grow1MassFractAgreg()
     3205                                        failed = IR3A_Grow1MassFractAgreg(0)
    29253206                                        if(!failed)
     3207                                                IR3A_CalculateAggValues()
     3208                                                IR3A_Display3DAggregate(1)
    29263209                                                IR3A_Calculate1DIntensity()
    29273210                                                IR3A_StoreCurrentMassFractAgreg()
    2928                                                 IR3A_Display3DAggregate(1)
    29293211                                                IR3A_Create3DAggListForListbox()
    29303212                                                print ">>>      Grown "+num2str(i+1)+" aggregate out of "+num2str(NUmberOfTestAggregates)
     
    29323214                                endfor
    29333215                                print "   >>>>     Done Growing "+num2str(NUmberOfTestAggregates)+" aggregates <<<<    "
     3216                        endif
     3217                        if(stringmatch(ba.ctrlName,"GrowOptimizedAgg"))
     3218                                IR3A_FindBestFitGrowth()
    29343219                        endif
    29353220                        if(stringmatch(ba.ctrlName,"Display3DMassFracGizmo"))
     
    30413326                Stored3DAggSelections = 0
    30423327                setDataFolder root:Packages:AggregateModeling:
    3043                 make/O/N=(NumOfFolders-1) IndexStoredResWave, dMinStoredResWave, cValStoredResWave, dfStoredResWave
    3044                 make/O/N=(NumOfFolders-1) dMinTarget, cValTarget, dfTarget
     3328                make/O/N=(NumOfFolders-1) IndexStoredResWave, dMinStoredResWave, cValStoredResWave, dfStoredResWave, MisfitValWave
     3329                make/O/N=(NumOfFolders-1) dMinTarget, cValTarget, dfTarget, MisfitTarget
    30453330                Wave IndexStoredResWave
    30463331                Wave dMinStoredResWave
     
    30603345                        dMinStoredResWave[i] = IR3A_Return3DAggParamVal("root:MassFractalAggregates:"+tempStr,"dMin")
    30613346                        dfStoredResWave[i] = IR3A_Return3DAggParamVal("root:MassFractalAggregates:"+tempStr,"df")
     3347                        MisfitValWave[i] = IR3A_Return3DAggParamVal("root:MassFractalAggregates:"+tempStr,"Misfit")
    30623348                endfor 
    30633349        endif
     
    30673353        NVAR cTarg = root:Packages:AggregateModeling:BrFract_c
    30683354        NVAR dfTarg = root:Packages:AggregateModeling:BrFract_df
     3355        NVAR MisFitTarg = root:Packages:AggregateModeling:MinSearchTargetValue
    30693356        dMinTarget = dminTarg
    30703357        cValTarget = cTarg
    30713358        dfTarget = dfTarg
     3359        if(MisFitTarg<1e-4)
     3360                MisFitTarg = WaveMin(MisfitValWave)
     3361        endif
     3362        MisfitTarget = MisFitTarg
    30723363        KillWIndow/Z AggStoredResultsOverview
    30733364       
     
    30763367        AppendToGraph/L=cAxis cValStoredResWave,cValTarget vs IndexStoredResWave
    30773368        AppendToGraph/L=dfAxis dfStoredResWave,dfTarget vs IndexStoredResWave
     3369        AppendToGraph/L=MisfitAxis MisfitValWave,MisfitTarget vs IndexStoredResWave
    30783370        ModifyGraph mode(dMinStoredResWave)=3,mode(cValStoredResWave)=3,mode(dfStoredResWave)=3
    30793371        ModifyGraph marker(dMinStoredResWave)=19,marker(cValStoredResWave)=17,marker(dfStoredResWave)=26
     3372        ModifyGraph mode(MisfitValWave)=3,marker(MisfitValWave)=29,rgb(MisfitValWave)=(0,0,0)
    30803373        ModifyGraph lStyle(dMinTarget)=3,lStyle(cValTarget)=3,lStyle(dfTarget)=3
    30813374        ModifyGraph rgb(cValStoredResWave)=(1,16019,65535),rgb(cValTarget)=(1,16019,65535)
    30823375        ModifyGraph rgb(dfStoredResWave)=(3,52428,1),rgb(dfTarget)=(3,52428,1)
    30833376        ModifyGraph lblPosMode(cAxis)=3
    3084         ModifyGraph lblPos(left)=63,lblPos(cAxis)=64,lblPos(dfAxis)=66
     3377        ModifyGraph lblPos(left)=64,lblPos(cAxis)=64,lblPos(dfAxis)=64,lblPos(MisfitAxis)=64
    30853378        ModifyGraph lblLatPos(left)=-8,lblLatPos(cAxis)=-6,lblLatPos(dfAxis)=-6
     3379        ModifyGraph lblLatPos(MisfitAxis)=-6   
    30863380        ModifyGraph freePos(cAxis)=0
    30873381        ModifyGraph freePos(dfAxis)=0
    3088         ModifyGraph axisEnab(left)={0,0.31}
    3089         ModifyGraph axisEnab(cAxis)={0.35,0.64}
    3090         ModifyGraph axisEnab(dfAxis)={0.68,1}
     3382        ModifyGraph freePos(MisfitAxis)=0
     3383        ModifyGraph axisEnab(left)={0,0.24}
     3384        ModifyGraph axisEnab(cAxis)={0.26,0.49}
     3385        ModifyGraph axisEnab(dfAxis)={0.51,0.74}
     3386        ModifyGraph axisEnab(MisfitAxis)={0.76,1}
    30913387        ModifyGraph mirror=1
    30923388        ModifyGraph tick(bottom)=2
     
    30943390        ModifyGraph tick(cAxis)=1
    30953391        ModifyGraph tick(dfAxis)=1
     3392        ModifyGraph lowTrip(MisfitAxis)=0.001
    30963393       
    30973394        Label left "\\Z"+IN2G_LkUpDfltVar("AxisLabelSize")+"d\\Bmin"
     
    30993396        Label cAxis "\\Z"+IN2G_LkUpDfltVar("AxisLabelSize")+"c value"
    31003397        Label dfAxis "\\Z"+IN2G_LkUpDfltVar("AxisLabelSize")+"df"
     3398        Label MisfitAxis "\\Z"+IN2G_LkUpDfltVar("AxisLabelSize")+"Misfit"
    31013399        wavestats/Q dMinStoredResWave
    31023400        MinVal=min(V_min,dminTarg)*0.95
     
    31303428        DrawLine 0,0.34,1,0.34
    31313429        string LegendText="\\F"+IN2G_LkUpDfltStr("FontType")+"\\Z"+IN2G_LkUpDfltVar("LegendSize")+"\\s(dMinStoredResWave) d\\Bmin\r\\s(dMinTarget) d\\Bmin\\M  target\r\\s(cValStoredResWave) c\r\\s(cValTarget) c target\r\\s(dfStoredResWave) d\\Bf\r\\s(dfTarget) d\\Bf\\M target"
     3430        LegendText+=" \r\s(MisfitValWave) Misfit Values \r\\s(MisfitTarget) MisfitTarget"
    31323431        Legend/C/N=LegendText/J/A=LT LegendText
    31333432        setDataFOlder OldDf
     
    31513450                NVAR df = dfValue
    31523451                RetValue = df
     3452        elseif(StringMatch(ParName, "Misfit"))
     3453                NVAR Misfit = Misfit
     3454                RetValue = Misfit
    31533455        else
    31543456                RetValue = 0
     
    31793481        NVAR OldAttemptValue=root:Packages:AggregateModeling:AttemptValue
    31803482        NVAR AllowedNearDistance=root:Packages:AggregateModeling:AllowedNearDistance
     3483        NVAR OldMisfit = root:Packages:AggregateModeling:CurrentMisfitValue
    31813484        Wave/Z MSF=root:Packages:AggregateModeling:MassFractalAggregate
    31823485        if(WaveExists(MSF))
    31833486                string NewFolderName
    3184                 NewFolderName = "MFA_DOA_"+num2str(OldDegreeOfAggregation)+"_Stick_"+num2str(OldStickingProbability)+"_StickMeth_"+num2str(AllowedNearDistance)+"_"
     3487                NewFolderName = "MFA_DOA_"+num2str(trunc(OldDegreeOfAggregation))+"_Stick_"+num2str(trunc(OldStickingProbability))+"_StickMeth_"+num2str(trunc(AllowedNearDistance))+"_"
    31853488                NewDataFolder/O/S root:MassFractalAggregates
    31863489                NewFolderName = UniqueName(NewFolderName, 11, 0 )
     
    31973500                variable/g AttemptValue = OldAttemptValue               
    31983501                variable/g StickingMethod = AllowedNearDistance
     3502                variable/g Misfit = oldMisfit
    31993503        endif
    32003504        setDataFOlder OldDf
     
    34523756        Wave ThreeDVoxelGram = POVVoxelWave
    34533757        NVAR voxelSize = root:packages:POVPDBImport:voxelSize
    3454         print "Warning = IR3P_Calculate1DDataFile needs to get VoxelSize fixzed, it is fixerd at 2A"
     3758        print "Warning = IR3P_Calculate1DDataFile needs to get VoxelSize fixed, it is fixed at 2A"
    34553759        //variable NumRSteps=300
    34563760        variable IsoValue = 0.5
  • trunk/User Procedures/Irena/IR3_SimpleFits.ipf

    r1169 r1171  
    148148        NewPanel /K=1 /W=(2.25,43.25,530,800) as "Simple Fits & Analysis tool"
    149149        DoWIndow/C IR3J_SimpleFitsPanel
    150         TitleBox MainTitle title="Simple Fists & Analysis tool",pos={120,2},frame=0,fstyle=3, fixedSize=1,font= "Times New Roman", size={360,30},fSize=22,fColor=(0,0,52224)
     150        TitleBox MainTitle title="Simple Fits & Analysis tool",pos={120,2},frame=0,fstyle=3, fixedSize=1,font= "Times New Roman", size={360,30},fSize=22,fColor=(0,0,52224)
    151151        string UserDataTypes=""
    152152        string UserNameString=""
  • trunk/User Procedures/Nika/NI1_Main.ipf

    r1170 r1171  
    100100        help={"This enables switching among multiple Nika geometries, such as distances or wavelengths"}
    101101        Submenu "Instrument configurations"
    102                 "9IDC or 15IDD USAXS-SAXS-WAXS", NI1_9IDCConfigureNika()
     102                "9IDC USAXS-SAXS-WAXS", NI1_9IDCConfigureNika()
    103103                help={"Support for data from 9ID or9IDC (USAXS/SAXS) beamline at APS"}
    104104                "RSoXS ALS soft energy instrument", NI1_RSoXSCreateGUI()
  • trunk/User Procedures/Nika/NI1_USAXSSupport.ipf

    r1156 r1171  
    150150        SetDrawLayer UserBack
    151151        SetDrawEnv fsize= 18,fstyle= 3,textrgb= (16385,16388,65535)
    152         DrawText 10,25,"9ID-C (or 15ID-D) Nexus file configuration"
    153        
    154         DrawText 10, 43, "SAXS : Pilatus 100k camera in USAXS (use with USAXS)"
    155         DrawText 10, 60, "WAXS    : Pilatus 100k or 200kw WAXS used in USAXS/SAXS/WAXS configuration"
     152        DrawText 10,25,"USAXS SAXS/WAXS Nexus file configuration"
     153       
     154        DrawText 10, 43, "SAXS : Pilatus 100k in USAXS/SAXS/WAXS"
     155        DrawText 10, 60, "WAXS-Pilatus : default Pilatus 300kw in USAXS/SAXS/WAXS"
     156        DrawText 10, 77, "WAXS-Dexela : rare Dexela 2315 in USAXS/SAXS/WAXS"
    156157        ///DrawText 10, 77, "SAXS     : large SAXS camera in the 15ID-D (only SAXS, no USAXS)"
    157158        Checkbox SAXSSelection,pos={10,90},size={100,20}, variable=root:Packages:Convert2Dto1D:USAXSSAXSselector, proc=NI1_9IDCCheckProc
    158159        Checkbox SAXSSelection, title ="SAXS", help={"Use to configure Nika for SAXS"}
    159160        Checkbox USAXSWAXSselector,pos={120,90},size={100,20}, variable=root:Packages:Convert2Dto1D:USAXSWAXSselector, proc=NI1_9IDCCheckProc
    160         Checkbox USAXSWAXSselector, title ="WAXS-Pilatus", help={"Use to configure Nika for WAXS using Pilatus"}
     161        Checkbox USAXSWAXSselector, title ="WAXS-Pilatus (typ)", help={"Common detecctor - Use to configure Nika for WAXS using Pilatus"}
    161162        Checkbox USAXSWAXSDexselector,pos={230,90},size={100,20}, variable=root:Packages:Convert2Dto1D:USAXSWAXSDexselector, proc=NI1_9IDCCheckProc
    162         Checkbox USAXSWAXSDexselector, title ="WAXS-Dexela", help={"Use to configure Nika for WAXS using Dexela"}
     163        Checkbox USAXSWAXSDexselector, title ="WAXS-Dexela (rare)", help={"Rare detector - Use to configure Nika for WAXS using Dexela"}
    163164
    164165        Checkbox DisplayJPGFile,pos={370,90},size={100,20}, variable=root:Packages:Convert2Dto1D:DisplayJPGFile, noproc
Note: See TracChangeset for help on using the changeset viewer.