source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_HDF5_VSANS_Utils.ipf @ 999

Last change on this file since 999 was 999, checked in by srkline, 7 years ago

changes to a few analysis models to make these Igor 7-ready

adding mask editing utilities

many changes to event mode for easier processing of split lists

updated event mode help file

+ lots more!

File size: 19.9 KB
Line 
1#pragma rtGlobals=1             // Use modern global access method.
2
3//
4// This file has utility procedures to be able to read/write
5// test HDF5 (from Igor) for SANS and VSANS in Nexus format
6//
7// It is predominantly to be able to WRITE a full Nexus file from Igor
8// -- this is only necessary to be able to write out "fake" VSANS files from VCALC
9//    since I need a "template" of the Nexus folder structure to start from and fill in
10//
11// It doesn't reproduce the NICE logs, but will leave a spece for them if
12// it is read in and is part of the xref.
13//
14// It may be easier to hard-wire my own folder definition (NewDataFolder)
15// that is MY Nexus file to write out and use that as the base case
16// rather than rely on Pete's code, which is terribly slow for writing.
17// Attributes are the issue, but it may be unimportant if they are missing.
18//
19
20
21
22//
23// There's an odd sequence of steps that need to be done to use HDFGateway
24// to most easily write out attributes, and be able to read then back in.
25// Rather awkward, but it works without me needing to go nuts with an atomistic
26// understanding of HDF5. This is necessary for me to be able to write out
27// Nexus files, which is important both for testing, and for simulation.
28//
29// This is done as a set of macros that need to be applied in a specific sequence
30// in order to be able to generate HDF5___xref
31// Ideally, the HDF5___xref wave can be saved/imported to make proper saving possible
32// once the "tree" is finalized.
33//
34//
35// The basic saving routines are here, just as Proc rather than Macro menu clutter
36//
37
38
39// Next... think of all of R/W access needed
40//
41// the simple read/write works...
42// linear_data does not seem to need to be transposed at all
43//
44//  -- this seems too easy. what am I doing wrong? Is something getting garbled when I
45// write back any single values back to the file
46//
47// -- try a string value next
48// -- then start to write the generic get/write functions
49//
50
51//
52// do I ditch the RealsRead/IntegersRead/TextRead? It makes little sense now.
53// maybe copy a "dataInfo" folder/subfolders. can't keep them all (bloat)
54// but then what about multiple files added together?
55//
56
57Menu "VSANS"
58        SubMenu "Nexus File Testing"
59                "Fill_Nexus_V_Template"
60                "Save_Nexus_V_Template"
61                "Load_Nexus_V_Template"
62                "-"
63                "IgorOnly_Setup_VSANS_Struct"
64                "IgorOnly_Save_VSANS_Nexus"
65                "IgorOnly_Setup_SANS_Struct"
66                "IgorOnly_Save_SANS_Struct"
67                "Setup_VSANS_DIV_Struct"
68                "Save_VSANS_DIV_Nexus"
69                "Setup_VSANS_MASK_Struct"
70                "Save_VSANS_MASK_Nexus"
71                "-"
72                "Read_Nexus with attributes",Read_Nexus_Xref()          //this will read with attributes
73                "Write_Nexus with attributes",Write_Nexus_Xref()                                //this will write out with attributes if read in by Read_Nexus_Xref
74        End
75End
76
77
78
79
80
81Proc Load_Nexus_V_Template()
82        H_HDF5Gate_Read_Raw("")
83        String tmpStr=root:file_name  //SRK - so I can get the file name that was loaded
84       
85// this is the folder name
86        String base_name = StringFromList(0,File_Name,".")
87        RenameDataFolder $("root:"+base_name), V_Nexus_Template
88End
89
90
91Proc Fill_Nexus_V_Template()
92        H_Fill_VSANS_Template_wSim()
93End
94
95
96Proc Save_Nexus_V_Template()
97        H_HDF5Gate_Write_Raw("root:V_Nexus_Template:","")
98End
99
100
101
102
103
104
105
106
107
108
109
110
111
112/////////////////////////////
113
114/////////////below is largely depricated, ugly dance to be able to "fake" a file from Igor
115// which was not complete anyways.
116
117
118
119Proc IgorOnly_Setup_VSANS_Struct()
120
121        // lays out the tree and fills with dummy values
122        H_Setup_VSANS_Structure()
123       
124        // writes in the attributes
125        H_Fill_VSANS_Attributes()
126       
127        // fill in with VCALC simulation bits
128        H_Fill_VSANS_wSim()
129       
130End
131
132Proc IgorOnly_Save_VSANS_Nexus(fileName)
133        String fileName="Test_VSANS_file"
134
135        // save as HDF5 (no attributes saved yet)
136        Save_VSANS_file("root:VSANS_file", fileName+".h5")
137       
138        // read in a data file using the gateway-- reads from the home path
139        H_HDF5Gate_Read_Raw(fileName+".h5")
140       
141        // after reading in a "partial" file using the gateway (to generate the xref)
142        // Save the xref to disk (for later use)
143        Save_HDF5___xref("root:"+fileName,"HDF5___xref")
144       
145        // after you've generated the HDF5___xref, load it in and copy it
146        // to the necessary folder location.
147        Copy_HDF5___xref("root:VSANS_file", "HDF5___xref")
148       
149        // writes out the contents of a data folder using the gateway
150        H_HDF5Gate_Write_Raw("root:VSANS_file", fileName+".h5")
151
152        // re-load the data file using the gateway-- reads from the home path
153        // now with attributes
154        H_HDF5Gate_Read_Raw(fileName+".h5")
155       
156End
157
158
159
160Proc IgorOnly_Setup_SANS_Struct()
161
162        // lays out the tree and fills with dummy values
163        H_Setup_SANS_Structure()
164       
165        // writes in the attributes
166        H_Fill_SANS_Attributes()
167       
168        // fill in with VCALC simulation bits
169        H_Fill_SANS_wSim()
170
171End
172
173Proc IgorOnly_Save_SANS_Nexus(fileName)
174        String fileName="Test_SANS_file"
175       
176        // save as HDF5 (no attributes saved yet) (save_VSANS is actually generic HDF...)
177        Save_VSANS_file("root:SANS_file", fileName+".h5")
178       
179        // read in a data file using the gateway-- reads from the home path
180        H_HDF5Gate_Read_Raw(fileName+".h5")
181       
182        // after reading in a "partial" file using the gateway (to generate the xref)
183        // Save the xref to disk (for later use)
184        Save_HDF5___xref("root:"+fileName,"HDF5___xref")
185       
186        // after you've generated the HDF5___xref, load it in and copy it
187        // to the necessary folder location.
188        Copy_HDF5___xref("root:SANS_file", "HDF5___xref")
189       
190        // writes out the contents of a data folder using the gateway
191        H_HDF5Gate_Write_Raw("root:SANS_file", fileName+".h5")
192
193        // re-load the data file using the gateway-- reads from the home path
194        // now with attributes
195        H_HDF5Gate_Read_Raw(fileName+".h5")
196
197
198End
199
200
201
202// TODO
203// currently, there are no dummy fill values or attributes for the fake DIV file
204//
205Proc Setup_VSANS_DIV_Struct()
206
207        // lays out the tree and fills with dummy values
208        H_Setup_VSANS_DIV_Structure()
209       
210        // writes in the attributes
211//      H_Fill_VSANS_Attributes()
212       
213        // fill in with VCALC simulation bits
214//      H_Fill_VSANS_wSim()
215       
216End
217
218Proc Save_VSANS_DIV_Nexus(fileName)
219        String fileName="Test_VSANS_DIV_file"
220
221        // save as HDF5 (no attributes saved yet)
222        Save_VSANS_file("root:VSANS_DIV_file", fileName+".h5")
223       
224        // read in a data file using the gateway-- reads from the home path
225        H_HDF5Gate_Read_Raw(fileName+".h5")
226       
227        // after reading in a "partial" file using the gateway (to generate the xref)
228        // Save the xref to disk (for later use)
229        Save_HDF5___xref("root:"+fileName,"HDF5___xref")
230       
231        // after you've generated the HDF5___xref, load it in and copy it
232        // to the necessary folder location.
233        Copy_HDF5___xref("root:VSANS_DIV_file", "HDF5___xref")
234       
235        // writes out the contents of a data folder using the gateway
236        H_HDF5Gate_Write_Raw("root:VSANS_DIV_file", fileName+".h5")
237
238        // re-load the data file using the gateway-- reads from the home path
239        // now with attributes
240        H_HDF5Gate_Read_Raw(fileName+".h5")
241       
242End
243
244////////////// fake DIV file tests
245//
246//
247//      Make/O/T/N=1    file_name       = "VSANS_DIV_test.h5"
248//
249// simple generation of a fake div file. for sans, nothing other than the creation date was written to the
250// file header. nothing more is needed (possibly)
251//
252// TODO -- I want to re-visit the propagation of errors in the DIV file. No errors are ever calculated/saved
253//   during the generation of the file, but there's no reason it couldn't. the idea is that the plex
254//   is counted so long that the errors are insignificant compared to the data errors, but that may not
255//   always be the case. A bit of math may prove this. or not. Plus, the situation for VSANS may be different.
256//
257//
258// TODO -- make the number of pixels GLOBAL
259// TODO -- there will be lots of work to do to develop the procedures necessary to actually generate the
260//      9 data sets to become the DIV file contents. More complexity here than for the simple SANS case.
261//
262Proc H_Setup_VSANS_DIV_Structure()
263       
264        NewDataFolder/O/S root:VSANS_DIV_file           
265
266        NewDataFolder/O/S root:VSANS_DIV_file:entry     
267                Make/O/T/N=1    title   = "This is a fake DIV file for VSANS"
268                Make/O/T/N=1    start_date      = "2015-02-28T08:15:30-5:00"
269                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument         
270                        Make/O/T/N=1    name    = "NG3_VSANS"
271                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_B       
272                        Make/O/D/N=(150,150)    data    = 1 + (enoise(0.1))
273                        Make/O/D/N=(150,150)    linear_data_error       = 0.01*abs(gnoise(1))
274                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MR             
275                        Make/O/D/N=(48,128)     data    = 1 + (enoise(0.1))
276                        Make/O/D/N=(48,128)     linear_data_error       = 0.01*abs(gnoise(1))
277                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_ML             
278                        Make/O/D/N=(48,128)     data    = 1 + (enoise(0.1))
279                        Make/O/D/N=(48,128)     linear_data_error       = 0.01*abs(gnoise(1))
280                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MT             
281                        Make/O/D/N=(128,48)     data    = 1 + (enoise(0.1))
282                        Make/O/D/N=(128,48)     linear_data_error       = 0.01*abs(gnoise(1))
283                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_MB             
284                        Make/O/D/N=(128,48)     data    = 1 + (enoise(0.1))
285                        Make/O/D/N=(128,48)     linear_data_error       = 0.01*abs(gnoise(1))
286                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FR             
287                        Make/O/D/N=(48,128)     data    = 1 + (enoise(0.1))
288                        Make/O/D/N=(48,128)     linear_data_error       = 0.01*abs(gnoise(1))
289                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FL             
290                        Make/O/D/N=(48,128)     data    = 1 + (enoise(0.1))
291                        Make/O/D/N=(48,128)     linear_data_error       = 0.01*abs(gnoise(1))
292                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FT             
293                        Make/O/D/N=(128,48)     data    = 1 + (enoise(0.1))
294                        Make/O/D/N=(128,48)     linear_data_error       = 0.01*abs(gnoise(1))
295                NewDataFolder/O/S root:VSANS_DIV_file:entry:instrument:detector_FB             
296                        Make/O/D/N=(128,48)     data    = 1 + (enoise(0.1))
297                        Make/O/D/N=(128,48)     linear_data_error       = 0.01*abs(gnoise(1))
298                       
299        SetDataFolder root:
300
301End
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316//
317// saves a specified folder, with a given filename.
318// saves to the home path
319//
320Proc Save_VSANS_file(dfPath, filename)
321        String dfPath   ="root:VSANS_file"              // e.g., "root:FolderA" or ":"
322        String filename = "Test_VSANS_file.h5"
323       
324        H_NXSANS_SaveGroupAsHDF5(dfPath, filename)
325End
326
327
328//     
329// this is my procedure to save the folders to HDF5, once I've filled the folder tree
330//
331// this does NOT save attributes, but gets the folder structure correct
332//
333Function H_NXSANS_SaveGroupAsHDF5(dfPath, filename)
334        String dfPath   // e.g., "root:FolderA" or ":"
335        String filename
336
337        Variable result = 0     // 0 means no error
338       
339        Variable fileID
340        HDF5CreateFile/P=home /O /Z fileID as filename
341        if (V_flag != 0)
342                Print "HDF5CreateFile failed"
343                return -1
344        endif
345
346        HDF5SaveGroup /IGOR=0 /O /R /Z $dfPath, fileID, "."
347//      HDF5SaveGroup /O /R /Z $dfPath, fileID, "."
348        if (V_flag != 0)
349                Print "HDF5SaveGroup failed"
350                result = -1
351        endif
352       
353        HDF5CloseFile fileID
354
355        return result
356End
357
358// passing null file string presents a dialog
359// these two procedures will use the full Xrefs, so they can write out full
360// files. They are, however, slow
361Proc Read_Nexus_Xref()
362        H_HDF5Gate_Read_Raw("")
363End
364
365Proc Write_Nexus_Xref()
366        H_HDF5Gate_Write_Raw()
367End
368
369//
370// writes out the contents of a data folder using the gateway
371// -- the HDF5___xref wave must be present at the top level for it to
372//    write out anything.
373//
374Proc H_HDF5Gate_Write_Raw(dfPath,filename)
375        String dfPath   = "root:"       // e.g., "root:FolderA" or ":"
376        String filename = "Test_VSANS_file.h5"
377//      Prompt dfPath, "Data Folder",popup,H_GetAList(4)       
378//      Prompt fileName, "File name"
379       
380//      DoPrompt "Folder and file to write", dfPath,fileName
381        // Check our work so far.
382        // If something prints, there was an error above.
383//      print H5GW_ValidateFolder(dfPath)
384
385// H5GW_WriteHDF5 calls the validate function, so no need to call it before
386        print H5GW_WriteHDF5(dfPath, filename)
387       
388        SetDataFolder root:
389End
390
391//
392// read in a data file using the gateway
393//
394// reads from the home path
395//
396Proc H_HDF5Gate_Read_Raw(file)
397        String file
398       
399//      NewDataFolder/O/S root:newdata
400        Print H5GW_ReadHDF5("", file)   // reads into current folder
401        SetDataFolder root:
402End
403
404
405
406// this is in PlotUtils, but duplicated here
407// utility used in the "PlotSmeared...() macros to get a list of data folders
408//
409//1:    Waves.
410//2:    Numeric variables.
411//3:    String variables.
412//4:    Data folders.
413Function/S H_GetAList(type)
414        Variable type
415       
416        SetDataFolder root:
417       
418        String objName,str=""
419        Variable index = 0
420        do
421                objName = GetIndexedObjName(":", type, index)
422                if (strlen(objName) == 0)
423                        break
424                endif
425                //Print objName
426                str += objName + ";"
427                index += 1
428        while(1)
429       
430        // remove myGlobals, Packages, etc. from the folder list
431        if(type==4)
432                str = RemoveFromList("myGlobals", str , ";" )
433                str = RemoveFromList("Packages", str, ";")
434        endif
435       
436        return(str)
437End
438
439//
440// after reading in a "partial" file using the gateway (to generate the xref)
441// Save the xref to disk (for later use)
442//
443Proc Save_HDF5___xref(dfPath, filename)
444        String dfPath   ="root:VSANS_file"              // e.g., "root:FolderA" or ":"
445        String filename = "HDF5___xref"
446
447        Save/T/P=home $(dfPath+":HDF5___xref") as "HDF5___xref.itx"
448
449//      Copy_HDF5___xref(dfPath, filename)
450       
451        SetDataFolder root:
452End
453
454//
455// after you've generated the HDF5___xref, load it in and copy it to
456// the necessary folder location.
457// - then all is set to *really* write out the file correctly, including the attributes
458//
459Proc Copy_HDF5___xref(dfPath, filename)
460        String dfPath   ="root:VSANS_file"              // e.g., "root:FolderA" or ":"
461        String filename = "HDF5___xref"
462
463        if(exists(filename) != 1)
464                //load it in   
465                LoadWave/T/P=home/O "HDF5___xref.itx"
466        endif
467       
468        Duplicate/O HDF5___xref, $(dfPath+":HDF5___xref")
469       
470        SetDataFolder root:
471End
472
473
474
475//////// testing procedures, may be of use, maybe not //////////////
476
477
478//////// Two procedures that test out Pete Jemain's HDF5Gateway
479//
480// This works fine, but it may not be terribly compatible with the way NICE will eventually
481// write out the data files. I'll have very little control over that and I'll need to cobble together
482// a bunch of fixes to cover up their mistakes.
483//
484// Using Nick Hauser's code as a starting point may be a lot more painful, but more flexible in the end.
485//
486// I'm completely baffled about what to do with attributes. Are they needed, is this the best way to deal
487// with them, do I care about reading them in, and if I do, why?
488//
489Proc H_HDF5Gate_WriteTest()
490
491        // create the folder structure
492        NewDataFolder/O/S root:mydata
493        NewDataFolder/O sasentry
494        NewDataFolder/O :sasentry:sasdata
495
496        // create the waves
497        Make/O :sasentry:sasdata:I0
498        Make/O :sasentry:sasdata:Q0
499
500        Make/O/N=0 Igor___folder_attributes
501        Make/O/N=0 :sasentry:Igor___folder_attributes
502        Make/O/N=0 :sasentry:sasdata:Igor___folder_attributes
503
504        // create the attributes
505        Note/K Igor___folder_attributes, "producer=IgorPro\rNX_class=NXroot"
506        Note/K :sasentry:Igor___folder_attributes, "NX_class=NXentry"
507        Note/K :sasentry:sasdata:Igor___folder_attributes, "NX_class=NXdata"
508        Note/K :sasentry:sasdata:I0, "units=1/cm\rsignal=1\rtitle=reduced intensity"
509        Note/K :sasentry:sasdata:Q0, "units=1/A\rtitle=|scattering vector|"
510
511        // create the cross-reference mapping
512        Make/O/T/N=(5,2) HDF5___xref
513        Edit/K=0 'HDF5___xref';DelayUpdate
514        HDF5___xref[0][1] = ":"
515        HDF5___xref[1][1] = ":sasentry"
516        HDF5___xref[2][1] = ":sasentry:sasdata"
517        HDF5___xref[3][1] = ":sasentry:sasdata:I0"
518        HDF5___xref[4][1] = ":sasentry:sasdata:Q0"
519        HDF5___xref[0][0] = "/"
520        HDF5___xref[1][0] = "/sasentry"
521        HDF5___xref[2][0] = "/sasentry/sasdata"
522        HDF5___xref[3][0] = "/sasentry/sasdata/I"
523        HDF5___xref[4][0] = "/sasentry/sasdata/Q"
524
525        // Check our work so far.
526        // If something prints, there was an error above.
527        print H5GW_ValidateFolder("root:mydata")
528
529        // set I0 and Q0 to your data
530
531        print H5GW_WriteHDF5("root:mydata", "mydata.h5")
532       
533        SetDataFolder root:
534End
535
536
537//
538// given a filename of a VSANS data file of the form
539// name.anything.any.other (any number of extensions is OK)
540// returns the name as a string without ANY ".fbdfasga" extension
541//
542// returns the input string if a "." can't be found (maybe it wasn't there)
543//
544Function/S H_RemoveDotExtension(item)
545        String item
546        String invalid = item   //
547        Variable num=-1
548       
549        //find the "dot"
550        String runStr=""
551        Variable pos = strsearch(item,".",0)
552        if(pos == -1)
553                //"dot" not found
554                return (invalid)
555        else
556                //found, get all of the characters preceeding it
557                runStr = item[0,pos-1]
558                return (runStr)
559        Endif
560End
561
562
563//
564// Writing attributes to a group and to a dataset.
565// example from the WM documentation for HDF5SaveData
566//
567Function DemoAttributes(w)
568        Wave w
569
570        Variable result = 0     // 0 means no error
571       
572        // Create file
573        Variable fileID
574        HDF5CreateFile/P=home /O /Z fileID as "Test.h5"
575        if (V_flag != 0)
576                Print "HDF5CreateFile failed"
577                return -1
578        endif
579
580        // Write an attribute to the root group
581        Make /FREE /T /N=1 groupAttribute = "This is a group attribute"
582        HDF5SaveData /A="GroupAttribute" groupAttribute, fileID, "/"
583       
584        // Save wave as dataset
585        HDF5SaveData /O /Z w, fileID    // Uses wave name as dataset name
586        if (V_flag != 0)
587                Print "HDF5SaveData failed"
588                result = -1
589        endif
590
591        // Write an attribute to the dataset
592        Make /FREE /T /N=1 datasetAttribute = "This is a dataset attribute"
593        String datasetName = NameOfWave(w)
594        HDF5SaveData /A="DatasetAttribute" datasetAttribute, fileID, datasetName
595
596        HDF5CloseFile fileID
597       
598        return result
599End     // The attribute waves are automatically killed since they are free waves
600
601
602
603//     
604//Function H_Test_HDFWriteTrans(fname,val)
605//      String fname
606//      Variable val
607//     
608//     
609//      String str
610//      PathInfo home
611//      str = S_path
612//     
613//      H_WriteTransmissionToHeader(str+fname,val)
614//     
615//      return(0)
616//End
617//
618//Function H_WriteTransmissionToHeader(fname,trans)
619//      String fname
620//      Variable trans
621//     
622//      Make/O/D/N=1 wTmpWrite
623//      String groupName = "/Sample"    //      /Run1/Sample becomes groupName /Run1/Run1/Sample
624//      String varName = "TRNS"
625//      wTmpWrite[0] = trans //
626//
627//      variable err
628//      err = HDFWrite_Wave(fname, groupName, varName, wTmpWrite)
629//      KillWaves wTmpWrite
630//     
631//      //err not handled here
632//             
633//      return(0)
634//End
635
636
637
638Function H_Test_ListAttributes(fname,groupName)
639        String fname,groupName
640        Variable trans
641       
642//      Make/O/D/N=1 wTmpWrite
643//      String groupName = "/Sample"    //      /Run1/Sample becomes groupName /Run1/Run1/Sample
644//      String varName = "TRNS"
645//      wTmpWrite[0] = trans //
646        String str
647        PathInfo home
648        str = S_path
649       
650        variable err
651        err = H_HDF_ListAttributes(str+fname, groupName)
652       
653        //err not handled here
654               
655        return(0)
656End
657
658Function H_HDF_ListAttributes(fname, groupName)
659        String fname, groupName
660       
661        variable err=0, fileID,groupID
662        String cDF = getDataFolder(1), temp
663        String NXentry_name, attrValue=""
664       
665        STRUCT HDF5DataInfo di  // Defined in HDF5 Browser.ipf.
666        InitHDF5DataInfo(di)    // Initialize structure.
667       
668        try     
669                HDF5OpenFile /Z fileID  as fname  //open file read-write
670                if(!fileID)
671                        err = 1
672                        abort "HDF5 file does not exist"
673                endif
674               
675                HDF5OpenGroup /Z fileID , groupName, groupID
676
677        //      (QUOKKA) !! At the moment, there is no entry for sample thickness in our data file
678        //      therefore create new HDF5 group to enable write / patch command
679        //      comment out the following group creation once thickness appears in revised file
680       
681                if(!groupID)
682                        HDF5CreateGroup /Z fileID, groupName, groupID
683                        //err = 1
684                        //abort "HDF5 group does not exist"
685                else
686
687//                      HDF5AttributeInfo(fileID, "/", 1, "file_name", 0, di)
688                        HDF5AttributeInfo(fileID, "/", 1, "NeXus_version", 0, di)
689                        Print di
690
691//                      see the HDF5 Browser  for how to get the actual <value> of the attribute. See GetPreviewString in
692//        or in FillGroupAttributesList or in FillDatasetAttributesList (from FillLists)
693//                      it seems to be ridiculously complex to get such a simple bit of information - the HDF5BrowserData STRUCT
694//                      needs to be filled first. Ugh.
695                        attrValue = GetPreviewString(fileID, 1, di, "/entry", "cucumber")
696                        Print "attrValue = ",attrValue
697                       
698                       
699                        //get attributes and save them
700                        HDF5ListAttributes/TYPE=1 /Z fileID, groupName          //TYPE=1 means that we're referencing a group, not a dataset
701                        Print "S_HDF5ListAttributes = ", S_HDF5ListAttributes
702                       
703                        // passing the groupID works too, then the group name is not needed                     
704                        HDF5ListAttributes/TYPE=1 /Z groupID, "."               //TYPE=1 means that we're referencing a group, not a dataset
705                        Print "S_HDF5ListAttributes = ", S_HDF5ListAttributes
706                endif
707        catch
708
709                // catch any aborts here
710               
711        endtry
712       
713        if(groupID)
714                HDF5CloseGroup /Z groupID
715        endif
716       
717        if(fileID)
718                HDF5CloseFile /Z fileID
719        endif
720
721        setDataFolder $cDF
722        return err
723end
724
725
726/////////////// end of the testing procedures ////////////////
Note: See TracBrowser for help on using the repository browser.