source: sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/V_HDF5_Read.ipf @ 989

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

more additions to HDF reader to work with the Nexus definition

Additions to SANS event mode processing to allow proper processing of large data streams. Data was inproperly saved after decimation without correcting for the decimation. Instead, use decimation for screening, and bin the full data (splits) on the fly.

File size: 48.1 KB
Line 
1#pragma rtGlobals=3             // Use modern global access method and strict wave access.
2
3
4//////////// READ (GET) FUNCTIONS ////////////////////
5
6
7//////////////////////////////////////////////
8//////////////////////////////////
9// for TESTING of the get functions - to quickly access and se if there are errors
10//
11// -- not sure how to test the string functions -- can't seem to get a FUNCREF to a string function
12// to work -- maybe it's not alllowed?
13//
14// -- also, now I have get_functions that take a detStr input with the detector information, so that the
15//    functions didn't need to be repeated
16//
17//      -- Not sure how to test the "write" functions. writing the wrong data type to the wrong data field will be a disaster
18//    Writing odd, dummy values will also be a mess - no way to know if I'm doing anything correctly
19//
20Function proto_V_get_FP(str)
21        String str
22        return(0)
23end
24Function proto_V_get_FP2(str,str2)
25        String str,str2
26        return(0)
27end
28//Function/S proto_V_get_STR(str)
29//      String str
30//      return("")
31//end
32
33Macro Dump_V_getFP(fname)
34        String fname
35       
36        Test_V_get_FP("V_get*",fname)
37end
38
39Function Test_V_get_FP(str,fname)
40        String str,fname
41       
42        Variable ii,num
43        String list,item
44       
45       
46        list=FunctionList(str,";","NPARAMS:1,VALTYPE:1") //,VALTYPE:1 gives real return values, not strings
47//      Print list
48        num = ItemsInlist(list)
49       
50       
51        for(ii=0;ii<num;ii+=1)
52                item = StringFromList(ii, list , ";")
53                FUNCREF proto_V_get_FP f = $item
54                Print item ," = ", f(fname)
55        endfor
56       
57        return(0)
58end
59
60Macro Dump_V_getFP_Det(fname,detStr)
61        String fname,detStr="FL"
62       
63        Test_V_get_FP2("V_get*",fname,detStr)
64end
65
66Function Test_V_get_FP2(str,fname,detStr)
67        String str,fname,detStr
68       
69        Variable ii,num
70        String list,item
71       
72       
73        list=FunctionList(str,";","NPARAMS:2,VALTYPE:1") //,VALTYPE:1 gives real return values, not strings
74//      Print list
75        num = ItemsInlist(list)
76       
77       
78        for(ii=0;ii<num;ii+=1)
79                item = StringFromList(ii, list , ";")
80                FUNCREF proto_V_get_FP2 f = $item
81                Print item ," = ", f(fname,detStr)
82        endfor
83       
84        return(0)
85end
86
87
88Macro Dump_V_getSTR(fname)
89        String fname
90       
91        Test_V_get_STR("V_get*",fname)
92end
93
94Function Test_V_get_STR(str,fname)
95        String str,fname
96       
97        Variable ii,num
98        String list,item,strToEx
99       
100       
101        list=FunctionList(str,";","NPARAMS:1,VALTYPE:4")
102//      Print list
103        num = ItemsInlist(list)
104       
105       
106        for(ii=0;ii<num;ii+=1)
107                item = StringFromList(ii, list , ";")
108        //      FUNCREF proto_V_get_STR f = $item
109                printf "%s = ",item
110                sprintf strToEx,"Print %s(\"%s\")",item,fname
111                Execute strToEx
112//              print strToEx
113//              Print item ," = ", f(fname)
114        endfor
115       
116        return(0)
117end
118
119Macro Dump_V_getSTR_Det(fname,detStr)
120        String fname,detStr="FL"
121       
122        Test_V_get_STR2("V_get*",fname,detStr)
123end
124
125Function Test_V_get_STR2(str,fname,detStr)
126        String str,fname,detStr
127       
128        Variable ii,num
129        String list,item,strToEx
130       
131       
132        list=FunctionList(str,";","NPARAMS:2,VALTYPE:4")
133//      Print list
134        num = ItemsInlist(list)
135       
136       
137        for(ii=0;ii<num;ii+=1)
138                item = StringFromList(ii, list , ";")
139        //      FUNCREF proto_V_get_STR f = $item
140                printf "%s = ",item
141                sprintf strToEx,"Print %s(\"%s\",\"%s\")",item,fname,detStr
142                Execute strToEx
143//              print strToEx
144//              Print item ," = ", f(fname)
145        endfor
146       
147        return(0)
148end
149///////////////////////////////////////
150
151
152//////////////////////////////////////////////
153
154
155///////////////////////
156//
157// *These are the specific bits of information to retrieve (or write) to the data file
158// *These functions use the path to the file as input, and each has the specific
159//   path to the variable srting, or wave hard-coded into the access function
160// *They call the generic worker functions to get the values, either from the local copy if present,
161//   or the full file is loaded.
162//
163// *Since the path is the important bit, these are written as get/write pairs to make it easier to
164//   keep up with any changes in path
165//
166//
167// TODO -- verify the paths, and add more as needed
168// TODO -- for all of the String functions -- "num" does nothing right now -
169//         -- if it ever does, or needs to, a lot of locations will need to be corrected
170//
171
172
173//////// TOP LEVEL
174//////// TOP LEVEL
175//////// TOP LEVEL
176
177//// nexus version used for definitions
178//Function/S V_getNeXus_version(fname)
179//      String fname
180//     
181//      String path = "entry:NeXus_version"     
182//      Variable num=60
183//      return(V_getStringFromHDF5(fname,path,num))
184//End
185
186// TODO -- not mine, added somewhere by Nexus writer?
187// data collection time (! this is the true counting time??)
188Function V_getCollectionTime(fname)
189        String fname
190       
191        String path = "entry:collection_time"   
192        return(V_getRealValueFromHDF5(fname,path))
193End
194
195// data directory where data files are stored (for user access, not archive)
196Function/S V_getData_directory(fname)
197        String fname
198       
199        String path = "entry:data_directory"   
200        Variable num=60
201        return(V_getStringFromHDF5(fname,path,num))
202End
203
204// Base class of Nexus definition (=NXsas)
205Function/S V_getNexusDefinition(fname)
206        String fname
207       
208        String path = "entry:definition"       
209        Variable num=60
210        return(V_getStringFromHDF5(fname,path,num))
211End
212
213// TODO -- not mine, added somewhere by Nexus writer?
214// data collection duration (may include pauses, other "dead" time)
215Function V_getDataDuration(fname)
216        String fname
217       
218        String path = "entry:duration" 
219        return(V_getRealValueFromHDF5(fname,path))
220End
221
222// TODO -- not mine, added somewhere by Nexus writer?
223// data collection end time
224Function/S V_getDataEndTime(fname)
225        String fname
226       
227        String path = "entry:end_time" 
228        Variable num=60
229        return(V_getStringFromHDF5(fname,path,num))
230End
231
232// experiment description
233Function/S V_getExperiment_description(fname)
234        String fname
235       
236        String path = "entry:experiment_description"   
237        Variable num=60
238        return(V_getStringFromHDF5(fname,path,num))
239End
240
241// experiment identifier? used only by NICE?
242Function/S V_getExperiment_identifier(fname)
243        String fname
244       
245        String path = "entry:experiment_identifier"     
246        Variable num=60
247        return(V_getStringFromHDF5(fname,path,num))
248End
249
250// name of facility = NCNR
251Function/S V_getFacility(fname)
252        String fname
253       
254        String path = "entry:facility" 
255        Variable num=60
256        return(V_getStringFromHDF5(fname,path,num))
257End
258               
259// file write time (what is this??
260// TODO - figure out if this is supposed to be an integer or text (ISO)
261Function V_getFileWriteTime(fname)
262        String fname
263       
264        String path = "entry:file_time"
265        return(V_getRealValueFromHDF5(fname,path))
266End
267
268// TODO - should be the file name as saved on disk, currently it's not
269Function/S V_getFile_name(fname)
270        String fname
271       
272        String path = "entry:file_name"
273        Variable num=60
274        return(V_getStringFromHDF5(fname,path,num))
275End
276               
277//
278Function/S V_getHDF_version(fname)
279        String fname
280       
281        String path = "entry:hdf_version"       
282        Variable num=60
283        return(V_getStringFromHDF5(fname,path,num))
284End
285
286// TODO -- not mine, added somewhere by Nexus writer?
287Function/S V_getProgram_name(fname)
288        String fname
289       
290        String path = "entry:program_name"     
291        Variable num=60
292        return(V_getStringFromHDF5(fname,path,num))
293End
294
295// TODO -- not mine, added somewhere by Nexus writer?
296// data collection start time
297Function/S V_getDataStartTime(fname)
298        String fname
299       
300        String path = "entry:start_time"       
301        Variable num=60
302        return(V_getStringFromHDF5(fname,path,num))
303End
304               
305// title of experiment
306Function/S V_getTitle(fname)
307        String fname
308       
309        String path = "entry:title"     
310        Variable num=60
311        return(V_getStringFromHDF5(fname,path,num))
312end
313       
314       
315               
316////////// USER
317////////// USER
318////////// USER
319
320// list of user names
321// TODO -- currently not written out to data file??
322Function/S V_getUserNames(fname)
323        String fname
324       
325        String path = "entry:user:name"
326        Variable num=60
327        return(V_getStringFromHDF5(fname,path,num))
328end
329
330
331//////// CONTROL
332//////// CONTROL
333//////// CONTROL
334
335// TODO -- for the control section, document each of the fields
336
337Function V_getCount_end(fname)
338        String fname
339       
340        String path = "entry:control:count_end"
341        return(V_getRealValueFromHDF5(fname,path))
342end
343
344
345Function V_getCount_start(fname)
346        String fname
347       
348        String path = "entry:control:count_start"       
349        return(V_getRealValueFromHDF5(fname,path))
350end
351
352
353Function V_getCount_time(fname)
354        String fname
355       
356        String path = "entry:control:count_time"       
357        return(V_getRealValueFromHDF5(fname,path))
358end
359
360
361Function V_getCount_time_preset(fname)
362        String fname
363       
364        String path = "entry:control:count_time_preset"
365        return(V_getRealValueFromHDF5(fname,path))
366end
367
368
369Function V_getDetector_counts(fname)
370        String fname
371       
372        String path = "entry:control:detector_counts"   
373        return(V_getRealValueFromHDF5(fname,path))
374end
375
376
377Function V_getDetector_preset(fname)
378        String fname
379       
380        String path = "entry:control:detector_preset"   
381        return(V_getRealValueFromHDF5(fname,path))
382end
383
384
385Function V_getIntegral(fname)
386        String fname
387       
388        String path = "entry:control:integral" 
389        return(V_getRealValueFromHDF5(fname,path))
390end
391
392// control mode for data acquisition, "timer"
393// TODO - what are the enumerated types for this?
394Function/S V_getControlMode(fname)
395        String fname
396       
397        String path = "entry:control:mode"     
398        Variable num=60
399        return(V_getStringFromHDF5(fname,path,num))
400End
401
402//monitor count
403Function V_getMonitorCount(fname)
404        String fname
405       
406        String path = "entry:control:monitor_counts"   
407        return(V_getRealValueFromHDF5(fname,path))
408end
409
410Function V_getMonitor_preset(fname)
411        String fname
412       
413        String path = "entry:control:monitor_preset"   
414        return(V_getRealValueFromHDF5(fname,path))
415end
416
417// TODO - what are the enumerated types for this?
418Function V_getPreset(fname)
419        String fname
420       
421        String path = "entry:control:preset"   
422        return(V_getRealValueFromHDF5(fname,path))
423end
424
425
426
427
428
429//////// INSTRUMENT
430//////// INSTRUMENT
431//////// INSTRUMENT
432
433// TODO -- this does not appear to be written out
434Function/S V_getLocalContact(fname)
435        String fname
436
437        String path = "entry:instrument:local_contact"
438        Variable num=60
439        return(V_getStringFromHDF5(fname,path,num))
440End
441
442Function/S V_getInstrumentName(fname)
443        String fname
444
445        String path = "entry:instrument:name"
446        Variable num=60
447        return(V_getStringFromHDF5(fname,path,num))
448End
449
450Function/S V_getInstrumentType(fname)
451        String fname
452
453        String path = "entry:instrument:type"
454        Variable num=60
455        return(V_getStringFromHDF5(fname,path,num))
456End
457
458////// INSTRUMENT/ATTENUATOR
459// TODO - be sure of the definition of these terms
460//
461
462// transmission value for the attenuator in the beam
463// use this, but if something wrong, the tables are present
464Function V_getAttenuator_transmission(fname)
465        String fname
466       
467        String path = "entry:instrument:attenuator:attenuator_transmission"     
468        return(V_getRealValueFromHDF5(fname,path))
469end
470
471// transmission value (error) for the attenuator in the beam
472// use this, but if something wrong, the tables are present
473Function V_getAttenuator_trans_err(fname)
474        String fname
475       
476        String path = "entry:instrument:attenuator:attenuator_transmission_error"       
477        return(V_getRealValueFromHDF5(fname,path))
478end
479
480// desired thickness
481Function V_getAtten_desired_thickness(fname)
482        String fname
483       
484        String path = "entry:instrument:attenuator:desired_thickness"   
485        return(V_getRealValueFromHDF5(fname,path))
486end
487
488
489
490// distance from the attenuator to the sample (units??)
491Function V_getAttenDistance(fname)
492        String fname
493       
494        String path = "entry:instrument:attenuator:distance"   
495        return(V_getRealValueFromHDF5(fname,path))
496end
497
498
499//// attenuator index, to use in the lookup table of transmission values
500//Function V_getAttenIndex(fname)
501//      String fname
502//     
503//      String path = "entry:instrument:attenuator:index"       
504//      return(V_getRealValueFromHDF5(fname,path))
505//end
506
507// table of the attenuation factor error
508Function V_getAttenIndex_error_table(fname,outW)
509        String fname
510        Wave outW
511       
512        String path = "entry:instrument:attenuator:index_error_table"
513        WAVE w = V_getRealWaveFromHDF5(fname,path)
514
515        outW = w
516        return(0)
517end
518
519// table of the attenuation factor
520Function V_getAttenIndex_table(fname,outW)
521        String fname
522        Wave outW
523       
524        String path = "entry:instrument:attenuator:index_table"
525        WAVE w = V_getRealWaveFromHDF5(fname,path)
526
527        outW = w
528        return(0)
529end
530//
531//// status "in or out"
532//Function/S V_getAttenStatus(fname)
533//      String fname
534//
535//      String path = "entry:instrument:attenuator:status"
536//      Variable num=60
537//      return(V_getStringFromHDF5(fname,path,num))
538//End
539
540Function V_getAtten_number(fname)
541        String fname
542       
543        String path = "entry:instrument:attenuator:num_atten_dropped"   
544        return(V_getRealValueFromHDF5(fname,path))
545end
546
547// thickness of the attenuator (PMMA) - units??
548Function V_getAttenThickness(fname)
549        String fname
550       
551        String path = "entry:instrument:attenuator:thickness"   
552        return(V_getRealValueFromHDF5(fname,path))
553end
554
555
556// type of material for the atteunator
557Function/S V_getAttenType(fname)
558        String fname
559
560        String path = "entry:instrument:attenuator:type"
561        Variable num=60
562        return(V_getStringFromHDF5(fname,path,num))
563End
564
565
566////// INSTRUMENT/BEAM
567// instrument/beam/chopper (data folder)
568Function V_getChopperAngular_opening(fname)
569        String fname
570       
571        String path = "entry:instrument:beam:chopper:angular_opening"   
572        return(V_getRealValueFromHDF5(fname,path))
573end
574
575Function V_getChopDistance_from_sample(fname)
576        String fname
577       
578        String path = "entry:instrument:beam:chopper:distance_from_sample"     
579        return(V_getRealValueFromHDF5(fname,path))
580end
581
582Function V_getChopDistance_from_source(fname)
583        String fname
584       
585        String path = "entry:instrument:beam:chopper:distance_from_source"     
586        return(V_getRealValueFromHDF5(fname,path))
587end
588
589Function V_getChopperDuty_cycle(fname)
590        String fname
591       
592        String path = "entry:instrument:beam:chopper:duty_cycle"       
593        return(V_getRealValueFromHDF5(fname,path))
594end
595
596Function V_getChopperRotation_speed(fname)
597        String fname
598       
599        String path = "entry:instrument:beam:chopper:rotation_speed"   
600        return(V_getRealValueFromHDF5(fname,path))
601end
602
603Function V_getChopperSlits(fname)
604        String fname
605       
606        String path = "entry:instrument:beam:chopper:slits"     
607        return(V_getRealValueFromHDF5(fname,path))
608end
609
610Function/S V_getChopperstatus(fname)
611        String fname
612
613        String path = "entry:instrument:beam:chopper:status"
614        Variable num=60
615        return(V_getStringFromHDF5(fname,path,num))
616End
617
618Function/S V_getChoppertype(fname)
619        String fname
620
621        String path = "entry:instrument:beam:chopper:type"
622        Variable num=60
623        return(V_getStringFromHDF5(fname,path,num))
624End
625
626
627// instrument/beam/flipper (data folder)
628Function V_getFlipperDriving_current(fname)
629        String fname
630       
631        String path = "entry:instrument:beam:flipper:driving_current"   
632        return(V_getRealValueFromHDF5(fname,path))
633end
634
635Function V_getFlipperFrequency(fname)
636        String fname
637       
638        String path = "entry:instrument:beam:flipper:frequency"
639        return(V_getRealValueFromHDF5(fname,path))
640end
641
642Function/S V_getFlipperstatus(fname)
643        String fname
644
645        String path = "entry:instrument:beam:flipper:status"
646        Variable num=60
647        return(V_getStringFromHDF5(fname,path,num))
648End
649
650Function V_getFlipperTransmitted_power(fname)
651        String fname
652       
653        String path = "entry:instrument:beam:flipper:transmitted_power"
654        return(V_getRealValueFromHDF5(fname,path))
655end
656
657Function/S V_getFlipperWaveform(fname)
658        String fname
659
660        String path = "entry:instrument:beam:flipper:waveform"
661        Variable num=60
662        return(V_getStringFromHDF5(fname,path,num))
663End
664
665// instrument/beam/monochromator (data folder)
666Function/S V_getMonochromatorType(fname)
667        String fname
668
669        String path = "entry:instrument:beam:monochromator:type"
670        Variable num=60
671        return(V_getStringFromHDF5(fname,path,num))
672End
673
674Function V_getWavelength(fname)
675        String fname
676       
677        String path = "entry:instrument:beam:monochromator:wavelength" 
678        return(V_getRealValueFromHDF5(fname,path))
679end
680
681Function V_getWavelength_spread(fname)
682        String fname
683       
684        String path = "entry:instrument:beam:monochromator:wavelength_spread"   
685        return(V_getRealValueFromHDF5(fname,path))
686end
687
688// instrument/beam/monochromator/crystal (data folder)
689Function V_getCrystalEnergy(fname)
690        String fname
691       
692        String path = "entry:instrument:beam:monochromator:crystal:energy"     
693        return(V_getRealValueFromHDF5(fname,path))
694end
695
696Function V_getCrystalHorizontal_aperture(fname)
697        String fname
698       
699        String path = "entry:instrument:beam:monochromator:crystal:horizontal_aperture"
700        return(V_getRealValueFromHDF5(fname,path))
701end
702
703Function V_getCrystalHoriz_curvature(fname)
704        String fname
705       
706        String path = "entry:instrument:beam:monochromator:crystal:horizontal_curvature"       
707        return(V_getRealValueFromHDF5(fname,path))
708end
709
710Function V_getCrystalLattice_parameter(fname)
711        String fname
712       
713        String path = "entry:instrument:beam:monochromator:crystal:lattice_parameter"   
714        return(V_getRealValueFromHDF5(fname,path))
715end
716
717Function V_getCrystalDistance(fname)
718        String fname
719       
720        String path = "entry:instrument:beam:monochromator:crystal:distance"   
721        return(V_getRealValueFromHDF5(fname,path))
722end
723
724Function V_getCrystalReflection(fname)
725        String fname
726       
727        String path = "entry:instrument:beam:monochromator:crystal:reflection" 
728        return(V_getRealValueFromHDF5(fname,path))
729end
730
731Function V_getCrystalRotation(fname)
732        String fname
733       
734        String path = "entry:instrument:beam:monochromator:crystal:rotation"   
735        return(V_getRealValueFromHDF5(fname,path))
736end
737
738Function/S V_getCrystalStatus(fname)
739        String fname
740
741        String path = "entry:instrument:beam:monochromator:crystal:status"
742        Variable num=60
743        return(V_getStringFromHDF5(fname,path,num))
744End
745
746Function V_getCrystalVertical_aperture(fname)
747        String fname
748       
749        String path = "entry:instrument:beam:monochromator:crystal:vertical_aperture"   
750        return(V_getRealValueFromHDF5(fname,path))
751end
752
753Function V_getCrystalVertical_curvature(fname)
754        String fname
755       
756        String path = "entry:instrument:beam:monochromator:crystal:vertical_curvature" 
757        return(V_getRealValueFromHDF5(fname,path))
758end
759
760Function V_getCrystalWavelength(fname)
761        String fname
762       
763        String path = "entry:instrument:beam:monochromator:crystal:wavelength" 
764        return(V_getRealValueFromHDF5(fname,path))
765end
766
767Function V_getCrystalWavelength_spread(fname)
768        String fname
769       
770        String path = "entry:instrument:beam:monochromator:crystal:wavelength_spread"   
771        return(V_getRealValueFromHDF5(fname,path))
772end
773
774Function V_getCrystalWavevector(fname)
775        String fname
776       
777        String path = "entry:instrument:beam:monochromator:crystal:wavevector" 
778        return(V_getRealValueFromHDF5(fname,path))
779end
780
781// instrument/beam/monochromator/velocity_selector (data folder)
782Function V_getVSDistance(fname)
783        String fname
784       
785        String path = "entry:instrument:beam:monochromator:velocity_selector:distance" 
786        return(V_getRealValueFromHDF5(fname,path))
787end
788
789Function V_getVSRotation_speed(fname)
790        String fname
791       
792        String path = "entry:instrument:beam:monochromator:velocity_selector:rotation_speed"   
793        return(V_getRealValueFromHDF5(fname,path))
794end
795
796Function/S V_getVelSelStatus(fname)
797        String fname
798
799        String path = "entry:instrument:beam:monochromator:velocity_selector:status"
800        Variable num=60
801        return(V_getStringFromHDF5(fname,path,num))
802End
803
804Function V_getVSTable(fname,outW)
805        String fname
806        Wave outW
807       
808        String path = "entry:instrument:beam:monochromator:velocity_selector:table"     
809        WAVE w = V_getRealWaveFromHDF5(fname,path)
810
811        outW = w
812        return(0)
813end
814
815Function V_getVSTable_parameters(fname)
816        String fname
817       
818        String path = "entry:instrument:beam:monochromator:velocity_selector:table_parameters" 
819        return(V_getRealValueFromHDF5(fname,path))
820end
821
822Function V_getVS_tilt(fname)
823        String fname
824       
825        String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt"   
826        return(V_getRealValueFromHDF5(fname,path))
827end
828
829Function V_getVSWavelength(fname)
830        String fname
831       
832        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength"       
833        return(V_getRealValueFromHDF5(fname,path))
834end
835
836Function V_getVSWavelength_spread(fname)
837        String fname
838       
839        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength_spread"
840        return(V_getRealValueFromHDF5(fname,path))
841end
842
843// instrument/beam/monochromator/white_beam (data folder)
844Function/S V_getWhiteBeamStatus(fname)
845        String fname
846
847        String path = "entry:instrument:beam:monochromator:white_beam:status"
848        Variable num=60
849        return(V_getStringFromHDF5(fname,path,num))
850End
851
852Function V_getWhiteBeamWavelength(fname)
853        String fname
854       
855        String path = "entry:instrument:beam:monochromator:white_beam:wavelength"       
856        return(V_getRealValueFromHDF5(fname,path))
857end
858
859Function V_getWhiteBeamWavelength_spread(fname)
860        String fname
861       
862        String path = "entry:instrument:beam:monochromator:white_beam:wavelength_spread"       
863        return(V_getRealValueFromHDF5(fname,path))
864end
865
866// instrument/beam/polarizer (data folder)
867Function/S V_getPolarizerComposition(fname)
868        String fname
869
870        String path = "entry:instrument:beam:polarizer:composition"
871        Variable num=60
872        return(V_getStringFromHDF5(fname,path,num))
873End
874
875Function V_getPolarizerEfficiency(fname)
876        String fname
877       
878        String path = "entry:instrument:beam:polarizer:efficiency"     
879        return(V_getRealValueFromHDF5(fname,path))
880end
881
882Function/S V_getPolarizerStatus(fname)
883        String fname
884
885        String path = "entry:instrument:beam:polarizer:status"
886        Variable num=60
887        return(V_getStringFromHDF5(fname,path,num))
888End
889
890Function/S V_getPolarizerType(fname)
891        String fname
892
893        String path = "entry:instrument:beam:polarizer:type"
894        Variable num=60
895        return(V_getStringFromHDF5(fname,path,num))
896End
897
898// instrument/beam/polarizer_analyzer (data folder)
899Function V_getPolAnaCell_index(fname)
900        String fname
901
902        String path = "entry:instrument:beam:polarizer_analyzer:cell_index"
903        return(V_getRealValueFromHDF5(fname,path))
904End
905
906Function/S V_getPolAnaCell_name(fname)
907        String fname
908
909        String path = "entry:instrument:beam:polarizer_analyzer:cell_name"
910        Variable num=60
911        return(V_getStringFromHDF5(fname,path,num))
912End
913
914Function V_getPolAnaCell_parameters(fname,outW)
915        String fname
916        Wave outW
917
918        String path = "entry:instrument:beam:polarizer_analyzer:cell_parameters"
919        WAVE w = V_getRealWaveFromHDF5(fname,path)
920
921        outW = w
922        return(0)
923End
924
925Function V_getPolAnaGuideFieldCur_1(fname)
926        String fname
927
928        String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_1"
929        return(V_getRealValueFromHDF5(fname,path))
930End
931
932Function V_getPolAnaGuideFieldCur_2(fname)
933        String fname
934
935        String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_2"
936        return(V_getRealValueFromHDF5(fname,path))
937End
938
939Function V_getPolAnaSolenoid_current(fname)
940        String fname
941
942        String path = "entry:instrument:beam:polarizer_analyzer:solenoid_current"
943        return(V_getRealValueFromHDF5(fname,path))
944End
945
946Function/S V_getPolAnaStatus(fname)
947        String fname
948
949        String path = "entry:instrument:beam:polarizer_analyzer:status"
950        Variable num=60
951        return(V_getStringFromHDF5(fname,path,num))
952End
953
954                                       
955/////// INSTRUMENT/BEAM MONITORS
956
957//beam_monitor_low (data folder)
958Function V_getBeamMonLowData(fname)
959        String fname
960
961        String path = "entry:instrument:beam_monitor_low:data"
962        return(V_getRealValueFromHDF5(fname,path))
963End
964
965Function V_getBeamMonLowEfficiency(fname)
966        String fname
967
968        String path = "entry:instrument:beam_monitor_low:efficiency"
969        return(V_getRealValueFromHDF5(fname,path))
970End
971
972Function V_getBeamMonLowDistance(fname)
973        String fname
974
975        String path = "entry:instrument:beam_monitor_low:distance"
976        return(V_getRealValueFromHDF5(fname,path))
977End
978
979Function V_getBeamMonLowSaved_count(fname)
980        String fname
981
982        String path = "entry:instrument:beam_monitor_low:saved_count"
983        return(V_getRealValueFromHDF5(fname,path))
984End
985
986Function/S V_getBeamMonLowType(fname)
987        String fname
988
989        String path = "entry:instrument:beam_monitor_low:type"
990        Variable num=60
991        return(V_getStringFromHDF5(fname,path,num))
992End
993
994//beam_monitor_norm (data folder)
995Function V_getBeamMonNormData(fname)
996        String fname
997
998        String path = "entry:instrument:beam_monitor_norm:data"
999        return(V_getRealValueFromHDF5(fname,path))
1000End
1001
1002Function V_getBeamMonNormEfficiency(fname)
1003        String fname
1004
1005        String path = "entry:instrument:beam_monitor_norm:efficiency"
1006        return(V_getRealValueFromHDF5(fname,path))
1007End
1008
1009Function V_getBeamMonNormDistance(fname)
1010        String fname
1011
1012        String path = "entry:instrument:beam_monitor_norm:distance"
1013        return(V_getRealValueFromHDF5(fname,path))
1014End
1015
1016Function V_getBeamMonNormSaved_count(fname)
1017        String fname
1018
1019        String path = "entry:instrument:beam_monitor_norm:saved_count"
1020        return(V_getRealValueFromHDF5(fname,path))
1021End
1022
1023Function/S V_getBeamMonNormType(fname)
1024        String fname
1025
1026        String path = "entry:instrument:beam_monitor_norm:type"
1027        Variable num=60
1028        return(V_getStringFromHDF5(fname,path,num))
1029End
1030
1031//beam_stop (data folder)
1032Function/S V_getBeamStopDescription(fname)
1033        String fname
1034
1035        String path = "entry:instrument:beam_stop:description"
1036        Variable num=60
1037        return(V_getStringFromHDF5(fname,path,num))
1038End
1039
1040Function V_getBeamStopDist_to_det(fname)
1041        String fname
1042
1043        String path = "entry:instrument:beam_stop:distance_to_detector"
1044        return(V_getRealValueFromHDF5(fname,path))
1045End
1046
1047Function V_getBeamStop_x_pos(fname)
1048        String fname
1049
1050        String path = "entry:instrument:beam_stop:x_pos"
1051        return(V_getRealValueFromHDF5(fname,path))
1052End
1053
1054Function V_getBeamStop_y_pos(fname)
1055        String fname
1056
1057        String path = "entry:instrument:beam_stop:y_pos"
1058        return(V_getRealValueFromHDF5(fname,path))
1059End
1060
1061//// INSTRUMENT/COLLIMATOR
1062//collimator (data folder)
1063Function V_getNumberOfGuides(fname)
1064        String fname
1065
1066        String path = "entry:instrument:collimator:number_guides"
1067        return(V_getRealValueFromHDF5(fname,path))
1068End
1069
1070//                              geometry (data folder)
1071//                                      shape (data folder)
1072Function/S V_getGuideShape(fname)
1073        String fname
1074
1075        String path = "entry:instrument:collimator:geometry:shape:shape"
1076        Variable num=60
1077        return(V_getStringFromHDF5(fname,path,num))
1078End
1079
1080Function V_getGuideSize(fname)
1081        String fname
1082
1083        String path = "entry:instrument:collimator:geometry:shape:size"
1084        return(V_getRealValueFromHDF5(fname,path))
1085End
1086
1087//                      converging_pinholes (data folder)
1088Function/S V_getConvPinholeStatus(fname)
1089        String fname
1090
1091        String path = "entry:instrument:converging_pinholes:status"
1092        Variable num=60
1093        return(V_getStringFromHDF5(fname,path,num))
1094End
1095
1096//                      converging_slits (not used)
1097
1098////// INSTRUMENT/DETECTORS
1099//                      detector_B (data folder)
1100//
1101// only defined for the "B" detector, and may not be necessary?
1102// TODO -- write to return an ARRAY
1103Function/WAVE V_getDet_cal_x(fname,detStr)
1104        String fname,detStr
1105
1106        if(cmpstr(detStr,"B") == 0)
1107                String path = "entry:instrument:detector_"+detStr+":cal_x"
1108                WAVE w = V_getRealWaveFromHDF5(fname,path)
1109
1110                return w
1111        else
1112                return $""
1113        endif
1114End
1115
1116// only defined for the "B" detector, and may not be necessary?
1117// TODO -- write to return an ARRAY
1118Function/WAVE V_getDet_cal_y(fname,detStr)
1119        String fname,detStr
1120
1121        if(cmpstr(detStr,"B") == 0)
1122                String path = "entry:instrument:detector_"+detStr+":cal_y"
1123                WAVE w = V_getRealWaveFromHDF5(fname,path)
1124       
1125                return w
1126        else
1127                return $""
1128        endif
1129End
1130
1131// TODO -- write and X and Y version of this. Pixels are not square
1132// so the FHWM will be different in each direction. May need to return
1133// "dummy" value for "B" detector if pixels there are square
1134Function V_getDet_pixel_fwhm_x(fname,detStr)
1135        String fname,detStr
1136
1137        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_x"
1138
1139// TODO -- different behavior for "B"
1140        if(cmpstr(detStr,"B") == 0)
1141                return(V_getRealValueFromHDF5(fname,path))
1142        else
1143                return(V_getRealValueFromHDF5(fname,path))
1144        endif
1145End
1146
1147// TODO -- write and X and Y version of this. Pixels are not square
1148// so the FHWM will be different in each direction. May need to return
1149// "dummy" value for "B" detector if pixels there are square
1150Function V_getDet_pixel_fwhm_y(fname,detStr)
1151        String fname,detStr
1152
1153        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_y"
1154
1155// TODO -- different behavior for "B"
1156        if(cmpstr(detStr,"B") == 0)
1157                return(V_getRealValueFromHDF5(fname,path))
1158        else
1159                return(V_getRealValueFromHDF5(fname,path))
1160        endif
1161End
1162
1163Function V_getDet_pixel_num_x(fname,detStr)
1164        String fname,detStr
1165
1166        String path = "entry:instrument:detector_"+detStr+":pixel_num_x"
1167        return(V_getRealValueFromHDF5(fname,path))
1168End
1169
1170Function V_getDet_pixel_num_y(fname,detStr)
1171        String fname,detStr
1172
1173        String path = "entry:instrument:detector_"+detStr+":pixel_num_y"
1174        return(V_getRealValueFromHDF5(fname,path))
1175End
1176
1177// only defined for the "B" detector, and only to satisfy NXsas
1178Function V_getDet_azimuthalAngle(fname,detStr)
1179        String fname,detStr
1180
1181        if(cmpstr(detStr,"B") == 0)
1182                String path = "entry:instrument:detector_"+detStr+":azimuthal_angle"
1183                return(V_getRealValueFromHDF5(fname,path))
1184        else
1185                return(0)
1186        endif
1187End
1188
1189Function V_getDet_beam_center_x(fname,detStr)
1190        String fname,detStr
1191
1192        String path = "entry:instrument:detector_"+detStr+":beam_center_x"
1193        return(V_getRealValueFromHDF5(fname,path))
1194End
1195
1196Function V_getDet_beam_center_y(fname,detStr)
1197        String fname,detStr
1198
1199        String path = "entry:instrument:detector_"+detStr+":beam_center_y"
1200        return(V_getRealValueFromHDF5(fname,path))
1201End
1202
1203
1204//TODO
1205//
1206// x and y center in mm is currently not part of the NExus definition
1207//  does it need to be?
1208// these lookups will fail if they have not been generated locally!
1209
1210Function V_getDet_beam_center_x_mm(fname,detStr)
1211        String fname,detStr
1212
1213        String path = "entry:instrument:detector_"+detStr+":beam_center_x_mm"
1214        return(V_getRealValueFromHDF5(fname,path))
1215End
1216
1217//TODO
1218//
1219// x and y center in mm is currently not part of the NExus definition
1220//  does it need to be?
1221// these lookups will fail if they have not been generated locally!
1222
1223Function V_getDet_beam_center_y_mm(fname,detStr)
1224        String fname,detStr
1225
1226        String path = "entry:instrument:detector_"+detStr+":beam_center_y_mm"
1227        return(V_getRealValueFromHDF5(fname,path))
1228End
1229
1230
1231
1232// TODO -- write this function to return a WAVE with the data
1233// either as a wave reference, or as an input parameter
1234Function/WAVE V_getDetectorDataW(fname,detStr)
1235        String fname,detStr
1236
1237        String path = "entry:instrument:detector_"+detStr+":data"
1238        WAVE w = V_getRealWaveFromHDF5(fname,path)
1239
1240        return w
1241End
1242
1243// TODO -- write this function to return a WAVE with the data
1244// either as a wave reference, or as an input parameter
1245Function/WAVE V_getDetectorDataErrW(fname,detStr)
1246        String fname,detStr
1247
1248        String path = "entry:instrument:detector_"+detStr+":linear_data_error"
1249        WAVE w = V_getRealWaveFromHDF5(fname,path)
1250
1251        return w
1252End
1253
1254// TODO -- write this function to return a WAVE with the data
1255// either as a wave reference, or as an input parameter
1256// ALSO -- the "B" deadtime will be a single value (probably)
1257//  but the tube banks will be 1D arrays of values, one per tube
1258Function/WAVE V_getDetector_deadtime(fname,detStr)
1259        String fname,detStr
1260
1261        String path = "entry:instrument:detector_"+detStr+":dead_time"
1262        WAVE w = V_getRealWaveFromHDF5(fname,path)
1263
1264        return w
1265End
1266
1267
1268Function/S V_getDetDescription(fname,detStr)
1269        String fname,detStr
1270
1271        String path = "entry:instrument:detector_"+detStr+":description"
1272        Variable num=60
1273        return(V_getStringFromHDF5(fname,path,num))
1274End
1275
1276Function V_getDet_distance(fname,detStr)
1277        String fname,detStr
1278
1279        String path = "entry:instrument:detector_"+detStr+":distance"
1280        return(V_getRealValueFromHDF5(fname,path))
1281End
1282
1283// only defined for the "B" detector, and only to satisfy NXsas
1284Function V_getDet_equatorial_angle(fname,detStr)
1285        String fname,detStr
1286
1287        if(cmpstr(detStr,"B") == 0)
1288                String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1289                return(V_getRealValueFromHDF5(fname,path))
1290        else
1291                return(0)
1292        endif
1293End
1294
1295Function/S V_getDetEventFileName(fname,detStr)
1296        String fname,detStr
1297
1298        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1299        Variable num=60
1300        return(V_getStringFromHDF5(fname,path,num))
1301End
1302
1303Function V_getDet_IntegratedCount(fname,detStr)
1304        String fname,detStr
1305
1306        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1307        return(V_getRealValueFromHDF5(fname,path))
1308End
1309
1310Function V_getDet_LateralOffset(fname,detStr)
1311        String fname,detStr
1312
1313        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1314        return(V_getRealValueFromHDF5(fname,path))
1315End
1316
1317Function V_getDet_VerticalOffset(fname,detStr)
1318        String fname,detStr
1319
1320        String path = "entry:instrument:detector_"+detStr+":vertical_offset"
1321        return(V_getRealValueFromHDF5(fname,path))
1322End
1323
1324
1325// only defined for the "B" detector, and only to satisfy NXsas
1326Function V_getDet_polar_angle(fname,detStr)
1327        String fname,detStr
1328
1329        if(cmpstr(detStr,"B") == 0)
1330                String path = "entry:instrument:detector_"+detStr+":polar_angle"
1331                return(V_getRealValueFromHDF5(fname,path))
1332        else
1333                return(0)
1334        endif
1335End
1336
1337// only defined for the "B" detector, and only to satisfy NXsas
1338Function V_getDet_rotational_angle(fname,detStr)
1339        String fname,detStr
1340
1341        if(cmpstr(detStr,"B") == 0)
1342                String path = "entry:instrument:detector_"+detStr+":rotational_angle"
1343                return(V_getRealValueFromHDF5(fname,path))
1344        else
1345                return(0)
1346        endif
1347End
1348
1349Function/S V_getDetSettings(fname,detStr)
1350        String fname,detStr
1351
1352        String path = "entry:instrument:detector_"+detStr+":settings"
1353        Variable num=60
1354        return(V_getStringFromHDF5(fname,path,num))
1355End
1356
1357// really has no meaning at all
1358Function V_getDet_size(fname,detStr)
1359        String fname,detStr
1360
1361        String path = "entry:instrument:detector_"+detStr+":size"
1362        return(V_getRealValueFromHDF5(fname,path))
1363End
1364
1365Function/S V_getDetType(fname,detStr)
1366        String fname,detStr
1367
1368        String path = "entry:instrument:detector_"+detStr+":type"
1369        Variable num=60
1370        return(V_getStringFromHDF5(fname,path,num))
1371End
1372
1373Function V_getDet_x_pixel_size(fname,detStr)
1374        String fname,detStr
1375
1376        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1377        return(V_getRealValueFromHDF5(fname,path))
1378End
1379
1380Function V_getDet_y_pixel_size(fname,detStr)
1381        String fname,detStr
1382
1383        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1384        return(V_getRealValueFromHDF5(fname,path))
1385End
1386
1387/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1388
1389Function V_getDet_numberOfTubes(fname,detStr)
1390        String fname,detStr
1391
1392        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1393        if(cmpstr(detStr,"B") == 0)
1394                return(0)
1395        else
1396                return(V_getRealValueFromHDF5(fname,path))
1397        endif
1398End
1399
1400// TODO -- be clear on how this is defined. Separation as defined from what point? Units?
1401Function V_getDetPanelSeparation(fname,detStr)
1402        String fname,detStr
1403
1404        String path = "entry:instrument:detector_"+detStr+":separation"
1405        if(cmpstr(detStr,"B") == 0)
1406                return(0)
1407        else
1408                return(V_getRealValueFromHDF5(fname,path))
1409        endif
1410End
1411
1412// TODO -- write this function to return a WAVE with the data
1413// either as a wave reference, or as an input parameter
1414Function/WAVE V_getDetTube_spatialCalib(fname,detStr)
1415        String fname,detStr
1416
1417        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1418        if(cmpstr(detStr,"B") == 0)
1419                return $("")    // return should be null
1420        else
1421                WAVE w = V_getRealWaveFromHDF5(fname,path)
1422                return w
1423        endif
1424End
1425
1426// TODO -- be clear on how this is defined.
1427Function V_getDet_tubeIndex(fname,detStr)
1428        String fname,detStr
1429
1430        String path = "entry:instrument:detector_"+detStr+":tube_index"
1431        if(cmpstr(detStr,"B") == 0)
1432                return(0)
1433        else
1434                return(V_getRealValueFromHDF5(fname,path))
1435        endif
1436End
1437
1438Function/S V_getDet_tubeOrientation(fname,detStr)
1439        String fname,detStr
1440
1441        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1442        Variable num=60
1443        if(cmpstr(detStr,"B") == 0)
1444                return("")
1445        else
1446                return(V_getStringFromHDF5(fname,path,num))
1447        endif
1448End
1449
1450// TODO -- be clear on how this is defined. Units?
1451Function V_getDet_tubeWidth(fname,detStr)
1452        String fname,detStr
1453
1454        String path = "entry:instrument:detector_"+detStr+":tube_width"
1455        if(cmpstr(detStr,"B") == 0)
1456                return(0)
1457        else
1458                return(V_getRealValueFromHDF5(fname,path))
1459        endif
1460End
1461
1462//////////////////////
1463
1464// INSTRUMENT/LENSES    /APERTURES
1465//  lenses (data folder)
1466
1467Function V_getLensCurvature(fname)
1468        String fname
1469
1470        String path = "entry:instrument:lenses:curvature"
1471        return(V_getRealValueFromHDF5(fname,path))
1472End
1473
1474Function/S V_getLensesFocusType(fname)
1475        String fname
1476
1477        String path = "entry:instrument:lenses:focus_type"
1478        Variable num=60
1479        return(V_getStringFromHDF5(fname,path,num))
1480End
1481
1482Function V_getLensDistance(fname)
1483        String fname
1484
1485        String path = "entry:instrument:lenses:lens_distance"
1486        return(V_getRealValueFromHDF5(fname,path))
1487End
1488
1489Function/S V_getLensGeometry(fname)
1490        String fname
1491
1492        String path = "entry:instrument:lenses:lens_geometry"
1493        Variable num=60
1494        return(V_getStringFromHDF5(fname,path,num))
1495End
1496
1497Function/S V_getLensMaterial(fname)
1498        String fname
1499
1500        String path = "entry:instrument:lenses:lens_material"
1501        Variable num=60
1502        return(V_getStringFromHDF5(fname,path,num))
1503End
1504
1505Function V_getNumber_of_Lenses(fname)
1506        String fname
1507
1508        String path = "entry:instrument:lenses:number_of_lenses"
1509        return(V_getRealValueFromHDF5(fname,path))
1510End
1511
1512Function V_getNumber_of_prisms(fname)
1513        String fname
1514
1515        String path = "entry:instrument:lenses:number_of_prisms"
1516        return(V_getRealValueFromHDF5(fname,path))
1517End
1518
1519Function V_getPrism_distance(fname)
1520        String fname
1521
1522        String path = "entry:instrument:lenses:prism_distance"
1523        return(V_getRealValueFromHDF5(fname,path))
1524End
1525
1526Function/S V_getPrismMaterial(fname)
1527        String fname
1528
1529        String path = "entry:instrument:lenses:prism_material"
1530        Variable num=60
1531        return(V_getStringFromHDF5(fname,path,num))
1532End
1533
1534// status of lens/prism = lens | prism | both | out
1535Function/S V_getLensPrismStatus(fname)
1536        String fname
1537
1538        String path = "entry:instrument:lenses:status"
1539        Variable num=60
1540        return(V_getStringFromHDF5(fname,path,num))
1541End
1542       
1543
1544///////  sample_aperture (data folder)
1545
1546Function/S V_getSampleAp_Description(fname)
1547        String fname
1548
1549        String path = "entry:instrument:sample_aperture:description"
1550        Variable num=60
1551        return(V_getStringFromHDF5(fname,path,num))
1552End
1553
1554Function V_getSampleAp_distance(fname)
1555        String fname
1556
1557        String path = "entry:instrument:sample_aperture:distance"
1558        return(V_getRealValueFromHDF5(fname,path))
1559End
1560//      shape (data folder)
1561
1562Function/S V_getSampleAp_shape(fname)
1563        String fname
1564
1565        String path = "entry:instrument:sample_aperture:shape:shape"
1566        Variable num=60
1567        return(V_getStringFromHDF5(fname,path,num))
1568End
1569
1570// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1571// and will need to return more than a single dimension
1572// TODO -- be careful of the UNITS
1573Function V_getSampleAp_size(fname,outW)
1574        String fname
1575        Wave outW
1576
1577        String path = "entry:instrument:sample_aperture:shape:size"
1578        WAVE w = V_getRealWaveFromHDF5(fname,path)
1579
1580        outW = w
1581        return(0)
1582End             
1583
1584///////  sample_aperture_2 (data folder)
1585
1586Function/S V_getSampleAp2_Description(fname)
1587        String fname
1588
1589        String path = "entry:instrument:sample_aperture_2:description"
1590        Variable num=60
1591        return(V_getStringFromHDF5(fname,path,num))
1592End
1593
1594Function V_getSampleAp2_distance(fname)
1595        String fname
1596
1597        String path = "entry:instrument:sample_aperture_2:distance"
1598        return(V_getRealValueFromHDF5(fname,path))
1599End
1600//      shape (data folder)
1601
1602Function/S V_getSampleAp2_shape(fname)
1603        String fname
1604
1605        String path = "entry:instrument:sample_aperture_2:shape:shape"
1606        Variable num=60
1607        return(V_getStringFromHDF5(fname,path,num))
1608End
1609
1610// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1611// and will need to return more than a single dimension
1612// TODO -- be careful of the UNITS
1613Function V_getSampleAp2_size(fname,outW)
1614        String fname
1615        Wave outW
1616
1617        String path = "entry:instrument:sample_aperture_2:shape:size"
1618        WAVE w = V_getRealWaveFromHDF5(fname,path)
1619
1620        outW = w
1621        return(0)
1622End             
1623               
1624//////  sample_table (data folder)
1625// location  = "CHAMBER" or HUBER
1626Function/S V_getSampleTableLocation(fname)
1627        String fname
1628
1629        String path = "entry:instrument:sample_table:location"
1630        Variable num=60
1631        return(V_getStringFromHDF5(fname,path,num))
1632End
1633
1634// TODO - verify the meaning
1635//      offset_distance (?? for center of sample table vs. sample position)
1636Function V_getSampleTableOffset(fname)
1637        String fname
1638
1639        String path = "entry:instrument:sample_table:offset_distance"
1640        return(V_getRealValueFromHDF5(fname,path))
1641End     
1642       
1643//  source (data folder)
1644//name "NCNR"
1645Function/S V_getSourceName(fname)
1646        String fname
1647
1648        String path = "entry:instrument:source:name"
1649        Variable num=60
1650        return(V_getStringFromHDF5(fname,path,num))
1651End
1652
1653//      power -- nominal only, not connected to any real number
1654Function V_getReactorPower(fname)
1655        String fname
1656
1657        String path = "entry:instrument:source:power"
1658        return(V_getRealValueFromHDF5(fname,path))
1659End     
1660
1661//probe (wave) "neutron"
1662Function/S V_getSourceProbe(fname)
1663        String fname
1664
1665        String path = "entry:instrument:source:probe"
1666        Variable num=60
1667        return(V_getStringFromHDF5(fname,path,num))
1668End
1669
1670//type (wave) "Reactor Neutron Source"
1671Function/S V_getSourceType(fname)
1672        String fname
1673
1674        String path = "entry:instrument:source:type"
1675        Variable num=60
1676        return(V_getStringFromHDF5(fname,path,num))
1677End
1678
1679       
1680///////  source_aperture (data folder)
1681
1682Function/S V_getSourceAp_Description(fname)
1683        String fname
1684
1685        String path = "entry:instrument:source_aperture:description"
1686        Variable num=60
1687        return(V_getStringFromHDF5(fname,path,num))
1688End
1689
1690Function V_getSourceAp_distance(fname)
1691        String fname
1692
1693        String path = "entry:instrument:source_aperture:distance"
1694        return(V_getRealValueFromHDF5(fname,path))
1695End
1696//      shape (data folder)
1697
1698Function/S V_getSourceAp_shape(fname)
1699        String fname
1700
1701        String path = "entry:instrument:source_aperture:shape:shape"
1702        Variable num=60
1703        return(V_getStringFromHDF5(fname,path,num))
1704End
1705
1706// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1707// and will need to return more than a single dimension
1708// TODO -- be careful of the UNITS
1709Function V_getSourceAp_size(fname,outW)
1710        String fname
1711        Wave outW
1712
1713        String path = "entry:instrument:source_aperture:shape:size"
1714        WAVE w = V_getRealWaveFromHDF5(fname,path)
1715
1716        outW = w
1717        return(0)
1718End             
1719
1720
1721
1722
1723//////// SAMPLE
1724//////// SAMPLE
1725//////// SAMPLE
1726
1727//Sample position in changer
1728// TODO -- in the NexusWriter, this ends up as a STRING -- which is wrong. it needs to be FP
1729Function V_getSamplePosition(fname)
1730        String fname
1731       
1732        String path = "entry:sample:changer_position"   
1733        return(V_getRealValueFromHDF5(fname,path))
1734end
1735
1736// sample label
1737// TODO: value of num is currently not used
1738Function/S V_getSampleDescription(fname)
1739        String fname
1740
1741        String path = "entry:sample:description"
1742        Variable num=60
1743        return(V_getStringFromHDF5(fname,path,num))
1744End
1745
1746//no meaning to this...
1747Function V_getSample_equatorial_ang(fname)
1748        String fname
1749       
1750        String path = "entry:sample:equatorial_angle"   
1751        return(V_getRealValueFromHDF5(fname,path))
1752end
1753
1754// group ID !!! very important for matching up files
1755Function V_getSample_GroupID(fname)
1756        String fname
1757       
1758        String path = "entry:sample:group_id"   
1759        return(V_getRealValueFromHDF5(fname,path))
1760end
1761
1762
1763//Sample Rotation Angle
1764Function V_getSampleRotationAngle(fname)
1765        String fname
1766       
1767        String path = "entry:sample:rotation_angle"     
1768        return(V_getRealValueFromHDF5(fname,path))
1769end
1770
1771//?? this is huber/chamber??
1772// TODO -- then where is the description of 10CB, etc...
1773Function/S V_getSampleHolderDescription(fname)
1774        String fname
1775
1776        String path = "entry:sample:sample_holder_description"
1777        Variable num=60
1778        return(V_getStringFromHDF5(fname,path,num))
1779End
1780
1781//Sample Thickness
1782// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
1783Function V_getSampleThickness(fname)
1784        String fname
1785       
1786        String path = "entry:sample:thickness" 
1787        return(V_getRealValueFromHDF5(fname,path))
1788end
1789
1790// sample transmission
1791Function V_getSampleTransmission(fname)
1792        String fname
1793       
1794        String path = "entry:sample:transmission"       
1795//      String path = "QKK0037737:data:Transmission"   
1796        return(V_getRealValueFromHDF5(fname,path))
1797end
1798
1799//transmission error (one sigma)
1800Function V_getSampleTransError(fname)
1801        String fname
1802       
1803        String path = "entry:sample:transmission_error"
1804        return(V_getRealValueFromHDF5(fname,path))
1805end
1806
1807
1808
1809
1810//// SAMPLE / DATA LOGS
1811// write this generic , call with the name of the environment log desired
1812//
1813// temperature_1
1814// temperature_2
1815// shear_field
1816// pressure
1817// magnetic_field
1818// electric_field
1819//
1820//////// (for example) electric_field (data folder)
1821
1822Function/S V_getLog_attachedTo(fname,logStr)
1823        String fname,logStr
1824
1825        String path = "entry:sample:"+logstr+":attached_to"
1826        Variable num=60
1827        return(V_getStringFromHDF5(fname,path,num))
1828End
1829
1830
1831Function/S V_getLog_measurement(fname,logStr)
1832        String fname,logStr
1833
1834        String path = "entry:sample:"+logstr+":measurement"
1835        Variable num=60
1836        return(V_getStringFromHDF5(fname,path,num))
1837End
1838
1839
1840Function/S V_getLog_Name(fname,logStr)
1841        String fname,logStr
1842
1843        String path = "entry:sample:"+logstr+":name"
1844        Variable num=60
1845        return(V_getStringFromHDF5(fname,path,num))
1846End
1847
1848
1849// TODO --
1850Function V_getLog_nomValue(fname,logStr)
1851        String fname,logStr
1852       
1853        String path = "entry:sample:"+logstr+":value"
1854        return(V_getRealValueFromHDF5(fname,path))
1855end
1856
1857////            value_log (data folder)
1858Function/S V_getLog_startTime(fname,logStr)
1859        String fname,logStr
1860
1861        String path = "entry:sample:"+logstr+":value_log:start"
1862        Variable num=60
1863        return(V_getStringFromHDF5(fname,path,num))
1864End
1865
1866// TODO --
1867Function V_getLog_avgValue(fname,logStr)
1868        String fname,logStr
1869       
1870        String path = "entry:sample:"+logstr+":value_log:average_value"
1871        return(V_getRealValueFromHDF5(fname,path))
1872end
1873
1874// TODO -- this needs to be a WAVE reference
1875// TODO -- verify that the field is really read in as "time0"
1876Function V_getLog_time(fname,logStr,outW)
1877        String fname,logStr
1878        Wave outW
1879       
1880        String path = "entry:sample:"+logstr+":value_log:time0"
1881        WAVE w = V_getRealWaveFromHDF5(fname,path)
1882
1883        outW = w
1884        return(0)
1885end
1886
1887
1888// TODO -- this needs to be a WAVE reference
1889Function V_getLog_Value(fname,logStr,outW)
1890        String fname,logStr
1891        Wave outW
1892       
1893        String path = "entry:sample:"+logstr+":value_log:value"
1894        WAVE w = V_getRealWaveFromHDF5(fname,path)
1895
1896        outW = w
1897        return(0)
1898end
1899
1900
1901
1902
1903
1904
1905
1906///////// REDUCTION
1907///////// REDUCTION
1908///////// REDUCTION
1909
1910
1911// TODO -- needs to be a WAVE
1912Function V_getAbsolute_Scaling(fname,outW)
1913        String fname
1914        Wave outW
1915       
1916        String path = "entry:reduction:absolute_scaling"       
1917        WAVE w = V_getRealWaveFromHDF5(fname,path)
1918
1919        outW = w
1920        return(0)
1921end
1922
1923// TODO -- needs to be a WAVE
1924Function V_getBoxCoordinates(fname,outW)
1925        String fname
1926        Wave outW
1927       
1928        String path = "entry:reduction:box_coordinates"
1929        WAVE w = V_getRealWaveFromHDF5(fname,path)
1930
1931        outW = w
1932        return(0)
1933end
1934
1935//box counts
1936Function V_getBoxCounts(fname)
1937        String fname
1938       
1939        String path = "entry:reduction:box_count"       
1940        return(V_getRealValueFromHDF5(fname,path))
1941end
1942
1943//box counts error
1944Function V_getBoxCountsError(fname)
1945        String fname
1946       
1947        String path = "entry:reduction:box_count_error"
1948        return(V_getRealValueFromHDF5(fname,path))
1949end
1950
1951Function/S V_getReductionComments(fname)
1952        String fname
1953
1954        String path = "entry:reduction:comments"       
1955        Variable num=60
1956        return(V_getStringFromHDF5(fname,path,num))
1957End
1958
1959
1960Function/S V_getReductionIntent(fname)
1961        String fname
1962
1963        String path = "entry:reduction:intent" 
1964        Variable num=60
1965        return(V_getStringFromHDF5(fname,path,num))
1966End
1967
1968
1969Function/S V_getLogFileName(fname)
1970        String fname
1971
1972        String path = "entry:reduction:sans_log_file_name"     
1973        Variable num=60
1974        return(V_getStringFromHDF5(fname,path,num))
1975End
1976
1977
1978Function/S V_getSensitivityFileName(fname)
1979        String fname
1980
1981        String path = "entry:reduction:sensitivity_file_name"   
1982        Variable num=60
1983        return(V_getStringFromHDF5(fname,path,num))
1984End
1985
1986Function/S V_getTransmissionFileName(fname)
1987        String fname
1988
1989        String path = "entry:reduction:transmission_file_name" 
1990        Variable num=60
1991        return(V_getStringFromHDF5(fname,path,num))
1992End
1993
1994Function/S V_getEmptyBeamFileName(fname)
1995        String fname
1996
1997        String path = "entry:reduction:empty_beam_file_name"   
1998        Variable num=60
1999        return(V_getStringFromHDF5(fname,path,num))
2000End
2001
2002
2003//whole detector trasmission
2004Function V_getSampleTransWholeDetector(fname)
2005        String fname
2006       
2007        String path = "entry:reduction:whole_trans"     
2008        return(V_getRealValueFromHDF5(fname,path))
2009end
2010
2011//whole detector trasmission error
2012Function V_getSampleTransWholeDetErr(fname)
2013        String fname
2014       
2015        String path = "entry:reduction:whole_trans_error"       
2016        return(V_getRealValueFromHDF5(fname,path))
2017end
2018
2019                       
2020/////                   pol_sans (data folder)
2021
2022Function/S V_getPolSANS_cellName(fname)
2023        String fname
2024
2025        String path = "entry:reduction:pol_sans:cell_name"     
2026        Variable num=60
2027        return(V_getStringFromHDF5(fname,path,num))
2028End
2029
2030
2031// TODO -- needs to be a WAVE
2032Function V_getPolSANS_cellParams(fname,outW)
2033        String fname
2034        Wave outW
2035       
2036        String path = "entry:reduction:pol_sans:cell_parameters"       
2037        WAVE w = V_getRealWaveFromHDF5(fname,path)
2038
2039        outW = w
2040        return(0)
2041end
2042
2043Function/S V_getPolSANS_PolSANSPurpose(fname)
2044        String fname
2045
2046        String path = "entry:reduction:pol_sans:pol_sans_purpose"       
2047        Variable num=60
2048        return(V_getStringFromHDF5(fname,path,num))
2049End
2050
2051                               
2052//////// TOP LEVEL DATA REPRESENTATION
2053//
2054// note that here the data is (supposed to be) a link, not the actual data
2055// Igor HDf implementation cannot follow links properly, as far as I know.
2056// so ignore them here, and focus on the image that may be possible to read
2057//
2058
2059//              data_B (data folder)
2060//                      data (wave) 1           //ignore this, it's a link
2061//                      variables (wave) 320
2062//                      thumbnail (data folder)
2063
2064//data (wave) "binary"
2065// TODO -- this will need to be completely replaced with a function that can
2066// read the binary image data. should be possible, but I don't know the details on either end...
2067Function/S V_getDataImage(fname,detStr)
2068        String fname,detStr
2069
2070        String path = "entry:data_"+detStr+":thumbnail:data"   
2071        Variable num=60
2072        return(V_getStringFromHDF5(fname,path,num))
2073End
2074
2075Function/S V_getDataImageDescription(fname,detStr)
2076        String fname,detStr
2077
2078        String path = "entry:data_"+detStr+":thumbnail:description"     
2079        Variable num=60
2080        return(V_getStringFromHDF5(fname,path,num))
2081End
2082                                                               
2083Function/S V_getDataImageType(fname,detStr)
2084        String fname,detStr
2085
2086        String path = "entry:data_"+detStr+":thumbnail:type"   
2087        Variable num=60
2088        return(V_getStringFromHDF5(fname,path,num))
2089End
2090
2091
2092
2093
2094
2095
2096
Note: See TracBrowser for help on using the repository browser.