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

Last change on this file since 1061 was 1061, checked in by srkline, 5 years ago

Added USANS loader/initializer

Updated units of distance for q-calculation (SDD)

status display bug fixed

File size: 62.3 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
30//Function/S proto_V_get_STR(str)
31//      String str
32//      return("")
33//end
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_getMonitorCount(fname)
405        String fname
406       
407        String path = "entry:control:monitor_counts"   
408        return(V_getRealValueFromHDF5(fname,path))
409end
410
411Function V_getMonitor_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
467Function V_getAttenuator_transmission(fname)
468        String fname
469       
470        String path = "entry:instrument:attenuator:attenuator_transmission"     
471        return(V_getRealValueFromHDF5(fname,path))
472end
473
474// transmission value (error) for the attenuator in the beam
475// use this, but if something wrong, the tables are present
476Function V_getAttenuator_trans_err(fname)
477        String fname
478       
479        String path = "entry:instrument:attenuator:attenuator_transmission_error"       
480        return(V_getRealValueFromHDF5(fname,path))
481end
482
483// desired thickness
484Function V_getAtten_desired_thickness(fname)
485        String fname
486       
487        String path = "entry:instrument:attenuator:desired_thickness"   
488        return(V_getRealValueFromHDF5(fname,path))
489end
490
491
492// distance from the attenuator to the sample (units??)
493Function V_getAttenDistance(fname)
494        String fname
495       
496        String path = "entry:instrument:attenuator:distance"   
497        return(V_getRealValueFromHDF5(fname,path))
498end
499
500
501
502// table of the attenuation factor error
503Function/WAVE V_getAttenIndex_error_table(fname)
504        String fname
505       
506        String path = "entry:instrument:attenuator:index_error_table"
507        WAVE w = V_getRealWaveFromHDF5(fname,path)
508       
509        return w
510end
511
512// table of the attenuation factor
513Function/WAVE V_getAttenIndex_table(fname)
514        String fname
515       
516        String path = "entry:instrument:attenuator:index_table"
517        WAVE w = V_getRealWaveFromHDF5(fname,path)
518
519        return w
520end
521
522//
523//// status "in or out"
524//Function/S V_getAttenStatus(fname)
525//      String fname
526//
527//      String path = "entry:instrument:attenuator:status"
528//      Variable num=60
529//      return(V_getStringFromHDF5(fname,path,num))
530//End
531
532//// this is the "number" of attenuators dropped in the beam - and should be
533// what I can use to lookup the actual attenuator transmission
534Function V_getAtten_number(fname)
535        String fname
536       
537        String path = "entry:instrument:attenuator:num_atten_dropped"   
538        return(V_getRealValueFromHDF5(fname,path))
539end
540
541// thickness of the attenuator (PMMA) - units??
542Function V_getAttenThickness(fname)
543        String fname
544       
545        String path = "entry:instrument:attenuator:thickness"   
546        return(V_getRealValueFromHDF5(fname,path))
547end
548
549
550// type of material for the atteunator
551Function/S V_getAttenType(fname)
552        String fname
553
554        String path = "entry:instrument:attenuator:type"
555        Variable num=60
556        return(V_getStringFromHDF5(fname,path,num))
557End
558
559
560////// INSTRUMENT/BEAM
561// instrument/beam/analyzer (data folder)
562// this is the He3 analyzer, after the sample (but first alphabetically)
563// TODO -- document what all of the fields represent, and what are the most important to "key" on to read
564//
565Function V_getAnalyzer_depth(fname)
566        String fname
567       
568        String path = "entry:instrument:beam:analyzer:depth"   
569        return(V_getRealValueFromHDF5(fname,path))
570end
571
572Function/S V_getAnalyzer_direction(fname)
573        String fname
574
575        String path = "entry:instrument:beam:analyzer:direction"
576        Variable num=60
577        return(V_getStringFromHDF5(fname,path,num))
578End
579
580Function V_getAnalyzer_height(fname)
581        String fname
582       
583        String path = "entry:instrument:beam:analyzer:height"   
584        return(V_getRealValueFromHDF5(fname,path))
585end
586
587// ?? TODO is this equivalent to "status" -- ?? 0|1
588Function V_getAnalyzer_inBeam(fname)
589        String fname
590       
591        String path = "entry:instrument:beam:analyzer:inBeam"   
592        return(V_getRealValueFromHDF5(fname,path))
593end
594
595Function V_getAnalyzer_innerDiameter(fname)
596        String fname
597       
598        String path = "entry:instrument:beam:analyzer:innerDiameter"   
599        return(V_getRealValueFromHDF5(fname,path))
600end
601
602// one of the most important
603Function/S V_getAnalyzer_name(fname)
604        String fname
605
606        String path = "entry:instrument:beam:analyzer:name"
607        Variable num=60
608        return(V_getStringFromHDF5(fname,path,num))
609End
610
611Function V_getAnalyzer_opacityAt1Ang(fname)
612        String fname
613       
614        String path = "entry:instrument:beam:analyzer:opacityAt1Ang"   
615        return(V_getRealValueFromHDF5(fname,path))
616end
617
618Function V_getAnalyzer_opacityAt1Ang_err(fname)
619        String fname
620       
621        String path = "entry:instrument:beam:analyzer:opacityAt1AngStd"
622        return(V_getRealValueFromHDF5(fname,path))
623end
624
625Function V_getAnalyzer_outerDiameter(fname)
626        String fname
627       
628        String path = "entry:instrument:beam:analyzer:outerDiameter"   
629        return(V_getRealValueFromHDF5(fname,path))
630end
631
632Function/S V_getAnalyzer_shape(fname)
633        String fname
634
635        String path = "entry:instrument:beam:analyzer:shape"
636        Variable num=60
637        return(V_getStringFromHDF5(fname,path,num))
638End
639
640Function V_getAnalyzer_tE(fname)
641        String fname
642       
643        String path = "entry:instrument:beam:analyzer:tE"       
644        return(V_getRealValueFromHDF5(fname,path))
645end
646
647Function V_getAnalyzer_tE_err(fname)
648        String fname
649       
650        String path = "entry:instrument:beam:analyzer:tEStd"   
651        return(V_getRealValueFromHDF5(fname,path))
652end
653
654Function/S V_getAnalyzer_type(fname)
655        String fname
656
657        String path = "entry:instrument:beam:analyzer:type"
658        Variable num=60
659        return(V_getStringFromHDF5(fname,path,num))
660End
661
662
663Function V_getAnalyzer_width(fname)
664        String fname
665       
666        String path = "entry:instrument:beam:analyzer:width"   
667        return(V_getRealValueFromHDF5(fname,path))
668end
669
670
671// instrument/beam/chopper (data folder)
672Function V_getChopperAngular_opening(fname)
673        String fname
674       
675        String path = "entry:instrument:beam:chopper:angular_opening"   
676        return(V_getRealValueFromHDF5(fname,path))
677end
678
679Function V_getChopDistance_from_sample(fname)
680        String fname
681       
682        String path = "entry:instrument:beam:chopper:distance_from_sample"     
683        return(V_getRealValueFromHDF5(fname,path))
684end
685
686Function V_getChopDistance_from_source(fname)
687        String fname
688       
689        String path = "entry:instrument:beam:chopper:distance_from_source"     
690        return(V_getRealValueFromHDF5(fname,path))
691end
692
693Function V_getChopperDuty_cycle(fname)
694        String fname
695       
696        String path = "entry:instrument:beam:chopper:duty_cycle"       
697        return(V_getRealValueFromHDF5(fname,path))
698end
699
700Function V_getChopperRotation_speed(fname)
701        String fname
702       
703        String path = "entry:instrument:beam:chopper:rotation_speed"   
704        return(V_getRealValueFromHDF5(fname,path))
705end
706
707Function V_getChopperSlits(fname)
708        String fname
709       
710        String path = "entry:instrument:beam:chopper:slits"     
711        return(V_getRealValueFromHDF5(fname,path))
712end
713
714Function/S V_getChopperStatus(fname)
715        String fname
716
717        String path = "entry:instrument:beam:chopper:status"
718        Variable num=60
719        return(V_getStringFromHDF5(fname,path,num))
720End
721
722Function/S V_getChopperType(fname)
723        String fname
724
725        String path = "entry:instrument:beam:chopper:type"
726        Variable num=60
727        return(V_getStringFromHDF5(fname,path,num))
728End
729
730
731// instrument/beam/flipperPolarizer (data folder)
732// this is upstream, after the supermirror but before the sample
733
734Function/S V_getflipperPolarizer_Direction(fname)
735        String fname
736
737        String path = "entry:instrument:beam:flipperPolarizer:direction"
738        Variable num=60
739        return(V_getStringFromHDF5(fname,path,num))
740End
741
742Function V_getflipperPolarizer_inBeam(fname)
743        String fname
744       
745        String path = "entry:instrument:beam:flipperPolarizer:inBeam"   
746        return(V_getRealValueFromHDF5(fname,path))
747end
748
749Function/S V_getflipperPolarizer_Type(fname)
750        String fname
751
752        String path = "entry:instrument:beam:flipperPolarizer:type"
753        Variable num=60
754        return(V_getStringFromHDF5(fname,path,num))
755End
756
757
758
759//Function V_getFlipperDriving_current(fname)
760//      String fname
761//     
762//      String path = "entry:instrument:beam:flipper:driving_current"   
763//      return(V_getRealValueFromHDF5(fname,path))
764//end
765//
766//Function V_getFlipperFrequency(fname)
767//      String fname
768//     
769//      String path = "entry:instrument:beam:flipper:frequency"
770//      return(V_getRealValueFromHDF5(fname,path))
771//end
772//
773//Function/S V_getFlipperstatus(fname)
774//      String fname
775//
776//      String path = "entry:instrument:beam:flipper:status"
777//      Variable num=60
778//      return(V_getStringFromHDF5(fname,path,num))
779//End
780//
781//Function V_getFlipperTransmitted_power(fname)
782//      String fname
783//     
784//      String path = "entry:instrument:beam:flipper:transmitted_power"
785//      return(V_getRealValueFromHDF5(fname,path))
786//end
787//
788//Function/S V_getFlipperWaveform(fname)
789//      String fname
790//
791//      String path = "entry:instrument:beam:flipper:waveform"
792//      Variable num=60
793//      return(V_getStringFromHDF5(fname,path,num))
794//End
795
796
797
798// instrument/beam/monochromator (data folder)
799Function/S V_getMonochromatorType(fname)
800        String fname
801
802        String path = "entry:instrument:beam:monochromator:type"
803        Variable num=60
804        return(V_getStringFromHDF5(fname,path,num))
805End
806
807Function V_getWavelength(fname)
808        String fname
809       
810        String path = "entry:instrument:beam:monochromator:wavelength" 
811        return(V_getRealValueFromHDF5(fname,path))
812end
813
814Function V_getWavelength_spread(fname)
815        String fname
816       
817        String path = "entry:instrument:beam:monochromator:wavelength_spread"   
818        return(V_getRealValueFromHDF5(fname,path))
819end
820
821// instrument/beam/monochromator/crystal (data folder)
822Function V_getCrystalDistance(fname)
823        String fname
824       
825        String path = "entry:instrument:beam:monochromator:crystal:distance"   
826        return(V_getRealValueFromHDF5(fname,path))
827end
828
829Function V_getCrystalEnergy(fname)
830        String fname
831       
832        String path = "entry:instrument:beam:monochromator:crystal:energy"     
833        return(V_getRealValueFromHDF5(fname,path))
834end
835
836Function V_getCrystalHorizontal_aperture(fname)
837        String fname
838       
839        String path = "entry:instrument:beam:monochromator:crystal:horizontal_aperture"
840        return(V_getRealValueFromHDF5(fname,path))
841end
842
843Function V_getCrystalHoriz_curvature(fname)
844        String fname
845       
846        String path = "entry:instrument:beam:monochromator:crystal:horizontal_curvature"       
847        return(V_getRealValueFromHDF5(fname,path))
848end
849
850Function V_getCrystalLattice_parameter(fname)
851        String fname
852       
853        String path = "entry:instrument:beam:monochromator:crystal:lattice_parameter"   
854        return(V_getRealValueFromHDF5(fname,path))
855end
856
857Function V_getCrystalReflection(fname)
858        String fname
859       
860        String path = "entry:instrument:beam:monochromator:crystal:reflection" 
861        return(V_getRealValueFromHDF5(fname,path))
862end
863
864Function V_getCrystalRotation(fname)
865        String fname
866       
867        String path = "entry:instrument:beam:monochromator:crystal:rotation"   
868        return(V_getRealValueFromHDF5(fname,path))
869end
870
871Function/S V_getCrystalStatus(fname)
872        String fname
873
874        String path = "entry:instrument:beam:monochromator:crystal:status"
875        Variable num=60
876        return(V_getStringFromHDF5(fname,path,num))
877End
878
879Function V_getCrystalVertical_aperture(fname)
880        String fname
881       
882        String path = "entry:instrument:beam:monochromator:crystal:vertical_aperture"   
883        return(V_getRealValueFromHDF5(fname,path))
884end
885
886Function V_getCrystalVertical_curvature(fname)
887        String fname
888       
889        String path = "entry:instrument:beam:monochromator:crystal:vertical_curvature" 
890        return(V_getRealValueFromHDF5(fname,path))
891end
892
893Function V_getCrystalWavelength(fname)
894        String fname
895       
896        String path = "entry:instrument:beam:monochromator:crystal:wavelength" 
897        return(V_getRealValueFromHDF5(fname,path))
898end
899
900Function V_getCrystalWavelength_spread(fname)
901        String fname
902       
903        String path = "entry:instrument:beam:monochromator:crystal:wavelength_spread"   
904        return(V_getRealValueFromHDF5(fname,path))
905end
906
907Function V_getCrystalWavevector(fname)
908        String fname
909       
910        String path = "entry:instrument:beam:monochromator:crystal:wavevector" 
911        return(V_getRealValueFromHDF5(fname,path))
912end
913
914// instrument/beam/monochromator/velocity_selector (data folder)
915Function V_getVSDistance(fname)
916        String fname
917       
918        String path = "entry:instrument:beam:monochromator:velocity_selector:distance" 
919        return(V_getRealValueFromHDF5(fname,path))
920end
921
922Function V_getVSRotation_speed(fname)
923        String fname
924       
925        String path = "entry:instrument:beam:monochromator:velocity_selector:rotation_speed"   
926        return(V_getRealValueFromHDF5(fname,path))
927end
928
929Function/S V_getVelSelStatus(fname)
930        String fname
931
932        String path = "entry:instrument:beam:monochromator:velocity_selector:status"
933        Variable num=60
934        return(V_getStringFromHDF5(fname,path,num))
935End
936
937Function/WAVE V_getVSTable_parameters(fname)
938        String fname
939       
940        String path = "entry:instrument:beam:monochromator:velocity_selector:table_parameters" 
941        WAVE w = V_getRealWaveFromHDF5(fname,path)
942
943        return w
944end
945
946//// DONE - this does not exist for VSANS - per JGB 4/2016
947//Function V_getVS_tilt(fname)
948//      String fname
949//     
950//      String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt"   
951//      return(V_getRealValueFromHDF5(fname,path))
952//end
953
954Function V_getVSWavelength(fname)
955        String fname
956       
957        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength"       
958        return(V_getRealValueFromHDF5(fname,path))
959end
960
961Function V_getVSWavelength_spread(fname)
962        String fname
963       
964        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength_spread"
965        return(V_getRealValueFromHDF5(fname,path))
966end
967
968// instrument/beam/monochromator/white_beam (data folder)
969Function/S V_getWhiteBeamStatus(fname)
970        String fname
971
972        String path = "entry:instrument:beam:monochromator:white_beam:status"
973        Variable num=60
974        return(V_getStringFromHDF5(fname,path,num))
975End
976
977Function V_getWhiteBeamWavelength(fname)
978        String fname
979       
980        String path = "entry:instrument:beam:monochromator:white_beam:wavelength"       
981        return(V_getRealValueFromHDF5(fname,path))
982end
983
984Function V_getWhiteBeamWavelength_spread(fname)
985        String fname
986       
987        String path = "entry:instrument:beam:monochromator:white_beam:wavelength_spread"       
988        return(V_getRealValueFromHDF5(fname,path))
989end
990
991// instrument/beam/superMirror (data folder)
992// This is the upstream polarizer. There are no other choices for polarizer on VSANS
993Function/S V_getPolarizerComposition(fname)
994        String fname
995
996        String path = "entry:instrument:beam:superMirror:composition"
997        Variable num=60
998        return(V_getStringFromHDF5(fname,path,num))
999End
1000
1001Function V_getPolarizerEfficiency(fname)
1002        String fname
1003       
1004        String path = "entry:instrument:beam:superMirror:efficiency"   
1005        return(V_getRealValueFromHDF5(fname,path))
1006end
1007
1008Function/S V_getPolarizerState(fname)
1009        String fname
1010
1011        String path = "entry:instrument:beam:superMirror:state"
1012        Variable num=60
1013        return(V_getStringFromHDF5(fname,path,num))
1014End
1015
1016//Function/S V_getPolarizerType(fname)
1017//      String fname
1018//
1019//      String path = "entry:instrument:beam:polarizer:type"
1020//      Variable num=60
1021//      return(V_getStringFromHDF5(fname,path,num))
1022//End
1023
1024//// instrument/beam/polarizer_analyzer (data folder)
1025//Function V_getPolAnaCell_index(fname)
1026//      String fname
1027//
1028//      String path = "entry:instrument:beam:polarizer_analyzer:cell_index"
1029//      return(V_getRealValueFromHDF5(fname,path))
1030//End
1031//
1032//Function/S V_getPolAnaCell_name(fname)
1033//      String fname
1034//
1035//      String path = "entry:instrument:beam:polarizer_analyzer:cell_name"
1036//      Variable num=60
1037//      return(V_getStringFromHDF5(fname,path,num))
1038//End
1039//
1040//Function/WAVE V_getPolAnaCell_parameters(fname)
1041//      String fname
1042//
1043//      String path = "entry:instrument:beam:polarizer_analyzer:cell_parameters"
1044//      WAVE w = V_getRealWaveFromHDF5(fname,path)
1045//
1046//      return w
1047//End
1048//
1049//Function V_getPolAnaGuideFieldCur_1(fname)
1050//      String fname
1051//
1052//      String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_1"
1053//      return(V_getRealValueFromHDF5(fname,path))
1054//End
1055//
1056//Function V_getPolAnaGuideFieldCur_2(fname)
1057//      String fname
1058//
1059//      String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_2"
1060//      return(V_getRealValueFromHDF5(fname,path))
1061//End
1062//
1063//Function V_getPolAnaSolenoid_current(fname)
1064//      String fname
1065//
1066//      String path = "entry:instrument:beam:polarizer_analyzer:solenoid_current"
1067//      return(V_getRealValueFromHDF5(fname,path))
1068//End
1069//
1070//Function/S V_getPolAnaStatus(fname)
1071//      String fname
1072//
1073//      String path = "entry:instrument:beam:polarizer_analyzer:status"
1074//      Variable num=60
1075//      return(V_getStringFromHDF5(fname,path,num))
1076//End
1077
1078                                       
1079/////// INSTRUMENT/BEAM MONITORS
1080
1081//beam_monitor_low (data folder)
1082Function V_getBeamMonLowData(fname)
1083        String fname
1084
1085        String path = "entry:instrument:beam_monitor_low:data"
1086        return(V_getRealValueFromHDF5(fname,path))
1087End
1088
1089Function V_getBeamMonLowDistance(fname)
1090        String fname
1091
1092        String path = "entry:instrument:beam_monitor_low:distance"
1093        return(V_getRealValueFromHDF5(fname,path))
1094End
1095
1096Function V_getBeamMonLowEfficiency(fname)
1097        String fname
1098
1099        String path = "entry:instrument:beam_monitor_low:efficiency"
1100        return(V_getRealValueFromHDF5(fname,path))
1101End
1102
1103Function V_getBeamMonLowSaved_count(fname)
1104        String fname
1105
1106        String path = "entry:instrument:beam_monitor_low:saved_count"
1107        return(V_getRealValueFromHDF5(fname,path))
1108End
1109
1110Function/S V_getBeamMonLowType(fname)
1111        String fname
1112
1113        String path = "entry:instrument:beam_monitor_low:type"
1114        Variable num=60
1115        return(V_getStringFromHDF5(fname,path,num))
1116End
1117
1118//beam_monitor_norm (data folder)
1119Function V_getBeamMonNormData(fname)
1120        String fname
1121
1122        String path = "entry:instrument:beam_monitor_norm:data"
1123        return(V_getRealValueFromHDF5(fname,path))
1124End
1125
1126Function V_getBeamMonNormDistance(fname)
1127        String fname
1128
1129        String path = "entry:instrument:beam_monitor_norm:distance"
1130        return(V_getRealValueFromHDF5(fname,path))
1131End
1132
1133Function V_getBeamMonNormEfficiency(fname)
1134        String fname
1135
1136        String path = "entry:instrument:beam_monitor_norm:efficiency"
1137        return(V_getRealValueFromHDF5(fname,path))
1138End
1139
1140Function V_getBeamMonNormSaved_count(fname)
1141        String fname
1142
1143        String path = "entry:instrument:beam_monitor_norm:saved_count"
1144        return(V_getRealValueFromHDF5(fname,path))
1145End
1146
1147Function/S V_getBeamMonNormType(fname)
1148        String fname
1149
1150        String path = "entry:instrument:beam_monitor_norm:type"
1151        Variable num=60
1152        return(V_getStringFromHDF5(fname,path,num))
1153End
1154
1155//beam_stop C2 (data folder)
1156Function/S V_getBeamStopC2Description(fname)
1157        String fname
1158
1159        String path = "entry:instrument:beam_stop_C2:description"
1160        Variable num=60
1161        return(V_getStringFromHDF5(fname,path,num))
1162End
1163
1164Function V_getBeamStopC2Dist_to_det(fname)
1165        String fname
1166
1167        String path = "entry:instrument:beam_stop_C2:distance_to_detector"
1168        return(V_getRealValueFromHDF5(fname,path))
1169End
1170
1171//TODO -- not sure what this really means
1172Function V_getBeamStopC2num_beamstops(fname)
1173        String fname
1174
1175        String path = "entry:instrument:beam_stop_C2:num_beamstops"
1176        return(V_getRealValueFromHDF5(fname,path))
1177End
1178
1179Function V_getBeamStopC2_x_pos(fname)
1180        String fname
1181
1182        String path = "entry:instrument:beam_stop_C2:x_pos"
1183        return(V_getRealValueFromHDF5(fname,path))
1184End
1185
1186Function V_getBeamStopC2_y_pos(fname)
1187        String fname
1188
1189        String path = "entry:instrument:beam_stop_C2:y_pos"
1190        return(V_getRealValueFromHDF5(fname,path))
1191End
1192
1193// beam stop shape parameters
1194Function V_getBeamStopC2_height(fname)
1195        String fname
1196
1197        String path = "entry:instrument:beam_stop_C2:shape:height"
1198        return(V_getRealValueFromHDF5(fname,path))
1199End
1200
1201Function/S V_getBeamStopC2_shape(fname)
1202        String fname
1203
1204        Variable num=60
1205        String path = "entry:instrument:beam_stop_C2:shape:shape"
1206        return(V_getStringFromHDF5(fname,path,num))
1207End
1208
1209// == diameter if shape = CIRCLE
1210Function V_getBeamStopC2_size(fname)
1211        String fname
1212
1213        String path = "entry:instrument:beam_stop_C2:shape:size"
1214        return(V_getRealValueFromHDF5(fname,path))
1215End
1216
1217Function V_getBeamStopC2_width(fname)
1218        String fname
1219
1220        String path = "entry:instrument:beam_stop_C2:shape:width"
1221        return(V_getRealValueFromHDF5(fname,path))
1222End
1223
1224
1225
1226//beam_stop C3 (data folder)
1227Function/S V_getBeamStopC3Description(fname)
1228        String fname
1229
1230        String path = "entry:instrument:beam_stop_C3:description"
1231        Variable num=60
1232        return(V_getStringFromHDF5(fname,path,num))
1233End
1234
1235Function V_getBeamStopC3Dist_to_det(fname)
1236        String fname
1237
1238        String path = "entry:instrument:beam_stop_C3:distance_to_detector"
1239        return(V_getRealValueFromHDF5(fname,path))
1240End
1241
1242//TODO -- not sure what this really means
1243Function V_getBeamStopC3num_beamstops(fname)
1244        String fname
1245
1246        String path = "entry:instrument:beam_stop_C3:num_beamstops"
1247        return(V_getRealValueFromHDF5(fname,path))
1248End
1249
1250Function V_getBeamStopC3_x_pos(fname)
1251        String fname
1252
1253        String path = "entry:instrument:beam_stop_C3:x_pos"
1254        return(V_getRealValueFromHDF5(fname,path))
1255End
1256
1257Function V_getBeamStopC3_y_pos(fname)
1258        String fname
1259
1260        String path = "entry:instrument:beam_stop_C3:y_pos"
1261        return(V_getRealValueFromHDF5(fname,path))
1262End
1263
1264// beam stop shape parameters
1265Function V_getBeamStopC3_height(fname)
1266        String fname
1267
1268        String path = "entry:instrument:beam_stop_C3:shape:height"
1269        return(V_getRealValueFromHDF5(fname,path))
1270End
1271
1272Function/S V_getBeamStopC3_shape(fname)
1273        String fname
1274
1275        Variable num=60
1276        String path = "entry:instrument:beam_stop_C3:shape:shape"
1277        return(V_getStringFromHDF5(fname,path,num))
1278End
1279
1280// == diameter if shape = CIRCLE
1281Function V_getBeamStopC3_size(fname)
1282        String fname
1283
1284        String path = "entry:instrument:beam_stop_C3:shape:size"
1285        return(V_getRealValueFromHDF5(fname,path))
1286End
1287
1288Function V_getBeamStopC3_width(fname)
1289        String fname
1290
1291        String path = "entry:instrument:beam_stop_C3:shape:width"
1292        return(V_getRealValueFromHDF5(fname,path))
1293End
1294
1295
1296
1297
1298//// INSTRUMENT/COLLIMATOR
1299//collimator (data folder)
1300
1301// this is now defined as text, due to selections from GUI
1302Function/S V_getNumberOfGuides(fname)
1303        String fname
1304
1305        Variable num=60
1306        String path = "entry:instrument:collimator:number_guides"
1307        return(V_getStringFromHDF5(fname,path,num))
1308End
1309
1310//                              geometry (data folder)
1311//                                      shape (data folder)
1312Function/S V_getGuideShape(fname)
1313        String fname
1314
1315        String path = "entry:instrument:collimator:geometry:shape:shape"
1316        Variable num=60
1317        return(V_getStringFromHDF5(fname,path,num))
1318End
1319
1320Function V_getGuideSize(fname)
1321        String fname
1322
1323        String path = "entry:instrument:collimator:geometry:shape:size"
1324        return(V_getRealValueFromHDF5(fname,path))
1325End
1326
1327
1328//                      converging_pinholes (data folder)
1329Function/S V_getConvPinholeStatus(fname)
1330        String fname
1331
1332        String path = "entry:instrument:converging_pinholes:status"
1333        Variable num=60
1334        return(V_getStringFromHDF5(fname,path,num))
1335End
1336
1337//                      converging_slits (not used)
1338
1339////// INSTRUMENT/DETECTORS
1340//                      detector_B (data folder)
1341//
1342// only defined for the "B" detector, and may not be necessary?
1343// DONE -- write to return an ARRAY
1344Function/WAVE V_getDet_cal_x(fname,detStr)
1345        String fname,detStr
1346
1347        if(cmpstr(detStr,"B") == 0)
1348                String path = "entry:instrument:detector_"+detStr+":cal_x"
1349                WAVE w = V_getRealWaveFromHDF5(fname,path)
1350
1351                return w
1352        else
1353                return $""
1354        endif
1355End
1356
1357// only defined for the "B" detector, and may not be necessary?
1358// TODO -- write to return an ARRAY
1359Function/WAVE V_getDet_cal_y(fname,detStr)
1360        String fname,detStr
1361
1362        if(cmpstr(detStr,"B") == 0)
1363                String path = "entry:instrument:detector_"+detStr+":cal_y"
1364                WAVE w = V_getRealWaveFromHDF5(fname,path)
1365       
1366                return w
1367        else
1368                return $""
1369        endif
1370End
1371
1372//  Pixels are not square
1373// so the FHWM will be different in each direction. May need to return
1374// "dummy" value for "B" detector if pixels there are square
1375Function V_getDet_pixel_fwhm_x(fname,detStr)
1376        String fname,detStr
1377
1378        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_x"
1379
1380        return(V_getRealValueFromHDF5(fname,path))
1381End
1382
1383// Pixels are not square
1384// so the FHWM will be different in each direction. May need to return
1385// "dummy" value for "B" detector if pixels there are square
1386Function V_getDet_pixel_fwhm_y(fname,detStr)
1387        String fname,detStr
1388
1389        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_y"
1390
1391        return(V_getRealValueFromHDF5(fname,path))
1392End
1393
1394Function V_getDet_pixel_num_x(fname,detStr)
1395        String fname,detStr
1396
1397        String path = "entry:instrument:detector_"+detStr+":pixel_num_x"
1398        return(V_getRealValueFromHDF5(fname,path))
1399End
1400
1401Function V_getDet_pixel_num_y(fname,detStr)
1402        String fname,detStr
1403
1404        String path = "entry:instrument:detector_"+detStr+":pixel_num_y"
1405        return(V_getRealValueFromHDF5(fname,path))
1406End
1407
1408//// only defined for the "B" detector, and only to satisfy NXsas
1409//Function V_getDet_azimuthalAngle(fname,detStr)
1410//      String fname,detStr
1411//
1412//      if(cmpstr(detStr,"B") == 0)
1413//              String path = "entry:instrument:detector_"+detStr+":azimuthal_angle"
1414//              return(V_getRealValueFromHDF5(fname,path))
1415//      else
1416//              return(0)
1417//      endif
1418//End
1419
1420Function V_getDet_beam_center_x(fname,detStr)
1421        String fname,detStr
1422
1423        String path = "entry:instrument:detector_"+detStr+":beam_center_x"
1424        return(V_getRealValueFromHDF5(fname,path))
1425End
1426
1427Function V_getDet_beam_center_y(fname,detStr)
1428        String fname,detStr
1429
1430        String path = "entry:instrument:detector_"+detStr+":beam_center_y"
1431        return(V_getRealValueFromHDF5(fname,path))
1432End
1433
1434
1435//TODO
1436//
1437// x and y center in mm is currently not part of the Nexus definition
1438//  does it need to be?
1439// these lookups will fail if they have not been generated locally!
1440Function V_getDet_beam_center_x_mm(fname,detStr)
1441        String fname,detStr
1442
1443        String path = "entry:instrument:detector_"+detStr+":beam_center_x_mm"
1444        return(V_getRealValueFromHDF5(fname,path))
1445End
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_y_mm(fname,detStr)
1453        String fname,detStr
1454
1455        String path = "entry:instrument:detector_"+detStr+":beam_center_y_mm"
1456        return(V_getRealValueFromHDF5(fname,path))
1457End
1458
1459//TODO
1460//
1461// x and y center in pix 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_x_pix(fname,detStr)
1465        String fname,detStr
1466
1467        String path = "entry:instrument:detector_"+detStr+":beam_center_x_pix"
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_y_pix(fname,detStr)
1477        String fname,detStr
1478
1479        String path = "entry:instrument:detector_"+detStr+":beam_center_y_pix"
1480        return(V_getRealValueFromHDF5(fname,path))
1481End
1482
1483Function/WAVE V_getDetectorDataW(fname,detStr)
1484        String fname,detStr
1485
1486        String path = "entry:instrument:detector_"+detStr+":data"
1487        WAVE w = V_getRealWaveFromHDF5(fname,path)
1488
1489        return w
1490End
1491
1492//
1493// TODO -- this does not exist in the raw data, but does in the processed data
1494// !!! how to handle this?? Binning routines need the error wave
1495//
1496Function/WAVE V_getDetectorDataErrW(fname,detStr)
1497        String fname,detStr
1498
1499        String path = "entry:instrument:detector_"+detStr+":linear_data_error"
1500        WAVE w = V_getRealWaveFromHDF5(fname,path)
1501
1502        return w
1503End
1504
1505// TODO -- write this function to return a WAVE with the data
1506// either as a wave reference, or as an input parameter
1507// ALSO -- the "B" deadtime will be a single value (probably)
1508//  but the tube banks will be 1D arrays of values, one per tube
1509Function/WAVE V_getDetector_deadtime(fname,detStr)
1510        String fname,detStr
1511
1512        String path = "entry:instrument:detector_"+detStr+":dead_time"
1513        if(cmpstr(detStr,"B") == 0)
1514                return $""
1515        else   
1516                WAVE w = V_getRealWaveFromHDF5(fname,path)
1517                return w
1518        endif
1519End
1520
1521// for "B" only
1522Function V_getDetector_deadtime_B(fname,detStr)
1523        String fname,detStr
1524
1525        String path = "entry:instrument:detector_"+detStr+":dead_time"
1526        if(cmpstr(detStr,"B") == 0)
1527                return(V_getRealValueFromHDF5(fname,path))
1528        else   
1529                return(0)
1530        endif
1531End
1532
1533Function/S V_getDetDescription(fname,detStr)
1534        String fname,detStr
1535
1536        String path = "entry:instrument:detector_"+detStr+":description"
1537        Variable num=60
1538        return(V_getStringFromHDF5(fname,path,num))
1539End
1540
1541// return value in [cm]
1542Function V_getDet_NominalDistance(fname,detStr)
1543        String fname,detStr
1544
1545        String path = "entry:instrument:detector_"+detStr+":distance"
1546        return(V_getRealValueFromHDF5(fname,path))
1547End
1548
1549//this is a DERIVED distance, since the nominal sdd is for the carriage (=LR panels)
1550// return value in [cm]
1551Function V_getDet_ActualDistance(fname,detStr)
1552        String fname,detStr
1553
1554        Variable sdd
1555        sdd = V_getDet_NominalDistance(fname,detStr)            //[cm]
1556        sdd += V_getDet_TBSetback(fname,detStr)/10              // written in [mm], convert to [cm], returns 0 for L/R/B panels
1557               
1558        return(sdd)
1559End
1560
1561//// only defined for the "B" detector, and only to satisfy NXsas
1562//Function V_getDet_equatorial_angle(fname,detStr)
1563//      String fname,detStr
1564//
1565//      if(cmpstr(detStr,"B") == 0)
1566//              String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1567//              return(V_getRealValueFromHDF5(fname,path))
1568//      else
1569//              return(0)
1570//      endif
1571//End
1572
1573Function/S V_getDetEventFileName(fname,detStr)
1574        String fname,detStr
1575
1576        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1577        Variable num=60
1578        return(V_getStringFromHDF5(fname,path,num))
1579End
1580
1581Function V_getDet_IntegratedCount(fname,detStr)
1582        String fname,detStr
1583
1584        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1585        return(V_getRealValueFromHDF5(fname,path))
1586End
1587
1588// only return value for B and L/R detectors. everything else returns zero
1589Function V_getDet_LateralOffset(fname,detStr)
1590        String fname,detStr
1591
1592        if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0)
1593                return(0)
1594        endif
1595        if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0)
1596                return(0)
1597        endif   
1598       
1599        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1600        return(V_getRealValueFromHDF5(fname,path))
1601End
1602
1603// only return values for T/B. everything else returns zero
1604Function V_getDet_VerticalOffset(fname,detStr)
1605        String fname,detStr
1606
1607        if(cmpstr(detStr,"B") == 0)
1608                return(0)
1609        endif
1610        if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0)
1611                return(0)
1612        endif
1613        if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0)
1614                return(0)
1615        endif   
1616       
1617        String path = "entry:instrument:detector_"+detStr+":vertical_offset"
1618        return(V_getRealValueFromHDF5(fname,path))
1619End
1620
1621// TODO - be sure this is defined correctly (with correct units!)
1622// -- only returns for T/B detectors
1623Function V_getDet_TBSetback(fname,detStr)
1624        String fname,detStr
1625
1626        if(cmpstr(detStr,"B") == 0)
1627                return(0)
1628        endif
1629        if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0)
1630                return(0)
1631        endif
1632        if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0)
1633                return(0)
1634        endif   
1635       
1636        String path = "entry:instrument:detector_"+detStr+":setback"
1637        return(V_getRealValueFromHDF5(fname,path))
1638       
1639       
1640End
1641
1642
1643Function/S V_getDetSettings(fname,detStr)
1644        String fname,detStr
1645
1646        String path = "entry:instrument:detector_"+detStr+":settings"
1647        Variable num=60
1648        return(V_getStringFromHDF5(fname,path,num))
1649End
1650
1651
1652Function V_getDet_x_pixel_size(fname,detStr)
1653        String fname,detStr
1654
1655        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1656        return(V_getRealValueFromHDF5(fname,path))
1657End
1658
1659Function V_getDet_y_pixel_size(fname,detStr)
1660        String fname,detStr
1661
1662        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1663        return(V_getRealValueFromHDF5(fname,path))
1664End
1665
1666/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1667
1668Function V_getDet_numberOfTubes(fname,detStr)
1669        String fname,detStr
1670
1671        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1672        if(cmpstr(detStr,"B") == 0)
1673                return(0)
1674        else
1675                return(V_getRealValueFromHDF5(fname,path))
1676        endif
1677End
1678
1679
1680// DONE -- write this function to return a WAVE with the data
1681// either as a wave reference, or as an input parameter
1682Function/WAVE V_getDetTube_spatialCalib(fname,detStr)
1683        String fname,detStr
1684
1685        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1686        if(cmpstr(detStr,"B") == 0)
1687                return $("")    // return should be null
1688        else
1689                WAVE w = V_getRealWaveFromHDF5(fname,path)
1690                return w
1691        endif
1692End
1693
1694
1695Function/S V_getDet_tubeOrientation(fname,detStr)
1696        String fname,detStr
1697
1698        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1699        Variable num=60
1700        if(cmpstr(detStr,"B") == 0)
1701                return("")
1702        else
1703                return(V_getStringFromHDF5(fname,path,num))
1704        endif
1705End
1706
1707// TODO -- be clear on how this is defined. Units?
1708Function V_getDet_tubeWidth(fname,detStr)
1709        String fname,detStr
1710
1711        String path = "entry:instrument:detector_"+detStr+":tube_width"
1712        if(cmpstr(detStr,"B") == 0)
1713                return(0)
1714        else
1715                return(V_getRealValueFromHDF5(fname,path))
1716        endif
1717End
1718
1719//////////////////////
1720
1721// INSTRUMENT/LENSES
1722//  lenses (data folder)
1723
1724Function V_getLensCurvature(fname)
1725        String fname
1726
1727        String path = "entry:instrument:lenses:curvature"
1728        return(V_getRealValueFromHDF5(fname,path))
1729End
1730
1731Function/S V_getLensesFocusType(fname)
1732        String fname
1733
1734        String path = "entry:instrument:lenses:focus_type"
1735        Variable num=60
1736        return(V_getStringFromHDF5(fname,path,num))
1737End
1738
1739Function V_getLensDistance(fname)
1740        String fname
1741
1742        String path = "entry:instrument:lenses:lens_distance"
1743        return(V_getRealValueFromHDF5(fname,path))
1744End
1745
1746Function/S V_getLensGeometry(fname)
1747        String fname
1748
1749        String path = "entry:instrument:lenses:lens_geometry"
1750        Variable num=60
1751        return(V_getStringFromHDF5(fname,path,num))
1752End
1753
1754Function/S V_getLensMaterial(fname)
1755        String fname
1756
1757        String path = "entry:instrument:lenses:lens_material"
1758        Variable num=60
1759        return(V_getStringFromHDF5(fname,path,num))
1760End
1761
1762Function V_getNumber_of_Lenses(fname)
1763        String fname
1764
1765        String path = "entry:instrument:lenses:number_of_lenses"
1766        return(V_getRealValueFromHDF5(fname,path))
1767End
1768
1769Function V_getNumber_of_prisms(fname)
1770        String fname
1771
1772        String path = "entry:instrument:lenses:number_of_prisms"
1773        return(V_getRealValueFromHDF5(fname,path))
1774End
1775
1776Function V_getPrism_distance(fname)
1777        String fname
1778
1779        String path = "entry:instrument:lenses:prism_distance"
1780        return(V_getRealValueFromHDF5(fname,path))
1781End
1782
1783Function/S V_getPrismMaterial(fname)
1784        String fname
1785
1786        String path = "entry:instrument:lenses:prism_material"
1787        Variable num=60
1788        return(V_getStringFromHDF5(fname,path,num))
1789End
1790
1791// status of lens/prism = lens | prism | both | out
1792Function/S V_getLensPrismStatus(fname)
1793        String fname
1794
1795        String path = "entry:instrument:lenses:status"
1796        Variable num=60
1797        return(V_getStringFromHDF5(fname,path,num))
1798End
1799       
1800
1801
1802
1803///////  sample_aperture (1) (data folder)
1804// this is the INTERNAL sample aperture
1805//
1806Function/S V_getSampleAp_Description(fname)
1807        String fname
1808
1809        String path = "entry:instrument:sample_aperture:description"
1810        Variable num=60
1811        return(V_getStringFromHDF5(fname,path,num))
1812End
1813
1814Function V_getSampleAp_distance(fname)
1815        String fname
1816
1817        String path = "entry:instrument:sample_aperture:distance"
1818        return(V_getRealValueFromHDF5(fname,path))
1819End
1820
1821//      shape (data folder)
1822Function V_getSampleAp_height(fname)
1823        String fname
1824
1825        String path = "entry:instrument:sample_aperture:shape:height"
1826        return(V_getRealValueFromHDF5(fname,path))
1827End
1828
1829Function/S V_getSampleAp_shape(fname)
1830        String fname
1831
1832        String path = "entry:instrument:sample_aperture:shape:shape"
1833        Variable num=60
1834        return(V_getStringFromHDF5(fname,path,num))
1835End
1836
1837// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1838Function/S V_getSampleAp_size(fname)
1839        String fname
1840
1841        String path = "entry:instrument:sample_aperture:shape:size"
1842        Variable num=60
1843        return(V_getStringFromHDF5(fname,path,num))
1844End
1845
1846Function V_getSampleAp_width(fname)
1847        String fname
1848
1849        String path = "entry:instrument:sample_aperture:shape:width"
1850        return(V_getRealValueFromHDF5(fname,path))
1851End
1852
1853
1854
1855///////  sample_aperture_2 (data folder)
1856// sample aperture (2) is the external aperture, which may or may not be present
1857
1858Function/S V_getSampleAp2_Description(fname)
1859        String fname
1860
1861        String path = "entry:instrument:sample_aperture_2:description"
1862        Variable num=60
1863        return(V_getStringFromHDF5(fname,path,num))
1864End
1865
1866Function V_getSampleAp2_distance(fname)
1867        String fname
1868
1869        String path = "entry:instrument:sample_aperture_2:distance"
1870        return(V_getRealValueFromHDF5(fname,path))
1871End
1872
1873//      shape (data folder)
1874Function V_getSampleAp2_height(fname)
1875        String fname
1876
1877        String path = "entry:instrument:sample_aperture_2:shape:height"
1878        return(V_getRealValueFromHDF5(fname,path))
1879End
1880
1881Function/S V_getSampleAp2_shape(fname)
1882        String fname
1883
1884        String path = "entry:instrument:sample_aperture_2:shape:shape"
1885        Variable num=60
1886        return(V_getStringFromHDF5(fname,path,num))
1887End
1888
1889// this returns REAL, DIFFERENT than SampleAp1
1890Function V_getSampleAp2_size(fname)
1891        String fname
1892
1893        String path = "entry:instrument:sample_aperture_2:shape:size"
1894        return(V_getRealValueFromHDF5(fname,path))
1895End
1896
1897Function V_getSampleAp2_width(fname)
1898        String fname
1899
1900        String path = "entry:instrument:sample_aperture_2:shape:width"
1901        return(V_getRealValueFromHDF5(fname,path))
1902End
1903
1904       
1905//////  sample_table (data folder)
1906// location  = "CHAMBER" or HUBER
1907Function/S V_getSampleTableLocation(fname)
1908        String fname
1909
1910        String path = "entry:instrument:sample_table:location"
1911        Variable num=60
1912        return(V_getStringFromHDF5(fname,path,num))
1913End
1914
1915// TODO - verify the meaning
1916//      offset_distance (?? for center of sample table vs. sample position)
1917Function V_getSampleTableOffset(fname)
1918        String fname
1919
1920        String path = "entry:instrument:sample_table:offset_distance"
1921        return(V_getRealValueFromHDF5(fname,path))
1922End     
1923       
1924//  source (data folder)
1925//name "NCNR"
1926Function/S V_getSourceName(fname)
1927        String fname
1928
1929        String path = "entry:instrument:source:name"
1930        Variable num=60
1931        return(V_getStringFromHDF5(fname,path,num))
1932End
1933
1934//      power -- nominal only, not connected to any real number
1935Function V_getReactorPower(fname)
1936        String fname
1937
1938        String path = "entry:instrument:source:power"
1939        return(V_getRealValueFromHDF5(fname,path))
1940End     
1941
1942//probe (wave) "neutron"
1943Function/S V_getSourceProbe(fname)
1944        String fname
1945
1946        String path = "entry:instrument:source:probe"
1947        Variable num=60
1948        return(V_getStringFromHDF5(fname,path,num))
1949End
1950
1951//type (wave) "Reactor Neutron Source"
1952Function/S V_getSourceType(fname)
1953        String fname
1954
1955        String path = "entry:instrument:source:type"
1956        Variable num=60
1957        return(V_getStringFromHDF5(fname,path,num))
1958End
1959
1960       
1961///////  source_aperture (data folder)
1962
1963Function/S V_getSourceAp_Description(fname)
1964        String fname
1965
1966        String path = "entry:instrument:source_aperture:description"
1967        Variable num=60
1968        return(V_getStringFromHDF5(fname,path,num))
1969End
1970
1971Function V_getSourceAp_distance(fname)
1972        String fname
1973
1974        String path = "entry:instrument:source_aperture:distance"
1975        return(V_getRealValueFromHDF5(fname,path))
1976End
1977
1978//      shape (data folder)
1979Function V_getSourceAp_height(fname)
1980        String fname
1981
1982        String path = "entry:instrument:source_aperture:shape:height"
1983        return(V_getRealValueFromHDF5(fname,path))
1984End
1985
1986Function/S V_getSourceAp_shape(fname)
1987        String fname
1988
1989        String path = "entry:instrument:source_aperture:shape:shape"
1990        Variable num=60
1991        return(V_getStringFromHDF5(fname,path,num))
1992End
1993
1994// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1995Function/S V_getSourceAp_size(fname)
1996        String fname
1997
1998        String path = "entry:instrument:source_aperture:shape:size"
1999        Variable num=60
2000        return(V_getStringFromHDF5(fname,path,num))
2001End
2002
2003Function V_getSourceAp_width(fname)
2004        String fname
2005
2006        String path = "entry:instrument:source_aperture:shape:width"
2007        return(V_getRealValueFromHDF5(fname,path))
2008End
2009
2010
2011//////// SAMPLE
2012//////// SAMPLE
2013//////// SAMPLE
2014
2015//Sample position in changer (returned as TEXT)
2016Function/S V_getSamplePosition(fname)
2017        String fname
2018       
2019        String path = "entry:sample:changer_position"   
2020        Variable num=60
2021        return(V_getStringFromHDF5(fname,path,num))
2022end
2023
2024// sample label
2025Function/S V_getSampleDescription(fname)
2026        String fname
2027
2028        String path = "entry:sample:description"
2029        Variable num=60
2030        return(V_getStringFromHDF5(fname,path,num))
2031End
2032
2033// for a z-stage??
2034Function V_getSampleElevation(fname)
2035        String fname
2036       
2037        String path = "entry:sample:elevation" 
2038        return(V_getRealValueFromHDF5(fname,path))
2039end
2040
2041//no meaning to this...
2042Function V_getSample_equatorial_ang(fname)
2043        String fname
2044       
2045        String path = "entry:sample:equatorial_angle"   
2046        return(V_getRealValueFromHDF5(fname,path))
2047end
2048
2049// group ID !!! very important for matching up files
2050Function V_getSample_GroupID(fname)
2051        String fname
2052       
2053        String path = "entry:sample:group_id"   
2054        return(V_getRealValueFromHDF5(fname,path))
2055end
2056
2057
2058//Sample Rotation Angle
2059Function V_getSampleRotationAngle(fname)
2060        String fname
2061       
2062        String path = "entry:sample:rotation_angle"     
2063        return(V_getRealValueFromHDF5(fname,path))
2064end
2065
2066//?? this is huber/chamber??
2067// TODO -- then where is the description of 10CB, etc...
2068Function/S V_getSampleHolderDescription(fname)
2069        String fname
2070
2071        String path = "entry:sample:sample_holder_description"
2072        Variable num=60
2073        return(V_getStringFromHDF5(fname,path,num))
2074End
2075
2076Function V_getSampleTemperature(fname)
2077        String fname
2078       
2079        String path = "entry:sample:temperature"       
2080        return(V_getRealValueFromHDF5(fname,path))
2081end
2082
2083Function V_getSampleTempSetPoint(fname)
2084        String fname
2085       
2086        String path = "entry:sample:temperature_setpoint"       
2087        return(V_getRealValueFromHDF5(fname,path))
2088end
2089
2090
2091//Sample Thickness
2092// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
2093Function V_getSampleThickness(fname)
2094        String fname
2095       
2096        String path = "entry:sample:thickness" 
2097        return(V_getRealValueFromHDF5(fname,path))
2098end
2099
2100Function V_getSampleTranslation(fname)
2101        String fname
2102       
2103        String path = "entry:sample:translation"       
2104        return(V_getRealValueFromHDF5(fname,path))
2105end
2106
2107// sample transmission
2108Function V_getSampleTransmission(fname)
2109        String fname
2110       
2111        String path = "entry:sample:transmission"       
2112        return(V_getRealValueFromHDF5(fname,path))
2113end
2114
2115//transmission error (one sigma)
2116Function V_getSampleTransError(fname)
2117        String fname
2118       
2119        String path = "entry:sample:transmission_error"
2120        return(V_getRealValueFromHDF5(fname,path))
2121end
2122
2123
2124
2125//
2126// TODO -- this is all a big mess with the changes in the data file structure
2127//  in JUNE 2017, which completely wrecks what was decided in 2016.
2128// Now, I'm not sure at all what I'll get...or what the field will be called... or what they mean...
2129//
2130//
2131//// SAMPLE / DATA LOGS
2132// write this generic , call with the name of the environment log desired
2133//
2134//
2135// shear_field
2136// pressure
2137// magnetic_field
2138// electric_field
2139//
2140//////// (for example) electric_field (data folder)
2141
2142Function/S V_getLog_attachedTo(fname,logStr)
2143        String fname,logStr
2144
2145        String path = "entry:sample:"+logstr+":attached_to"
2146        Variable num=60
2147        return(V_getStringFromHDF5(fname,path,num))
2148End
2149
2150
2151Function/S V_getLog_measurement(fname,logStr)
2152        String fname,logStr
2153
2154        String path = "entry:sample:"+logstr+":measurement"
2155        Variable num=60
2156        return(V_getStringFromHDF5(fname,path,num))
2157End
2158
2159
2160Function/S V_getLog_Name(fname,logStr)
2161        String fname,logStr
2162
2163        String path = "entry:sample:"+logstr+":name"
2164        Variable num=60
2165        return(V_getStringFromHDF5(fname,path,num))
2166End
2167
2168
2169
2170// for temperature only, logStr = "temperature_env"
2171Function/S V_getTemp_ControlSensor(fname,logStr)
2172        String fname,logStr
2173
2174        String path = "entry:sample:"+logstr+":control_sensor"
2175        Variable num=60
2176        return(V_getStringFromHDF5(fname,path,num))
2177End
2178
2179// for temperature only, logStr = "temperature_env"
2180Function/S V_getTemp_MonitorSensor(fname,logStr)
2181        String fname,logStr
2182
2183        String path = "entry:sample:"+logstr+":monitor_sensor"
2184        Variable num=60
2185        return(V_getStringFromHDF5(fname,path,num))
2186End
2187
2188       
2189
2190//// TODO -- this may not exist if it is not a "controlling" sensor, but there still may be logged data present
2191//// TODO -- it may also have different names for each sensor (setpoint_1, setpoint_2, etc. which will be a big hassle)
2192//Function V_getLog_setPoint(fname,logStr)
2193//      String fname,logStr
2194//     
2195//      String path = "entry:sample:"+logstr+":setpoint_1"
2196//      return(V_getRealValueFromHDF5(fname,path))
2197//end
2198//
2199//Function/S V_getLog_startTime(fname,logStr)
2200//      String fname,logStr
2201//
2202//      String path = "entry:sample:"+logstr+":start"
2203//      Variable num=60
2204//      return(V_getStringFromHDF5(fname,path,num))
2205//End
2206//
2207//
2208//// TODO -- this may only exist for electric field and magnetic field...
2209//// or may be eliminated altogether
2210//Function V_getLog_nomValue(fname,logStr)
2211//      String fname,logStr
2212//     
2213//      String path = "entry:sample:"+logstr+":value"
2214//      return(V_getRealValueFromHDF5(fname,path))
2215//end
2216
2217
2218
2219///////////
2220// for temperature, the "attached_to", "measurement", and "name" fields
2221// are one level down farther than before, and down deeper than for other sensors
2222//
2223//
2224// read the value of V_getTemp_MonitorSensor/ControlSensor to get the name of the sensor level .
2225//
2226
2227Function/S V_getTempLog_attachedTo(fname,logStr)
2228        String fname,logStr
2229
2230        String path = "entry:sample:temperature_env:"+logstr+":attached_to"
2231        Variable num=60
2232        return(V_getStringFromHDF5(fname,path,num))
2233End
2234
2235Function V_getTempLog_highTrip(fname,logStr)
2236        String fname,logStr
2237       
2238        String path = "entry:sample:temperature_env:"+logstr+":high_trip_value"
2239        return(V_getRealValueFromHDF5(fname,path))
2240end
2241
2242Function V_getTempLog_holdTime(fname,logStr)
2243        String fname,logStr
2244       
2245        String path = "entry:sample:temperature_env:"+logstr+":hold_time"
2246        return(V_getRealValueFromHDF5(fname,path))
2247end
2248
2249Function V_getTempLog_lowTrip(fname,logStr)
2250        String fname,logStr
2251       
2252        String path = "entry:sample:temperature_env:"+logstr+":low_trip_value"
2253        return(V_getRealValueFromHDF5(fname,path))
2254end
2255
2256Function/S V_getTempLog_measurement(fname,logStr)
2257        String fname,logStr
2258
2259        String path = "entry:sample:temperature_env:"+logstr+":measurement"
2260        Variable num=60
2261        return(V_getStringFromHDF5(fname,path,num))
2262End
2263
2264
2265Function/S V_getTempLog_Model(fname,logStr)
2266        String fname,logStr
2267
2268        String path = "entry:sample:temperature_env:"+logstr+":model"
2269        Variable num=60
2270        return(V_getStringFromHDF5(fname,path,num))
2271End
2272
2273Function/S V_getTempLog_Name(fname,logStr)
2274        String fname,logStr
2275
2276        String path = "entry:sample:temperature_env:"+logstr+":name"
2277        Variable num=60
2278        return(V_getStringFromHDF5(fname,path,num))
2279End
2280
2281Function V_getTempLog_runControl(fname,logStr)
2282        String fname,logStr
2283       
2284        String path = "entry:sample:temperature_env:"+logstr+":run_control"
2285        return(V_getRealValueFromHDF5(fname,path))
2286end
2287
2288Function V_getTempLog_Setpoint(fname,logStr)
2289        String fname,logStr
2290       
2291        String path = "entry:sample:temperature_env:"+logstr+":setpoint"
2292        return(V_getRealValueFromHDF5(fname,path))
2293end
2294
2295Function/S V_getTempLog_ShortName(fname,logStr)
2296        String fname,logStr
2297
2298        String path = "entry:sample:temperature_env:"+logstr+":short_name"
2299        Variable num=60
2300        return(V_getStringFromHDF5(fname,path,num))
2301End
2302
2303Function V_getTempLog_Timeout(fname,logStr)
2304        String fname,logStr
2305       
2306        String path = "entry:sample:temperature_env:"+logstr+":timeout"
2307        return(V_getRealValueFromHDF5(fname,path))
2308end
2309
2310Function V_getTempLog_Tolerance(fname,logStr)
2311        String fname,logStr
2312       
2313        String path = "entry:sample:temperature_env:"+logstr+":tolerance"
2314        return(V_getRealValueFromHDF5(fname,path))
2315end
2316
2317Function V_getTempLog_ToleranceBand(fname,logStr)
2318        String fname,logStr
2319       
2320        String path = "entry:sample:temperature_env:"+logstr+":tolerance_band_time"
2321        return(V_getRealValueFromHDF5(fname,path))
2322end
2323
2324Function V_getTempLog_Value(fname,logStr)
2325        String fname,logStr
2326       
2327        String path = "entry:sample:temperature_env:"+logstr+":value"
2328        return(V_getRealValueFromHDF5(fname,path))
2329end
2330
2331
2332
2333
2334
2335
2336//
2337// temperature_env:temp_Internal_1:value_log
2338//
2339////            value_log (data folder)
2340//
2341// TODO:
2342// -- be sure that the calling function properly calls for temperture
2343// logs which are down an extra layer:
2344//      for example, logStr = "temperature_env:temp_Internal_1"
2345//
2346// read the value of V_getTemp_MonitorSensor to get the name of the sensor the next level down.
2347//
2348Function V_getLog_avgValue(fname,logStr)
2349        String fname,logStr
2350       
2351        String path = "entry:sample:"+logstr+":value_log:average_value"
2352        return(V_getRealValueFromHDF5(fname,path))
2353end
2354
2355Function V_getLog_avgValue_err(fname,logStr)
2356        String fname,logStr
2357       
2358        String path = "entry:sample:"+logstr+":value_log:average_value_error"
2359        return(V_getRealValueFromHDF5(fname,path))
2360end
2361
2362Function V_getLog_maximumValue(fname,logStr)
2363        String fname,logStr
2364       
2365        String path = "entry:sample:"+logstr+":value_log:maximum_value"
2366        return(V_getRealValueFromHDF5(fname,path))
2367end
2368
2369Function V_getLog_medianValue(fname,logStr)
2370        String fname,logStr
2371       
2372        String path = "entry:sample:"+logstr+":value_log:median_value"
2373        return(V_getRealValueFromHDF5(fname,path))
2374end
2375
2376Function V_getLog_minimumValue(fname,logStr)
2377        String fname,logStr
2378       
2379        String path = "entry:sample:"+logstr+":value_log:minimum_value"
2380        return(V_getRealValueFromHDF5(fname,path))
2381end
2382
2383// DONE -- this needs to be a WAVE reference
2384// DONE -- verify that the field is really read in as "time0"
2385Function V_getLog_timeWave(fname,logStr,outW)
2386        String fname,logStr
2387        Wave outW
2388       
2389        String path = "entry:sample:"+logstr+":value_log:time0"
2390        WAVE w = V_getRealWaveFromHDF5(fname,path)
2391
2392        outW = w
2393        return(0)
2394end
2395
2396// DONE -- this needs to be a WAVE reference
2397Function V_getLog_ValueWave(fname,logStr,outW)
2398        String fname,logStr
2399        Wave outW
2400       
2401        String path = "entry:sample:"+logstr+":value_log:value"
2402        WAVE w = V_getRealWaveFromHDF5(fname,path)
2403
2404        outW = w
2405        return(0)
2406end
2407
2408
2409
2410
2411
2412
2413
2414///////// REDUCTION
2415///////// REDUCTION
2416///////// REDUCTION
2417
2418
2419Function/WAVE V_getAbsolute_Scaling(fname)
2420        String fname
2421       
2422        String path = "entry:reduction:absolute_scaling"       
2423        WAVE w = V_getRealWaveFromHDF5(fname,path)
2424       
2425        return w
2426end
2427
2428Function/S V_getBackgroundFileName(fname)
2429        String fname
2430
2431        String path = "entry:reduction:background_file_name"   
2432        Variable num=60
2433        return(V_getStringFromHDF5(fname,path,num))
2434End
2435
2436Function/WAVE V_getBoxCoordinates(fname)
2437        String fname
2438       
2439        String path = "entry:reduction:box_coordinates"
2440        WAVE w = V_getRealWaveFromHDF5(fname,path)
2441
2442        return w
2443end
2444
2445//box counts
2446Function V_getBoxCounts(fname)
2447        String fname
2448       
2449        String path = "entry:reduction:box_count"       
2450        return(V_getRealValueFromHDF5(fname,path))
2451end
2452
2453//box counts error
2454Function V_getBoxCountsError(fname)
2455        String fname
2456       
2457        String path = "entry:reduction:box_count_error"
2458        return(V_getRealValueFromHDF5(fname,path))
2459end
2460
2461Function/S V_getReductionComments(fname)
2462        String fname
2463
2464        String path = "entry:reduction:comments"       
2465        Variable num=60
2466        return(V_getStringFromHDF5(fname,path,num))
2467End
2468
2469
2470Function/S V_getEmptyBeamFileName(fname)
2471        String fname
2472
2473        String path = "entry:reduction:empty_beam_file_name"   
2474        Variable num=60
2475        return(V_getStringFromHDF5(fname,path,num))
2476End
2477
2478Function/S V_getEmptyFileName(fname)
2479        String fname
2480
2481        String path = "entry:reduction:empty_file_name"
2482        Variable num=60
2483        return(V_getStringFromHDF5(fname,path,num))
2484End
2485
2486// this is (presumably) the polarization "intent"
2487Function/S V_getReduction_polSANSPurpose(fname)
2488        String fname
2489
2490        String path = "entry:reduction:file_purpose"   
2491        Variable num=60
2492        return(V_getStringFromHDF5(fname,path,num))
2493End
2494
2495////group ID
2496//// DONE
2497//// x- is this duplicated?
2498//// x- yes, this is a duplicated field in the /entry/sample block (and is probably more appropriate there)
2499//// x- so pick a single location, rather than needing to duplicate.
2500//// x- REPLACE with a single function V_getSample_GroupID()
2501////
2502//Function V_getSample_group_ID(fname)
2503//      String fname
2504//
2505//// do not use the entry/reduction location
2506////    String path = "entry:reduction:group_id"
2507//      String path = "entry:sample:group_id"   
2508//
2509//      return(V_getRealValueFromHDF5(fname,path))
2510//end
2511
2512Function/S V_getReduction_intent(fname)
2513        String fname
2514
2515        String path = "entry:reduction:intent" 
2516        Variable num=60
2517        return(V_getStringFromHDF5(fname,path,num))
2518End
2519
2520Function/S V_getMaskFileName(fname)
2521        String fname
2522
2523        String path = "entry:reduction:mask_file_name" 
2524        Variable num=60
2525        return(V_getStringFromHDF5(fname,path,num))
2526End
2527
2528Function/S V_getLogFileName(fname)
2529        String fname
2530
2531        String path = "entry:reduction:sans_log_file_name"     
2532        Variable num=60
2533        return(V_getStringFromHDF5(fname,path,num))
2534End
2535
2536Function/S V_getSensitivityFileName(fname)
2537        String fname
2538
2539        String path = "entry:reduction:sensitivity_file_name"   
2540        Variable num=60
2541        return(V_getStringFromHDF5(fname,path,num))
2542End
2543
2544Function/S V_getTransmissionFileName(fname)
2545        String fname
2546
2547        String path = "entry:reduction:transmission_file_name" 
2548        Variable num=60
2549        return(V_getStringFromHDF5(fname,path,num))
2550End
2551
2552//whole detector trasmission
2553Function V_getSampleTransWholeDetector(fname)
2554        String fname
2555       
2556        String path = "entry:reduction:whole_trans"     
2557        return(V_getRealValueFromHDF5(fname,path))
2558end
2559
2560//whole detector trasmission error
2561Function V_getSampleTransWholeDetErr(fname)
2562        String fname
2563       
2564        String path = "entry:reduction:whole_trans_error"       
2565        return(V_getRealValueFromHDF5(fname,path))
2566end
2567
2568// this is a NON NICE entered field
2569// so I need to catch the error if it's not there
2570Function/WAVE V_getReductionProtocolWave(fname)
2571        String fname
2572       
2573        String path = "entry:reduction:protocol"       
2574        WAVE/T/Z tw = V_getTextWaveFromHDF5(fname,path)
2575       
2576        if(waveExists(tw))
2577                return tw
2578        else
2579                Make/O/T/N=0 nullTextWave
2580                return nullTextWave
2581        endif
2582       
2583end
2584       
2585
2586
2587
2588// these have all been moved elsewhere                 
2589///////                 pol_sans (data folder)
2590//
2591//Function/S V_getPolSANS_cellName(fname)
2592//      String fname
2593//
2594//      String path = "entry:reduction:pol_sans:cell_name"     
2595//      Variable num=60
2596//      return(V_getStringFromHDF5(fname,path,num))
2597//End
2598//
2599//
2600//Function/WAVE V_getPolSANS_cellParams(fname)
2601//      String fname
2602//     
2603//      String path = "entry:reduction:pol_sans:cell_parameters"       
2604//      WAVE w = V_getRealWaveFromHDF5(fname,path)
2605//
2606//      return w
2607//end
2608//
2609//Function/S V_getPolSANS_PolSANSPurpose(fname)
2610//      String fname
2611//
2612//      String path = "entry:reduction:pol_sans:pol_sans_purpose"       
2613//      Variable num=60
2614//      return(V_getStringFromHDF5(fname,path,num))
2615//End
2616
2617                               
2618//////// TOP LEVEL DATA REPRESENTATION
2619//
2620// note that here the data is (supposed to be) a link, not the actual data
2621// Igor HDf implementation cannot follow links properly, as far as I know.
2622// so ignore them here, and focus on the image that may be possible to read
2623//
2624
2625//              data_B (data folder)
2626//                      data (wave) 1           //ignore this, it's a link
2627//                      variables (wave) 320
2628//                      thumbnail (data folder)
2629
2630////data (wave) "binary"
2631//// TODO -- this will need to be completely replaced with a function that can
2632//// read the binary image data. should be possible, but I don't know the details on either end...
2633//Function/S V_getDataImage(fname,detStr)
2634//      String fname,detStr
2635//
2636//      String path = "entry:data_"+detStr+":thumbnail:data"   
2637//      Variable num=60
2638//      return(V_getStringFromHDF5(fname,path,num))
2639//End
2640//
2641//Function/S V_getDataImageDescription(fname,detStr)
2642//      String fname,detStr
2643//
2644//      String path = "entry:data_"+detStr+":thumbnail:description"     
2645//      Variable num=60
2646//      return(V_getStringFromHDF5(fname,path,num))
2647//End
2648//                                                             
2649//Function/S V_getDataImageType(fname,detStr)
2650//      String fname,detStr
2651//
2652//      String path = "entry:data_"+detStr+":thumbnail:type"   
2653//      Variable num=60
2654//      return(V_getStringFromHDF5(fname,path,num))
2655//End
2656//
2657//
2658
2659
Note: See TracBrowser for help on using the repository browser.