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

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

a few quick bug fixes

File size: 61.5 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
1460
1461Function/WAVE V_getDetectorDataW(fname,detStr)
1462        String fname,detStr
1463
1464        String path = "entry:instrument:detector_"+detStr+":data"
1465        WAVE w = V_getRealWaveFromHDF5(fname,path)
1466
1467        return w
1468End
1469
1470//
1471// TODO -- this does not exist in the raw data, but does in the processed data
1472// !!! how to handle this?? Binning routines need the error wave
1473//
1474Function/WAVE V_getDetectorDataErrW(fname,detStr)
1475        String fname,detStr
1476
1477        String path = "entry:instrument:detector_"+detStr+":linear_data_error"
1478        WAVE w = V_getRealWaveFromHDF5(fname,path)
1479
1480        return w
1481End
1482
1483// TODO -- write this function to return a WAVE with the data
1484// either as a wave reference, or as an input parameter
1485// ALSO -- the "B" deadtime will be a single value (probably)
1486//  but the tube banks will be 1D arrays of values, one per tube
1487Function/WAVE V_getDetector_deadtime(fname,detStr)
1488        String fname,detStr
1489
1490        String path = "entry:instrument:detector_"+detStr+":dead_time"
1491        if(cmpstr(detStr,"B") == 0)
1492                return $""
1493        else   
1494                WAVE w = V_getRealWaveFromHDF5(fname,path)
1495                return w
1496        endif
1497End
1498
1499// for "B" only
1500Function V_getDetector_deadtime_B(fname,detStr)
1501        String fname,detStr
1502
1503        String path = "entry:instrument:detector_"+detStr+":dead_time"
1504        if(cmpstr(detStr,"B") == 0)
1505                return(V_getRealValueFromHDF5(fname,path))
1506        else   
1507                return(0)
1508        endif
1509End
1510
1511Function/S V_getDetDescription(fname,detStr)
1512        String fname,detStr
1513
1514        String path = "entry:instrument:detector_"+detStr+":description"
1515        Variable num=60
1516        return(V_getStringFromHDF5(fname,path,num))
1517End
1518
1519Function V_getDet_NominalDistance(fname,detStr)
1520        String fname,detStr
1521
1522        String path = "entry:instrument:detector_"+detStr+":distance"
1523        return(V_getRealValueFromHDF5(fname,path))
1524End
1525
1526//this is a DERIVED distance, since the nominal sdd is for the carriage (=LR panels)
1527Function V_getDet_ActualDistance(fname,detStr)
1528        String fname,detStr
1529
1530        Variable sdd
1531        sdd = V_getDet_NominalDistance(fname,detStr)            //[cm]
1532        sdd += V_getDet_TBSetback(fname,detStr)/10              // written in [mm], convert to [cm], returns 0 for L/R/B panels
1533               
1534        return(sdd)
1535End
1536
1537//// only defined for the "B" detector, and only to satisfy NXsas
1538//Function V_getDet_equatorial_angle(fname,detStr)
1539//      String fname,detStr
1540//
1541//      if(cmpstr(detStr,"B") == 0)
1542//              String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1543//              return(V_getRealValueFromHDF5(fname,path))
1544//      else
1545//              return(0)
1546//      endif
1547//End
1548
1549Function/S V_getDetEventFileName(fname,detStr)
1550        String fname,detStr
1551
1552        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1553        Variable num=60
1554        return(V_getStringFromHDF5(fname,path,num))
1555End
1556
1557Function V_getDet_IntegratedCount(fname,detStr)
1558        String fname,detStr
1559
1560        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1561        return(V_getRealValueFromHDF5(fname,path))
1562End
1563
1564// only return value for B and L/R detectors. everything else returns zero
1565Function V_getDet_LateralOffset(fname,detStr)
1566        String fname,detStr
1567
1568        if(cmpstr(detStr,"FT") == 0 || cmpstr(detStr,"FB") == 0)
1569                return(0)
1570        endif
1571        if(cmpstr(detStr,"MT") == 0 || cmpstr(detStr,"MB") == 0)
1572                return(0)
1573        endif   
1574       
1575        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1576        return(V_getRealValueFromHDF5(fname,path))
1577End
1578
1579// only return values for T/B. everything else returns zero
1580Function V_getDet_VerticalOffset(fname,detStr)
1581        String fname,detStr
1582
1583        if(cmpstr(detStr,"B") == 0)
1584                return(0)
1585        endif
1586        if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0)
1587                return(0)
1588        endif
1589        if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0)
1590                return(0)
1591        endif   
1592       
1593        String path = "entry:instrument:detector_"+detStr+":vertical_offset"
1594        return(V_getRealValueFromHDF5(fname,path))
1595End
1596
1597// TODO - be sure this is defined correctly (with correct units!)
1598// -- only returns for T/B detectors
1599Function V_getDet_TBSetback(fname,detStr)
1600        String fname,detStr
1601
1602        if(cmpstr(detStr,"B") == 0)
1603                return(0)
1604        endif
1605        if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0)
1606                return(0)
1607        endif
1608        if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0)
1609                return(0)
1610        endif   
1611       
1612        String path = "entry:instrument:detector_"+detStr+":setback"
1613        return(V_getRealValueFromHDF5(fname,path))
1614       
1615       
1616End
1617
1618
1619Function/S V_getDetSettings(fname,detStr)
1620        String fname,detStr
1621
1622        String path = "entry:instrument:detector_"+detStr+":settings"
1623        Variable num=60
1624        return(V_getStringFromHDF5(fname,path,num))
1625End
1626
1627
1628Function V_getDet_x_pixel_size(fname,detStr)
1629        String fname,detStr
1630
1631        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1632        return(V_getRealValueFromHDF5(fname,path))
1633End
1634
1635Function V_getDet_y_pixel_size(fname,detStr)
1636        String fname,detStr
1637
1638        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1639        return(V_getRealValueFromHDF5(fname,path))
1640End
1641
1642/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1643
1644Function V_getDet_numberOfTubes(fname,detStr)
1645        String fname,detStr
1646
1647        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1648        if(cmpstr(detStr,"B") == 0)
1649                return(0)
1650        else
1651                return(V_getRealValueFromHDF5(fname,path))
1652        endif
1653End
1654
1655
1656// DONE -- write this function to return a WAVE with the data
1657// either as a wave reference, or as an input parameter
1658Function/WAVE V_getDetTube_spatialCalib(fname,detStr)
1659        String fname,detStr
1660
1661        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1662        if(cmpstr(detStr,"B") == 0)
1663                return $("")    // return should be null
1664        else
1665                WAVE w = V_getRealWaveFromHDF5(fname,path)
1666                return w
1667        endif
1668End
1669
1670
1671Function/S V_getDet_tubeOrientation(fname,detStr)
1672        String fname,detStr
1673
1674        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1675        Variable num=60
1676        if(cmpstr(detStr,"B") == 0)
1677                return("")
1678        else
1679                return(V_getStringFromHDF5(fname,path,num))
1680        endif
1681End
1682
1683// TODO -- be clear on how this is defined. Units?
1684Function V_getDet_tubeWidth(fname,detStr)
1685        String fname,detStr
1686
1687        String path = "entry:instrument:detector_"+detStr+":tube_width"
1688        if(cmpstr(detStr,"B") == 0)
1689                return(0)
1690        else
1691                return(V_getRealValueFromHDF5(fname,path))
1692        endif
1693End
1694
1695//////////////////////
1696
1697// INSTRUMENT/LENSES
1698//  lenses (data folder)
1699
1700Function V_getLensCurvature(fname)
1701        String fname
1702
1703        String path = "entry:instrument:lenses:curvature"
1704        return(V_getRealValueFromHDF5(fname,path))
1705End
1706
1707Function/S V_getLensesFocusType(fname)
1708        String fname
1709
1710        String path = "entry:instrument:lenses:focus_type"
1711        Variable num=60
1712        return(V_getStringFromHDF5(fname,path,num))
1713End
1714
1715Function V_getLensDistance(fname)
1716        String fname
1717
1718        String path = "entry:instrument:lenses:lens_distance"
1719        return(V_getRealValueFromHDF5(fname,path))
1720End
1721
1722Function/S V_getLensGeometry(fname)
1723        String fname
1724
1725        String path = "entry:instrument:lenses:lens_geometry"
1726        Variable num=60
1727        return(V_getStringFromHDF5(fname,path,num))
1728End
1729
1730Function/S V_getLensMaterial(fname)
1731        String fname
1732
1733        String path = "entry:instrument:lenses:lens_material"
1734        Variable num=60
1735        return(V_getStringFromHDF5(fname,path,num))
1736End
1737
1738Function V_getNumber_of_Lenses(fname)
1739        String fname
1740
1741        String path = "entry:instrument:lenses:number_of_lenses"
1742        return(V_getRealValueFromHDF5(fname,path))
1743End
1744
1745Function V_getNumber_of_prisms(fname)
1746        String fname
1747
1748        String path = "entry:instrument:lenses:number_of_prisms"
1749        return(V_getRealValueFromHDF5(fname,path))
1750End
1751
1752Function V_getPrism_distance(fname)
1753        String fname
1754
1755        String path = "entry:instrument:lenses:prism_distance"
1756        return(V_getRealValueFromHDF5(fname,path))
1757End
1758
1759Function/S V_getPrismMaterial(fname)
1760        String fname
1761
1762        String path = "entry:instrument:lenses:prism_material"
1763        Variable num=60
1764        return(V_getStringFromHDF5(fname,path,num))
1765End
1766
1767// status of lens/prism = lens | prism | both | out
1768Function/S V_getLensPrismStatus(fname)
1769        String fname
1770
1771        String path = "entry:instrument:lenses:status"
1772        Variable num=60
1773        return(V_getStringFromHDF5(fname,path,num))
1774End
1775       
1776
1777
1778
1779///////  sample_aperture (1) (data folder)
1780// this is the INTERNAL sample aperture
1781//
1782Function/S V_getSampleAp_Description(fname)
1783        String fname
1784
1785        String path = "entry:instrument:sample_aperture:description"
1786        Variable num=60
1787        return(V_getStringFromHDF5(fname,path,num))
1788End
1789
1790Function V_getSampleAp_distance(fname)
1791        String fname
1792
1793        String path = "entry:instrument:sample_aperture:distance"
1794        return(V_getRealValueFromHDF5(fname,path))
1795End
1796
1797//      shape (data folder)
1798Function V_getSampleAp_height(fname)
1799        String fname
1800
1801        String path = "entry:instrument:sample_aperture:shape:height"
1802        return(V_getRealValueFromHDF5(fname,path))
1803End
1804
1805Function/S V_getSampleAp_shape(fname)
1806        String fname
1807
1808        String path = "entry:instrument:sample_aperture:shape:shape"
1809        Variable num=60
1810        return(V_getStringFromHDF5(fname,path,num))
1811End
1812
1813// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1814Function/S V_getSampleAp_size(fname)
1815        String fname
1816
1817        String path = "entry:instrument:sample_aperture:shape:size"
1818        Variable num=60
1819        return(V_getStringFromHDF5(fname,path,num))
1820End
1821
1822Function V_getSampleAp_width(fname)
1823        String fname
1824
1825        String path = "entry:instrument:sample_aperture:shape:width"
1826        return(V_getRealValueFromHDF5(fname,path))
1827End
1828
1829
1830
1831///////  sample_aperture_2 (data folder)
1832// sample aperture (2) is the external aperture, which may or may not be present
1833
1834Function/S V_getSampleAp2_Description(fname)
1835        String fname
1836
1837        String path = "entry:instrument:sample_aperture_2:description"
1838        Variable num=60
1839        return(V_getStringFromHDF5(fname,path,num))
1840End
1841
1842Function V_getSampleAp2_distance(fname)
1843        String fname
1844
1845        String path = "entry:instrument:sample_aperture_2:distance"
1846        return(V_getRealValueFromHDF5(fname,path))
1847End
1848
1849//      shape (data folder)
1850Function V_getSampleAp2_height(fname)
1851        String fname
1852
1853        String path = "entry:instrument:sample_aperture_2:shape:height"
1854        return(V_getRealValueFromHDF5(fname,path))
1855End
1856
1857Function/S V_getSampleAp2_shape(fname)
1858        String fname
1859
1860        String path = "entry:instrument:sample_aperture_2:shape:shape"
1861        Variable num=60
1862        return(V_getStringFromHDF5(fname,path,num))
1863End
1864
1865// this returns REAL, DIFFERENT than SampleAp1
1866Function V_getSampleAp2_size(fname)
1867        String fname
1868
1869        String path = "entry:instrument:sample_aperture_2:shape:size"
1870        return(V_getRealValueFromHDF5(fname,path))
1871End
1872
1873Function V_getSampleAp2_width(fname)
1874        String fname
1875
1876        String path = "entry:instrument:sample_aperture_2:shape:width"
1877        return(V_getRealValueFromHDF5(fname,path))
1878End
1879
1880       
1881//////  sample_table (data folder)
1882// location  = "CHAMBER" or HUBER
1883Function/S V_getSampleTableLocation(fname)
1884        String fname
1885
1886        String path = "entry:instrument:sample_table:location"
1887        Variable num=60
1888        return(V_getStringFromHDF5(fname,path,num))
1889End
1890
1891// TODO - verify the meaning
1892//      offset_distance (?? for center of sample table vs. sample position)
1893Function V_getSampleTableOffset(fname)
1894        String fname
1895
1896        String path = "entry:instrument:sample_table:offset_distance"
1897        return(V_getRealValueFromHDF5(fname,path))
1898End     
1899       
1900//  source (data folder)
1901//name "NCNR"
1902Function/S V_getSourceName(fname)
1903        String fname
1904
1905        String path = "entry:instrument:source:name"
1906        Variable num=60
1907        return(V_getStringFromHDF5(fname,path,num))
1908End
1909
1910//      power -- nominal only, not connected to any real number
1911Function V_getReactorPower(fname)
1912        String fname
1913
1914        String path = "entry:instrument:source:power"
1915        return(V_getRealValueFromHDF5(fname,path))
1916End     
1917
1918//probe (wave) "neutron"
1919Function/S V_getSourceProbe(fname)
1920        String fname
1921
1922        String path = "entry:instrument:source:probe"
1923        Variable num=60
1924        return(V_getStringFromHDF5(fname,path,num))
1925End
1926
1927//type (wave) "Reactor Neutron Source"
1928Function/S V_getSourceType(fname)
1929        String fname
1930
1931        String path = "entry:instrument:source:type"
1932        Variable num=60
1933        return(V_getStringFromHDF5(fname,path,num))
1934End
1935
1936       
1937///////  source_aperture (data folder)
1938
1939Function/S V_getSourceAp_Description(fname)
1940        String fname
1941
1942        String path = "entry:instrument:source_aperture:description"
1943        Variable num=60
1944        return(V_getStringFromHDF5(fname,path,num))
1945End
1946
1947Function V_getSourceAp_distance(fname)
1948        String fname
1949
1950        String path = "entry:instrument:source_aperture:distance"
1951        return(V_getRealValueFromHDF5(fname,path))
1952End
1953
1954//      shape (data folder)
1955Function V_getSourceAp_height(fname)
1956        String fname
1957
1958        String path = "entry:instrument:source_aperture:shape:height"
1959        return(V_getRealValueFromHDF5(fname,path))
1960End
1961
1962Function/S V_getSourceAp_shape(fname)
1963        String fname
1964
1965        String path = "entry:instrument:source_aperture:shape:shape"
1966        Variable num=60
1967        return(V_getStringFromHDF5(fname,path,num))
1968End
1969
1970// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1971Function/S V_getSourceAp_size(fname)
1972        String fname
1973
1974        String path = "entry:instrument:source_aperture:shape:size"
1975        Variable num=60
1976        return(V_getStringFromHDF5(fname,path,num))
1977End
1978
1979Function V_getSourceAp_width(fname)
1980        String fname
1981
1982        String path = "entry:instrument:source_aperture:shape:width"
1983        return(V_getRealValueFromHDF5(fname,path))
1984End
1985
1986
1987//////// SAMPLE
1988//////// SAMPLE
1989//////// SAMPLE
1990
1991//Sample position in changer (returned as TEXT)
1992Function/S V_getSamplePosition(fname)
1993        String fname
1994       
1995        String path = "entry:sample:changer_position"   
1996        Variable num=60
1997        return(V_getStringFromHDF5(fname,path,num))
1998end
1999
2000// sample label
2001Function/S V_getSampleDescription(fname)
2002        String fname
2003
2004        String path = "entry:sample:description"
2005        Variable num=60
2006        return(V_getStringFromHDF5(fname,path,num))
2007End
2008
2009// for a z-stage??
2010Function V_getSampleElevation(fname)
2011        String fname
2012       
2013        String path = "entry:sample:elevation" 
2014        return(V_getRealValueFromHDF5(fname,path))
2015end
2016
2017//no meaning to this...
2018Function V_getSample_equatorial_ang(fname)
2019        String fname
2020       
2021        String path = "entry:sample:equatorial_angle"   
2022        return(V_getRealValueFromHDF5(fname,path))
2023end
2024
2025// group ID !!! very important for matching up files
2026Function V_getSample_GroupID(fname)
2027        String fname
2028       
2029        String path = "entry:sample:group_id"   
2030        return(V_getRealValueFromHDF5(fname,path))
2031end
2032
2033
2034//Sample Rotation Angle
2035Function V_getSampleRotationAngle(fname)
2036        String fname
2037       
2038        String path = "entry:sample:rotation_angle"     
2039        return(V_getRealValueFromHDF5(fname,path))
2040end
2041
2042//?? this is huber/chamber??
2043// TODO -- then where is the description of 10CB, etc...
2044Function/S V_getSampleHolderDescription(fname)
2045        String fname
2046
2047        String path = "entry:sample:sample_holder_description"
2048        Variable num=60
2049        return(V_getStringFromHDF5(fname,path,num))
2050End
2051
2052Function V_getSampleTemperature(fname)
2053        String fname
2054       
2055        String path = "entry:sample:temperature"       
2056        return(V_getRealValueFromHDF5(fname,path))
2057end
2058
2059Function V_getSampleTempSetPoint(fname)
2060        String fname
2061       
2062        String path = "entry:sample:temperature_setpoint"       
2063        return(V_getRealValueFromHDF5(fname,path))
2064end
2065
2066
2067//Sample Thickness
2068// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
2069Function V_getSampleThickness(fname)
2070        String fname
2071       
2072        String path = "entry:sample:thickness" 
2073        return(V_getRealValueFromHDF5(fname,path))
2074end
2075
2076Function V_getSampleTranslation(fname)
2077        String fname
2078       
2079        String path = "entry:sample:translation"       
2080        return(V_getRealValueFromHDF5(fname,path))
2081end
2082
2083// sample transmission
2084Function V_getSampleTransmission(fname)
2085        String fname
2086       
2087        String path = "entry:sample:transmission"       
2088        return(V_getRealValueFromHDF5(fname,path))
2089end
2090
2091//transmission error (one sigma)
2092Function V_getSampleTransError(fname)
2093        String fname
2094       
2095        String path = "entry:sample:transmission_error"
2096        return(V_getRealValueFromHDF5(fname,path))
2097end
2098
2099
2100
2101//
2102// TODO -- this is all a big mess with the changes in the data file structure
2103//  in JUNE 2017, which completely wrecks what was decided in 2016.
2104// Now, I'm not sure at all what I'll get...or what the field will be called... or what they mean...
2105//
2106//
2107//// SAMPLE / DATA LOGS
2108// write this generic , call with the name of the environment log desired
2109//
2110//
2111// shear_field
2112// pressure
2113// magnetic_field
2114// electric_field
2115//
2116//////// (for example) electric_field (data folder)
2117
2118Function/S V_getLog_attachedTo(fname,logStr)
2119        String fname,logStr
2120
2121        String path = "entry:sample:"+logstr+":attached_to"
2122        Variable num=60
2123        return(V_getStringFromHDF5(fname,path,num))
2124End
2125
2126
2127Function/S V_getLog_measurement(fname,logStr)
2128        String fname,logStr
2129
2130        String path = "entry:sample:"+logstr+":measurement"
2131        Variable num=60
2132        return(V_getStringFromHDF5(fname,path,num))
2133End
2134
2135
2136Function/S V_getLog_Name(fname,logStr)
2137        String fname,logStr
2138
2139        String path = "entry:sample:"+logstr+":name"
2140        Variable num=60
2141        return(V_getStringFromHDF5(fname,path,num))
2142End
2143
2144
2145
2146// for temperature only, logStr = "temperature_env"
2147Function/S V_getTemp_ControlSensor(fname,logStr)
2148        String fname,logStr
2149
2150        String path = "entry:sample:"+logstr+":control_sensor"
2151        Variable num=60
2152        return(V_getStringFromHDF5(fname,path,num))
2153End
2154
2155// for temperature only, logStr = "temperature_env"
2156Function/S V_getTemp_MonitorSensor(fname,logStr)
2157        String fname,logStr
2158
2159        String path = "entry:sample:"+logstr+":monitor_sensor"
2160        Variable num=60
2161        return(V_getStringFromHDF5(fname,path,num))
2162End
2163
2164       
2165
2166//// TODO -- this may not exist if it is not a "controlling" sensor, but there still may be logged data present
2167//// TODO -- it may also have different names for each sensor (setpoint_1, setpoint_2, etc. which will be a big hassle)
2168//Function V_getLog_setPoint(fname,logStr)
2169//      String fname,logStr
2170//     
2171//      String path = "entry:sample:"+logstr+":setpoint_1"
2172//      return(V_getRealValueFromHDF5(fname,path))
2173//end
2174//
2175//Function/S V_getLog_startTime(fname,logStr)
2176//      String fname,logStr
2177//
2178//      String path = "entry:sample:"+logstr+":start"
2179//      Variable num=60
2180//      return(V_getStringFromHDF5(fname,path,num))
2181//End
2182//
2183//
2184//// TODO -- this may only exist for electric field and magnetic field...
2185//// or may be eliminated altogether
2186//Function V_getLog_nomValue(fname,logStr)
2187//      String fname,logStr
2188//     
2189//      String path = "entry:sample:"+logstr+":value"
2190//      return(V_getRealValueFromHDF5(fname,path))
2191//end
2192
2193
2194
2195///////////
2196// for temperature, the "attached_to", "measurement", and "name" fields
2197// are one level down farther than before, and down deeper than for other sensors
2198//
2199//
2200// read the value of V_getTemp_MonitorSensor/ControlSensor to get the name of the sensor level .
2201//
2202
2203Function/S V_getTempLog_attachedTo(fname,logStr)
2204        String fname,logStr
2205
2206        String path = "entry:sample:temperature_env:"+logstr+":attached_to"
2207        Variable num=60
2208        return(V_getStringFromHDF5(fname,path,num))
2209End
2210
2211Function V_getTempLog_highTrip(fname,logStr)
2212        String fname,logStr
2213       
2214        String path = "entry:sample:temperature_env:"+logstr+":high_trip_value"
2215        return(V_getRealValueFromHDF5(fname,path))
2216end
2217
2218Function V_getTempLog_holdTime(fname,logStr)
2219        String fname,logStr
2220       
2221        String path = "entry:sample:temperature_env:"+logstr+":hold_time"
2222        return(V_getRealValueFromHDF5(fname,path))
2223end
2224
2225Function V_getTempLog_lowTrip(fname,logStr)
2226        String fname,logStr
2227       
2228        String path = "entry:sample:temperature_env:"+logstr+":low_trip_value"
2229        return(V_getRealValueFromHDF5(fname,path))
2230end
2231
2232Function/S V_getTempLog_measurement(fname,logStr)
2233        String fname,logStr
2234
2235        String path = "entry:sample:temperature_env:"+logstr+":measurement"
2236        Variable num=60
2237        return(V_getStringFromHDF5(fname,path,num))
2238End
2239
2240
2241Function/S V_getTempLog_Model(fname,logStr)
2242        String fname,logStr
2243
2244        String path = "entry:sample:temperature_env:"+logstr+":model"
2245        Variable num=60
2246        return(V_getStringFromHDF5(fname,path,num))
2247End
2248
2249Function/S V_getTempLog_Name(fname,logStr)
2250        String fname,logStr
2251
2252        String path = "entry:sample:temperature_env:"+logstr+":name"
2253        Variable num=60
2254        return(V_getStringFromHDF5(fname,path,num))
2255End
2256
2257Function V_getTempLog_runControl(fname,logStr)
2258        String fname,logStr
2259       
2260        String path = "entry:sample:temperature_env:"+logstr+":run_control"
2261        return(V_getRealValueFromHDF5(fname,path))
2262end
2263
2264Function V_getTempLog_Setpoint(fname,logStr)
2265        String fname,logStr
2266       
2267        String path = "entry:sample:temperature_env:"+logstr+":setpoint"
2268        return(V_getRealValueFromHDF5(fname,path))
2269end
2270
2271Function/S V_getTempLog_ShortName(fname,logStr)
2272        String fname,logStr
2273
2274        String path = "entry:sample:temperature_env:"+logstr+":short_name"
2275        Variable num=60
2276        return(V_getStringFromHDF5(fname,path,num))
2277End
2278
2279Function V_getTempLog_Timeout(fname,logStr)
2280        String fname,logStr
2281       
2282        String path = "entry:sample:temperature_env:"+logstr+":timeout"
2283        return(V_getRealValueFromHDF5(fname,path))
2284end
2285
2286Function V_getTempLog_Tolerance(fname,logStr)
2287        String fname,logStr
2288       
2289        String path = "entry:sample:temperature_env:"+logstr+":tolerance"
2290        return(V_getRealValueFromHDF5(fname,path))
2291end
2292
2293Function V_getTempLog_ToleranceBand(fname,logStr)
2294        String fname,logStr
2295       
2296        String path = "entry:sample:temperature_env:"+logstr+":tolerance_band_time"
2297        return(V_getRealValueFromHDF5(fname,path))
2298end
2299
2300Function V_getTempLog_Value(fname,logStr)
2301        String fname,logStr
2302       
2303        String path = "entry:sample:temperature_env:"+logstr+":value"
2304        return(V_getRealValueFromHDF5(fname,path))
2305end
2306
2307
2308
2309
2310
2311
2312//
2313// temperature_env:temp_Internal_1:value_log
2314//
2315////            value_log (data folder)
2316//
2317// TODO:
2318// -- be sure that the calling function properly calls for temperture
2319// logs which are down an extra layer:
2320//      for example, logStr = "temperature_env:temp_Internal_1"
2321//
2322// read the value of V_getTemp_MonitorSensor to get the name of the sensor the next level down.
2323//
2324Function V_getLog_avgValue(fname,logStr)
2325        String fname,logStr
2326       
2327        String path = "entry:sample:"+logstr+":value_log:average_value"
2328        return(V_getRealValueFromHDF5(fname,path))
2329end
2330
2331Function V_getLog_avgValue_err(fname,logStr)
2332        String fname,logStr
2333       
2334        String path = "entry:sample:"+logstr+":value_log:average_value_error"
2335        return(V_getRealValueFromHDF5(fname,path))
2336end
2337
2338Function V_getLog_maximumValue(fname,logStr)
2339        String fname,logStr
2340       
2341        String path = "entry:sample:"+logstr+":value_log:maximum_value"
2342        return(V_getRealValueFromHDF5(fname,path))
2343end
2344
2345Function V_getLog_medianValue(fname,logStr)
2346        String fname,logStr
2347       
2348        String path = "entry:sample:"+logstr+":value_log:median_value"
2349        return(V_getRealValueFromHDF5(fname,path))
2350end
2351
2352Function V_getLog_minimumValue(fname,logStr)
2353        String fname,logStr
2354       
2355        String path = "entry:sample:"+logstr+":value_log:minimum_value"
2356        return(V_getRealValueFromHDF5(fname,path))
2357end
2358
2359// DONE -- this needs to be a WAVE reference
2360// DONE -- verify that the field is really read in as "time0"
2361Function V_getLog_timeWave(fname,logStr,outW)
2362        String fname,logStr
2363        Wave outW
2364       
2365        String path = "entry:sample:"+logstr+":value_log:time0"
2366        WAVE w = V_getRealWaveFromHDF5(fname,path)
2367
2368        outW = w
2369        return(0)
2370end
2371
2372// DONE -- this needs to be a WAVE reference
2373Function V_getLog_ValueWave(fname,logStr,outW)
2374        String fname,logStr
2375        Wave outW
2376       
2377        String path = "entry:sample:"+logstr+":value_log:value"
2378        WAVE w = V_getRealWaveFromHDF5(fname,path)
2379
2380        outW = w
2381        return(0)
2382end
2383
2384
2385
2386
2387
2388
2389
2390///////// REDUCTION
2391///////// REDUCTION
2392///////// REDUCTION
2393
2394
2395Function/WAVE V_getAbsolute_Scaling(fname)
2396        String fname
2397       
2398        String path = "entry:reduction:absolute_scaling"       
2399        WAVE w = V_getRealWaveFromHDF5(fname,path)
2400       
2401        return w
2402end
2403
2404Function/S V_getBackgroundFileName(fname)
2405        String fname
2406
2407        String path = "entry:reduction:background_file_name"   
2408        Variable num=60
2409        return(V_getStringFromHDF5(fname,path,num))
2410End
2411
2412Function/WAVE V_getBoxCoordinates(fname)
2413        String fname
2414       
2415        String path = "entry:reduction:box_coordinates"
2416        WAVE w = V_getRealWaveFromHDF5(fname,path)
2417
2418        return w
2419end
2420
2421//box counts
2422Function V_getBoxCounts(fname)
2423        String fname
2424       
2425        String path = "entry:reduction:box_count"       
2426        return(V_getRealValueFromHDF5(fname,path))
2427end
2428
2429//box counts error
2430Function V_getBoxCountsError(fname)
2431        String fname
2432       
2433        String path = "entry:reduction:box_count_error"
2434        return(V_getRealValueFromHDF5(fname,path))
2435end
2436
2437Function/S V_getReductionComments(fname)
2438        String fname
2439
2440        String path = "entry:reduction:comments"       
2441        Variable num=60
2442        return(V_getStringFromHDF5(fname,path,num))
2443End
2444
2445
2446Function/S V_getEmptyBeamFileName(fname)
2447        String fname
2448
2449        String path = "entry:reduction:empty_beam_file_name"   
2450        Variable num=60
2451        return(V_getStringFromHDF5(fname,path,num))
2452End
2453
2454Function/S V_getEmptyFileName(fname)
2455        String fname
2456
2457        String path = "entry:reduction:empty_file_name"
2458        Variable num=60
2459        return(V_getStringFromHDF5(fname,path,num))
2460End
2461
2462// this is (presumably) the polarization "intent"
2463Function/S V_getReduction_polSANSPurpose(fname)
2464        String fname
2465
2466        String path = "entry:reduction:file_purpose"   
2467        Variable num=60
2468        return(V_getStringFromHDF5(fname,path,num))
2469End
2470
2471////group ID
2472//// DONE
2473//// x- is this duplicated?
2474//// x- yes, this is a duplicated field in the /entry/sample block (and is probably more appropriate there)
2475//// x- so pick a single location, rather than needing to duplicate.
2476//// x- REPLACE with a single function V_getSample_GroupID()
2477////
2478//Function V_getSample_group_ID(fname)
2479//      String fname
2480//
2481//// do not use the entry/reduction location
2482////    String path = "entry:reduction:group_id"
2483//      String path = "entry:sample:group_id"   
2484//
2485//      return(V_getRealValueFromHDF5(fname,path))
2486//end
2487
2488Function/S V_getReduction_intent(fname)
2489        String fname
2490
2491        String path = "entry:reduction:intent" 
2492        Variable num=60
2493        return(V_getStringFromHDF5(fname,path,num))
2494End
2495
2496Function/S V_getMaskFileName(fname)
2497        String fname
2498
2499        String path = "entry:reduction:mask_file_name" 
2500        Variable num=60
2501        return(V_getStringFromHDF5(fname,path,num))
2502End
2503
2504Function/S V_getLogFileName(fname)
2505        String fname
2506
2507        String path = "entry:reduction:sans_log_file_name"     
2508        Variable num=60
2509        return(V_getStringFromHDF5(fname,path,num))
2510End
2511
2512Function/S V_getSensitivityFileName(fname)
2513        String fname
2514
2515        String path = "entry:reduction:sensitivity_file_name"   
2516        Variable num=60
2517        return(V_getStringFromHDF5(fname,path,num))
2518End
2519
2520Function/S V_getTransmissionFileName(fname)
2521        String fname
2522
2523        String path = "entry:reduction:transmission_file_name" 
2524        Variable num=60
2525        return(V_getStringFromHDF5(fname,path,num))
2526End
2527
2528//whole detector trasmission
2529Function V_getSampleTransWholeDetector(fname)
2530        String fname
2531       
2532        String path = "entry:reduction:whole_trans"     
2533        return(V_getRealValueFromHDF5(fname,path))
2534end
2535
2536//whole detector trasmission error
2537Function V_getSampleTransWholeDetErr(fname)
2538        String fname
2539       
2540        String path = "entry:reduction:whole_trans_error"       
2541        return(V_getRealValueFromHDF5(fname,path))
2542end
2543
2544// this is a NON NICE entered field
2545// so I need to catch the error if it's not there
2546Function/WAVE V_getReductionProtocolWave(fname)
2547        String fname
2548       
2549        String path = "entry:reduction:protocol"       
2550        WAVE/T/Z tw = V_getTextWaveFromHDF5(fname,path)
2551       
2552        if(waveExists(tw))
2553                return tw
2554        else
2555                Make/O/T/N=0 nullTextWave
2556                return nullTextWave
2557        endif
2558       
2559end
2560       
2561
2562
2563
2564// these have all been moved elsewhere                 
2565///////                 pol_sans (data folder)
2566//
2567//Function/S V_getPolSANS_cellName(fname)
2568//      String fname
2569//
2570//      String path = "entry:reduction:pol_sans:cell_name"     
2571//      Variable num=60
2572//      return(V_getStringFromHDF5(fname,path,num))
2573//End
2574//
2575//
2576//Function/WAVE V_getPolSANS_cellParams(fname)
2577//      String fname
2578//     
2579//      String path = "entry:reduction:pol_sans:cell_parameters"       
2580//      WAVE w = V_getRealWaveFromHDF5(fname,path)
2581//
2582//      return w
2583//end
2584//
2585//Function/S V_getPolSANS_PolSANSPurpose(fname)
2586//      String fname
2587//
2588//      String path = "entry:reduction:pol_sans:pol_sans_purpose"       
2589//      Variable num=60
2590//      return(V_getStringFromHDF5(fname,path,num))
2591//End
2592
2593                               
2594//////// TOP LEVEL DATA REPRESENTATION
2595//
2596// note that here the data is (supposed to be) a link, not the actual data
2597// Igor HDf implementation cannot follow links properly, as far as I know.
2598// so ignore them here, and focus on the image that may be possible to read
2599//
2600
2601//              data_B (data folder)
2602//                      data (wave) 1           //ignore this, it's a link
2603//                      variables (wave) 320
2604//                      thumbnail (data folder)
2605
2606////data (wave) "binary"
2607//// TODO -- this will need to be completely replaced with a function that can
2608//// read the binary image data. should be possible, but I don't know the details on either end...
2609//Function/S V_getDataImage(fname,detStr)
2610//      String fname,detStr
2611//
2612//      String path = "entry:data_"+detStr+":thumbnail:data"   
2613//      Variable num=60
2614//      return(V_getStringFromHDF5(fname,path,num))
2615//End
2616//
2617//Function/S V_getDataImageDescription(fname,detStr)
2618//      String fname,detStr
2619//
2620//      String path = "entry:data_"+detStr+":thumbnail:description"     
2621//      Variable num=60
2622//      return(V_getStringFromHDF5(fname,path,num))
2623//End
2624//                                                             
2625//Function/S V_getDataImageType(fname,detStr)
2626//      String fname,detStr
2627//
2628//      String path = "entry:data_"+detStr+":thumbnail:type"   
2629//      Variable num=60
2630//      return(V_getStringFromHDF5(fname,path,num))
2631//End
2632//
2633//
2634
2635
Note: See TracBrowser for help on using the repository browser.