Ignore:
Timestamp:
Feb 17, 2017 1:55:05 PM (6 years ago)
Author:
srkline
Message:

many additions.

Moved unused igor/nexus testing files to Vx_ prefix since they're garbage. Pulled out the useful bits for mask and div R/W and moved those to theire appropriate procedures.

Testing the simple correction of data, only tested basic subtraction. All of it still needs to be verified since I don't have any real header numbers and units yet.

Adjusted the columns on the file catalog to be more appropriate, and added a hook to allow loading of raw data files directly from the table and a popup contextual menu. May add more functionality to it later.

Corrected how the 1D data is plotted so that it correctly uses the binning type. I(q) save now also uses the binning as specified.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_IQ_Utilities.ipf

    r1022 r1023  
    22#pragma rtGlobals=3             // Use modern global access method and strict wave access. 
    33 
    4 // 
    5 // does no scaling, only the basic (default) trim of the ends, concatenate, sort, and save 
    6 // 
    7  
    8  
     4 
     5// 
     6// Operation does no scaling, only the basic (default) trim of the ends, concatenate, sort, and save 
     7// -- if data has been converted to WORK and hte solid angle correction was done, then the data 
     8//   is per unit solid angle, and matches up - at least the simulated data does... 
     9// 
     10// 
     11// V_DataPlotting.ipf is where the I(q) panel is drawn and the binning is set 
    912// 
    1013// see the VCALC BinAllMiddlePanels() for an example of this 
    1114// see the binning routines in VC_DetectorBinning_Utils.ipf for the details 
    1215// 
     16 
    1317// TODO  
    1418// 
     
    2529// x- figure out when this needs to be called to (force) re-calculate I vs Q 
    2630// 
    27  
    28  
    2931 
    3032 
     
    105107        String type = root:Packages:NIST:VSANS:Globals:gCurDispType 
    106108 
    107 // figure out which binning was used 
    108109 
    109110// trim the data if needed 
     
    113114 
    114115// concatenate the data sets 
     116// TODO x- figure out which binning was used (this is done in V_1DConcatenate()) 
    115117        // clear the old tmp waves first, if they still exist 
    116118        SetDataFolder $("root:Packages:NIST:VSANS:"+type) 
     
    160162// 
    161163// TODO: 
     164// x- this currently ignores the binning type (one, two, etc. ) 
    162165// -- this currently assumes that all of the waves exist 
    163166// -- need robust error checking for wave existence 
    164167// -- wave names are hard-wired and their name and location may be different in the future 
    165 // -- if different averaging options were chosen (bin type of 2, 4 etc) then 
     168// x- if different averaging options were chosen (bin type of 2, 4 etc) then 
    166169//    although waves may exist, they may not be the right ones to use. There 
    167170//    will be a somewhat complex selection process 
    168171// x- detector B is currently skipped 
    169172// 
    170 // this seems like a lot of extra work to do something so simple... 
     173// this seems like a lot of extra work to do something so simple...but it's better than a loop 
    171174// 
    172175//  root:Packages:NIST:VSANS:RAW:iBin_qxqy_FB 
     176// 
     177// binType = 1 = one 
     178// binType = 2 = two 
     179// binType = 3 = four 
     180// binType = 4 = Slit Mode 
     181// 
    173182Function V_1DConcatenate(folderStr) 
    174183        String folderStr 
    175184         
     185        Variable binType = V_GetBinningPopMode() 
     186         
     187         
    176188        SetDataFolder $("root:Packages:NIST:VSANS:"+folderStr) 
    177          
    178         Wave/Z q_fb = qBin_qxqy_FB 
    179         Wave/Z q_ft = qBin_qxqy_FT 
    180         Wave/Z q_fl = qBin_qxqy_FL 
    181         Wave/Z q_fr = qBin_qxqy_FR 
    182         Wave/Z q_mb = qBin_qxqy_MB 
    183         Wave/Z q_mt = qBin_qxqy_MT 
    184         Wave/Z q_ml = qBin_qxqy_ML 
    185         Wave/Z q_mr = qBin_qxqy_MR 
    186         Wave/Z q_b = qBin_qxqy_B 
    187  
    188         Concatenate/NP {q_fb,q_ft,q_fl,q_fr,q_mb,q_mt,q_ml,q_mr,q_b}, tmp_q 
    189          
    190         Wave/Z i_fb = iBin_qxqy_FB 
    191         Wave/Z i_ft = iBin_qxqy_FT 
    192         Wave/Z i_fl = iBin_qxqy_FL 
    193         Wave/Z i_fr = iBin_qxqy_FR 
    194         Wave/Z i_mb = iBin_qxqy_MB 
    195         Wave/Z i_mt = iBin_qxqy_MT 
    196         Wave/Z i_ml = iBin_qxqy_ML 
    197         Wave/Z i_mr = iBin_qxqy_MR 
    198         Wave/Z i_b = iBin_qxqy_B 
    199          
    200         Concatenate/NP {i_fb,i_ft,i_fl,i_fr,i_mb,i_mt,i_ml,i_mr,i_b}, tmp_i 
    201  
    202         Wave/Z s_fb = eBin_qxqy_FB 
    203         Wave/Z s_ft = eBin_qxqy_FT 
    204         Wave/Z s_fl = eBin_qxqy_FL 
    205         Wave/Z s_fr = eBin_qxqy_FR 
    206         Wave/Z s_mb = eBin_qxqy_MB 
    207         Wave/Z s_mt = eBin_qxqy_MT 
    208         Wave/Z s_ml = eBin_qxqy_ML 
    209         Wave/Z s_mr = eBin_qxqy_MR 
    210         Wave/Z s_b = eBin_qxqy_B 
    211          
    212         Concatenate/NP {s_fb,s_ft,s_fl,s_fr,s_mb,s_mt,s_ml,s_mr,s_b}, tmp_s 
    213                  
    214 //      Concatenate/NP {$("root:"+folder1+":"+folder1+"_q"),$("root:"+folder2+":"+folder2+"_q")},tmp_q 
    215 //      Concatenate/NP {$("root:"+folder1+":"+folder1+"_i"),$("root:"+folder2+":"+folder2+"_i")},tmp_i 
    216 //      Concatenate/NP {$("root:"+folder1+":"+folder1+"_s"),$("root:"+folder2+":"+folder2+"_s")},tmp_s 
    217 //      Concatenate/NP {$("root:"+folder1+":res0"),$("root:"+folder2+":res0")},tmp_res0 
    218 //      Concatenate/NP {$("root:"+folder1+":res1"),$("root:"+folder2+":res1")},tmp_res1 
    219 //      Concatenate/NP {$("root:"+folder1+":res2"),$("root:"+folder2+":res2")},tmp_res2 
    220 //      Concatenate/NP {$("root:"+folder1+":res3"),$("root:"+folder2+":res3")},tmp_res3 
    221          
    222 //// move the concatenated result into the destination folder (killing the old stuff first) 
    223 //      KillWaves/Z $("root:"+folder2+":"+folder2+"_q") 
    224 //      KillWaves/Z $("root:"+folder2+":"+folder2+"_i") 
    225 //      KillWaves/Z $("root:"+folder2+":"+folder2+"_s") 
    226 //      KillWaves/Z $("root:"+folder2+":res0") 
    227 //      KillWaves/Z $("root:"+folder2+":res1") 
    228 //      KillWaves/Z $("root:"+folder2+":res2") 
    229 //      KillWaves/Z $("root:"+folder2+":res3") 
    230          
    231 //      Duplicate/O tmp_q $("root:"+folder2+":"+folder2+"_q") 
    232 //      Duplicate/O tmp_i $("root:"+folder2+":"+folder2+"_i") 
    233 //      Duplicate/O tmp_s $("root:"+folder2+":"+folder2+"_s") 
    234 //      Duplicate/O tmp_res0 $("root:"+folder2+":res0") 
    235 //      Duplicate/O tmp_res1 $("root:"+folder2+":res1") 
    236 //      Duplicate/O tmp_res2 $("root:"+folder2+":res2") 
    237 //      Duplicate/O tmp_res3 $("root:"+folder2+":res3") 
     189 
     190        if(binType == 1)         
     191                Wave/Z q_fb = qBin_qxqy_FB 
     192                Wave/Z q_ft = qBin_qxqy_FT 
     193                Wave/Z q_fl = qBin_qxqy_FL 
     194                Wave/Z q_fr = qBin_qxqy_FR 
     195                Wave/Z q_mb = qBin_qxqy_MB 
     196                Wave/Z q_mt = qBin_qxqy_MT 
     197                Wave/Z q_ml = qBin_qxqy_ML 
     198                Wave/Z q_mr = qBin_qxqy_MR 
     199                Wave/Z q_b = qBin_qxqy_B 
     200         
     201                Concatenate/NP {q_fb,q_ft,q_fl,q_fr,q_mb,q_mt,q_ml,q_mr,q_b}, tmp_q 
     202                 
     203                Wave/Z i_fb = iBin_qxqy_FB 
     204                Wave/Z i_ft = iBin_qxqy_FT 
     205                Wave/Z i_fl = iBin_qxqy_FL 
     206                Wave/Z i_fr = iBin_qxqy_FR 
     207                Wave/Z i_mb = iBin_qxqy_MB 
     208                Wave/Z i_mt = iBin_qxqy_MT 
     209                Wave/Z i_ml = iBin_qxqy_ML 
     210                Wave/Z i_mr = iBin_qxqy_MR 
     211                Wave/Z i_b = iBin_qxqy_B 
     212                 
     213                Concatenate/NP {i_fb,i_ft,i_fl,i_fr,i_mb,i_mt,i_ml,i_mr,i_b}, tmp_i 
     214         
     215                Wave/Z s_fb = eBin_qxqy_FB 
     216                Wave/Z s_ft = eBin_qxqy_FT 
     217                Wave/Z s_fl = eBin_qxqy_FL 
     218                Wave/Z s_fr = eBin_qxqy_FR 
     219                Wave/Z s_mb = eBin_qxqy_MB 
     220                Wave/Z s_mt = eBin_qxqy_MT 
     221                Wave/Z s_ml = eBin_qxqy_ML 
     222                Wave/Z s_mr = eBin_qxqy_MR 
     223                Wave/Z s_b = eBin_qxqy_B 
     224                 
     225                Concatenate/NP {s_fb,s_ft,s_fl,s_fr,s_mb,s_mt,s_ml,s_mr,s_b}, tmp_s 
     226        endif 
     227 
     228        if(binType == 2)         
     229                Wave/Z q_ftb = qBin_qxqy_FTB 
     230                Wave/Z q_flr = qBin_qxqy_FLR 
     231                Wave/Z q_mtb = qBin_qxqy_MTB 
     232                Wave/Z q_mlr = qBin_qxqy_MLR 
     233                Wave/Z q_b = qBin_qxqy_B 
     234         
     235                Concatenate/NP {q_ftb,q_flr,q_mtb,q_mlr,q_b}, tmp_q 
     236                 
     237                Wave/Z i_ftb = iBin_qxqy_FTB 
     238                Wave/Z i_flr = iBin_qxqy_FLR 
     239                Wave/Z i_mtb = iBin_qxqy_MTB 
     240                Wave/Z i_mlr = iBin_qxqy_MLR 
     241                Wave/Z i_b = iBin_qxqy_B 
     242                 
     243                Concatenate/NP {i_ftb,i_flr,i_mtb,i_mlr,i_b}, tmp_i 
     244         
     245                Wave/Z s_ftb = eBin_qxqy_FTB 
     246                Wave/Z s_flr = eBin_qxqy_FLR 
     247                Wave/Z s_mtb = eBin_qxqy_MTB 
     248                Wave/Z s_mlr = eBin_qxqy_MLR 
     249                Wave/Z s_b = eBin_qxqy_B 
     250                 
     251                Concatenate/NP {s_ftb,s_flr,s_mtb,s_mlr,s_b}, tmp_s 
     252        endif 
     253 
     254        if(binType == 3)         
     255                Wave/Z q_flrtb = qBin_qxqy_FLRTB 
     256                Wave/Z q_mlrtb = qBin_qxqy_MLRTB 
     257                Wave/Z q_b = qBin_qxqy_B 
     258         
     259                Concatenate/NP {q_flrtb,q_mlrtb,q_b}, tmp_q 
     260                 
     261                Wave/Z i_flrtb = iBin_qxqy_FLRTB 
     262                Wave/Z i_mlrtb = iBin_qxqy_MLRTB 
     263                Wave/Z i_b = iBin_qxqy_B 
     264                 
     265                Concatenate/NP {i_flrtb,i_mlrtb,i_b}, tmp_i 
     266         
     267                Wave/Z s_flrtb = eBin_qxqy_FLRTB 
     268                Wave/Z s_mlrtb = eBin_qxqy_MLRTB 
     269                Wave/Z s_b = eBin_qxqy_B 
     270                 
     271                Concatenate/NP {s_flrtb,s_mlrtb,s_b}, tmp_s 
     272        endif 
     273 
     274// TODO - This is the identical set of waves as for the case of binType = 1. 
     275// they have the same names, but are averaged differently since it's slit mode. 
     276// I have separated this, since in practice the TB panels are probably best to ignore 
     277// and NOT include in the averaging since the Qy range is so limited. 
     278        if(binType == 4)         
     279                Wave/Z q_fb = qBin_qxqy_FB 
     280                Wave/Z q_ft = qBin_qxqy_FT 
     281                Wave/Z q_fl = qBin_qxqy_FL 
     282                Wave/Z q_fr = qBin_qxqy_FR 
     283                Wave/Z q_mb = qBin_qxqy_MB 
     284                Wave/Z q_mt = qBin_qxqy_MT 
     285                Wave/Z q_ml = qBin_qxqy_ML 
     286                Wave/Z q_mr = qBin_qxqy_MR 
     287                Wave/Z q_b = qBin_qxqy_B 
     288         
     289                Concatenate/NP {q_fb,q_ft,q_fl,q_fr,q_mb,q_mt,q_ml,q_mr,q_b}, tmp_q 
     290                 
     291                Wave/Z i_fb = iBin_qxqy_FB 
     292                Wave/Z i_ft = iBin_qxqy_FT 
     293                Wave/Z i_fl = iBin_qxqy_FL 
     294                Wave/Z i_fr = iBin_qxqy_FR 
     295                Wave/Z i_mb = iBin_qxqy_MB 
     296                Wave/Z i_mt = iBin_qxqy_MT 
     297                Wave/Z i_ml = iBin_qxqy_ML 
     298                Wave/Z i_mr = iBin_qxqy_MR 
     299                Wave/Z i_b = iBin_qxqy_B 
     300                 
     301                Concatenate/NP {i_fb,i_ft,i_fl,i_fr,i_mb,i_mt,i_ml,i_mr,i_b}, tmp_i 
     302         
     303                Wave/Z s_fb = eBin_qxqy_FB 
     304                Wave/Z s_ft = eBin_qxqy_FT 
     305                Wave/Z s_fl = eBin_qxqy_FL 
     306                Wave/Z s_fr = eBin_qxqy_FR 
     307                Wave/Z s_mb = eBin_qxqy_MB 
     308                Wave/Z s_mt = eBin_qxqy_MT 
     309                Wave/Z s_ml = eBin_qxqy_ML 
     310                Wave/Z s_mr = eBin_qxqy_MR 
     311                Wave/Z s_b = eBin_qxqy_B 
     312                 
     313                Concatenate/NP {s_fb,s_ft,s_fl,s_fr,s_mb,s_mt,s_ml,s_mr,s_b}, tmp_s 
     314        endif 
     315 
     316 
     317 
    238318 
    239319// Can't kill here, since they are still needed to sort and write out! 
Note: See TracChangeset for help on using the changeset viewer.