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

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

cleaning up a lot of the TODO items from the code.

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