Changeset 668


Ignore:
Timestamp:
Apr 7, 2010 11:00:01 AM (12 years ago)
Author:
srkline
Message:

Made the preference panel fancier, with a tab control. this makes it much easier to add more things in the future. Added two more SANS items to turn off some detector corrections. good for testing, but maybe a bit dangerous.

removed the SANSPreferences procedure file from the general includes list for reduction. kept it in the very old versions of the includes (510 and older) for backwards comaptibility. new experiments start with 520 or higher.

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

Legend:

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

    r665 r668  
    33#pragma IgorVersion=6.1 
    44 
    5 // 
    6 // need a way of importing more functions into the experiment 
    7 // ? call the picker panel from the panel? 
    8 // 
    9 // 
    105 
    116//Macro OpenWrapperPanel() 
     
    3227        //initializes preferences. this includes XML y/n, and SANS Reduction items.  
    3328        // if they already exist, they won't be overwritten 
    34         Execute "init_pref()"            
     29        Execute "Initialize_Preferences()"               
    3530         
    3631        DoWindow/F WrapperPanel 
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtilsMacro_v40.ipf

    r665 r668  
    12021202        DoWindow/F Pref_Panel 
    12031203        if(V_flag==0) 
    1204                 Init_Pref() 
     1204                Initialize_Preferences() 
    12051205                Pref_Panel() 
    12061206        Endif 
     
    12081208End 
    12091209 
    1210 Proc init_pref() 
     1210Proc Initialize_Preferences() 
    12111211        // create the globals here if they are not already present 
    12121212         
     
    12321232        Variable/G root:Packages:NIST:gNPhiSteps=val 
    12331233         
     1234        // flags to turn detector corrections on/off for testing (you should leave these ON) 
     1235        val = NumVarOrDefault("root:Packages:NIST:gDoDetectorEffCorr", 1 ) 
     1236        Variable/G root:Packages:NIST:gDoDetectorEffCorr = 1 
     1237         
     1238        val = NumVarOrDefault("root:Packages:NIST:gDoTransmissionCorr", 1 ) 
     1239        Variable/G root:Packages:NIST:gDoTransmissionCorr = 1 
     1240         
     1241         
    12341242        /// items for SANS Analysis 
    12351243         
     
    12851293End 
    12861294 
    1287 // draws the panel 
    1288 // each checkbox should actively change a global value 
    12891295Proc Pref_Panel() 
    12901296        PauseUpdate; Silent 1           // building window... 
    1291         NewPanel /W=(607,158,958,580)/K=2 as "SANS Preference Panel" 
     1297        NewPanel /W=(646,208,1070,468)/K=2 as "NCNR Preference Panel" 
    12921298        DoWindow/C pref_panel 
    12931299        ModifyPanel cbRGB=(49694,61514,27679) 
    12941300        SetDrawLayer UserBack 
    1295         DrawText 34,288,"nothing to set" 
    1296         DrawText 34,370,"nothing to set" 
    1297         CheckBox check0,pos={21,99},size={171,14},proc=LogScalePrefCheck,title="Use Log scaling for 2D data display" 
    1298         CheckBox check0,help={"Checking this will display 2D SANS data with a logarithmic color scale of neutron counts. If not checked, the color mapping will be linear."} 
    1299         CheckBox check0,value= root:Packages:NIST:gLogScalingAsDefault 
    1300         CheckBox check1,pos={21,119},size={163,14},proc=DRKProtocolPref,title="Allow DRK correction in protocols" 
    1301         CheckBox check1,help={"Checking this will allow DRK correction to be used in reduction protocols. You will need to re-draw the protocol panel for this change to be visible."} 
    1302         CheckBox check1,value= root:Packages:NIST:gAllowDRK 
    1303         CheckBox check2,pos={21,139},size={137,14},proc=UnityTransPref,title="Check for Transmission = 1" 
    1304         CheckBox check2,help={"Checking this will check for SAM or EMP Trans = 1 during data correction"} 
    1305         CheckBox check2,value= root:Packages:NIST:gDoTransCheck 
    1306         Button button0,pos={282,379},size={50,20},proc=PrefDoneButtonProc,title="Done" 
    1307         SetVariable setvar0,pos={21,169},size={200,15},title="Averaging Bin Width (pixels)" 
    1308         SetVariable setvar0,limits={1,100,1},value= root:Packages:NIST:gBinWidth 
    1309         SetVariable setvar1,pos={21,194},size={200,15},title="# Phi Steps (annular avg)" 
    1310         SetVariable setvar1,limits={1,360,1},value= root:Packages:NIST:gNPhiSteps 
    1311         CheckBox check3,pos={21,34},size={124,14},proc=XMLWritePref,title="Use canSAS XML Output" 
    1312         CheckBox check3,help={"Checking this will set the default output format to be canSAS XML rather than NIST 6 column"} 
    1313         CheckBox check3,value= root:Packages:NIST:gXML_Write 
    1314         GroupBox group0,pos={9,6},size={230,54},title="Global Preferences",fSize=12 
    1315         GroupBox group0_1,pos={9,74},size={230,149},title="SANS Reduction",fSize=12 
    1316         GroupBox group0_2,pos={9,238},size={230,68},title="USANS Reduction",fSize=12 
    1317         GroupBox group0_3,pos={9,319},size={230,68},title="Analysis",fSize=12 
    1318          
    1319         //keep these hidden for now so that nobody can accidentally change them from 
    1320         //the default values set in Initialize.ipf (128x128) 
    1321 //      SetVariable setvar2,pos={10,125},size={200,15},title="Detector Pixels (X)" 
    1322 //      SetVariable setvar2,limits={1,2000,1},value= root:Packages:NIST:gNPixelsX 
    1323 //      SetVariable setvar3,pos={10,145},size={200,15},title="Detector Pixels (Y)" 
    1324 //      SetVariable setvar3,limits={1,2000,1},value= root:Packages:NIST:gNPixelsY 
    1325  
    1326 End 
     1301        ModifyPanel fixedSize=1 
     1302////// 
     1303//on main portion of panel, always visible 
     1304        Button PrefPanelButtA,pos={354,12},size={50,20},proc=PrefDoneButtonProc,title="Done" 
     1305 
     1306        TabControl PrefTab,pos={7,49},size={410,202},tabLabel(0)="General",proc=PrefTabProc 
     1307        TabControl PrefTab,tabLabel(1)="SANS",tabLabel(2)="USANS",tabLabel(3)="Analysis" 
     1308        TabControl PrefTab,value=0 
     1309        TabControl PrefTab labelBack=(49694,61514,27679) 
     1310         
     1311//on tab(0) - General - initially visible 
     1312        CheckBox PrefChec_0a,pos={21,96},size={124,14},proc=XMLWritePref,title="Use canSAS XML Output" 
     1313        CheckBox PrefChec_0a,help={"Checking this will set the default output format to be canSAS XML rather than NIST 6 column"} 
     1314        CheckBox PrefChec_0a,value= root:Packages:NIST:gXML_Write 
     1315 
     1316//on tab(1) - SANS 
     1317        CheckBox PrefChec_1a,pos={21,100},size={171,14},proc=LogScalePrefCheck,title="Use Log scaling for 2D data display" 
     1318        CheckBox PrefChec_1a,help={"Checking this will display 2D SANS data with a logarithmic color scale of neutron counts. If not checked, the color mapping will be linear."} 
     1319        CheckBox PrefChec_1a,value= root:Packages:NIST:gLogScalingAsDefault 
     1320        CheckBox PrefChec_1b,pos={21,120},size={163,14},proc=DRKProtocolPref,title="Allow DRK correction in protocols" 
     1321        CheckBox PrefChec_1b,help={"Checking this will allow DRK correction to be used in reduction protocols. You will need to re-draw the protocol panel for this change to be visible."} 
     1322        CheckBox PrefChec_1b,value= root:Packages:NIST:gAllowDRK 
     1323        CheckBox PrefChec_1c,pos={21,140},size={137,14},proc=UnityTransPref,title="Check for Transmission = 1" 
     1324        CheckBox PrefChec_1c,help={"Checking this will check for SAM or EMP Trans = 1 during data correction"} 
     1325        CheckBox PrefChec_1c,value= root:Packages:NIST:gDoTransCheck 
     1326        SetVariable PrefSetV_1d,pos={21,170},size={200,15},title="Averaging Bin Width (pixels)" 
     1327        SetVariable PrefSetV_1d,limits={1,100,1},value= root:Packages:NIST:gBinWidth 
     1328        SetVariable PrefSetV_1e,pos={21,195},size={200,15},title="# Phi Steps (annular avg)" 
     1329        SetVariable PrefSetV_1e,limits={1,360,1},value= root:Packages:NIST:gNPhiSteps 
     1330        CheckBox PrefChec_1f title="Do Transmssion Correction?",size={140,14},value=1 
     1331        CheckBox PrefChec_1f pos={255,100},help={"TURN OFF ONLY FOR DEBUGGING. This corrects the data for angle dependent transmssion."} 
     1332        CheckBox PrefChec_1g title="Do Efficiency Correction?",size={140,14} 
     1333        CheckBox PrefChec_1g value=1,pos={255,120},help={"TURN OFF ONLY FOR DEBUGGING. This corrects the data for angle dependent detector efficiency."} 
     1334 
     1335 
     1336        CheckBox PrefChec_1a,disable=1 
     1337        CheckBox PrefChec_1b,disable=1 
     1338        CheckBox PrefChec_1c,disable=1 
     1339        SetVariable PrefSetV_1d,disable=1 
     1340        SetVariable PrefSetV_1e,disable=1 
     1341        CheckBox PrefChec_1f,disable=1 
     1342        CheckBox PrefChec_1g,disable=1 
     1343 
     1344//on tab(2) - USANS 
     1345        GroupBox PrefGrou_2a pos={21,100},size={1,1},title="nothing to set",fSize=12 
     1346 
     1347        GroupBox PrefGrou_2a,disable=1 
     1348 
     1349 
     1350//on tab(3) - Analysis 
     1351        GroupBox PrefGrou_3a pos={21,100},size={1,1},title="nothing to set",fSize=12 
     1352         
     1353        GroupBox PrefGrou_3a,disable=1 
     1354 
     1355EndMacro 
     1356 
     1357// function to control the drawing of controls in the TabControl on the main panel 
     1358// Naming scheme for the controls MUST be strictly adhered to... else controls will  
     1359// appear in odd places... 
     1360// all controls are named PrefCtrl_NA where N is the tab number and A is the letter denoting 
     1361// the controls position on that particular tab. 
     1362// in this way, they will always be drawn correctly.. 
     1363// 
     1364Function PrefTabProc(name,tab) 
     1365        String name 
     1366        Variable tab 
     1367         
     1368//      Print "name,number",name,tab 
     1369        String ctrlList = ControlNameList("",";"),item="",nameStr="" 
     1370        Variable num = ItemsinList(ctrlList,";"),ii,onTab 
     1371        for(ii=0;ii<num;ii+=1) 
     1372                //items all start w/"PrefCtrl_" 
     1373                item=StringFromList(ii, ctrlList ,";") 
     1374                nameStr=item[0,10] 
     1375                strswitch(item[0,7])     
     1376                        case "PrefChec":                 
     1377                                onTab = str2num(item[9]) 
     1378                                CheckBox $item,disable=(tab!=onTab) 
     1379                                break                                           // exit from switch 
     1380                        case "PrefSetV":                 
     1381                                onTab = str2num(item[9]) 
     1382                                SetVariable $item,disable=(tab!=onTab) 
     1383                                break 
     1384                        case "PrefGrou":                 
     1385                                onTab = str2num(item[9]) 
     1386                                GroupBox $item,disable=(tab!=onTab) 
     1387                                break 
     1388                        default: 
     1389                                        //do nothing for no match 
     1390                endswitch 
     1391         
     1392        endfor  
     1393End 
     1394 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Includes_v520.ipf

    r658 r668  
    6262//Add back Real Time for ICE 
    6363////#include "RealTimeUpdate_RT"                version>=5.0             
    64 #include "SANSPreferences"                              version>=5.0            //NEW 05MAY03 
    6564#include "Subtract_1D"                          version>=5.0                    //NEW 14MAY03 
    6665 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes.ipf

    r570 r668  
    44 
    55 
     6 
     7// SRK 7 APR 2012 
     8// as of version 5.1, this is now a pointer to the current version of the includes 
     9#include "Includes_v520" 
     10 
    611// SRK 12 FEB 08 
    712// as of version 5.1, this is now a pointer to the current version of the includes 
    8 #include "Includes_v510" 
     13//#include "Includes_v510" 
    914 
    1015// as of version 5, this is now a pointer to the current version of the includes 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_Facility.ipf

    r575 r668  
    55 
    66// be sure to add a definition for your facility so that 
    7 // minor chnages to the core code can be added through compiler directives 
    8 //#define SYMBOL 
     7// minor changes to the core code can be added through compiler directives 
     8// 
    99 
     10//Function FACILITY() 
     11//      //does nothing but define FACILITY() 
     12//      return(0) 
     13//End 
    1014 
    1115 
     
    4852// removed RT ipf file in 29MAR07 branch (do not delete, but do not include or maintain) 
    4953//#include "RealTimeUpdate_RT"          version>=5.0             
    50 #include "SANSPreferences"                              version>=5.0            //NEW 05MAY03 
    5154#include "Subtract_1D"                          version>=5.0                    //NEW 14MAY03 
    5255 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520.ipf

    r658 r668  
    5959//Add back Real Time for ICE 
    6060#include "RealTimeUpdate_RT"            version>=5.0             
    61 #include "SANSPreferences"                              version>=5.0            //NEW 05MAY03 
    6261#include "Subtract_1D"                          version>=5.0                    //NEW 14MAY03 
    6362 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520_ILL.ipf

    r658 r668  
    6060// removed RT ipf file in 29MAR07 branch (do not delete, but do not include or maintain) 
    6161//#include "RealTimeUpdate_RT"          version>=5.0             
    62 #include "SANSPreferences"                              version>=5.0            //NEW 05MAY03 
    6362#include "Subtract_1D"                          version>=5.0                    //NEW 14MAY03 
    6463 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Initialize.ipf

    r665 r668  
    104104        //initializes preferences. this includes XML y/n, and SANS Reduction items.  
    105105        // if they already exist, they won't be overwritten 
    106         Execute "init_pref()"    
     106        Execute "Initialize_Preferences()"       
    107107 
    108108         
    109         // flags to turn detector corrections on/off for testing (you should leave these ON) 
    110         Variable/G root:myGlobals:gDoDetectorEffCorr = 1 
    111         Variable/G root:myGlobals:gDoTransmissionCorr = 1 
     109 
    112110 
    113111        //set flag if Demo Version is detected 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SANSPreferences.ipf

    r665 r668  
    44 
    55 
     6/////////////////////////// 
     7// user preferences 
     8//  
     9// globals are created in initialize.ipf 
     10// 
     11// this panel allows for user modification 
     12/////////////////////////// 
     13Proc Show_Preferences_Panel() 
     14 
     15        DoWindow/F Pref_Panel 
     16        if(V_flag==0) 
     17                Init_Pref() 
     18                Pref_Panel() 
     19        Endif 
     20//      Print "Preferences Panel stub" 
     21End 
     22 
     23Proc init_pref() 
     24        // all creation of global values for the pref panel 
     25        // should be done in the experiment initialization 
     26        // since all these globals will be in active use 
     27        // even if the preferences are never actively set 
     28end 
     29 
     30Function LogScalePrefCheck(ctrlName,checked) : CheckBoxControl 
     31        String ctrlName 
     32        Variable checked 
     33         
     34        NVAR gLog = root:myGlobals:gLogScalingAsDefault 
     35        glog=checked 
     36        //print "log pref checked = ",checked 
     37End 
     38 
     39Function DRKProtocolPref(ctrlName,checked) : CheckBoxControl 
     40        String ctrlName 
     41        Variable checked 
     42         
     43        NVAR gDRK = root:myGlobals:gAllowDRK 
     44        gDRK = checked 
     45        //Print "DRK preference = ",checked 
     46End 
     47 
     48Function UnityTransPref(ctrlName,checked) : CheckBoxControl 
     49        String ctrlName 
     50        Variable checked 
     51         
     52        NVAR gVal = root:myGlobals:gDoTransCheck 
     53        gVal = checked 
     54End 
     55 
     56Function XMLWritePref(ctrlName,checked) : CheckBoxControl 
     57        String ctrlName 
     58        Variable checked 
     59         
     60        NVAR gVal = root:Packages:NIST:gXML_Write 
     61        gVal = checked 
     62End 
     63 
     64Function PrefDoneButtonProc(ctrlName) : ButtonControl 
     65        String ctrlName 
     66         
     67        DoWindow/K pref_panel 
     68End 
     69 
     70// draws the panel 
     71// each checkbox should actively change a global value 
     72Proc Pref_Panel() 
     73        PauseUpdate; Silent 1           // building window... 
     74        NewPanel /K=2 /W=(607,158,899,360) as "SANS Preference Panel" 
     75        DoWindow/C pref_panel 
     76        ModifyPanel cbRGB=(49694,61514,27679) 
     77        CheckBox check0,pos={10,10},size={186,14},proc=LogScalePrefCheck,title="Use Log scaling for 2D data display" 
     78        CheckBox check0,help={"Checking this will display 2D SANS data with a logarithmic color scale of neutron counts. If not checked, the color mapping will be linear."} 
     79        CheckBox check0,value= root:myGlobals:gLogScalingAsDefault 
     80        CheckBox check1,pos={10,30},size={184,14},proc=DRKProtocolPref,title="Allow DRK correction in protocols" 
     81        CheckBox check1,help={"Checking this will allow DRK correction to be used in reduction protocols. You will need to re-draw the protocol panel for this change to be visible."} 
     82        CheckBox check1,value= root:myGlobals:gAllowDRK 
     83        CheckBox check2,pos={10,50},size={184,14},proc=UnityTransPref,title="Check for Transmission = 1" 
     84        CheckBox check2,help={"Checking this will check for SAM or EMP Trans = 1 during data correction"} 
     85        CheckBox check2,value= root:myGlobals:gDoTransCheck 
     86        Button button0,pos={226,168},size={50,20},proc=PrefDoneButtonProc,title="Done" 
     87        SetVariable setvar0,pos={10,80},size={200,15},title="Averaging Bin Width (pixels)" 
     88        SetVariable setvar0,limits={1,100,1},value= root:myGlobals:gBinWidth 
     89        SetVariable setvar1,pos={10,105},size={200,15},title="# Phi Steps (annular avg)" 
     90        SetVariable setvar1,limits={1,360,1},value= root:myGlobals:gNPhiSteps 
     91        CheckBox check3,pos={10,130},size={184,14},proc=XMLWritePref,title="Use canSAS XML Output" 
     92        CheckBox check3,help={"Checking this will set the default output format to be canSAS XML rather than NIST 6 column"} 
     93        CheckBox check3,value=root:Packages:NIST:gXML_Write 
     94        //keep these hidden for now so that nobody can accidentally change them from 
     95        //the default values set in Initialize.ipf (128x128) 
     96//      SetVariable setvar2,pos={10,125},size={200,15},title="Detector Pixels (X)" 
     97//      SetVariable setvar2,limits={1,2000,1},value= root:myGlobals:gNPixelsX 
     98//      SetVariable setvar3,pos={10,145},size={200,15},title="Detector Pixels (Y)" 
     99//      SetVariable setvar3,limits={1,2000,1},value= root:myGlobals:gNPixelsY 
     100 
     101End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WorkFileUtils.ipf

    r609 r668  
    121121         
    122122        // switches to control what is done, don't do the transmission correction for the BGD measurement 
    123         NVAR doEfficiency = root:myGlobals:gDoDetectorEffCorr 
    124         NVAR gDoTrans = root:myGlobals:gDoTransmissionCorr 
     123        NVAR doEfficiency = root:Packages:NIST:gDoDetectorEffCorr 
     124        NVAR gDoTrans = root:Packages:NIST:gDoTransmissionCorr 
    125125        Variable doTrans = gDoTrans 
    126126        if(cmpstr("BGD",newtype) == 0) 
     
    291291        //apply nonlinear, Jacobian corrections --- 
    292292        // switches to control what is done, don't do the transmission correction for the BGD measurement 
    293         NVAR doEfficiency = root:myGlobals:gDoDetectorEffCorr 
    294         NVAR gDoTrans = root:myGlobals:gDoTransmissionCorr 
     293        NVAR doEfficiency = root:Packages:NIST:gDoDetectorEffCorr 
     294        NVAR gDoTrans = root:Packages:NIST:gDoTransmissionCorr 
    295295        Variable doTrans = gDoTrans 
    296296        if(cmpstr("BGD",newtype) == 0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/Main_USANS.ipf

    r667 r668  
    123123        Variable/G      root:Packages:NIST:USANS:Globals:MainPanel:gDQv = 0.117         //divergence, in terms of Q (1/A)  (NOV 2004) 
    124124 
    125         String/G root:Packages:NIST:gXMLLoader_Title 
     125        String/G root:Packages:NIST:gXMLLoader_Title="" 
    126126 
    127127        //initializes preferences. this includes XML y/n, and SANS Reduction items.  
    128128        // if they already exist, they won't be overwritten 
    129129         
    130         Execute "init_pref()"    
     130        Execute "Initialize_Preferences()"       
    131131         
    132132 
Note: See TracChangeset for help on using the changeset viewer.