Ignore:
Timestamp:
Sep 27, 2013 4:59:01 PM (9 years ago)
Author:
srkline
Message:

Better colorization of Gizmo plots when real-space structures are generated with more than one SLD. Up to 5 different SLDs are colored (this is a voxelgram limit on Gizmo)

Simulation scripting was tweaked so that the examples can be configured and run from the menu once it is enabled.

Location:
sans/Dev/trunk/NCNR_User_Procedures
Files:
2 edited

Legend:

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

    r923 r924  
    5050 
    5151        Wave mat = root:mat 
    52         ParseMatrix3D_rho(mat) 
    5352         
    54         Wave rho3D = root:rho3D 
    55         NVAR solventSLD = root:FFT_SolventSLD 
    56  
    57         Variable np,val,ii,ind 
    58         string str 
    59  
    60 // how many different SLDs are there? 
    61         //loop through the rho wave, disregarding the solvent 
    62         Duplicate/O rho3D tmpSLD 
    63         Make/O/D/N=0 SLD_id 
    64         SLD_id = 0 
    65         np = 0 
    66  
    67         if(numpnts(rho3D)==0) 
    68                 return(0)               //nothing in matrix, get out 
     53        String listStr,str 
     54        listStr = ListOfValues(mat)             //returns a ";" delimited list of the different SLD values 
     55        //remove the solvent 
     56        NVAR val = root:FFT_SolventSLD 
     57        listStr = RemoveFromList(num2istr(val), listStr ,";") 
     58         
     59        print listStr 
     60         
     61        Variable numDiffSLD = ItemsInList(listStr ,";") 
     62        if(numdiffSLD > 5) 
     63                numDiffSLD = 5 
     64                DoAlert 0,"Only 5 different colors can be displayed. Some SLDs will not be displayed." 
    6965        endif 
    7066 
    71         do 
    72                 val = WaveMin(tmpSLD) 
    73                 if(val != solventSLD && val != 1e10) 
    74                         np += 1 
    75                         InsertPoints numpnts(SLD_id),1,SLD_id 
    76                         SLD_id[np-1] = val 
    77                 endif 
    78                 tmpSLD = (tmpSLD == val) ? 1e10 : tmpSLD                // set the values to 1e10 
    79         while(val != 1e10) 
    80         KillWaves/Z tmpSLD       
    81  
    82         Variable numDiffSLD = numpnts(SLD_id) 
    83         if(numdiffSLD > 5) 
    84                 DoAlert 0,"Only 5 different colors can be displayed. Some SLDs will not be displayed." 
    85         endif 
    86 //      print SLD_id 
    87  
     67        Variable ii,ind 
    8868//// now loop through and colorize the different parts 
    8969        Make/O/D/N=5 rr,gg,bb,aa 
     
    9171        gg = {0.244434,0,0.6,0.799954,0} 
    9272        bb = {1,0,0,0,0} 
    93         aa = 0.2 
     73        aa = 0.15                               //alpha = transparency 
    9474         
    95         for(ii=0;ii<5;ii+=1) 
     75        for(ii=0;ii<numDiffSLD;ii+=1) 
    9676                ind = ii 
    9777//      for(ii=0;ii<numDiffSLD;ii+=1) 
     
    9979                str = "ModifyGizmo/N=Gizmo_VoxelMat ModifyObject=voxelgram0 property={ valueRGBA," 
    10080                str += num2istr(ind)+"," 
    101                 str += num2istr(SLD_id[ind])+"," 
     81                str += StringFromList(ind, listStr ,";")   +"," 
    10282                str += num2str(rr[ind])+"," 
    10383                str += num2str(gg[ind])+"," 
     
    10686                         
    10787//              ModifyGizmo/N=Gizmo_VoxelMat ModifyObject=voxelgram0 property={ valueRGBA,ii,SLD_id[ii],rr[ii],gg[ii],bb[ii],aa[ii]} 
    108 //              print str 
     88                print str 
    10989                execute str 
    11090        endfor 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MC_SimulationScripting.ipf

    r921 r924  
    66//************ 
    77// un-comment the Macros menu declaration to provide easier access to the functions 
     8// -- remove the "x" from "xMenu" in the section following these comments.  The macros menu 
     9//    will then have easier access to the scripting functions. 
     10// 
     11// **To write your own scripts, follow the examples in: 
     12//              Example_1DSim() 
     13//              Example_2DSim() 
     14// 
     15// and also the instructions below in the "basic cycle" 
     16// 
    817//************ 
    918 
     
    112121// 
    113122// -- scattering from an empty cell is NOT provided in 2D 
    114  
     123// 
     124 
     125 
     126 
     127/// un-comment this by removing the "x" from the word xMenu. Then compile. 
    115128xMenu "Macros" 
    116129        Submenu "Simulation Scripting - Beta" 
     
    118131                "Move to Configuration",Sim_moveConfProc() 
    119132                "List Configurations",ListSASCALCConfigs() 
    120                 "Setup Sim Example",Setup_Sim_Example() 
    121133                "1D Count Rates",DryRunProc_1D() 
    122134                "2D Dry Run",DryRunProc_2D() 
     
    125137                "Combine by Name",DoCombineFiles_byName(lowQfile,medQfile,hiQfile,saveName) 
    126138                "Turn Off Dead Time Correction",Sim_SetDeadTimeTiny() 
     139                "-" 
     140                "Setup Sim Example",Setup_Sim_Example() 
     141                "Run 1D Sim Example",Example_1DSim() 
     142                "Run 2D Sim Example",Example_2DSim() 
    127143        End 
    128144End 
    129145 
    130 // run this before the examples to make sure that the proper named configurations exist. 
    131 // this function will overwrite any same-named waves 
     146 
     147////////// --- START OF EXAMPLE SCRIPTS ---  //////////////// 
     148 
     149// 
     150// run this before the examples to make sure that the proper named configurations and function exist. 
     151// this function will overwrite any same-named configurations 
     152// 
    132153Function Setup_Sim_Example() 
    133154 
     
    139160        Config_13m = {"checkNG7","1","5.08 cm","6","0.115","checkChamber","1/2\"","0","1300","0","","","","","","","","","",""} 
    140161   
     162// include the model and plot it, so that it will exist. Post to queue so they execute in order 
     163        Execute/P "INSERTINCLUDE \"SchulzSpheres_Sq_v40\"" 
     164        Execute/P "COMPILEPROCEDURES "  
     165        Execute/P "PlotSchulzSpheres_SC(256,0.001,0.7)" 
     166         
     167        Execute/P "SASCALC()" 
     168                                 
    141169        SetDataFolder root: 
    142170 
     
    305333        return(0)        
    306334End 
     335 
     336 
     337//////////////// ---- END OF EXAMPLE SCRIPTS --- //////////////////// 
    307338 
    308339 
Note: See TracChangeset for help on using the changeset viewer.