Ignore:
Timestamp:
Aug 12, 2015 12:04:50 PM (7 years ago)
Author:
srkline
Message:

more work with SANS and VSANS Nexus files, still trying to organize the r/w routines for just the basic testing of the first pass of NICE-generated files. Ditched the idea of generating the files from Igor, since DAS_log is not included. Now the plan is to start from a NICE/Nexus template. All still EXTREMELY fluid at this point.

File:
1 edited

Legend:

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

    r958 r960  
    4545 
    4646 
    47  
    48 Macro Setup_VSANS_Struct() 
     47Macro Load_Nexus_V_Template() 
     48        H_HDF5Gate_Read_Raw("") 
     49        String tmpStr=root:file_name  //SRK - so I can get the file name 
     50         
     51// this is the folder name 
     52        String base_name = StringFromList(0,File_Name,".") 
     53//      Print base_name 
     54        RenameDataFolder $("root:"+base_name), V_Nexus_Template 
     55End 
     56 
     57 
     58Macro Fill_Nexus_V_Template() 
     59 
     60End 
     61 
     62 
     63Macro Save_Nexus_V_Template() 
     64        H_HDF5Gate_Write_Raw() 
     65End 
     66 
     67 
     68 
     69 
     70 
     71 
     72 
     73 
     74 
     75 
     76 
     77 
     78 
     79///////////////////////////// 
     80 
     81/////////////below is largely depricated, ugly dance to be able to "fake" a file from Igor 
     82// which was not complete anyways. 
     83 
     84 
     85 
     86Macro IgorOnly_Setup_VSANS_Struct() 
    4987 
    5088        // lays out the tree and fills with dummy values 
     
    5997End 
    6098 
    61 Macro Save_VSANS_Nexus(fileName) 
     99Macro IgorOnly_Save_VSANS_Nexus(fileName) 
    62100        String fileName="Test_VSANS_file" 
    63101 
     
    87125 
    88126 
    89 Macro Setup_SANS_Struct() 
     127Macro IgorOnly_Setup_SANS_Struct() 
    90128 
    91129        // lays out the tree and fills with dummy values 
     
    100138End 
    101139 
    102 Macro Save_SANS_Nexus(fileName) 
     140Macro IgorOnly_Save_SANS_Nexus(fileName) 
    103141        String fileName="Test_SANS_file" 
    104142         
     
    197235// this is my procedure to save the folders to HDF5, once I've filled the folder tree 
    198236// 
    199 // this does NOT save attributes, but gets the fodler structure correct 
     237// this does NOT save attributes, but gets the folder structure correct 
    200238// 
    201239Function H_NXSANS_SaveGroupAsHDF5(dfPath, filename) 
     
    224262End 
    225263 
     264// passing null file string presents a dialog 
     265// these two procedures will use the full Xrefs, so they can write out full 
     266// files. They are, however, slow 
     267Proc Read_Nexus_Xref() 
     268        H_HDF5Gate_Read_Raw("") 
     269End 
     270 
     271Proc Write_Nexus_Xref() 
     272        H_HDF5Gate_Write_Raw() 
     273End 
    226274 
    227275// 
    228276// writes out the contents of a data folder using the gateway 
    229 // -- the HDF5___xref wave must be present at the toep level for it to 
     277// -- the HDF5___xref wave must be present at the top level for it to 
    230278//    write out anything. 
    231279// 
    232 Proc H_HDF5Gate_Write_Raw(dfPath, filename) 
    233         String dfPath   ="root:VSANS_file"              // e.g., "root:FolderA" or ":" 
     280Proc H_HDF5Gate_Write_Raw(dfPath,filename) 
     281        String dfPath   = "root:"       // e.g., "root:FolderA" or ":" 
    234282        String filename = "Test_VSANS_file.h5" 
    235          
     283//      Prompt dfPath, "Data Folder",popup,H_GetAList(4)         
     284//      Prompt fileName, "File name" 
     285         
     286//      DoPrompt "Folder and file to write", dfPath,fileName 
    236287        // Check our work so far. 
    237288        // If something prints, there was an error above. 
     
    250301Proc H_HDF5Gate_Read_Raw(file) 
    251302        String file 
     303         
    252304//      NewDataFolder/O/S root:newdata 
    253305        Print H5GW_ReadHDF5("", file)   // reads into current folder 
     
    255307End 
    256308 
     309 
     310 
     311// this is in PlotUtils, but duplicated here 
     312// utility used in the "PlotSmeared...() macros to get a list of data folders 
     313// 
     314//1:    Waves. 
     315//2:    Numeric variables. 
     316//3:    String variables. 
     317//4:    Data folders. 
     318Function/S H_GetAList(type) 
     319        Variable type 
     320         
     321        SetDataFolder root: 
     322         
     323        String objName,str="" 
     324        Variable index = 0 
     325        do 
     326                objName = GetIndexedObjName(":", type, index) 
     327                if (strlen(objName) == 0) 
     328                        break 
     329                endif 
     330                //Print objName 
     331                str += objName + ";" 
     332                index += 1 
     333        while(1) 
     334         
     335        // remove myGlobals, Packages, etc. from the folder list 
     336        if(type==4) 
     337                str = RemoveFromList("myGlobals", str , ";" ) 
     338                str = RemoveFromList("Packages", str, ";") 
     339        endif 
     340         
     341        return(str) 
     342End 
    257343 
    258344// 
Note: See TracChangeset for help on using the changeset viewer.