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

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

LOTS of changes to accommodate the beam center being reported in cm rather than pixels. Required a lot of changes to VCALC (to fill in simulated data), and in the reading and interpreting of data for display, and most importantly, the calculation of q.

There may still be a few residual bugs with this. I am still re-testing with new sample data sets.

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