Ignore:
Timestamp:
Jul 19, 2011 7:03:37 PM (11 years ago)
Author:
ajj
Message:
  • Modified ReSortDataSet?() to sort resolution data, handle 6 vs 3 column data and ignore USANS data
  • Added button to dataset management panel to do resort
File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Common/DataSetHandling.ipf

    r819 r820  
    3737Proc fMakeDMPanel() 
    3838        PauseUpdate; Silent 1           // building window... 
    39         NewPanel /W=(459,44,959,410)/N=DataManagementPanel/K=2 as "Data Set Management" 
     39        NewPanel /W=(459,44,959,460)/N=DataManagementPanel/K=2 as "Data Set Management" 
    4040        ModifyPanel fixedSize=1,cbRGB=(30000,60000,60000) 
    4141 
    4242        //Main bit of panel 
    43         GroupBox grpBox_0,pos={20,10},size={460,100} 
    44         GroupBox grpBox_1,pos={20,130},size={460,70} 
    45         GroupBox grpBox_2,pos={20,220},size={460,40} 
    46  
    47         GroupBox grpBox_3,pos={20,280},size={460,40} 
     43        GroupBox grpBox_0,pos={20,10},size={460,150} 
     44        GroupBox grpBox_1,pos={20,180},size={460,70} 
     45        GroupBox grpBox_2,pos={20,270},size={460,40} 
     46 
     47        GroupBox grpBox_3,pos={20,330},size={460,40} 
    4848 
    4949        Button DS_button,title="Load 1D Data Set",pos={300,20},size={150,20} 
     
    5353        Button Save_button,title="Save 1D Data Set",pos={300,80},size={150,20} 
    5454        Button Save_button,proc=DM_SaveProc 
     55        Button ReSort_button,title="Re-Sort 1D Data Set",pos={300,130},size={150,20} 
     56        Button ReSort_button,proc=DM_ReSortProc 
    5557        PopupMenu DS_popup,pos={30,40},size={318,20},title="Data Set ",proc=DM_PopupProc 
    5658        PopupMenu DS_popup,mode=1,value= #"DM_DataSetPopupList()" 
     
    6062        CheckBox XMLStateCtrl,value= root:Packages:NIST:gXML_Write,disable=2 
    6163 
    62         Button Rename_button,title="Rename",pos={75,170},size={150,20} 
     64        Button Rename_button,title="Rename",pos={75,220},size={150,20} 
    6365        Button Rename_button,proc=DM_RenameProc 
    64         Button Duplicate_button,title="Duplicate",pos={275,170},size={150,20} 
     66        Button Duplicate_button,title="Duplicate",pos={275,220},size={150,20} 
    6567        Button Duplicate_button,proc=DM_DuplicateProc 
    6668 
    67         SetVariable NewName_setvar,title="New Name (max 25 characters)",pos={50,140},size={400,20} 
     69        SetVariable NewName_setvar,title="New Name (max 25 characters)",pos={50,190},size={400,20} 
    6870        SetVariable NewName_setvar,fsize=12,value=_STR:"",proc=DMNameSetvarproc,live=1 
    6971                 
    70         Button SaveAsXML_button,title="Save as canSAS XML",pos={75,230},size={150,20} 
     72        Button SaveAsXML_button,title="Save as canSAS XML",pos={75,280},size={150,20} 
    7173        Button SaveAsXML_button,proc=DMSaveAsXMLproc     
    7274 
    73         Button SaveAs6col_button,title="Save as NIST 6 column",pos={275,230},size={160,20} 
     75        Button SaveAs6col_button,title="Save as NIST 6 column",pos={275,280},size={160,20} 
    7476        Button SaveAs6col_button,proc=DMSaveAs6colproc   
    7577         
    76         Button BatchConvertData_button,title="Batch Convert Format of 1D Data Files",pos={75,290},size={350,20} 
     78        Button BatchConvertData_button,title="Batch Convert Format of 1D Data Files",pos={75,340},size={350,20} 
    7779        Button BatchConvertData_button,proc=DMBatchConvertProc 
    7880                         
    79         Button DMDone_button,title="Done",pos={360,330},size={60,20} 
     81        Button DMDone_button,title="Done",pos={360,370},size={60,20} 
    8082        Button DMDone_button,proc=DMDoneButtonProc 
    81         Button DMHelp_button,title="?",pos={440,330},size={30,20} 
     83        Button DMHelp_button,title="?",pos={440,370},size={30,20} 
    8284        Button DMHelp_button,proc=DMHelpButtonProc 
    8385         
     
    401403        return 0 
    402404End 
     405 
     406Function DM_ReSortProc(ba) : ButtonControl 
     407        STRUCT WMButtonAction &ba 
     408         
     409        switch(ba.eventCode) 
     410                case 2: 
     411                        ControlInfo/W=$(ba.win) DS_popup 
     412                        ReSortDataSet(S_Value) 
     413                        break 
     414        endswitch 
     415         
     416        return 0 
     417end 
    403418 
    404419/////////////////////// Batch Data Conversion Panel //////////////////////////////////// 
     
    17181733        SetDataFolder set1Path 
    17191734         
    1720         sort $(set1name+"_q"),$(set1name+"_q"),$(set1name+"_i"),$(set1name+"_s") 
    1721          
     1735         
     1736        //Check for resolution wave 
     1737        if (exists(set1name+"_res")) 
     1738                Wave reswave = $(set1name+"_res") 
     1739                 
     1740                //Check for USANS data - we won't resort these for the moment 
     1741                if (dimsize(reswave, 1) > 4 ) 
     1742                        //USANS data, bail out 
     1743                        print "Can't re-sort USANS data yet!" 
     1744                        return 1 
     1745                endif 
     1746                 
     1747                //Break out resolution wave into separate waves 
     1748                Make/O/N=(numpnts($(set1name+"_q"))) res0 = reswave[p][0] 
     1749                Make/O/N=(numpnts($(set1name+"_q"))) res1 = reswave[p][1] 
     1750                Make/O/N=(numpnts($(set1name+"_q"))) res2 = reswave[p][2] 
     1751                Make/O/N=(numpnts($(set1name+"_q"))) res3 = reswave[p][3] 
     1752 
     1753                //sort  
     1754                print "Re-Sorting 4 or 6 Column Data Set with resolution information: "+set1Name 
     1755                sort $(set1name+"_q"),$(set1name+"_q"),$(set1name+"_i"),$(set1name+"_s"), res0, res1, res2, res3 
     1756         
     1757                //Put resolution contents back 
     1758                reswave[][0] = res0[p] 
     1759                reswave[][1]= res1[p] 
     1760                reswave[][2] = res2[p] 
     1761                reswave[][3] = res3[p] 
     1762 
     1763                //cleanup 
     1764                Killwaves/Z res0, res1, res2, res3 
     1765        else 
     1766                //3 Column only 
     1767                //sort  
     1768                print "Re-Sorting 3 Column Data Set: "+set1Name 
     1769                sort $(set1name+"_q"),$(set1name+"_q"),$(set1name+"_i"),$(set1name+"_s") 
     1770        endif 
     1771 
    17221772        SetDataFolder curPath 
    17231773 
Note: See TracChangeset for help on using the changeset viewer.