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

Last change on this file since 1219 was 1219, checked in by srkline, 3 years ago

Corrections to the NGB30mSANS attenuator tables (for 3A data only).

Corrections to the sample aperture units on VSANS (change in NICE on 5/22/19).

Additions for the super white beam mode on VSANS - still in progress.

File size: 66.7 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
24
25Function proto_V_get_FP2(str,str2)
26        String str,str2
27        return(0)
28end
29
30Function/S proto_V_get_STR(str)
31        String str
32        return("")
33end
34
35Proc Dump_V_getFP(fname)
36        String fname
37       
38        Test_V_get_FP("V_get*",fname)
39end
40
41Function Test_V_get_FP(str,fname)
42        String str,fname
43       
44        Variable ii,num
45        String list,item
46       
47       
48        list=FunctionList(str,";","NPARAMS:1,VALTYPE:1") //,VALTYPE:1 gives real return values, not strings
49//      Print list
50        num = ItemsInlist(list)
51       
52       
53        for(ii=0;ii<num;ii+=1)
54                item = StringFromList(ii, list , ";")
55                FUNCREF proto_V_get_FP f = $item
56                Print item ," = ", f(fname)
57        endfor
58       
59        return(0)
60end
61
62Proc Dump_V_getFP_Det(fname,detStr)
63        String fname,detStr="FL"
64       
65        Test_V_get_FP2("V_get*",fname,detStr)
66end
67
68Function Test_V_get_FP2(str,fname,detStr)
69        String str,fname,detStr
70       
71        Variable ii,num
72        String list,item
73       
74       
75        list=FunctionList(str,";","NPARAMS:2,VALTYPE:1") //,VALTYPE:1 gives real return values, not strings
76//      Print list
77        num = ItemsInlist(list)
78       
79       
80        for(ii=0;ii<num;ii+=1)
81                item = StringFromList(ii, list , ";")
82                FUNCREF proto_V_get_FP2 f = $item
83                Print item ," = ", f(fname,detStr)
84        endfor
85       
86        return(0)
87end
88
89
90Proc Dump_V_getSTR(fname)
91        String fname
92       
93        Test_V_get_STR("V_get*",fname)
94end
95
96Function Test_V_get_STR(str,fname)
97        String str,fname
98       
99        Variable ii,num
100        String list,item,strToEx
101       
102       
103        list=FunctionList(str,";","NPARAMS:1,VALTYPE:4")
104//      Print list
105        num = ItemsInlist(list)
106       
107       
108        for(ii=0;ii<num;ii+=1)
109                item = StringFromList(ii, list , ";")
110        //      FUNCREF proto_V_get_STR f = $item
111                printf "%s = ",item
112                sprintf strToEx,"Print %s(\"%s\")",item,fname
113                Execute strToEx
114//              print strToEx
115//              Print item ," = ", f(fname)
116        endfor
117       
118        return(0)
119end
120
121Proc Dump_V_getSTR_Det(fname,detStr)
122        String fname,detStr="FL"
123       
124        Test_V_get_STR2("V_get*",fname,detStr)
125end
126
127Function Test_V_get_STR2(str,fname,detStr)
128        String str,fname,detStr
129       
130        Variable ii,num
131        String list,item,strToEx
132       
133       
134        list=FunctionList(str,";","NPARAMS:2,VALTYPE:4")
135//      Print list
136        num = ItemsInlist(list)
137       
138       
139        for(ii=0;ii<num;ii+=1)
140                item = StringFromList(ii, list , ";")
141        //      FUNCREF proto_V_get_STR f = $item
142                printf "%s = ",item
143                sprintf strToEx,"Print %s(\"%s\",\"%s\")",item,fname,detStr
144                Execute strToEx
145//              print strToEx
146//              Print item ," = ", f(fname)
147        endfor
148       
149        return(0)
150end
151///////////////////////////////////////
152
153
154//////////////////////////////////////////////
155
156
157///////////////////////
158//
159// *These are the specific bits of information to retrieve (or write) to the data file
160// *These functions use the path to the file as input, and each has the specific
161//   path to the variable srting, or wave hard-coded into the access function
162// *They call the generic worker functions to get the values, either from the local copy if present,
163//   or the full file is loaded.
164//
165// *Since the path is the important bit, these are written as get/write pairs to make it easier to
166//   keep up with any changes in path
167//
168//
169// TODO -- verify the paths, and add more as needed
170// TODO -- for all of the String functions -- "num" does nothing right now -
171//         -- if it ever does, or needs to, a lot of locations will need to be corrected
172//
173
174
175//////// TOP LEVEL
176//////// TOP LEVEL
177//////// TOP LEVEL
178
179//// nexus version used for definitions
180//Function/S V_getNeXus_version(fname)
181//      String fname
182//     
183//      String path = "entry:NeXus_version"     
184//      Variable num=60
185//      return(V_getStringFromHDF5(fname,path,num))
186//End
187
188// TODO -- not mine, added somewhere by Nexus writer?
189// data collection time (! this is the true counting time??)
190Function V_getCollectionTime(fname)
191        String fname
192       
193        String path = "entry:collection_time"   
194        return(V_getRealValueFromHDF5(fname,path))
195End
196
197// data directory where data files are stored (for user access, not archive)
198Function/S V_getData_directory(fname)
199        String fname
200       
201        String path = "entry:data_directory"   
202        Variable num=60
203        return(V_getStringFromHDF5(fname,path,num))
204End
205
206// Base class of Nexus definition (=NXsas)
207Function/S V_getNexusDefinition(fname)
208        String fname
209       
210        String path = "entry:definition"       
211        Variable num=60
212        return(V_getStringFromHDF5(fname,path,num))
213End
214
215// TODO -- not mine, added somewhere by Nexus writer?
216// data collection duration (may include pauses, other "dead" time)
217Function V_getDataDuration(fname)
218        String fname
219       
220        String path = "entry:duration" 
221        return(V_getRealValueFromHDF5(fname,path))
222End
223
224// TODO -- not mine, added somewhere by Nexus writer?
225// data collection end time
226Function/S V_getDataEndTime(fname)
227        String fname
228       
229        String path = "entry:end_time" 
230        Variable num=60
231        return(V_getStringFromHDF5(fname,path,num))
232End
233
234// experiment description
235Function/S V_getExperiment_description(fname)
236        String fname
237       
238        String path = "entry:experiment_description"   
239        Variable num=60
240        return(V_getStringFromHDF5(fname,path,num))
241End
242
243// experiment identifier? used only by NICE?
244Function/S V_getExperiment_identifier(fname)
245        String fname
246       
247        String path = "entry:experiment_identifier"     
248        Variable num=60
249        return(V_getStringFromHDF5(fname,path,num))
250End
251
252// name of facility = NCNR
253Function/S V_getFacility(fname)
254        String fname
255       
256        String path = "entry:facility" 
257        Variable num=60
258        return(V_getStringFromHDF5(fname,path,num))
259End
260
261// **cut in JUNE 2017
262////  x- should be the file name as saved on disk, currently it's not
263//Function/S V_getFile_name(fname)
264//      String fname
265//     
266//      String path = "entry:file_name"
267//      Variable num=60
268//      return(V_getStringFromHDF5(fname,path,num))
269//End
270
271// **cut in JUNE 2017           
272////
273//Function/S V_getHDF_version(fname)
274//      String fname
275//     
276//      String path = "entry:hdf_version"       
277//      Variable num=60
278//      return(V_getStringFromHDF5(fname,path,num))
279//End
280
281// TODO -- not mine, added somewhere by Nexus writer?
282Function/S V_getProgram_name(fname)
283        String fname
284       
285        String path = "entry:program_name"     
286        Variable num=60
287        return(V_getStringFromHDF5(fname,path,num))
288End
289
290// TODO -- not mine, added somewhere by Nexus writer?
291// data collection start time
292Function/S V_getDataStartTime(fname)
293        String fname
294       
295        String path = "entry:start_time"       
296        Variable num=60
297        return(V_getStringFromHDF5(fname,path,num))
298End
299               
300// title of experiment
301Function/S V_getTitle(fname)
302        String fname
303       
304        String path = "entry:title"     
305        Variable num=60
306        return(V_getStringFromHDF5(fname,path,num))
307end
308       
309       
310               
311////////// USER
312////////// USER
313////////// USER
314
315// list of user names
316//  x- currently not written out to data file??
317Function/S V_getUserNames(fname)
318        String fname
319       
320        String path = "entry:user:name"
321        Variable num=60
322        return(V_getStringFromHDF5(fname,path,num))
323end
324
325
326//////// CONTROL
327//////// CONTROL
328//////// CONTROL
329
330// TODO -- for the control section, document each of the fields
331
332// **cut in JUNE 2017
333//Function/S V_getCount_end(fname)
334//      String fname
335//     
336//      Variable num
337//      String path = "entry:control:count_end"
338//      return(V_getStringFromHDF5(fname,path,num))
339//end
340
341// **cut in JUNE 2017
342//
343//Function/S V_getCount_start(fname)
344//      String fname
345//     
346//      Variable num
347//      String path = "entry:control:count_start"       
348//      return(V_getStringFromHDF5(fname,path,num))
349//end
350
351
352Function V_getCount_time(fname)
353        String fname
354       
355        String path = "entry:control:count_time"       
356        return(V_getRealValueFromHDF5(fname,path))
357end
358
359
360Function V_getCount_time_preset(fname)
361        String fname
362       
363        String path = "entry:control:count_time_preset"
364        return(V_getRealValueFromHDF5(fname,path))
365end
366
367
368Function V_getDetector_counts(fname)
369        String fname
370       
371        String path = "entry:control:detector_counts"   
372        return(V_getRealValueFromHDF5(fname,path))
373end
374
375
376Function V_getDetector_preset(fname)
377        String fname
378       
379        String path = "entry:control:detector_preset"   
380        return(V_getRealValueFromHDF5(fname,path))
381end
382
383// **cut in JUNE 2017
384//
385//Function V_getIntegral(fname)
386//      String fname
387//     
388//      String path = "entry:control:integral" 
389//      return(V_getRealValueFromHDF5(fname,path))
390//end
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
403// TODO - verify that this is the correct monitor
404Function V_getControlMonitorCount(fname)
405        String fname
406       
407        String path = "entry:control:monitor_counts"   
408        return(V_getRealValueFromHDF5(fname,path))
409end
410
411Function V_getControlMonitor_preset(fname)
412        String fname
413       
414        String path = "entry:control:monitor_preset"   
415        return(V_getRealValueFromHDF5(fname,path))
416end
417
418// **cut in JUNE 2017
419//  - what are the enumerated types for this?
420//Function/S V_getPreset(fname)
421//      String fname
422//     
423//      Variable num
424//      String path = "entry:control:preset"   
425//      return(V_getStringFromHDF5(fname,path,num))
426//end
427
428
429
430
431
432//////// INSTRUMENT
433//////// INSTRUMENT
434//////// INSTRUMENT
435
436// x- this does not appear to be written out
437Function/S V_getLocalContact(fname)
438        String fname
439
440        String path = "entry:instrument:local_contact"
441        Variable num=60
442        return(V_getStringFromHDF5(fname,path,num))
443End
444
445Function/S V_getInstrumentName(fname)
446        String fname
447
448        String path = "entry:instrument:name"
449        Variable num=60
450        return(V_getStringFromHDF5(fname,path,num))
451End
452
453Function/S V_getInstrumentType(fname)
454        String fname
455
456        String path = "entry:instrument:type"
457        Variable num=60
458        return(V_getStringFromHDF5(fname,path,num))
459End
460
461////// INSTRUMENT/ATTENUATOR
462// TODO - be sure of the definition of these terms
463//
464
465// transmission value for the attenuator in the beam
466// use this, but if something wrong, the tables are present
467// (and something is wrong -- NICE always writes out "1" for the atten factor (and error)
468//-- so I am forced to use the tables every time
469//
470Function V_getAttenuator_transmission(fname)
471        String fname
472       
473        Print "Atten read - diverted to calculation"
474        return(V_CalculateAttenuationFactor(fname))
475       
476//      String path = "entry:instrument:attenuator:attenuator_transmission"     
477//      return(V_getRealValueFromHDF5(fname,path))
478
479end
480
481// transmission value (error) for the attenuator in the beam
482// use this, but if something wrong, the tables are present
483Function V_getAttenuator_trans_err(fname)
484        String fname
485       
486        Print "Atten_err read - diverted to calculation"
487        return(V_CalculateAttenuationError(fname))
488       
489//      String path = "entry:instrument:attenuator:attenuator_transmission_error"       
490//      return(V_getRealValueFromHDF5(fname,path))
491       
492end
493
494// desired thickness
495Function V_getAtten_desired_thickness(fname)
496        String fname
497       
498        String path = "entry:instrument:attenuator:desired_thickness"   
499        return(V_getRealValueFromHDF5(fname,path))
500end
501
502
503// distance from the attenuator to the sample (units??)
504Function V_getAttenDistance(fname)
505        String fname
506       
507        String path = "entry:instrument:attenuator:distance"   
508        return(V_getRealValueFromHDF5(fname,path))
509end
510
511
512
513// table of the attenuation factor error
514Function/WAVE V_getAttenIndex_error_table(fname)
515        String fname
516       
517        String path = "entry:instrument:attenuator:index_error_table"
518        WAVE w = V_getRealWaveFromHDF5(fname,path)
519       
520        return w
521end
522
523// table of the attenuation factor
524Function/WAVE V_getAttenIndex_table(fname)
525        String fname
526       
527        String path = "entry:instrument:attenuator:index_table"
528        WAVE w = V_getRealWaveFromHDF5(fname,path)
529
530        return w
531end
532
533//
534//// status "in or out"
535//Function/S V_getAttenStatus(fname)
536//      String fname
537//
538//      String path = "entry:instrument:attenuator:status"
539//      Variable num=60
540//      return(V_getStringFromHDF5(fname,path,num))
541//End
542
543//// this is the "number" of attenuators dropped in the beam - and should be
544// what I can use to lookup the actual attenuator transmission
545Function V_getAtten_number(fname)
546        String fname
547       
548        String path = "entry:instrument:attenuator:num_atten_dropped"   
549        return(V_getRealValueFromHDF5(fname,path))
550end
551
552// thickness of the attenuator (PMMA) - units??
553Function V_getAttenThickness(fname)
554        String fname
555       
556        String path = "entry:instrument:attenuator:thickness"   
557        return(V_getRealValueFromHDF5(fname,path))
558end
559
560
561// type of material for the atteunator
562Function/S V_getAttenType(fname)
563        String fname
564
565        String path = "entry:instrument:attenuator:type"
566        Variable num=60
567        return(V_getStringFromHDF5(fname,path,num))
568End
569
570
571////// INSTRUMENT/BEAM
572// instrument/beam/analyzer (data folder)
573// this is the He3 analyzer, after the sample (but first alphabetically)
574// TODO -- document what all of the fields represent, and what are the most important to "key" on to read
575//
576Function V_getAnalyzer_depth(fname)
577        String fname
578       
579        String path = "entry:instrument:beam:analyzer:depth"   
580        return(V_getRealValueFromHDF5(fname,path))
581end
582
583Function/S V_getAnalyzer_direction(fname)
584        String fname
585
586        String path = "entry:instrument:beam:analyzer:direction"
587        Variable num=60
588        return(V_getStringFromHDF5(fname,path,num))
589End
590
591Function V_getAnalyzer_height(fname)
592        String fname
593       
594        String path = "entry:instrument:beam:analyzer:height"   
595        return(V_getRealValueFromHDF5(fname,path))
596end
597
598// ?? TODO is this equivalent to "status" -- ?? 0|1
599Function V_getAnalyzer_inBeam(fname)
600        String fname
601       
602        String path = "entry:instrument:beam:analyzer:inBeam"   
603        return(V_getRealValueFromHDF5(fname,path))
604end
605
606Function V_getAnalyzer_innerDiameter(fname)
607        String fname
608       
609        String path = "entry:instrument:beam:analyzer:innerDiameter"   
610        return(V_getRealValueFromHDF5(fname,path))
611end
612
613// one of the most important
614Function/S V_getAnalyzer_name(fname)
615        String fname
616
617        String path = "entry:instrument:beam:analyzer:name"
618        Variable num=60
619        return(V_getStringFromHDF5(fname,path,num))
620End
621
622Function V_getAnalyzer_opacityAt1Ang(fname)
623        String fname
624       
625        String path = "entry:instrument:beam:analyzer:opacityAt1Ang"   
626        return(V_getRealValueFromHDF5(fname,path))
627end
628
629Function V_getAnalyzer_opacityAt1Ang_err(fname)
630        String fname
631       
632        String path = "entry:instrument:beam:analyzer:opacityAt1AngStd"
633        return(V_getRealValueFromHDF5(fname,path))
634end
635
636Function V_getAnalyzer_outerDiameter(fname)
637        String fname
638       
639        String path = "entry:instrument:beam:analyzer:outerDiameter"   
640        return(V_getRealValueFromHDF5(fname,path))
641end
642
643Function/S V_getAnalyzer_shape(fname)
644        String fname
645
646        String path = "entry:instrument:beam:analyzer:shape"
647        Variable num=60
648        return(V_getStringFromHDF5(fname,path,num))
649End
650
651Function V_getAnalyzer_tE(fname)
652        String fname
653       
654        String path = "entry:instrument:beam:analyzer:tE"       
655        return(V_getRealValueFromHDF5(fname,path))
656end
657
658Function V_getAnalyzer_tE_err(fname)
659        String fname
660       
661        String path = "entry:instrument:beam:analyzer:tEStd"   
662        return(V_getRealValueFromHDF5(fname,path))
663end
664
665Function/S V_getAnalyzer_type(fname)
666        String fname
667
668        String path = "entry:instrument:beam:analyzer:type"
669        Variable num=60
670        return(V_getStringFromHDF5(fname,path,num))
671End
672
673
674Function V_getAnalyzer_width(fname)
675        String fname
676       
677        String path = "entry:instrument:beam:analyzer:width"   
678        return(V_getRealValueFromHDF5(fname,path))
679end
680
681
682// instrument/beam/chopper (data folder)
683Function V_getChopperAngular_opening(fname)
684        String fname
685       
686        String path = "entry:instrument:beam:chopper:angular_opening"   
687        return(V_getRealValueFromHDF5(fname,path))
688end
689
690Function V_getChopDistance_from_sample(fname)
691        String fname
692       
693        String path = "entry:instrument:beam:chopper:distance_from_sample"     
694        return(V_getRealValueFromHDF5(fname,path))
695end
696
697Function V_getChopDistance_from_source(fname)
698        String fname
699       
700        String path = "entry:instrument:beam:chopper:distance_from_source"     
701        return(V_getRealValueFromHDF5(fname,path))
702end
703
704Function V_getChopperDuty_cycle(fname)
705        String fname
706       
707        String path = "entry:instrument:beam:chopper:duty_cycle"       
708        return(V_getRealValueFromHDF5(fname,path))
709end
710
711Function V_getChopperRotation_speed(fname)
712        String fname
713       
714        String path = "entry:instrument:beam:chopper:rotation_speed"   
715        return(V_getRealValueFromHDF5(fname,path))
716end
717
718Function V_getChopperSlits(fname)
719        String fname
720       
721        String path = "entry:instrument:beam:chopper:slits"     
722        return(V_getRealValueFromHDF5(fname,path))
723end
724
725Function/S V_getChopperStatus(fname)
726        String fname
727
728        String path = "entry:instrument:beam:chopper:status"
729        Variable num=60
730        return(V_getStringFromHDF5(fname,path,num))
731End
732
733Function/S V_getChopperType(fname)
734        String fname
735
736        String path = "entry:instrument:beam:chopper:type"
737        Variable num=60
738        return(V_getStringFromHDF5(fname,path,num))
739End
740
741
742// instrument/beam/flipperPolarizer (data folder)
743// this is upstream, after the supermirror but before the sample
744
745Function/S V_getflipperPolarizer_Direction(fname)
746        String fname
747
748        String path = "entry:instrument:beam:flipperPolarizer:direction"
749        Variable num=60
750        return(V_getStringFromHDF5(fname,path,num))
751End
752
753Function V_getflipperPolarizer_inBeam(fname)
754        String fname
755       
756        String path = "entry:instrument:beam:flipperPolarizer:inBeam"   
757        return(V_getRealValueFromHDF5(fname,path))
758end
759
760Function/S V_getflipperPolarizer_Type(fname)
761        String fname
762
763        String path = "entry:instrument:beam:flipperPolarizer:type"
764        Variable num=60
765        return(V_getStringFromHDF5(fname,path,num))
766End
767
768
769
770//Function V_getFlipperDriving_current(fname)
771//      String fname
772//     
773//      String path = "entry:instrument:beam:flipper:driving_current"   
774//      return(V_getRealValueFromHDF5(fname,path))
775//end
776//
777//Function V_getFlipperFrequency(fname)
778//      String fname
779//     
780//      String path = "entry:instrument:beam:flipper:frequency"
781//      return(V_getRealValueFromHDF5(fname,path))
782//end
783//
784//Function/S V_getFlipperstatus(fname)
785//      String fname
786//
787//      String path = "entry:instrument:beam:flipper:status"
788//      Variable num=60
789//      return(V_getStringFromHDF5(fname,path,num))
790//End
791//
792//Function V_getFlipperTransmitted_power(fname)
793//      String fname
794//     
795//      String path = "entry:instrument:beam:flipper:transmitted_power"
796//      return(V_getRealValueFromHDF5(fname,path))
797//end
798//
799//Function/S V_getFlipperWaveform(fname)
800//      String fname
801//
802//      String path = "entry:instrument:beam:flipper:waveform"
803//      Variable num=60
804//      return(V_getStringFromHDF5(fname,path,num))
805//End
806
807
808
809// instrument/beam/monochromator (data folder)
810Function/S V_getMonochromatorType(fname)
811        String fname
812
813        String path = "entry:instrument:beam:monochromator:type"
814        Variable num=60
815        return(V_getStringFromHDF5(fname,path,num))
816End
817
818Function V_getWavelength(fname)
819        String fname
820       
821        String path = "entry:instrument:beam:monochromator:wavelength" 
822        return(V_getRealValueFromHDF5(fname,path))
823end
824
825Function V_getWavelength_spread(fname)
826        String fname
827       
828        String path = "entry:instrument:beam:monochromator:wavelength_spread"   
829        return(V_getRealValueFromHDF5(fname,path))
830end
831
832// instrument/beam/monochromator/crystal (data folder)
833Function V_getCrystalDistance(fname)
834        String fname
835       
836        String path = "entry:instrument:beam:monochromator:crystal:distance"   
837        return(V_getRealValueFromHDF5(fname,path))
838end
839
840Function V_getCrystalEnergy(fname)
841        String fname
842       
843        String path = "entry:instrument:beam:monochromator:crystal:energy"     
844        return(V_getRealValueFromHDF5(fname,path))
845end
846
847Function V_getCrystalHorizontal_aperture(fname)
848        String fname
849       
850        String path = "entry:instrument:beam:monochromator:crystal:horizontal_aperture"
851        return(V_getRealValueFromHDF5(fname,path))
852end
853
854Function V_getCrystalHoriz_curvature(fname)
855        String fname
856       
857        String path = "entry:instrument:beam:monochromator:crystal:horizontal_curvature"       
858        return(V_getRealValueFromHDF5(fname,path))
859end
860
861Function V_getCrystalLattice_parameter(fname)
862        String fname
863       
864        String path = "entry:instrument:beam:monochromator:crystal:lattice_parameter"   
865        return(V_getRealValueFromHDF5(fname,path))
866end
867
868Function V_getCrystalReflection(fname)
869        String fname
870       
871        String path = "entry:instrument:beam:monochromator:crystal:reflection" 
872        return(V_getRealValueFromHDF5(fname,path))
873end
874
875Function V_getCrystalRotation(fname)
876        String fname
877       
878        String path = "entry:instrument:beam:monochromator:crystal:rotation"   
879        return(V_getRealValueFromHDF5(fname,path))
880end
881
882Function/S V_getCrystalStatus(fname)
883        String fname
884
885        String path = "entry:instrument:beam:monochromator:crystal:status"
886        Variable num=60
887        return(V_getStringFromHDF5(fname,path,num))
888End
889
890Function V_getCrystalVertical_aperture(fname)
891        String fname
892       
893        String path = "entry:instrument:beam:monochromator:crystal:vertical_aperture"   
894        return(V_getRealValueFromHDF5(fname,path))
895end
896
897Function V_getCrystalVertical_curvature(fname)
898        String fname
899       
900        String path = "entry:instrument:beam:monochromator:crystal:vertical_curvature" 
901        return(V_getRealValueFromHDF5(fname,path))
902end
903
904Function V_getCrystalWavelength(fname)
905        String fname
906       
907        String path = "entry:instrument:beam:monochromator:crystal:wavelength" 
908        return(V_getRealValueFromHDF5(fname,path))
909end
910
911Function V_getCrystalWavelength_spread(fname)
912        String fname
913       
914        String path = "entry:instrument:beam:monochromator:crystal:wavelength_spread"   
915        return(V_getRealValueFromHDF5(fname,path))
916end
917
918Function V_getCrystalWavevector(fname)
919        String fname
920       
921        String path = "entry:instrument:beam:monochromator:crystal:wavevector" 
922        return(V_getRealValueFromHDF5(fname,path))
923end
924
925// instrument/beam/monochromator/velocity_selector (data folder)
926Function V_getVSDistance(fname)
927        String fname
928       
929        String path = "entry:instrument:beam:monochromator:velocity_selector:distance" 
930        return(V_getRealValueFromHDF5(fname,path))
931end
932
933Function V_getVSRotation_speed(fname)
934        String fname
935       
936        String path = "entry:instrument:beam:monochromator:velocity_selector:rotation_speed"   
937        return(V_getRealValueFromHDF5(fname,path))
938end
939
940Function/S V_getVelSelStatus(fname)
941        String fname
942
943        String path = "entry:instrument:beam:monochromator:velocity_selector:status"
944        Variable num=60
945        return(V_getStringFromHDF5(fname,path,num))
946End
947
948Function/WAVE V_getVSTable_parameters(fname)
949        String fname
950       
951        String path = "entry:instrument:beam:monochromator:velocity_selector:table_parameters" 
952        WAVE w = V_getRealWaveFromHDF5(fname,path)
953
954        return w
955end
956
957//// DONE - this does not exist for VSANS - per JGB 4/2016
958//Function V_getVS_tilt(fname)
959//      String fname
960//     
961//      String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt"   
962//      return(V_getRealValueFromHDF5(fname,path))
963//end
964
965Function V_getVSWavelength(fname)
966        String fname
967       
968        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength"       
969        return(V_getRealValueFromHDF5(fname,path))
970end
971
972Function V_getVSWavelength_spread(fname)
973        String fname
974       
975        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength_spread"
976        return(V_getRealValueFromHDF5(fname,path))
977end
978
979// instrument/beam/monochromator/white_beam (data folder)
980Function/S V_getWhiteBeamStatus(fname)
981        String fname
982
983        String path = "entry:instrument:beam:monochromator:white_beam:status"
984        Variable num=60
985        return(V_getStringFromHDF5(fname,path,num))
986End
987
988Function V_getWhiteBeamWavelength(fname)
989        String fname
990       
991        String path = "entry:instrument:beam:monochromator:white_beam:wavelength"       
992        return(V_getRealValueFromHDF5(fname,path))
993end
994
995Function V_getWhiteBeamWavelength_spread(fname)
996        String fname
997       
998        String path = "entry:instrument:beam:monochromator:white_beam:wavelength_spread"       
999        return(V_getRealValueFromHDF5(fname,path))
1000end
1001
1002// instrument/beam/superMirror (data folder)
1003// This is the upstream polarizer. There are no other choices for polarizer on VSANS
1004Function/S V_getPolarizerComposition(fname)
1005        String fname
1006
1007        String path = "entry:instrument:beam:superMirror:composition"
1008        Variable num=60
1009        return(V_getStringFromHDF5(fname,path,num))
1010End
1011
1012Function V_getPolarizerEfficiency(fname)
1013        String fname
1014       
1015        String path = "entry:instrument:beam:superMirror:efficiency"   
1016        return(V_getRealValueFromHDF5(fname,path))
1017end
1018
1019Function/S V_getPolarizerState(fname)
1020        String fname
1021
1022        String path = "entry:instrument:beam:superMirror:state"
1023        Variable num=60
1024        return(V_getStringFromHDF5(fname,path,num))
1025End
1026
1027//Function/S V_getPolarizerType(fname)
1028//      String fname
1029//
1030//      String path = "entry:instrument:beam:polarizer:type"
1031//      Variable num=60
1032//      return(V_getStringFromHDF5(fname,path,num))
1033//End
1034
1035//// instrument/beam/polarizer_analyzer (data folder)
1036//Function V_getPolAnaCell_index(fname)
1037//      String fname
1038//
1039//      String path = "entry:instrument:beam:polarizer_analyzer:cell_index"
1040//      return(V_getRealValueFromHDF5(fname,path))
1041//End
1042//
1043//Function/S V_getPolAnaCell_name(fname)
1044//      String fname
1045//
1046//      String path = "entry:instrument:beam:polarizer_analyzer:cell_name"
1047//      Variable num=60
1048//      return(V_getStringFromHDF5(fname,path,num))
1049//End
1050//
1051//Function/WAVE V_getPolAnaCell_parameters(fname)
1052//      String fname
1053//
1054//      String path = "entry:instrument:beam:polarizer_analyzer:cell_parameters"
1055//      WAVE w = V_getRealWaveFromHDF5(fname,path)
1056//
1057//      return w
1058//End
1059//
1060//Function V_getPolAnaGuideFieldCur_1(fname)
1061//      String fname
1062//
1063//      String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_1"
1064//      return(V_getRealValueFromHDF5(fname,path))
1065//End
1066//
1067//Function V_getPolAnaGuideFieldCur_2(fname)
1068//      String fname
1069//
1070//      String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_2"
1071//      return(V_getRealValueFromHDF5(fname,path))
1072//End
1073//
1074//Function V_getPolAnaSolenoid_current(fname)
1075//      String fname
1076//
1077//      String path = "entry:instrument:beam:polarizer_analyzer:solenoid_current"
1078//      return(V_getRealValueFromHDF5(fname,path))
1079//End
1080//
1081//Function/S V_getPolAnaStatus(fname)
1082//      String fname
1083//
1084//      String path = "entry:instrument:beam:polarizer_analyzer:status"
1085//      Variable num=60
1086//      return(V_getStringFromHDF5(fname,path,num))
1087//End
1088
1089                                       
1090/////// INSTRUMENT/BEAM MONITORS
1091
1092//beam_monitor_low (data folder)
1093Function V_getBeamMonLowData(fname)
1094        String fname
1095
1096        String path = "entry:instrument:beam_monitor_low:data"
1097        return(V_getRealValueFromHDF5(fname,path))
1098End
1099
1100Function V_getBeamMonLowDistance(fname)
1101        String fname
1102
1103        String path = "entry:instrument:beam_monitor_low:distance"
1104        return(V_getRealValueFromHDF5(fname,path))
1105End
1106
1107Function V_getBeamMonLowEfficiency(fname)
1108        String fname
1109
1110        String path = "entry:instrument:beam_monitor_low:efficiency"
1111        return(V_getRealValueFromHDF5(fname,path))
1112End
1113
1114Function V_getBeamMonLowSaved_count(fname)
1115        String fname
1116
1117        String path = "entry:instrument:beam_monitor_low:saved_count"
1118        return(V_getRealValueFromHDF5(fname,path))
1119End
1120
1121Function/S V_getBeamMonLowType(fname)
1122        String fname
1123
1124        String path = "entry:instrument:beam_monitor_low:type"
1125        Variable num=60
1126        return(V_getStringFromHDF5(fname,path,num))
1127End
1128
1129//beam_monitor_norm (data folder)
1130Function V_getBeamMonNormData(fname)
1131        String fname
1132
1133        String path = "entry:instrument:beam_monitor_norm:data"
1134        return(V_getRealValueFromHDF5(fname,path))
1135End
1136
1137Function V_getBeamMonNormDistance(fname)
1138        String fname
1139
1140        String path = "entry:instrument:beam_monitor_norm:distance"
1141        return(V_getRealValueFromHDF5(fname,path))
1142End
1143
1144Function V_getBeamMonNormEfficiency(fname)
1145        String fname
1146
1147        String path = "entry:instrument:beam_monitor_norm:efficiency"
1148        return(V_getRealValueFromHDF5(fname,path))
1149End
1150
1151Function V_getBeamMonNormSaved_count(fname)
1152        String fname
1153
1154        String path = "entry:instrument:beam_monitor_norm:saved_count"
1155        return(V_getRealValueFromHDF5(fname,path))
1156End
1157
1158Function/S V_getBeamMonNormType(fname)
1159        String fname
1160
1161        String path = "entry:instrument:beam_monitor_norm:type"
1162        Variable num=60
1163        return(V_getStringFromHDF5(fname,path,num))
1164End
1165
1166//beam_stop C2 (data folder)
1167Function/S V_getBeamStopC2Description(fname)
1168        String fname
1169
1170        String path = "entry:instrument:beam_stop_C2:description"
1171        Variable num=60
1172        return(V_getStringFromHDF5(fname,path,num))
1173End
1174
1175Function V_getBeamStopC2Dist_to_det(fname)
1176        String fname
1177
1178        String path = "entry:instrument:beam_stop_C2:distance_to_detector"
1179        return(V_getRealValueFromHDF5(fname,path))
1180End
1181
1182//TODO -- not sure what this really means
1183Function V_getBeamStopC2num_beamstops(fname)
1184        String fname
1185
1186        String path = "entry:instrument:beam_stop_C2:num_beamstops"
1187        return(V_getRealValueFromHDF5(fname,path))
1188End
1189
1190Function V_getBeamStopC2_x_pos(fname)
1191        String fname
1192
1193        String path = "entry:instrument:beam_stop_C2:x_pos"
1194        return(V_getRealValueFromHDF5(fname,path))
1195End
1196
1197Function V_getBeamStopC2_y_pos(fname)
1198        String fname
1199
1200        String path = "entry:instrument:beam_stop_C2:y_pos"
1201        return(V_getRealValueFromHDF5(fname,path))
1202End
1203
1204// beam stop shape parameters
1205Function V_getBeamStopC2_height(fname)
1206        String fname
1207
1208        String path = "entry:instrument:beam_stop_C2:shape:height"
1209        return(V_getRealValueFromHDF5(fname,path))
1210End
1211
1212Function/S V_getBeamStopC2_shape(fname)
1213        String fname
1214
1215        Variable num=60
1216        String path = "entry:instrument:beam_stop_C2:shape:shape"
1217        return(V_getStringFromHDF5(fname,path,num))
1218End
1219
1220// == diameter if shape = CIRCLE
1221// value is expected in [mm] diameter
1222Function V_getBeamStopC2_size(fname)
1223        String fname
1224
1225        String path = "entry:instrument:beam_stop_C2:shape:size"
1226        return(V_getRealValueFromHDF5(fname,path))
1227End
1228
1229Function V_getBeamStopC2_width(fname)
1230        String fname
1231
1232        String path = "entry:instrument:beam_stop_C2:shape:width"
1233        return(V_getRealValueFromHDF5(fname,path))
1234End
1235
1236
1237
1238//beam_stop C3 (data folder)
1239Function/S V_getBeamStopC3Description(fname)
1240        String fname
1241
1242        String path = "entry:instrument:beam_stop_C3:description"
1243        Variable num=60
1244        return(V_getStringFromHDF5(fname,path,num))
1245End
1246
1247Function V_getBeamStopC3Dist_to_det(fname)
1248        String fname
1249
1250        String path = "entry:instrument:beam_stop_C3:distance_to_detector"
1251        return(V_getRealValueFromHDF5(fname,path))
1252End
1253
1254//TODO -- not sure what this really means
1255Function V_getBeamStopC3num_beamstops(fname)
1256        String fname
1257
1258        String path = "entry:instrument:beam_stop_C3:num_beamstops"
1259        return(V_getRealValueFromHDF5(fname,path))
1260End
1261
1262Function V_getBeamStopC3_x_pos(fname)
1263        String fname
1264
1265        String path = "entry:instrument:beam_stop_C3:x_pos"
1266        return(V_getRealValueFromHDF5(fname,path))
1267End
1268
1269Function V_getBeamStopC3_y_pos(fname)
1270        String fname
1271
1272        String path = "entry:instrument:beam_stop_C3:y_pos"
1273        return(V_getRealValueFromHDF5(fname,path))
1274End
1275
1276// beam stop shape parameters
1277Function V_getBeamStopC3_height(fname)
1278        String fname
1279
1280        String path = "entry:instrument:beam_stop_C3:shape:height"
1281        return(V_getRealValueFromHDF5(fname,path))
1282End
1283
1284Function/S V_getBeamStopC3_shape(fname)
1285        String fname
1286
1287        Variable num=60
1288        String path = "entry:instrument:beam_stop_C3:shape:shape"
1289        return(V_getStringFromHDF5(fname,path,num))
1290End
1291
1292// == diameter if shape = CIRCLE
1293Function V_getBeamStopC3_size(fname)
1294        String fname
1295
1296        String path = "entry:instrument:beam_stop_C3:shape:size"
1297        return(V_getRealValueFromHDF5(fname,path))
1298End
1299
1300Function V_getBeamStopC3_width(fname)
1301        String fname
1302
1303        String path = "entry:instrument:beam_stop_C3:shape:width"
1304        return(V_getRealValueFromHDF5(fname,path))
1305End
1306
1307
1308
1309
1310//// INSTRUMENT/COLLIMATOR
1311//collimator (data folder)
1312
1313// this is now defined as text, due to selections from GUI
1314Function/S V_getNumberOfGuides(fname)
1315        String fname
1316
1317        Variable num=60
1318        String path = "entry:instrument:collimator:number_guides"
1319        return(V_getStringFromHDF5(fname,path,num))
1320End
1321
1322//                              geometry (data folder)
1323//                                      shape (data folder)
1324Function/S V_getGuideShape(fname)
1325        String fname
1326
1327        String path = "entry:instrument:collimator:geometry:shape:shape"
1328        Variable num=60
1329        return(V_getStringFromHDF5(fname,path,num))
1330End
1331
1332Function V_getGuideSize(fname)
1333        String fname
1334
1335        String path = "entry:instrument:collimator:geometry:shape:size"
1336        return(V_getRealValueFromHDF5(fname,path))
1337End
1338
1339
1340//                      converging_pinholes (data folder)
1341Function/S V_getConvPinholeStatus(fname)
1342        String fname
1343
1344        String path = "entry:instrument:converging_pinholes:status"
1345        Variable num=60
1346        return(V_getStringFromHDF5(fname,path,num))
1347End
1348
1349//                      converging_slits (not used)
1350
1351////// INSTRUMENT/DETECTORS
1352//                      detector_B (data folder)
1353//
1354// only defined for the "B" detector, and may not be necessary?
1355// DONE -- write to return an ARRAY
1356Function/WAVE V_getDet_cal_x(fname,detStr)
1357        String fname,detStr
1358
1359        if(cmpstr(detStr,"B") == 0)
1360                String path = "entry:instrument:detector_"+detStr+":cal_x"
1361                WAVE w = V_getRealWaveFromHDF5(fname,path)
1362
1363                return w
1364        else
1365                return $""
1366        endif
1367End
1368
1369// only defined for the "B" detector, and may not be necessary?
1370// TODO -- write to return an ARRAY
1371Function/WAVE V_getDet_cal_y(fname,detStr)
1372        String fname,detStr
1373
1374        if(cmpstr(detStr,"B") == 0)
1375                String path = "entry:instrument:detector_"+detStr+":cal_y"
1376                WAVE w = V_getRealWaveFromHDF5(fname,path)
1377       
1378                return w
1379        else
1380                return $""
1381        endif
1382End
1383
1384//  Pixels are not square
1385// so the FHWM will be different in each direction. May need to return
1386// "dummy" value for "B" detector if pixels there are square
1387Function V_getDet_pixel_fwhm_x(fname,detStr)
1388        String fname,detStr
1389
1390        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_x"
1391
1392        return(V_getRealValueFromHDF5(fname,path))
1393End
1394
1395// Pixels are not square
1396// so the FHWM will be different in each direction. May need to return
1397// "dummy" value for "B" detector if pixels there are square
1398Function V_getDet_pixel_fwhm_y(fname,detStr)
1399        String fname,detStr
1400
1401        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_y"
1402
1403        return(V_getRealValueFromHDF5(fname,path))
1404End
1405
1406Function V_getDet_pixel_num_x(fname,detStr)
1407        String fname,detStr
1408
1409        String path = "entry:instrument:detector_"+detStr+":pixel_num_x"
1410        return(V_getRealValueFromHDF5(fname,path))
1411End
1412
1413Function V_getDet_pixel_num_y(fname,detStr)
1414        String fname,detStr
1415
1416        String path = "entry:instrument:detector_"+detStr+":pixel_num_y"
1417        return(V_getRealValueFromHDF5(fname,path))
1418End
1419
1420//// only defined for the "B" detector, and only to satisfy NXsas
1421//Function V_getDet_azimuthalAngle(fname,detStr)
1422//      String fname,detStr
1423//
1424//      if(cmpstr(detStr,"B") == 0)
1425//              String path = "entry:instrument:detector_"+detStr+":azimuthal_angle"
1426//              return(V_getRealValueFromHDF5(fname,path))
1427//      else
1428//              return(0)
1429//      endif
1430//End
1431
1432Function V_getDet_beam_center_x(fname,detStr)
1433        String fname,detStr
1434
1435        String path = "entry:instrument:detector_"+detStr+":beam_center_x"
1436        return(V_getRealValueFromHDF5(fname,path))
1437End
1438
1439Function V_getDet_beam_center_y(fname,detStr)
1440        String fname,detStr
1441
1442        String path = "entry:instrument:detector_"+detStr+":beam_center_y"
1443        return(V_getRealValueFromHDF5(fname,path))
1444End
1445
1446
1447//TODO
1448//
1449// x and y center in mm is currently not part of the Nexus definition
1450//  does it need to be?
1451// these lookups will fail if they have not been generated locally!
1452Function V_getDet_beam_center_x_mm(fname,detStr)
1453        String fname,detStr
1454
1455        String path = "entry:instrument:detector_"+detStr+":beam_center_x_mm"
1456        return(V_getRealValueFromHDF5(fname,path))
1457End
1458
1459//TODO
1460//
1461// x and y center in mm is currently not part of the Nexus definition
1462//  does it need to be?
1463// these lookups will fail if they have not been generated locally!
1464Function V_getDet_beam_center_y_mm(fname,detStr)
1465        String fname,detStr
1466
1467        String path = "entry:instrument:detector_"+detStr+":beam_center_y_mm"
1468        return(V_getRealValueFromHDF5(fname,path))
1469End
1470
1471//TODO
1472//
1473// x and y center in pix is currently not part of the Nexus definition
1474//  does it need to be?
1475// these lookups will fail if they have not been generated locally!
1476Function V_getDet_beam_center_x_pix(fname,detStr)
1477        String fname,detStr
1478
1479        String path = "entry:instrument:detector_"+detStr+":beam_center_x_pix"
1480        return(V_getRealValueFromHDF5(fname,path))
1481End
1482
1483//TODO
1484//
1485// x and y center in pix is currently not part of the Nexus definition
1486//  does it need to be?
1487// these lookups will fail if they have not been generated locally!
1488Function V_getDet_beam_center_y_pix(fname,detStr)
1489        String fname,detStr
1490
1491        String path = "entry:instrument:detector_"+detStr+":beam_center_y_pix"
1492        return(V_getRealValueFromHDF5(fname,path))
1493End
1494
1495Function/WAVE V_getDetectorDataW(fname,detStr)
1496        String fname,detStr
1497
1498        String path = "entry:instrument:detector_"+detStr+":data"
1499        WAVE w = V_getRealWaveFromHDF5(fname,path)
1500
1501        return w
1502End
1503
1504// NOTE - this is not part of the file as written
1505// it is generated when the RAW data is loaded (when the error wave is generated)
1506Function/WAVE V_getDetectorLinearDataW(fname,detStr)
1507        String fname,detStr
1508
1509        String path = "entry:instrument:detector_"+detStr+":linear_data"
1510        WAVE w = V_getRealWaveFromHDF5(fname,path)
1511
1512        return w
1513End
1514
1515//
1516// TODO -- this does not exist in the raw data, but does in the processed data
1517// !!! how to handle this?? Binning routines need the error wave
1518//
1519Function/WAVE V_getDetectorLinearDataErrW(fname,detStr)
1520        String fname,detStr
1521
1522        String path = "entry:instrument:detector_"+detStr+":linear_data_error"
1523        WAVE w = V_getRealWaveFromHDF5(fname,path)
1524
1525        return w
1526End
1527
1528
1529//
1530// TODO -- this does not exist in the raw data, but does in the processed data
1531// !!! how to handle this?? Binning routines need the error wave
1532//
1533Function/WAVE V_getDetectorDataErrW(fname,detStr)
1534        String fname,detStr
1535
1536        String path = "entry:instrument:detector_"+detStr+":data_error"
1537        WAVE w = V_getRealWaveFromHDF5(fname,path)
1538
1539        return w
1540End
1541
1542// TODO -- write this function to return a WAVE with the data
1543// either as a wave reference, or as an input parameter
1544// ALSO -- the "B" deadtime will be a single value (probably)
1545//  but the tube banks will be 1D arrays of values, one per tube
1546Function/WAVE V_getDetector_deadtime(fname,detStr)
1547        String fname,detStr
1548
1549        String path = "entry:instrument:detector_"+detStr+":dead_time"
1550        if(cmpstr(detStr,"B") == 0)
1551                return $""
1552        else   
1553                WAVE w = V_getRealWaveFromHDF5(fname,path)
1554                return w
1555        endif
1556End
1557
1558// for "B" only
1559Function V_getDetector_deadtime_B(fname,detStr)
1560        String fname,detStr
1561
1562        String path = "entry:instrument:detector_"+detStr+":dead_time"
1563        if(cmpstr(detStr,"B") == 0)
1564                return(V_getRealValueFromHDF5(fname,path))
1565        else   
1566                return(0)
1567        endif
1568End
1569
1570// for "B" only
1571Function V_getDetector_highResGain(fname,detStr)
1572        String fname,detStr
1573
1574        String path = "entry:instrument:detector_"+detStr+":highResGain"
1575        if(cmpstr(detStr,"B") == 0)
1576                return(V_getRealValueFromHDF5(fname,path))
1577        else   
1578                return(0)
1579        endif
1580End
1581
1582Function/S V_getDetDescription(fname,detStr)
1583        String fname,detStr
1584
1585        String path = "entry:instrument:detector_"+detStr+":description"
1586        Variable num=60
1587        return(V_getStringFromHDF5(fname,path,num))
1588End
1589
1590// return value in [cm]
1591Function V_getDet_NominalDistance(fname,detStr)
1592        String fname,detStr
1593
1594        String path = "entry:instrument:detector_"+detStr+":distance"
1595        return(V_getRealValueFromHDF5(fname,path))
1596End
1597
1598//this is a DERIVED distance, since the nominal sdd is for the carriage (=LR panels)
1599// return value in [cm]
1600Function V_getDet_ActualDistance(fname,detStr)
1601        String fname,detStr
1602
1603        Variable sdd
1604        sdd = V_getDet_NominalDistance(fname,detStr)            //[cm]
1605        sdd += V_getDet_TBSetback(fname,detStr)         // written [cm], returns 0 for L/R/B panels
1606               
1607        return(sdd)
1608End
1609
1610//// only defined for the "B" detector, and only to satisfy NXsas
1611//Function V_getDet_equatorial_angle(fname,detStr)
1612//      String fname,detStr
1613//
1614//      if(cmpstr(detStr,"B") == 0)
1615//              String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1616//              return(V_getRealValueFromHDF5(fname,path))
1617//      else
1618//              return(0)
1619//      endif
1620//End
1621
1622Function/S V_getDetEventFileName(fname,detStr)
1623        String fname,detStr
1624
1625        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1626        Variable num=60
1627        return(V_getStringFromHDF5(fname,path,num))
1628End
1629
1630Function V_getDet_IntegratedCount(fname,detStr)
1631        String fname,detStr
1632
1633        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1634        return(V_getRealValueFromHDF5(fname,path))
1635End
1636
1637// only return value for B and L/R detectors. everything else returns zero
1638Function V_getDet_LateralOffset(fname,detStr)
1639        String fname,detStr
1640
1641        if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0)
1642                return(0)
1643        endif
1644        if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0)
1645                return(0)
1646        endif   
1647       
1648        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1649        return(V_getRealValueFromHDF5(fname,path))
1650End
1651
1652// only return values for T/B. everything else returns zero
1653Function V_getDet_VerticalOffset(fname,detStr)
1654        String fname,detStr
1655
1656        if(cmpstr(detStr,"B") == 0)
1657                return(0)
1658        endif
1659        if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0)
1660                return(0)
1661        endif
1662        if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0)
1663                return(0)
1664        endif   
1665       
1666        String path = "entry:instrument:detector_"+detStr+":vertical_offset"
1667        return(V_getRealValueFromHDF5(fname,path))
1668End
1669
1670// TODO -DONE be sure this is defined correctly (with correct units-- this is now 41.0 cm)
1671// -- only returns for T/B detectors
1672Function V_getDet_TBSetback(fname,detStr)
1673        String fname,detStr
1674
1675        if(cmpstr(detStr,"B") == 0)
1676                return(0)
1677        endif
1678        if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0)
1679                return(0)
1680        endif
1681        if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0)
1682                return(0)
1683        endif   
1684       
1685        String path = "entry:instrument:detector_"+detStr+":setback"
1686        return(V_getRealValueFromHDF5(fname,path))
1687       
1688       
1689End
1690
1691// gap when panels are "touching"
1692// units are mm
1693// returns gap value for RIGHT and LEFT (they are the same)
1694// returns gap value for TOP and BOTTOM (they are the same)
1695// returns 0 for BACK, (no such field for this detector)
1696//
1697Function V_getDet_panel_gap(fname,detStr)
1698        String fname,detStr
1699
1700        if(cmpstr(detStr,"B") == 0)
1701                return(0)
1702        endif
1703//      if(cmpstr(detStr,"FB") == 0 || cmpstr(detStr,"FL") == 0)
1704//              return(0)
1705//      endif
1706//      if(cmpstr(detStr,"MB") == 0 || cmpstr(detStr,"ML") == 0)
1707//              return(0)
1708//      endif   
1709       
1710        String path = "entry:instrument:detector_"+detStr+":panel_gap"
1711        return(V_getRealValueFromHDF5(fname,path))
1712       
1713       
1714End
1715
1716Function/S V_getDetSettings(fname,detStr)
1717        String fname,detStr
1718
1719        String path = "entry:instrument:detector_"+detStr+":settings"
1720        Variable num=60
1721        return(V_getStringFromHDF5(fname,path,num))
1722End
1723
1724
1725Function V_getDet_x_pixel_size(fname,detStr)
1726        String fname,detStr
1727
1728        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1729        return(V_getRealValueFromHDF5(fname,path))
1730End
1731
1732Function V_getDet_y_pixel_size(fname,detStr)
1733        String fname,detStr
1734
1735        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1736        return(V_getRealValueFromHDF5(fname,path))
1737End
1738
1739/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1740
1741Function V_getDet_numberOfTubes(fname,detStr)
1742        String fname,detStr
1743
1744        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1745        if(cmpstr(detStr,"B") == 0)
1746                return(0)
1747        else
1748                return(V_getRealValueFromHDF5(fname,path))
1749        endif
1750End
1751
1752
1753// DONE -- write this function to return a WAVE with the data
1754// either as a wave reference, or as an input parameter
1755Function/WAVE V_getDetTube_spatialCalib(fname,detStr)
1756        String fname,detStr
1757
1758        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1759        if(cmpstr(detStr,"B") == 0)
1760                return $("")    // return should be null
1761        else
1762                WAVE w = V_getRealWaveFromHDF5(fname,path)
1763                return w
1764        endif
1765End
1766
1767
1768Function/S V_getDet_tubeOrientation(fname,detStr)
1769        String fname,detStr
1770
1771        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1772        Variable num=60
1773        if(cmpstr(detStr,"B") == 0)
1774                return("")
1775        else
1776                return(V_getStringFromHDF5(fname,path,num))
1777        endif
1778End
1779
1780// TODO -- be clear on how this is defined. Units?
1781Function V_getDet_tubeWidth(fname,detStr)
1782        String fname,detStr
1783
1784        String path = "entry:instrument:detector_"+detStr+":tube_width"
1785        if(cmpstr(detStr,"B") == 0)
1786                return(0)
1787        else
1788                return(V_getRealValueFromHDF5(fname,path))
1789        endif
1790End
1791
1792//////////////////////
1793
1794// INSTRUMENT/LENSES
1795//  lenses (data folder)
1796
1797Function V_getLensCurvature(fname)
1798        String fname
1799
1800        String path = "entry:instrument:lenses:curvature"
1801        return(V_getRealValueFromHDF5(fname,path))
1802End
1803
1804Function/S V_getLensesFocusType(fname)
1805        String fname
1806
1807        String path = "entry:instrument:lenses:focus_type"
1808        Variable num=60
1809        return(V_getStringFromHDF5(fname,path,num))
1810End
1811
1812Function V_getLensDistance(fname)
1813        String fname
1814
1815        String path = "entry:instrument:lenses:lens_distance"
1816        return(V_getRealValueFromHDF5(fname,path))
1817End
1818
1819Function/S V_getLensGeometry(fname)
1820        String fname
1821
1822        String path = "entry:instrument:lenses:lens_geometry"
1823        Variable num=60
1824        return(V_getStringFromHDF5(fname,path,num))
1825End
1826
1827Function/S V_getLensMaterial(fname)
1828        String fname
1829
1830        String path = "entry:instrument:lenses:lens_material"
1831        Variable num=60
1832        return(V_getStringFromHDF5(fname,path,num))
1833End
1834
1835Function V_getNumber_of_Lenses(fname)
1836        String fname
1837
1838        String path = "entry:instrument:lenses:number_of_lenses"
1839        return(V_getRealValueFromHDF5(fname,path))
1840End
1841
1842Function V_getNumber_of_prisms(fname)
1843        String fname
1844
1845        String path = "entry:instrument:lenses:number_of_prisms"
1846        return(V_getRealValueFromHDF5(fname,path))
1847End
1848
1849Function V_getPrism_distance(fname)
1850        String fname
1851
1852        String path = "entry:instrument:lenses:prism_distance"
1853        return(V_getRealValueFromHDF5(fname,path))
1854End
1855
1856Function/S V_getPrismMaterial(fname)
1857        String fname
1858
1859        String path = "entry:instrument:lenses:prism_material"
1860        Variable num=60
1861        return(V_getStringFromHDF5(fname,path,num))
1862End
1863
1864// status of lens/prism = lens | prism | both | out
1865Function/S V_getLensPrismStatus(fname)
1866        String fname
1867
1868        String path = "entry:instrument:lenses:status"
1869        Variable num=60
1870        return(V_getStringFromHDF5(fname,path,num))
1871End
1872       
1873
1874
1875
1876///////  sample_aperture (1) (data folder)
1877// this is the INTERNAL sample aperture
1878//
1879Function/S V_getSampleAp_Description(fname)
1880        String fname
1881
1882        String path = "entry:instrument:sample_aperture:description"
1883        Variable num=60
1884        return(V_getStringFromHDF5(fname,path,num))
1885End
1886
1887Function V_getSampleAp_distance(fname)
1888        String fname
1889
1890        String path = "entry:instrument:sample_aperture:distance"
1891        return(V_getRealValueFromHDF5(fname,path))
1892End
1893
1894//      shape (data folder)
1895Function V_getSampleAp_height(fname)
1896        String fname
1897
1898        String path = "entry:instrument:sample_aperture:shape:height"
1899        return(V_getRealValueFromHDF5(fname,path))
1900End
1901
1902Function/S V_getSampleAp_shape(fname)
1903        String fname
1904
1905        String path = "entry:instrument:sample_aperture:shape:shape"
1906        Variable num=60
1907        return(V_getStringFromHDF5(fname,path,num))
1908End
1909
1910// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1911Function/S V_getSampleAp_size(fname)
1912        String fname
1913
1914        String path = "entry:instrument:sample_aperture:shape:size"
1915        Variable num=60
1916        return(V_getStringFromHDF5(fname,path,num))
1917End
1918
1919Function V_getSampleAp_width(fname)
1920        String fname
1921
1922        String path = "entry:instrument:sample_aperture:shape:width"
1923        return(V_getRealValueFromHDF5(fname,path))
1924End
1925
1926
1927
1928
1929// MAY 2019 SRK
1930//
1931// there was a change in the GUI and NICE behavior during the shutdown, before startup
1932// on 05/22/19 where the units of the sample Ap2 dimensions are changed. supposedly this
1933// will ensure consistency of all units as [cm]. From what I found in the code, all the units
1934// were already [cm], so I'm not sure what will happen.
1935//
1936// if I flag things here to switch on the date, I can force the output to always be [cm]
1937// V_Compare_ISO_Dates("2019-05-10T13:36:54.200-04:00",fileDate)
1938//
1939// here the first date is a generic date during the shutdown, but before startup.
1940// fileDate is the actual date of file collection
1941// if fileDate is more recent (and thus affected by the change), then the function
1942// will return a value == 2 (2nd date greater) and I can act on that
1943//
1944// this change only affects sampleAp2, and this value only affects the resolution calculation
1945//
1946//  V_Compare_ISO_Dates("2019-05-10T13:36:54.200-04:00",V_getDataStartTime(fname))
1947//
1948
1949
1950///////  sample_aperture_2 (data folder)
1951// sample aperture (2) is the external aperture, which may or may not be present
1952Function/S V_getSampleAp2_Description(fname)
1953        String fname
1954
1955        String path = "entry:instrument:sample_aperture_2:description"
1956        Variable num=60
1957        return(V_getStringFromHDF5(fname,path,num))
1958End
1959
1960Function V_getSampleAp2_distance(fname)
1961        String fname
1962
1963        String path = "entry:instrument:sample_aperture_2:distance"
1964        return(V_getRealValueFromHDF5(fname,path))
1965End
1966
1967//      shape (data folder)
1968// height and width are reported in [cm]
1969Function V_getSampleAp2_height(fname)
1970        String fname
1971
1972        String path = "entry:instrument:sample_aperture_2:shape:height"
1973        return(V_getRealValueFromHDF5(fname,path))
1974End
1975
1976Function/S V_getSampleAp2_shape(fname)
1977        String fname
1978
1979        String path = "entry:instrument:sample_aperture_2:shape:shape"
1980        Variable num=60
1981        return(V_getStringFromHDF5(fname,path,num))
1982End
1983
1984//
1985// this returns REAL, DIFFERENT than SampleAp1
1986// see the note above. after the hard-coded date, the values in the header
1987// are values appear to be in [mm]. before that date, the values are in [cm]
1988//
1989// This function returns a value in [cm]
1990//
1991Function V_getSampleAp2_size(fname)
1992        String fname
1993
1994        String path = "entry:instrument:sample_aperture_2:shape:size"
1995       
1996        Variable val = V_Compare_ISO_Dates("2019-05-10T13:36:54.200-04:00",V_getDataStartTime(fname))
1997       
1998        if(val == 2)            // more "current" data, mm in the header
1999                return(V_getRealValueFromHDF5(fname,path)/10)
2000        else
2001                // "older" data, cm in the header
2002                return(V_getRealValueFromHDF5(fname,path))
2003        endif
2004
2005//      return(V_getRealValueFromHDF5(fname,path))
2006
2007End
2008
2009Function V_getSampleAp2_width(fname)
2010        String fname
2011
2012        String path = "entry:instrument:sample_aperture_2:shape:width"
2013        return(V_getRealValueFromHDF5(fname,path))
2014End
2015
2016       
2017//////  sample_table (data folder)
2018// location  = "CHAMBER" or HUBER
2019Function/S V_getSampleTableLocation(fname)
2020        String fname
2021
2022        String path = "entry:instrument:sample_table:location"
2023        Variable num=60
2024        return(V_getStringFromHDF5(fname,path,num))
2025End
2026
2027// TODO - verify the meaning
2028//      offset_distance (?? for center of sample table vs. sample position)
2029Function V_getSampleTableOffset(fname)
2030        String fname
2031
2032        String path = "entry:instrument:sample_table:offset_distance"
2033        return(V_getRealValueFromHDF5(fname,path))
2034End     
2035       
2036//  source (data folder)
2037//name "NCNR"
2038Function/S V_getSourceName(fname)
2039        String fname
2040
2041        String path = "entry:instrument:source:name"
2042        Variable num=60
2043        return(V_getStringFromHDF5(fname,path,num))
2044End
2045
2046//      power -- nominal only, not connected to any real number
2047Function V_getReactorPower(fname)
2048        String fname
2049
2050        String path = "entry:instrument:source:power"
2051        return(V_getRealValueFromHDF5(fname,path))
2052End     
2053
2054//probe (wave) "neutron"
2055Function/S V_getSourceProbe(fname)
2056        String fname
2057
2058        String path = "entry:instrument:source:probe"
2059        Variable num=60
2060        return(V_getStringFromHDF5(fname,path,num))
2061End
2062
2063//type (wave) "Reactor Neutron Source"
2064Function/S V_getSourceType(fname)
2065        String fname
2066
2067        String path = "entry:instrument:source:type"
2068        Variable num=60
2069        return(V_getStringFromHDF5(fname,path,num))
2070End
2071
2072       
2073///////  source_aperture (data folder)
2074
2075Function/S V_getSourceAp_Description(fname)
2076        String fname
2077
2078        String path = "entry:instrument:source_aperture:description"
2079        Variable num=60
2080        return(V_getStringFromHDF5(fname,path,num))
2081End
2082
2083Function V_getSourceAp_distance(fname)
2084        String fname
2085
2086        String path = "entry:instrument:source_aperture:distance"
2087        return(V_getRealValueFromHDF5(fname,path))
2088End
2089
2090//      shape (data folder)
2091Function V_getSourceAp_height(fname)
2092        String fname
2093
2094        String path = "entry:instrument:source_aperture:shape:height"
2095        return(V_getRealValueFromHDF5(fname,path))
2096End
2097
2098Function/S V_getSourceAp_shape(fname)
2099        String fname
2100
2101        String path = "entry:instrument:source_aperture:shape:shape"
2102        Variable num=60
2103        return(V_getStringFromHDF5(fname,path,num))
2104End
2105
2106// this returns TEXT, due to GUI input, == to diameter if CIRCLE
2107Function/S V_getSourceAp_size(fname)
2108        String fname
2109
2110        String path = "entry:instrument:source_aperture:shape:size"
2111        Variable num=60
2112        return(V_getStringFromHDF5(fname,path,num))
2113End
2114
2115Function V_getSourceAp_width(fname)
2116        String fname
2117
2118        String path = "entry:instrument:source_aperture:shape:width"
2119        return(V_getRealValueFromHDF5(fname,path))
2120End
2121
2122
2123//////// SAMPLE
2124//////// SAMPLE
2125//////// SAMPLE
2126
2127//Sample position in changer (returned as TEXT)
2128Function/S V_getSamplePosition(fname)
2129        String fname
2130       
2131        String path = "entry:sample:changer_position"   
2132        Variable num=60
2133        return(V_getStringFromHDF5(fname,path,num))
2134end
2135
2136// sample label
2137Function/S V_getSampleDescription(fname)
2138        String fname
2139
2140        String path = "entry:sample:description"
2141        Variable num=60
2142        return(V_getStringFromHDF5(fname,path,num))
2143End
2144
2145// for a z-stage??
2146Function V_getSampleElevation(fname)
2147        String fname
2148       
2149        String path = "entry:sample:elevation" 
2150        return(V_getRealValueFromHDF5(fname,path))
2151end
2152
2153//no meaning to this...
2154Function V_getSample_equatorial_ang(fname)
2155        String fname
2156       
2157        String path = "entry:sample:equatorial_angle"   
2158        return(V_getRealValueFromHDF5(fname,path))
2159end
2160
2161// group ID !!! very important for matching up files
2162Function V_getSample_GroupID(fname)
2163        String fname
2164       
2165        String path = "entry:sample:group_id"   
2166        return(V_getRealValueFromHDF5(fname,path))
2167end
2168
2169
2170//Sample Rotation Angle
2171Function V_getSampleRotationAngle(fname)
2172        String fname
2173       
2174        String path = "entry:sample:rotation_angle"     
2175        return(V_getRealValueFromHDF5(fname,path))
2176end
2177
2178//?? this is huber/chamber??
2179// TODO -- then where is the description of 10CB, etc...
2180Function/S V_getSampleHolderDescription(fname)
2181        String fname
2182
2183        String path = "entry:sample:sample_holder_description"
2184        Variable num=60
2185        return(V_getStringFromHDF5(fname,path,num))
2186End
2187
2188// this field is apparently the "average" temperature reading
2189// and can be adversely affected by random faulty readings from the sensor
2190// to give an average that is far from the expected value
2191Function V_getSampleTemperature(fname)
2192        String fname
2193       
2194        String path = "entry:sample:temperature"       
2195        return(V_getRealValueFromHDF5(fname,path))
2196end
2197
2198Function V_getSampleTempSetPoint(fname)
2199        String fname
2200       
2201        String path = "entry:sample:temperature_setpoint"       
2202        return(V_getRealValueFromHDF5(fname,path))
2203end
2204
2205
2206//Sample Thickness
2207// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
2208Function V_getSampleThickness(fname)
2209        String fname
2210       
2211        String path = "entry:sample:thickness" 
2212        return(V_getRealValueFromHDF5(fname,path))
2213end
2214
2215Function V_getSampleTranslation(fname)
2216        String fname
2217       
2218        String path = "entry:sample:translation"       
2219        return(V_getRealValueFromHDF5(fname,path))
2220end
2221
2222// sample transmission
2223Function V_getSampleTransmission(fname)
2224        String fname
2225       
2226        String path = "entry:sample:transmission"       
2227        return(V_getRealValueFromHDF5(fname,path))
2228end
2229
2230//transmission error (one sigma)
2231Function V_getSampleTransError(fname)
2232        String fname
2233       
2234        String path = "entry:sample:transmission_error"
2235        return(V_getRealValueFromHDF5(fname,path))
2236end
2237
2238
2239
2240//
2241// TODO -- this is all a big mess with the changes in the data file structure
2242//  in JUNE 2017, which completely wrecks what was decided in 2016.
2243// Now, I'm not sure at all what I'll get...or what the field will be called... or what they mean...
2244//
2245//
2246//// SAMPLE / DATA LOGS
2247// write this generic , call with the name of the environment log desired
2248//
2249//
2250// shear_field
2251// pressure
2252// magnetic_field
2253// electric_field
2254//
2255//////// (for example) electric_field (data folder)
2256
2257Function/S V_getLog_attachedTo(fname,logStr)
2258        String fname,logStr
2259
2260        String path = "entry:sample:"+logstr+":attached_to"
2261        Variable num=60
2262        return(V_getStringFromHDF5(fname,path,num))
2263End
2264
2265
2266Function/S V_getLog_measurement(fname,logStr)
2267        String fname,logStr
2268
2269        String path = "entry:sample:"+logstr+":measurement"
2270        Variable num=60
2271        return(V_getStringFromHDF5(fname,path,num))
2272End
2273
2274
2275Function/S V_getLog_Name(fname,logStr)
2276        String fname,logStr
2277
2278        String path = "entry:sample:"+logstr+":name"
2279        Variable num=60
2280        return(V_getStringFromHDF5(fname,path,num))
2281End
2282
2283
2284
2285// for temperature only, logStr = "temperature_env"
2286Function/S V_getTemp_ControlSensor(fname,logStr)
2287        String fname,logStr
2288
2289        String path = "entry:sample:"+logstr+":control_sensor"
2290        Variable num=60
2291        return(V_getStringFromHDF5(fname,path,num))
2292End
2293
2294// for temperature only, logStr = "temperature_env"
2295Function/S V_getTemp_MonitorSensor(fname,logStr)
2296        String fname,logStr
2297
2298        String path = "entry:sample:"+logstr+":monitor_sensor"
2299        Variable num=60
2300        return(V_getStringFromHDF5(fname,path,num))
2301End
2302
2303       
2304
2305//// TODO -- this may not exist if it is not a "controlling" sensor, but there still may be logged data present
2306//// TODO -- it may also have different names for each sensor (setpoint_1, setpoint_2, etc. which will be a big hassle)
2307//Function V_getLog_setPoint(fname,logStr)
2308//      String fname,logStr
2309//     
2310//      String path = "entry:sample:"+logstr+":setpoint_1"
2311//      return(V_getRealValueFromHDF5(fname,path))
2312//end
2313//
2314//Function/S V_getLog_startTime(fname,logStr)
2315//      String fname,logStr
2316//
2317//      String path = "entry:sample:"+logstr+":start"
2318//      Variable num=60
2319//      return(V_getStringFromHDF5(fname,path,num))
2320//End
2321//
2322//
2323//// TODO -- this may only exist for electric field and magnetic field...
2324//// or may be eliminated altogether
2325//Function V_getLog_nomValue(fname,logStr)
2326//      String fname,logStr
2327//     
2328//      String path = "entry:sample:"+logstr+":value"
2329//      return(V_getRealValueFromHDF5(fname,path))
2330//end
2331
2332
2333
2334///////////
2335// for temperature, the "attached_to", "measurement", and "name" fields
2336// are one level down farther than before, and down deeper than for other sensors
2337//
2338//
2339// read the value of V_getTemp_MonitorSensor/ControlSensor to get the name of the sensor level .
2340//
2341
2342Function/S V_getTempLog_attachedTo(fname,logStr)
2343        String fname,logStr
2344
2345        String path = "entry:sample:temperature_env:"+logstr+":attached_to"
2346        Variable num=60
2347        return(V_getStringFromHDF5(fname,path,num))
2348End
2349
2350Function V_getTempLog_highTrip(fname,logStr)
2351        String fname,logStr
2352       
2353        String path = "entry:sample:temperature_env:"+logstr+":high_trip_value"
2354        return(V_getRealValueFromHDF5(fname,path))
2355end
2356
2357Function V_getTempLog_holdTime(fname,logStr)
2358        String fname,logStr
2359       
2360        String path = "entry:sample:temperature_env:"+logstr+":hold_time"
2361        return(V_getRealValueFromHDF5(fname,path))
2362end
2363
2364Function V_getTempLog_lowTrip(fname,logStr)
2365        String fname,logStr
2366       
2367        String path = "entry:sample:temperature_env:"+logstr+":low_trip_value"
2368        return(V_getRealValueFromHDF5(fname,path))
2369end
2370
2371Function/S V_getTempLog_measurement(fname,logStr)
2372        String fname,logStr
2373
2374        String path = "entry:sample:temperature_env:"+logstr+":measurement"
2375        Variable num=60
2376        return(V_getStringFromHDF5(fname,path,num))
2377End
2378
2379
2380Function/S V_getTempLog_Model(fname,logStr)
2381        String fname,logStr
2382
2383        String path = "entry:sample:temperature_env:"+logstr+":model"
2384        Variable num=60
2385        return(V_getStringFromHDF5(fname,path,num))
2386End
2387
2388Function/S V_getTempLog_Name(fname,logStr)
2389        String fname,logStr
2390
2391        String path = "entry:sample:temperature_env:"+logstr+":name"
2392        Variable num=60
2393        return(V_getStringFromHDF5(fname,path,num))
2394End
2395
2396Function V_getTempLog_runControl(fname,logStr)
2397        String fname,logStr
2398       
2399        String path = "entry:sample:temperature_env:"+logstr+":run_control"
2400        return(V_getRealValueFromHDF5(fname,path))
2401end
2402
2403Function V_getTempLog_Setpoint(fname,logStr)
2404        String fname,logStr
2405       
2406        String path = "entry:sample:temperature_env:"+logstr+":setpoint"
2407        return(V_getRealValueFromHDF5(fname,path))
2408end
2409
2410Function/S V_getTempLog_ShortName(fname,logStr)
2411        String fname,logStr
2412
2413        String path = "entry:sample:temperature_env:"+logstr+":short_name"
2414        Variable num=60
2415        return(V_getStringFromHDF5(fname,path,num))
2416End
2417
2418Function V_getTempLog_Timeout(fname,logStr)
2419        String fname,logStr
2420       
2421        String path = "entry:sample:temperature_env:"+logstr+":timeout"
2422        return(V_getRealValueFromHDF5(fname,path))
2423end
2424
2425Function V_getTempLog_Tolerance(fname,logStr)
2426        String fname,logStr
2427       
2428        String path = "entry:sample:temperature_env:"+logstr+":tolerance"
2429        return(V_getRealValueFromHDF5(fname,path))
2430end
2431
2432Function V_getTempLog_ToleranceBand(fname,logStr)
2433        String fname,logStr
2434       
2435        String path = "entry:sample:temperature_env:"+logstr+":tolerance_band_time"
2436        return(V_getRealValueFromHDF5(fname,path))
2437end
2438
2439Function V_getTempLog_Value(fname,logStr)
2440        String fname,logStr
2441       
2442        String path = "entry:sample:temperature_env:"+logstr+":value"
2443        return(V_getRealValueFromHDF5(fname,path))
2444end
2445
2446
2447
2448
2449
2450
2451//
2452// temperature_env:temp_Internal_1:value_log
2453//
2454////            value_log (data folder)
2455//
2456// TODO:
2457// -- be sure that the calling function properly calls for temperture
2458// logs which are down an extra layer:
2459//      for example, logStr = "temperature_env:temp_Internal_1"
2460//
2461// read the value of V_getTemp_MonitorSensor to get the name of the sensor the next level down.
2462//
2463Function V_getLog_avgValue(fname,logStr)
2464        String fname,logStr
2465       
2466        String path = "entry:sample:"+logstr+":value_log:average_value"
2467        return(V_getRealValueFromHDF5(fname,path))
2468end
2469
2470Function V_getLog_avgValue_err(fname,logStr)
2471        String fname,logStr
2472       
2473        String path = "entry:sample:"+logstr+":value_log:average_value_error"
2474        return(V_getRealValueFromHDF5(fname,path))
2475end
2476
2477Function V_getLog_maximumValue(fname,logStr)
2478        String fname,logStr
2479       
2480        String path = "entry:sample:"+logstr+":value_log:maximum_value"
2481        return(V_getRealValueFromHDF5(fname,path))
2482end
2483
2484Function V_getLog_medianValue(fname,logStr)
2485        String fname,logStr
2486       
2487        String path = "entry:sample:"+logstr+":value_log:median_value"
2488        return(V_getRealValueFromHDF5(fname,path))
2489end
2490
2491Function V_getLog_minimumValue(fname,logStr)
2492        String fname,logStr
2493       
2494        String path = "entry:sample:"+logstr+":value_log:minimum_value"
2495        return(V_getRealValueFromHDF5(fname,path))
2496end
2497
2498// DONE -- this needs to be a WAVE reference
2499// DONE -- verify that the field is really read in as "time0"
2500Function V_getLog_timeWave(fname,logStr,outW)
2501        String fname,logStr
2502        Wave outW
2503       
2504        String path = "entry:sample:"+logstr+":value_log:time0"
2505        WAVE w = V_getRealWaveFromHDF5(fname,path)
2506
2507        outW = w
2508        return(0)
2509end
2510
2511// DONE -- this needs to be a WAVE reference
2512Function V_getLog_ValueWave(fname,logStr,outW)
2513        String fname,logStr
2514        Wave outW
2515       
2516        String path = "entry:sample:"+logstr+":value_log:value"
2517        WAVE w = V_getRealWaveFromHDF5(fname,path)
2518
2519        outW = w
2520        return(0)
2521end
2522
2523
2524
2525
2526
2527
2528
2529///////// REDUCTION
2530///////// REDUCTION
2531///////// REDUCTION
2532
2533
2534Function/WAVE V_getAbsolute_Scaling(fname)
2535        String fname
2536       
2537        String path = "entry:reduction:absolute_scaling"       
2538        WAVE w = V_getRealWaveFromHDF5(fname,path)
2539       
2540        return w
2541end
2542
2543Function/S V_getBackgroundFileName(fname)
2544        String fname
2545
2546        String path = "entry:reduction:background_file_name"   
2547        Variable num=60
2548        return(V_getStringFromHDF5(fname,path,num))
2549End
2550
2551// THIS IS A NON-NICE ENTERED FIELD
2552// -- this is the panel string where the box coordinates refer to (for the open beam and transmission)
2553Function/S V_getReduction_BoxPanel(fname)
2554        String fname
2555
2556        String path = "entry:reduction:box_panel"       
2557        Variable num=60
2558        return(V_getStringFromHDF5(fname,path,num))
2559End
2560
2561Function/WAVE V_getBoxCoordinates(fname)
2562        String fname
2563       
2564        String path = "entry:reduction:box_coordinates"
2565        WAVE w = V_getRealWaveFromHDF5(fname,path)
2566
2567        return w
2568end
2569
2570//box counts
2571Function V_getBoxCounts(fname)
2572        String fname
2573       
2574        String path = "entry:reduction:box_count"       
2575        return(V_getRealValueFromHDF5(fname,path))
2576end
2577
2578//box counts error
2579Function V_getBoxCountsError(fname)
2580        String fname
2581       
2582        String path = "entry:reduction:box_count_error"
2583        return(V_getRealValueFromHDF5(fname,path))
2584end
2585
2586Function/S V_getReductionComments(fname)
2587        String fname
2588
2589        String path = "entry:reduction:comments"       
2590        Variable num=60
2591        return(V_getStringFromHDF5(fname,path,num))
2592End
2593
2594
2595Function/S V_getEmptyBeamFileName(fname)
2596        String fname
2597
2598        String path = "entry:reduction:empty_beam_file_name"   
2599        Variable num=60
2600        return(V_getStringFromHDF5(fname,path,num))
2601End
2602
2603Function/S V_getEmptyFileName(fname)
2604        String fname
2605
2606        String path = "entry:reduction:empty_file_name"
2607        Variable num=60
2608        return(V_getStringFromHDF5(fname,path,num))
2609End
2610
2611// this is purpose is used for all files, and has different meaning
2612// if polarization is used. need the "intent" also to be able to fully decipher what a file
2613//  is really being used for. GUI controls this, not me.
2614Function/S V_getReduction_purpose(fname)
2615        String fname
2616
2617        String path = "entry:reduction:file_purpose"   
2618        Variable num=60
2619        return(V_getStringFromHDF5(fname,path,num))
2620End
2621
2622////group ID
2623//// DONE
2624//// x- is this duplicated?
2625//// x- yes, this is a duplicated field in the /entry/sample block (and is probably more appropriate there)
2626//// x- so pick a single location, rather than needing to duplicate.
2627//// x- REPLACE with a single function V_getSample_GroupID()
2628////
2629//Function V_getSample_group_ID(fname)
2630//      String fname
2631//
2632//// do not use the entry/reduction location
2633////    String path = "entry:reduction:group_id"
2634//      String path = "entry:sample:group_id"   
2635//
2636//      return(V_getRealValueFromHDF5(fname,path))
2637//end
2638
2639Function/S V_getReduction_intent(fname)
2640        String fname
2641
2642        String path = "entry:reduction:intent" 
2643        Variable num=60
2644        return(V_getStringFromHDF5(fname,path,num))
2645End
2646
2647Function/S V_getMaskFileName(fname)
2648        String fname
2649
2650        String path = "entry:reduction:mask_file_name" 
2651        Variable num=60
2652        return(V_getStringFromHDF5(fname,path,num))
2653End
2654
2655Function/S V_getLogFileName(fname)
2656        String fname
2657
2658        String path = "entry:reduction:sans_log_file_name"     
2659        Variable num=60
2660        return(V_getStringFromHDF5(fname,path,num))
2661End
2662
2663Function/S V_getSensitivityFileName(fname)
2664        String fname
2665
2666        String path = "entry:reduction:sensitivity_file_name"   
2667        Variable num=60
2668        return(V_getStringFromHDF5(fname,path,num))
2669End
2670
2671Function/S V_getTransmissionFileName(fname)
2672        String fname
2673
2674        String path = "entry:reduction:transmission_file_name" 
2675        Variable num=60
2676        return(V_getStringFromHDF5(fname,path,num))
2677End
2678
2679//whole detector trasmission
2680Function V_getSampleTransWholeDetector(fname)
2681        String fname
2682       
2683        String path = "entry:reduction:whole_trans"     
2684        return(V_getRealValueFromHDF5(fname,path))
2685end
2686
2687//whole detector trasmission error
2688Function V_getSampleTransWholeDetErr(fname)
2689        String fname
2690       
2691        String path = "entry:reduction:whole_trans_error"       
2692        return(V_getRealValueFromHDF5(fname,path))
2693end
2694
2695// this is a NON NICE entered field
2696// so I need to catch the error if it's not there
2697Function/WAVE V_getReductionProtocolWave(fname)
2698        String fname
2699       
2700        String path = "entry:reduction:protocol"       
2701        WAVE/T/Z tw = V_getTextWaveFromHDF5(fname,path)
2702       
2703        if(waveExists(tw))
2704                return tw
2705        else
2706                Make/O/T/N=0 nullTextWave
2707                return nullTextWave
2708        endif
2709       
2710end
2711
2712// this is a NON NICE entered field
2713// so if it's not there, it returns -999999
2714//
2715// this is a flag to mark the file as "flipped" so it prevents a 2nd flip
2716// if the flip has been done, the field is written with a value of 1 (= true)
2717//
2718Function V_getLeftRightFlipDone(fname)
2719        String fname
2720       
2721        String path = "entry:reduction:left_right_flip"
2722        return(V_getRealValueFromHDF5(fname,path))
2723end     
2724
2725
2726
2727// these have all been moved elsewhere                 
2728///////                 pol_sans (data folder)
2729//
2730//Function/S V_getPolSANS_cellName(fname)
2731//      String fname
2732//
2733//      String path = "entry:reduction:pol_sans:cell_name"     
2734//      Variable num=60
2735//      return(V_getStringFromHDF5(fname,path,num))
2736//End
2737//
2738//
2739//Function/WAVE V_getPolSANS_cellParams(fname)
2740//      String fname
2741//     
2742//      String path = "entry:reduction:pol_sans:cell_parameters"       
2743//      WAVE w = V_getRealWaveFromHDF5(fname,path)
2744//
2745//      return w
2746//end
2747//
2748//Function/S V_getPolSANS_PolSANSPurpose(fname)
2749//      String fname
2750//
2751//      String path = "entry:reduction:pol_sans:pol_sans_purpose"       
2752//      Variable num=60
2753//      return(V_getStringFromHDF5(fname,path,num))
2754//End
2755
2756                               
2757//////// TOP LEVEL DATA REPRESENTATION
2758//
2759// note that here the data is (supposed to be) a link, not the actual data
2760// Igor HDf implementation cannot follow links properly, as far as I know.
2761// so ignore them here, and focus on the image that may be possible to read
2762//
2763
2764//              data_B (data folder)
2765//                      data (wave) 1           //ignore this, it's a link
2766//                      variables (wave) 320
2767//                      thumbnail (data folder)
2768
2769////data (wave) "binary"
2770//// TODO -- this will need to be completely replaced with a function that can
2771//// read the binary image data. should be possible, but I don't know the details on either end...
2772//Function/S V_getDataImage(fname,detStr)
2773//      String fname,detStr
2774//
2775//      String path = "entry:data_"+detStr+":thumbnail:data"   
2776//      Variable num=60
2777//      return(V_getStringFromHDF5(fname,path,num))
2778//End
2779//
2780//Function/S V_getDataImageDescription(fname,detStr)
2781//      String fname,detStr
2782//
2783//      String path = "entry:data_"+detStr+":thumbnail:description"     
2784//      Variable num=60
2785//      return(V_getStringFromHDF5(fname,path,num))
2786//End
2787//                                                             
2788//Function/S V_getDataImageType(fname,detStr)
2789//      String fname,detStr
2790//
2791//      String path = "entry:data_"+detStr+":thumbnail:type"   
2792//      Variable num=60
2793//      return(V_getStringFromHDF5(fname,path,num))
2794//End
2795//
2796//
2797
2798
Note: See TracBrowser for help on using the repository browser.