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

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

lots of changes to how VCALC simulations can be written to Nexus files to effectively make test data with different callues before the virtual machine is ready. many changes for visualization to effectively handle zeros in log scaled images

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