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

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

a few changes to update the calculation of transmission values from the tables, and updating the correct units in a few places. Also updated how a transmission file is matched with a scattering file.

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