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

Last change on this file since 981 was 981, checked in by srkline, 7 years ago

more changes, filling in functionality of the initial data correction

File size: 46.7 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
24Function proto_V_get_FP2(str,str2)
25        String str,str2
26        return(0)
27end
28//Function/S proto_V_get_STR(str)
29//      String str
30//      return("")
31//end
32
33Macro Dump_V_getFP(fname)
34        String fname
35       
36        Test_V_get_FP("V_get*",fname)
37end
38
39Function Test_V_get_FP(str,fname)
40        String str,fname
41       
42        Variable ii,num
43        String list,item
44       
45       
46        list=FunctionList(str,";","NPARAMS:1,VALTYPE:1") //,VALTYPE:1 gives real return values, not strings
47//      Print list
48        num = ItemsInlist(list)
49       
50       
51        for(ii=0;ii<num;ii+=1)
52                item = StringFromList(ii, list , ";")
53                FUNCREF proto_V_get_FP f = $item
54                Print item ," = ", f(fname)
55        endfor
56       
57        return(0)
58end
59
60Macro Dump_V_getFP_Det(fname,detStr)
61        String fname,detStr="FL"
62       
63        Test_V_get_FP2("V_get*",fname,detStr)
64end
65
66Function Test_V_get_FP2(str,fname,detStr)
67        String str,fname,detStr
68       
69        Variable ii,num
70        String list,item
71       
72       
73        list=FunctionList(str,";","NPARAMS:2,VALTYPE:1") //,VALTYPE:1 gives real return values, not strings
74//      Print list
75        num = ItemsInlist(list)
76       
77       
78        for(ii=0;ii<num;ii+=1)
79                item = StringFromList(ii, list , ";")
80                FUNCREF proto_V_get_FP2 f = $item
81                Print item ," = ", f(fname,detStr)
82        endfor
83       
84        return(0)
85end
86
87
88Macro Dump_V_getSTR(fname)
89        String fname
90       
91        Test_V_get_STR("V_get*",fname)
92end
93
94Function Test_V_get_STR(str,fname)
95        String str,fname
96       
97        Variable ii,num
98        String list,item,strToEx
99       
100       
101        list=FunctionList(str,";","NPARAMS:1,VALTYPE:4")
102//      Print list
103        num = ItemsInlist(list)
104       
105       
106        for(ii=0;ii<num;ii+=1)
107                item = StringFromList(ii, list , ";")
108        //      FUNCREF proto_V_get_STR f = $item
109                printf "%s = ",item
110                sprintf strToEx,"Print %s(\"%s\")",item,fname
111                Execute strToEx
112//              print strToEx
113//              Print item ," = ", f(fname)
114        endfor
115       
116        return(0)
117end
118
119Macro Dump_V_getSTR_Det(fname,detStr)
120        String fname,detStr="FL"
121       
122        Test_V_get_STR2("V_get*",fname,detStr)
123end
124
125Function Test_V_get_STR2(str,fname,detStr)
126        String str,fname,detStr
127       
128        Variable ii,num
129        String list,item,strToEx
130       
131       
132        list=FunctionList(str,";","NPARAMS:2,VALTYPE:4")
133//      Print list
134        num = ItemsInlist(list)
135       
136       
137        for(ii=0;ii<num;ii+=1)
138                item = StringFromList(ii, list , ";")
139        //      FUNCREF proto_V_get_STR f = $item
140                printf "%s = ",item
141                sprintf strToEx,"Print %s(\"%s\",\"%s\")",item,fname,detStr
142                Execute strToEx
143//              print strToEx
144//              Print item ," = ", f(fname)
145        endfor
146       
147        return(0)
148end
149///////////////////////////////////////
150
151
152//////////////////////////////////////////////
153
154
155///////////////////////
156//
157// *These are the specific bits of information to retrieve (or write) to the data file
158// *These functions use the path to the file as input, and each has the specific
159//   path to the variable srting, or wave hard-coded into the access function
160// *They call the generic worker functions to get the values, either from the local copy if present,
161//   or the full file is loaded.
162//
163// *Since the path is the important bit, these are written as get/write pairs to make it easier to
164//   keep up with any changes in path
165//
166//
167// TODO -- verify the paths, and add more as needed
168// TODO -- for all of the String functions -- "num" does nothing right now -
169//         -- if it ever does, or needs to, a lot of locations will need to be corrected
170//
171
172
173//////// TOP LEVEL
174//////// TOP LEVEL
175//////// TOP LEVEL
176
177// nexus version used for definitions
178Function/S V_getNeXus_version(fname)
179        String fname
180       
181        String path = "entry:NeXus_version"     
182        Variable num=60
183        return(V_getStringFromHDF5(fname,path,num))
184End
185
186// TODO -- not mine, added somewhere by Nexus writer?
187// data collection time (! this is the true counting time??)
188Function V_getCollectionTime(fname)
189        String fname
190       
191        String path = "entry:collection_time"   
192        return(V_getRealValueFromHDF5(fname,path))
193End
194
195// data directory where data files are stored (for user access, not archive)
196Function/S V_getData_directory(fname)
197        String fname
198       
199        String path = "entry:data_directory"   
200        Variable num=60
201        return(V_getStringFromHDF5(fname,path,num))
202End
203
204// Base class of Nexus definition (=NXsas)
205Function/S V_getNexusDefinition(fname)
206        String fname
207       
208        String path = "entry:definition"       
209        Variable num=60
210        return(V_getStringFromHDF5(fname,path,num))
211End
212
213// TODO -- not mine, added somewhere by Nexus writer?
214// data collection duration (may include pauses, other "dead" time)
215Function V_getDataDuration(fname)
216        String fname
217       
218        String path = "entry:duration" 
219        return(V_getRealValueFromHDF5(fname,path))
220End
221
222// TODO -- not mine, added somewhere by Nexus writer?
223// data collection end time
224Function/S V_getDataEndTime(fname)
225        String fname
226       
227        String path = "entry:end_time" 
228        Variable num=60
229        return(V_getStringFromHDF5(fname,path,num))
230End
231
232// experiment description
233Function/S V_getExperiment_description(fname)
234        String fname
235       
236        String path = "entry:experiment_description"   
237        Variable num=60
238        return(V_getStringFromHDF5(fname,path,num))
239End
240
241// experiment identifier? used only by NICE?
242Function/S V_getExperiment_identifier(fname)
243        String fname
244       
245        String path = "entry:experiment_identifier"     
246        Variable num=60
247        return(V_getStringFromHDF5(fname,path,num))
248End
249
250// name of facility = NCNR
251Function/S V_getFacility(fname)
252        String fname
253       
254        String path = "entry:facility" 
255        Variable num=60
256        return(V_getStringFromHDF5(fname,path,num))
257End
258               
259// file write time (what is this??
260// TODO - figure out if this is supposed to be an integer or text (ISO)
261Function V_getFileWriteTime(fname)
262        String fname
263       
264        String path = "entry:file_time"
265        return(V_getRealValueFromHDF5(fname,path))
266End
267               
268//
269Function/S V_getHDF_version(fname)
270        String fname
271       
272        String path = "entry:hdf_version"       
273        Variable num=60
274        return(V_getStringFromHDF5(fname,path,num))
275End
276
277// TODO -- not mine, added somewhere by Nexus writer?
278Function/S V_getProgram_name(fname)
279        String fname
280       
281        String path = "entry:program_name"     
282        Variable num=60
283        return(V_getStringFromHDF5(fname,path,num))
284End
285
286// TODO -- not mine, added somewhere by Nexus writer?
287// data collection start time
288Function/S V_getDataStartTime(fname)
289        String fname
290       
291        String path = "entry:start_time"       
292        Variable num=60
293        return(V_getStringFromHDF5(fname,path,num))
294End
295               
296// title of experiment
297Function/S V_getTitle(fname)
298        String fname
299       
300        String path = "entry:title"     
301        Variable num=60
302        return(V_getStringFromHDF5(fname,path,num))
303end
304       
305       
306               
307////////// USER
308////////// USER
309////////// USER
310
311// list of user names
312// TODO -- currently not written out to data file??
313Function/S V_getUserNames(fname)
314        String fname
315       
316        String path = "entry:user:name"
317        Variable num=60
318        return(V_getStringFromHDF5(fname,path,num))
319end
320
321
322//////// CONTROL
323//////// CONTROL
324//////// CONTROL
325
326// TODO -- for the control section, document each of the fields
327
328Function V_getCount_end(fname)
329        String fname
330       
331        String path = "entry:control:count_end"
332        return(V_getRealValueFromHDF5(fname,path))
333end
334
335
336Function V_getCount_start(fname)
337        String fname
338       
339        String path = "entry:control:count_start"       
340        return(V_getRealValueFromHDF5(fname,path))
341end
342
343
344Function V_getCount_time(fname)
345        String fname
346       
347        String path = "entry:control:count_time"       
348        return(V_getRealValueFromHDF5(fname,path))
349end
350
351
352Function V_getCount_time_preset(fname)
353        String fname
354       
355        String path = "entry:control:count_time_preset"
356        return(V_getRealValueFromHDF5(fname,path))
357end
358
359
360Function V_getDetector_counts(fname)
361        String fname
362       
363        String path = "entry:control:detector_counts"   
364        return(V_getRealValueFromHDF5(fname,path))
365end
366
367
368Function V_getDetector_preset(fname)
369        String fname
370       
371        String path = "entry:control:detector_preset"   
372        return(V_getRealValueFromHDF5(fname,path))
373end
374
375
376Function V_getIntegral(fname)
377        String fname
378       
379        String path = "entry:control:integral" 
380        return(V_getRealValueFromHDF5(fname,path))
381end
382
383// control mode for data acquisition, "timer"
384Function/S V_getControlMode(fname)
385        String fname
386       
387        String path = "entry:control:mode"     
388        Variable num=60
389        return(V_getStringFromHDF5(fname,path,num))
390End
391
392//monitor count
393Function V_getMonitorCount(fname)
394        String fname
395       
396        String path = "entry:control:monitor_counts"   
397        return(V_getRealValueFromHDF5(fname,path))
398end
399
400Function V_getMonitor_preset(fname)
401        String fname
402       
403        String path = "entry:control:monitor_preset"   
404        return(V_getRealValueFromHDF5(fname,path))
405end
406
407Function V_getPreset(fname)
408        String fname
409       
410        String path = "entry:control:preset"   
411        return(V_getRealValueFromHDF5(fname,path))
412end
413
414
415
416
417
418//////// INSTRUMENT
419//////// INSTRUMENT
420//////// INSTRUMENT
421
422Function/S V_getLocalContact(fname)
423        String fname
424
425        String path = "entry:instrument:local_contact"
426        Variable num=60
427        return(V_getStringFromHDF5(fname,path,num))
428End
429
430Function/S V_getInstrumentName(fname)
431        String fname
432
433        String path = "entry:instrument:name"
434        Variable num=60
435        return(V_getStringFromHDF5(fname,path,num))
436End
437
438Function/S V_getInstrumentType(fname)
439        String fname
440
441        String path = "entry:instrument:type"
442        Variable num=60
443        return(V_getStringFromHDF5(fname,path,num))
444End
445
446////// INSTRUMENT/ATTENUATOR
447// TODO
448// attenuator number -- for VSANS I think I want this to be some "binary" representation
449// of 4 plates in/out - so this may be an integer-> binary, or a text string (4 char)
450Function V_getAtten_number(fname)
451        String fname
452       
453        String path = "entry:instrument:attenuator:atten_number"       
454        return(V_getRealValueFromHDF5(fname,path))
455end
456
457
458// transmission value for the attenuator in the beam
459// use this, but if something wrong, the tables are present
460Function V_getAttenuator_transmission(fname)
461        String fname
462       
463        String path = "entry:instrument:attenuator:attenuator_transmission"     
464        return(V_getRealValueFromHDF5(fname,path))
465end
466
467// transmission value (error) for the attenuator in the beam
468// use this, but if something wrong, the tables are present
469Function V_getAttenuator_trans_err(fname)
470        String fname
471       
472        String path = "entry:instrument:attenuator:attenuator_transmission_error"       
473        return(V_getRealValueFromHDF5(fname,path))
474end
475
476// distance from the attenuator to the sample (units??)
477Function V_getAttenDistance(fname)
478        String fname
479       
480        String path = "entry:instrument:attenuator:distance"   
481        return(V_getRealValueFromHDF5(fname,path))
482end
483
484
485// attenuator index, to use in the lookup table of transmission values
486Function V_getAttenIndex(fname)
487        String fname
488       
489        String path = "entry:instrument:attenuator:index"       
490        return(V_getRealValueFromHDF5(fname,path))
491end
492
493
494// table of the attenuation factor
495Function V_getAttenIndex_table(fname,outW)
496        String fname
497        Wave outW
498       
499        String path = "entry:instrument:attenuator:index_table"
500        WAVE w = V_getRealWaveFromHDF5(fname,path)
501
502        outW = w
503        return(0)
504end
505
506
507// status "in or out"
508Function/S V_getAttenStatus(fname)
509        String fname
510
511        String path = "entry:instrument:attenuator:status"
512        Variable num=60
513        return(V_getStringFromHDF5(fname,path,num))
514End
515
516// thickness of the attenuator (PMMA) - units??
517Function V_getAttenThickness(fname)
518        String fname
519       
520        String path = "entry:instrument:attenuator:thickness"   
521        return(V_getRealValueFromHDF5(fname,path))
522end
523
524
525// type of material for the atteunator
526Function/S V_getAttenType(fname)
527        String fname
528
529        String path = "entry:instrument:attenuator:type"
530        Variable num=60
531        return(V_getStringFromHDF5(fname,path,num))
532End
533
534
535////// INSTRUMENT/BEAM
536// instrument/beam/chopper (data folder)
537Function V_getChopperAngular_opening(fname)
538        String fname
539       
540        String path = "entry:instrument:beam:chopper:angular_opening"   
541        return(V_getRealValueFromHDF5(fname,path))
542end
543
544Function V_getChopDistance_from_sample(fname)
545        String fname
546       
547        String path = "entry:instrument:beam:chopper:distance_from_sample"     
548        return(V_getRealValueFromHDF5(fname,path))
549end
550
551Function V_getChopDistance_from_source(fname)
552        String fname
553       
554        String path = "entry:instrument:beam:chopper:distance_from_source"     
555        return(V_getRealValueFromHDF5(fname,path))
556end
557
558Function V_getChopperDuty_cycle(fname)
559        String fname
560       
561        String path = "entry:instrument:beam:chopper:duty_cycle"       
562        return(V_getRealValueFromHDF5(fname,path))
563end
564
565Function V_getChopperRotation_speed(fname)
566        String fname
567       
568        String path = "entry:instrument:beam:chopper:rotation_speed"   
569        return(V_getRealValueFromHDF5(fname,path))
570end
571
572Function V_getChopperSlits(fname)
573        String fname
574       
575        String path = "entry:instrument:beam:chopper:slits"     
576        return(V_getRealValueFromHDF5(fname,path))
577end
578
579Function/S V_getChopperstatus(fname)
580        String fname
581
582        String path = "entry:instrument:beam:chopper:status"
583        Variable num=60
584        return(V_getStringFromHDF5(fname,path,num))
585End
586
587Function/S V_getChoppertype(fname)
588        String fname
589
590        String path = "entry:instrument:beam:chopper:type"
591        Variable num=60
592        return(V_getStringFromHDF5(fname,path,num))
593End
594
595
596// instrument/beam/flipper (data folder)
597Function V_getFlipperDriving_current(fname)
598        String fname
599       
600        String path = "entry:instrument:beam:flipper:driving_current"   
601        return(V_getRealValueFromHDF5(fname,path))
602end
603
604Function V_getFlipperFrequency(fname)
605        String fname
606       
607        String path = "entry:instrument:beam:flipper:frequency"
608        return(V_getRealValueFromHDF5(fname,path))
609end
610
611Function/S V_getFlipperstatus(fname)
612        String fname
613
614        String path = "entry:instrument:beam:flipper:status"
615        Variable num=60
616        return(V_getStringFromHDF5(fname,path,num))
617End
618
619Function V_getFlipperTransmitted_power(fname)
620        String fname
621       
622        String path = "entry:instrument:beam:flipper:transmitted_power"
623        return(V_getRealValueFromHDF5(fname,path))
624end
625
626Function/S V_getFlipperWaveform(fname)
627        String fname
628
629        String path = "entry:instrument:beam:flipper:waveform"
630        Variable num=60
631        return(V_getStringFromHDF5(fname,path,num))
632End
633
634// instrument/beam/monochromator (data folder)
635Function/S V_getMonochromatorType(fname)
636        String fname
637
638        String path = "entry:instrument:beam:monochromator:type"
639        Variable num=60
640        return(V_getStringFromHDF5(fname,path,num))
641End
642
643Function V_getWavelength(fname)
644        String fname
645       
646        String path = "entry:instrument:beam:monochromator:wavelength" 
647        return(V_getRealValueFromHDF5(fname,path))
648end
649
650Function V_getWavelength_spread(fname)
651        String fname
652       
653        String path = "entry:instrument:beam:monochromator:wavelength_spread"   
654        return(V_getRealValueFromHDF5(fname,path))
655end
656
657// instrument/beam/monochromator/crystal (data folder)
658Function V_getCrystalEnergy(fname)
659        String fname
660       
661        String path = "entry:instrument:beam:monochromator:crystal:energy"     
662        return(V_getRealValueFromHDF5(fname,path))
663end
664
665Function V_getCrystalHorizontal_aperture(fname)
666        String fname
667       
668        String path = "entry:instrument:beam:monochromator:crystal:horizontal_aperture"
669        return(V_getRealValueFromHDF5(fname,path))
670end
671
672Function V_getCrystalHoriz_curvature(fname)
673        String fname
674       
675        String path = "entry:instrument:beam:monochromator:crystal:horizontal_curvature"       
676        return(V_getRealValueFromHDF5(fname,path))
677end
678
679Function V_getCrystalLattice_parameter(fname)
680        String fname
681       
682        String path = "entry:instrument:beam:monochromator:crystal:lattice_parameter"   
683        return(V_getRealValueFromHDF5(fname,path))
684end
685
686Function V_getCrystalDistance(fname)
687        String fname
688       
689        String path = "entry:instrument:beam:monochromator:crystal:distance"   
690        return(V_getRealValueFromHDF5(fname,path))
691end
692
693Function V_getCrystalReflection(fname)
694        String fname
695       
696        String path = "entry:instrument:beam:monochromator:crystal:reflection" 
697        return(V_getRealValueFromHDF5(fname,path))
698end
699
700Function V_getCrystalRotation(fname)
701        String fname
702       
703        String path = "entry:instrument:beam:monochromator:crystal:rotation"   
704        return(V_getRealValueFromHDF5(fname,path))
705end
706
707Function/S V_getCrystalStatus(fname)
708        String fname
709
710        String path = "entry:instrument:beam:monochromator:crystal:status"
711        Variable num=60
712        return(V_getStringFromHDF5(fname,path,num))
713End
714
715Function V_getCrystalVertical_aperture(fname)
716        String fname
717       
718        String path = "entry:instrument:beam:monochromator:crystal:vertical_aperture"   
719        return(V_getRealValueFromHDF5(fname,path))
720end
721
722Function V_getCrystalVertical_curvature(fname)
723        String fname
724       
725        String path = "entry:instrument:beam:monochromator:crystal:vertical_curvature" 
726        return(V_getRealValueFromHDF5(fname,path))
727end
728
729Function V_getCrystalWavelength(fname)
730        String fname
731       
732        String path = "entry:instrument:beam:monochromator:crystal:wavelength" 
733        return(V_getRealValueFromHDF5(fname,path))
734end
735
736Function V_getCrystalWavelength_spread(fname)
737        String fname
738       
739        String path = "entry:instrument:beam:monochromator:crystal:wavelength_spread"   
740        return(V_getRealValueFromHDF5(fname,path))
741end
742
743Function V_getCrystalWavevector(fname)
744        String fname
745       
746        String path = "entry:instrument:beam:monochromator:crystal:wavevector" 
747        return(V_getRealValueFromHDF5(fname,path))
748end
749
750// instrument/beam/monochromator/velocity_selector (data folder)
751Function V_getVSDistance(fname)
752        String fname
753       
754        String path = "entry:instrument:beam:monochromator:velocity_selector:distance" 
755        return(V_getRealValueFromHDF5(fname,path))
756end
757
758Function V_getVSRotation_speed(fname)
759        String fname
760       
761        String path = "entry:instrument:beam:monochromator:velocity_selector:rotation_speed"   
762        return(V_getRealValueFromHDF5(fname,path))
763end
764
765Function/S V_getVelSelStatus(fname)
766        String fname
767
768        String path = "entry:instrument:beam:monochromator:velocity_selector:status"
769        Variable num=60
770        return(V_getStringFromHDF5(fname,path,num))
771End
772
773Function V_getVSTable(fname,outW)
774        String fname
775        Wave outW
776       
777        String path = "entry:instrument:beam:monochromator:velocity_selector:table"     
778        WAVE w = V_getRealWaveFromHDF5(fname,path)
779
780        outW = w
781        return(0)
782end
783
784Function V_getVSTable_parameters(fname)
785        String fname
786       
787        String path = "entry:instrument:beam:monochromator:velocity_selector:table_parameters" 
788        return(V_getRealValueFromHDF5(fname,path))
789end
790
791Function V_getVS_tilt(fname)
792        String fname
793       
794        String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt"   
795        return(V_getRealValueFromHDF5(fname,path))
796end
797
798Function V_getVSWavelength(fname)
799        String fname
800       
801        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength"       
802        return(V_getRealValueFromHDF5(fname,path))
803end
804
805Function V_getVSWavelength_spread(fname)
806        String fname
807       
808        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength_spread"
809        return(V_getRealValueFromHDF5(fname,path))
810end
811
812// instrument/beam/monochromator/white_beam (data folder)
813Function/S V_getWhiteBeamStatus(fname)
814        String fname
815
816        String path = "entry:instrument:beam:monochromator:white_beam:status"
817        Variable num=60
818        return(V_getStringFromHDF5(fname,path,num))
819End
820
821Function V_getWhiteBeamWavelength(fname)
822        String fname
823       
824        String path = "entry:instrument:beam:monochromator:white_beam:wavelength"       
825        return(V_getRealValueFromHDF5(fname,path))
826end
827
828Function V_getWhiteBeamWavelength_spread(fname)
829        String fname
830       
831        String path = "entry:instrument:beam:monochromator:white_beam:wavelength_spread"       
832        return(V_getRealValueFromHDF5(fname,path))
833end
834
835// instrument/beam/polarizer (data folder)
836Function/S V_getPolarizerComposition(fname)
837        String fname
838
839        String path = "entry:instrument:beam:polarizer:composition"
840        Variable num=60
841        return(V_getStringFromHDF5(fname,path,num))
842End
843
844Function V_getPolarizerEfficiency(fname)
845        String fname
846       
847        String path = "entry:instrument:beam:polarizer:efficiency"     
848        return(V_getRealValueFromHDF5(fname,path))
849end
850
851Function/S V_getPolarizerStatus(fname)
852        String fname
853
854        String path = "entry:instrument:beam:polarizer:status"
855        Variable num=60
856        return(V_getStringFromHDF5(fname,path,num))
857End
858
859Function/S V_getPolarizerType(fname)
860        String fname
861
862        String path = "entry:instrument:beam:polarizer:type"
863        Variable num=60
864        return(V_getStringFromHDF5(fname,path,num))
865End
866
867// instrument/beam/polarizer_analyzer (data folder)
868Function V_getPolAnaCell_index(fname)
869        String fname
870
871        String path = "entry:instrument:beam:polarizer_analyzer:cell_index"
872        return(V_getRealValueFromHDF5(fname,path))
873End
874
875Function/S V_getPolAnaCell_name(fname)
876        String fname
877
878        String path = "entry:instrument:beam:polarizer_analyzer:cell_name"
879        Variable num=60
880        return(V_getStringFromHDF5(fname,path,num))
881End
882
883Function V_getPolAnaCell_parameters(fname,outW)
884        String fname
885        Wave outW
886
887        String path = "entry:instrument:beam:polarizer_analyzer:cell_parameters"
888        WAVE w = V_getRealWaveFromHDF5(fname,path)
889
890        outW = w
891        return(0)
892End
893
894Function V_getPolAnaGuideFieldCur_1(fname)
895        String fname
896
897        String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_1"
898        return(V_getRealValueFromHDF5(fname,path))
899End
900
901Function V_getPolAnaGuideFieldCur_2(fname)
902        String fname
903
904        String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_2"
905        return(V_getRealValueFromHDF5(fname,path))
906End
907
908Function V_getPolAnaSolenoid_current(fname)
909        String fname
910
911        String path = "entry:instrument:beam:polarizer_analyzer:solenoid_current"
912        return(V_getRealValueFromHDF5(fname,path))
913End
914
915Function/S V_getPolAnaStatus(fname)
916        String fname
917
918        String path = "entry:instrument:beam:polarizer_analyzer:status"
919        Variable num=60
920        return(V_getStringFromHDF5(fname,path,num))
921End
922
923                                       
924/////// INSTRUMENT/BEAM MONITORS
925
926//beam_monitor_low (data folder)
927Function V_getBeamMonLowData(fname)
928        String fname
929
930        String path = "entry:instrument:beam_monitor_low:data"
931        return(V_getRealValueFromHDF5(fname,path))
932End
933
934Function V_getBeamMonLowEfficiency(fname)
935        String fname
936
937        String path = "entry:instrument:beam_monitor_low:efficiency"
938        return(V_getRealValueFromHDF5(fname,path))
939End
940
941Function V_getBeamMonLowDistance(fname)
942        String fname
943
944        String path = "entry:instrument:beam_monitor_low:distance"
945        return(V_getRealValueFromHDF5(fname,path))
946End
947
948Function V_getBeamMonLowSaved_count(fname)
949        String fname
950
951        String path = "entry:instrument:beam_monitor_low:saved_count"
952        return(V_getRealValueFromHDF5(fname,path))
953End
954
955Function/S V_getBeamMonLowType(fname)
956        String fname
957
958        String path = "entry:instrument:beam_monitor_low:type"
959        Variable num=60
960        return(V_getStringFromHDF5(fname,path,num))
961End
962
963//beam_monitor_norm (data folder)
964Function V_getBeamMonNormData(fname)
965        String fname
966
967        String path = "entry:instrument:beam_monitor_norm:data"
968        return(V_getRealValueFromHDF5(fname,path))
969End
970
971Function V_getBeamMonNormEfficiency(fname)
972        String fname
973
974        String path = "entry:instrument:beam_monitor_norm:efficiency"
975        return(V_getRealValueFromHDF5(fname,path))
976End
977
978Function V_getBeamMonNormDistance(fname)
979        String fname
980
981        String path = "entry:instrument:beam_monitor_norm:distance"
982        return(V_getRealValueFromHDF5(fname,path))
983End
984
985Function V_getBeamMonNormSaved_count(fname)
986        String fname
987
988        String path = "entry:instrument:beam_monitor_norm:saved_count"
989        return(V_getRealValueFromHDF5(fname,path))
990End
991
992Function/S V_getBeamMonNormType(fname)
993        String fname
994
995        String path = "entry:instrument:beam_monitor_norm:type"
996        Variable num=60
997        return(V_getStringFromHDF5(fname,path,num))
998End
999
1000//beam_stop (data folder)
1001Function/S V_getBeamStopDescription(fname)
1002        String fname
1003
1004        String path = "entry:instrument:beam_stop:description"
1005        Variable num=60
1006        return(V_getStringFromHDF5(fname,path,num))
1007End
1008
1009Function V_getBeamStopDist_to_det(fname)
1010        String fname
1011
1012        String path = "entry:instrument:beam_stop:distance_to_detector"
1013        return(V_getRealValueFromHDF5(fname,path))
1014End
1015
1016Function V_getBeamStop_x_pos(fname)
1017        String fname
1018
1019        String path = "entry:instrument:beam_stop:x_pos"
1020        return(V_getRealValueFromHDF5(fname,path))
1021End
1022
1023Function V_getBeamStop_y_pos(fname)
1024        String fname
1025
1026        String path = "entry:instrument:beam_stop:y_pos"
1027        return(V_getRealValueFromHDF5(fname,path))
1028End
1029
1030//// INSTRUMENT/COLLIMATOR
1031//collimator (data folder)
1032Function V_getNumberOfGuides(fname)
1033        String fname
1034
1035        String path = "entry:instrument:collimator:number_guides"
1036        return(V_getRealValueFromHDF5(fname,path))
1037End
1038
1039//                              geometry (data folder)
1040//                                      shape (data folder)
1041Function/S V_getGuideShape(fname)
1042        String fname
1043
1044        String path = "entry:instrument:collimator:geometry:shape:shape"
1045        Variable num=60
1046        return(V_getStringFromHDF5(fname,path,num))
1047End
1048
1049Function V_getGuideSize(fname)
1050        String fname
1051
1052        String path = "entry:instrument:collimator:geometry:shape:size"
1053        return(V_getRealValueFromHDF5(fname,path))
1054End
1055
1056//                      converging_pinholes (data folder)
1057Function/S V_getConvPinholeStatus(fname)
1058        String fname
1059
1060        String path = "entry:instrument:converging_pinholes:status"
1061        Variable num=60
1062        return(V_getStringFromHDF5(fname,path,num))
1063End
1064
1065//                      converging_slits (not used)
1066
1067////// INSTRUMENT/DETECTORS
1068//                      detector_B (data folder)
1069//
1070// only defined for the "B" detector, and may not be necessary?
1071// TODO -- write to return an ARRAY
1072Function V_getDet_cal_x(fname,detStr,outW)
1073        String fname,detStr
1074        Wave outW
1075
1076        if(cmpstr(detStr,"B") == 0)
1077                String path = "entry:instrument:detector_"+detStr+":cal_x"
1078                WAVE w = V_getRealWaveFromHDF5(fname,path)
1079
1080                outW = w
1081                return(0)
1082        else
1083                return(0)
1084        endif
1085End
1086
1087// only defined for the "B" detector, and may not be necessary?
1088// TODO -- write to return an ARRAY
1089Function V_getDet_cal_y(fname,detStr,outW)
1090        String fname,detStr
1091        Wave outW
1092
1093        if(cmpstr(detStr,"B") == 0)
1094                String path = "entry:instrument:detector_"+detStr+":cal_y"
1095                WAVE w = V_getRealWaveFromHDF5(fname,path)
1096       
1097                outW = w
1098                return(0)
1099        else
1100                return(0)
1101        endif
1102End
1103
1104// TODO -- write and X and Y version of this. Pixels are not square
1105// so the FHWM will be different in each direction. May need to return
1106// "dummy" value for "B" detector if pixels there are square
1107Function V_getDet_pixel_fwhm_x(fname,detStr)
1108        String fname,detStr
1109
1110        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_x"
1111
1112// TODO -- different behavior for "B"
1113        if(cmpstr(detStr,"B") == 0)
1114                return(V_getRealValueFromHDF5(fname,path))
1115        else
1116                return(V_getRealValueFromHDF5(fname,path))
1117        endif
1118End
1119
1120// TODO -- write and X and Y version of this. Pixels are not square
1121// so the FHWM will be different in each direction. May need to return
1122// "dummy" value for "B" detector if pixels there are square
1123Function V_getDet_pixel_fwhm_y(fname,detStr)
1124        String fname,detStr
1125
1126        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_y"
1127
1128// TODO -- different behavior for "B"
1129        if(cmpstr(detStr,"B") == 0)
1130                return(V_getRealValueFromHDF5(fname,path))
1131        else
1132                return(V_getRealValueFromHDF5(fname,path))
1133        endif
1134End
1135
1136Function V_getDet_pixel_num_x(fname,detStr)
1137        String fname,detStr
1138
1139        String path = "entry:instrument:detector_"+detStr+":pixel_num_x"
1140        return(V_getRealValueFromHDF5(fname,path))
1141End
1142
1143Function V_getDet_pixel_num_y(fname,detStr)
1144        String fname,detStr
1145
1146        String path = "entry:instrument:detector_"+detStr+":pixel_num_y"
1147        return(V_getRealValueFromHDF5(fname,path))
1148End
1149
1150// only defined for the "B" detector, and only to satisfy NXsas
1151Function V_getDet_azimuthalAngle(fname,detStr)
1152        String fname,detStr
1153
1154        if(cmpstr(detStr,"B") == 0)
1155                String path = "entry:instrument:detector_"+detStr+":azimuthal_angle"
1156                return(V_getRealValueFromHDF5(fname,path))
1157        else
1158                return(0)
1159        endif
1160End
1161
1162Function V_getDet_beam_center_x(fname,detStr)
1163        String fname,detStr
1164
1165        String path = "entry:instrument:detector_"+detStr+":beam_center_x"
1166        return(V_getRealValueFromHDF5(fname,path))
1167End
1168
1169Function V_getDet_beam_center_y(fname,detStr)
1170        String fname,detStr
1171
1172        String path = "entry:instrument:detector_"+detStr+":beam_center_y"
1173        return(V_getRealValueFromHDF5(fname,path))
1174End
1175
1176// TODO -- write this function to return a WAVE with the data
1177// either as a wave reference, or as an input parameter
1178Function/WAVE V_getDetectorDataW(fname,detStr)
1179        String fname,detStr
1180
1181        String path = "entry:instrument:detector_"+detStr+":data"
1182        WAVE w = V_getRealWaveFromHDF5(fname,path)
1183
1184        return w
1185End
1186
1187// TODO -- write this function to return a WAVE with the data
1188// either as a wave reference, or as an input parameter
1189Function/WAVE V_getDetectorDataErrW(fname,detStr)
1190        String fname,detStr
1191
1192        String path = "entry:instrument:detector_"+detStr+":linear_data_error"
1193        WAVE w = V_getRealWaveFromHDF5(fname,path)
1194
1195        return w
1196End
1197
1198// TODO -- write this function to return a WAVE with the data
1199// either as a wave reference, or as an input parameter
1200// ALSO -- the "B" deadtime will be a single value (probably)
1201//  but the tube banks will be 1D arrays of values, one per tube
1202Function/WAVE V_getDetector_deadtime(fname,detStr)
1203        String fname,detStr
1204
1205        String path = "entry:instrument:detector_"+detStr+":dead_time"
1206        WAVE w = V_getRealWaveFromHDF5(fname,path)
1207
1208        return w
1209End
1210
1211
1212Function/S V_getDetDescription(fname,detStr)
1213        String fname,detStr
1214
1215        String path = "entry:instrument:detector_"+detStr+":description"
1216        Variable num=60
1217        return(V_getStringFromHDF5(fname,path,num))
1218End
1219
1220Function V_getDet_distance(fname,detStr)
1221        String fname,detStr
1222
1223        String path = "entry:instrument:detector_"+detStr+":distance"
1224        return(V_getRealValueFromHDF5(fname,path))
1225End
1226
1227// only defined for the "B" detector, and only to satisfy NXsas
1228Function V_getDet_equatorial_angle(fname,detStr)
1229        String fname,detStr
1230
1231        if(cmpstr(detStr,"B") == 0)
1232                String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1233                return(V_getRealValueFromHDF5(fname,path))
1234        else
1235                return(0)
1236        endif
1237End
1238
1239Function/S V_getDetEventFileName(fname,detStr)
1240        String fname,detStr
1241
1242        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1243        Variable num=60
1244        return(V_getStringFromHDF5(fname,path,num))
1245End
1246
1247Function V_getDet_IntegratedCount(fname,detStr)
1248        String fname,detStr
1249
1250        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1251        return(V_getRealValueFromHDF5(fname,path))
1252End
1253
1254Function V_getDet_LateralOffset(fname,detStr)
1255        String fname,detStr
1256
1257        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1258        return(V_getRealValueFromHDF5(fname,path))
1259End
1260
1261Function V_getDet_VerticalOffset(fname,detStr)
1262        String fname,detStr
1263
1264        String path = "entry:instrument:detector_"+detStr+":vertical_offset"
1265        return(V_getRealValueFromHDF5(fname,path))
1266End
1267
1268
1269// only defined for the "B" detector, and only to satisfy NXsas
1270Function V_getDet_polar_angle(fname,detStr)
1271        String fname,detStr
1272
1273        if(cmpstr(detStr,"B") == 0)
1274                String path = "entry:instrument:detector_"+detStr+":polar_angle"
1275                return(V_getRealValueFromHDF5(fname,path))
1276        else
1277                return(0)
1278        endif
1279End
1280
1281// only defined for the "B" detector, and only to satisfy NXsas
1282Function V_getDet_rotational_angle(fname,detStr)
1283        String fname,detStr
1284
1285        if(cmpstr(detStr,"B") == 0)
1286                String path = "entry:instrument:detector_"+detStr+":rotational_angle"
1287                return(V_getRealValueFromHDF5(fname,path))
1288        else
1289                return(0)
1290        endif
1291End
1292
1293Function/S V_getDetSettings(fname,detStr)
1294        String fname,detStr
1295
1296        String path = "entry:instrument:detector_"+detStr+":settings"
1297        Variable num=60
1298        return(V_getStringFromHDF5(fname,path,num))
1299End
1300
1301// really has no meaning at all
1302Function V_getDet_size(fname,detStr)
1303        String fname,detStr
1304
1305        String path = "entry:instrument:detector_"+detStr+":size"
1306        return(V_getRealValueFromHDF5(fname,path))
1307End
1308
1309Function/S V_getDetType(fname,detStr)
1310        String fname,detStr
1311
1312        String path = "entry:instrument:detector_"+detStr+":type"
1313        Variable num=60
1314        return(V_getStringFromHDF5(fname,path,num))
1315End
1316
1317Function V_getDet_x_pixel_size(fname,detStr)
1318        String fname,detStr
1319
1320        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1321        return(V_getRealValueFromHDF5(fname,path))
1322End
1323
1324Function V_getDet_y_pixel_size(fname,detStr)
1325        String fname,detStr
1326
1327        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1328        return(V_getRealValueFromHDF5(fname,path))
1329End
1330
1331/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1332
1333Function V_getDet_numberOfTubes(fname,detStr)
1334        String fname,detStr
1335
1336        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1337        if(cmpstr(detStr,"B") == 0)
1338                return(0)
1339        else
1340                return(V_getRealValueFromHDF5(fname,path))
1341        endif
1342End
1343
1344// TODO -- be clear on how this is defined. Separation as defined from what point? Units?
1345Function V_getDetPanelSeparation(fname,detStr)
1346        String fname,detStr
1347
1348        String path = "entry:instrument:detector_"+detStr+":separation"
1349        if(cmpstr(detStr,"B") == 0)
1350                return(0)
1351        else
1352                return(V_getRealValueFromHDF5(fname,path))
1353        endif
1354End
1355
1356// TODO -- write this function to return a WAVE with the data
1357// either as a wave reference, or as an input parameter
1358Function/WAVE V_getDetTube_spatialCalib(fname,detStr)
1359        String fname,detStr
1360
1361        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1362        if(cmpstr(detStr,"B") == 0)
1363                return $("")    // return should be null
1364        else
1365                WAVE w = V_getRealWaveFromHDF5(fname,path)
1366                return w
1367        endif
1368End
1369
1370// TODO -- be clear on how this is defined.
1371Function V_getDet_tubeIndex(fname,detStr)
1372        String fname,detStr
1373
1374        String path = "entry:instrument:detector_"+detStr+":tube_index"
1375        if(cmpstr(detStr,"B") == 0)
1376                return(0)
1377        else
1378                return(V_getRealValueFromHDF5(fname,path))
1379        endif
1380End
1381
1382Function/S V_getDet_tubeOrientation(fname,detStr)
1383        String fname,detStr
1384
1385        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1386        Variable num=60
1387        if(cmpstr(detStr,"B") == 0)
1388                return("")
1389        else
1390                return(V_getStringFromHDF5(fname,path,num))
1391        endif
1392End
1393
1394// TODO -- be clear on how this is defined. Units?
1395Function V_getDet_tubeWidth(fname,detStr)
1396        String fname,detStr
1397
1398        String path = "entry:instrument:detector_"+detStr+":tube_width"
1399        if(cmpstr(detStr,"B") == 0)
1400                return(0)
1401        else
1402                return(V_getRealValueFromHDF5(fname,path))
1403        endif
1404End
1405
1406//////////////////////
1407
1408// INSTRUMENT/LENSES    /APERTURES
1409//  lenses (data folder)
1410
1411Function V_getLensCurvature(fname)
1412        String fname
1413
1414        String path = "entry:instrument:lenses:curvature"
1415        return(V_getRealValueFromHDF5(fname,path))
1416End
1417
1418Function/S V_getLensesFocusType(fname)
1419        String fname
1420
1421        String path = "entry:instrument:lenses:focus_type"
1422        Variable num=60
1423        return(V_getStringFromHDF5(fname,path,num))
1424End
1425
1426Function V_getLensDistance(fname)
1427        String fname
1428
1429        String path = "entry:instrument:lenses:lens_distance"
1430        return(V_getRealValueFromHDF5(fname,path))
1431End
1432
1433Function/S V_getLensGeometry(fname)
1434        String fname
1435
1436        String path = "entry:instrument:lenses:lens_geometry"
1437        Variable num=60
1438        return(V_getStringFromHDF5(fname,path,num))
1439End
1440
1441Function/S V_getLensMaterial(fname)
1442        String fname
1443
1444        String path = "entry:instrument:lenses:lens_material"
1445        Variable num=60
1446        return(V_getStringFromHDF5(fname,path,num))
1447End
1448
1449Function V_getNumber_of_Lenses(fname)
1450        String fname
1451
1452        String path = "entry:instrument:lenses:number_of_lenses"
1453        return(V_getRealValueFromHDF5(fname,path))
1454End
1455
1456Function V_getNumber_of_prisms(fname)
1457        String fname
1458
1459        String path = "entry:instrument:lenses:number_of_prisms"
1460        return(V_getRealValueFromHDF5(fname,path))
1461End
1462
1463Function V_getPrism_distance(fname)
1464        String fname
1465
1466        String path = "entry:instrument:lenses:prism_distance"
1467        return(V_getRealValueFromHDF5(fname,path))
1468End
1469
1470Function/S V_getPrismMaterial(fname)
1471        String fname
1472
1473        String path = "entry:instrument:lenses:prism_material"
1474        Variable num=60
1475        return(V_getStringFromHDF5(fname,path,num))
1476End
1477
1478// status of lens/prism = lens | prism | both | out
1479Function/S V_getLensPrismStatus(fname)
1480        String fname
1481
1482        String path = "entry:instrument:lenses:status"
1483        Variable num=60
1484        return(V_getStringFromHDF5(fname,path,num))
1485End
1486       
1487
1488///////  sample_aperture (data folder)
1489
1490Function/S V_getSampleAp_Description(fname)
1491        String fname
1492
1493        String path = "entry:instrument:sample_aperture:description"
1494        Variable num=60
1495        return(V_getStringFromHDF5(fname,path,num))
1496End
1497
1498Function V_getSampleAp_distance(fname)
1499        String fname
1500
1501        String path = "entry:instrument:sample_aperture:distance"
1502        return(V_getRealValueFromHDF5(fname,path))
1503End
1504//      shape (data folder)
1505
1506Function/S V_getSampleAp_shape(fname)
1507        String fname
1508
1509        String path = "entry:instrument:sample_aperture:shape:shape"
1510        Variable num=60
1511        return(V_getStringFromHDF5(fname,path,num))
1512End
1513
1514// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1515// and will need to return more than a single dimension
1516// TODO -- be careful of the UNITS
1517Function V_getSampleAp_size(fname,outW)
1518        String fname
1519        Wave outW
1520
1521        String path = "entry:instrument:sample_aperture:shape:size"
1522        WAVE w = V_getRealWaveFromHDF5(fname,path)
1523
1524        outW = w
1525        return(0)
1526End             
1527
1528///////  sample_aperture_2 (data folder)
1529
1530Function/S V_getSampleAp2_Description(fname)
1531        String fname
1532
1533        String path = "entry:instrument:sample_aperture_2:description"
1534        Variable num=60
1535        return(V_getStringFromHDF5(fname,path,num))
1536End
1537
1538Function V_getSampleAp2_distance(fname)
1539        String fname
1540
1541        String path = "entry:instrument:sample_aperture_2:distance"
1542        return(V_getRealValueFromHDF5(fname,path))
1543End
1544//      shape (data folder)
1545
1546Function/S V_getSampleAp2_shape(fname)
1547        String fname
1548
1549        String path = "entry:instrument:sample_aperture_2:shape:shape"
1550        Variable num=60
1551        return(V_getStringFromHDF5(fname,path,num))
1552End
1553
1554// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1555// and will need to return more than a single dimension
1556// TODO -- be careful of the UNITS
1557Function V_getSampleAp2_size(fname,outW)
1558        String fname
1559        Wave outW
1560
1561        String path = "entry:instrument:sample_aperture_2:shape:size"
1562        WAVE w = V_getRealWaveFromHDF5(fname,path)
1563
1564        outW = w
1565        return(0)
1566End             
1567               
1568//////  sample_table (data folder)
1569// location  = "CHAMBER" or HUBER
1570Function/S V_getSampleTableLocation(fname)
1571        String fname
1572
1573        String path = "entry:instrument:sample_table:location"
1574        Variable num=60
1575        return(V_getStringFromHDF5(fname,path,num))
1576End
1577
1578// TODO - verify the meaning
1579//      offset_distance (?? for center of sample table vs. sample position)
1580Function V_getSampleTableOffset(fname)
1581        String fname
1582
1583        String path = "entry:instrument:sample_table:offset_distance"
1584        return(V_getRealValueFromHDF5(fname,path))
1585End     
1586       
1587//  source (data folder)
1588//name "NCNR"
1589Function/S V_getSourceName(fname)
1590        String fname
1591
1592        String path = "entry:instrument:source:name"
1593        Variable num=60
1594        return(V_getStringFromHDF5(fname,path,num))
1595End
1596
1597//      power -- nominal only, not connected to any real number
1598Function V_getReactorPower(fname)
1599        String fname
1600
1601        String path = "entry:instrument:source:power"
1602        return(V_getRealValueFromHDF5(fname,path))
1603End     
1604
1605//probe (wave) "neutron"
1606Function/S V_getSourceProbe(fname)
1607        String fname
1608
1609        String path = "entry:instrument:source:probe"
1610        Variable num=60
1611        return(V_getStringFromHDF5(fname,path,num))
1612End
1613
1614//type (wave) "Reactor Neutron Source"
1615Function/S V_getSourceType(fname)
1616        String fname
1617
1618        String path = "entry:instrument:source:type"
1619        Variable num=60
1620        return(V_getStringFromHDF5(fname,path,num))
1621End
1622
1623       
1624///////  source_aperture (data folder)
1625
1626Function/S V_getSourceAp_Description(fname)
1627        String fname
1628
1629        String path = "entry:instrument:source_aperture:description"
1630        Variable num=60
1631        return(V_getStringFromHDF5(fname,path,num))
1632End
1633
1634Function V_getSourceAp_distance(fname)
1635        String fname
1636
1637        String path = "entry:instrument:source_aperture:distance"
1638        return(V_getRealValueFromHDF5(fname,path))
1639End
1640//      shape (data folder)
1641
1642Function/S V_getSourceAp_shape(fname)
1643        String fname
1644
1645        String path = "entry:instrument:source_aperture:shape:shape"
1646        Variable num=60
1647        return(V_getStringFromHDF5(fname,path,num))
1648End
1649
1650// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1651// and will need to return more than a single dimension
1652// TODO -- be careful of the UNITS
1653Function V_getSourceAp_size(fname,outW)
1654        String fname
1655        Wave outW
1656
1657        String path = "entry:instrument:source_aperture:shape:size"
1658        WAVE w = V_getRealWaveFromHDF5(fname,path)
1659
1660        outW = w
1661        return(0)
1662End             
1663
1664
1665
1666
1667//////// SAMPLE
1668//////// SAMPLE
1669//////// SAMPLE
1670
1671//Sample position in changer
1672// TODO -- in the NexusWriter, this ends up as a STRING -- which is wrong. it needs to be FP
1673Function V_getSamplePosition(fname)
1674        String fname
1675       
1676        String path = "entry:sample:changer_position"   
1677        return(V_getRealValueFromHDF5(fname,path))
1678end
1679
1680// sample label
1681// TODO: value of num is currently not used
1682Function/S V_getSampleDescription(fname)
1683        String fname
1684
1685        String path = "entry:sample:description"
1686        Variable num=60
1687        return(V_getStringFromHDF5(fname,path,num))
1688End
1689
1690//no meaning to this...
1691Function V_getSample_equatorial_ang(fname)
1692        String fname
1693       
1694        String path = "entry:sample:equatorial_angle"   
1695        return(V_getRealValueFromHDF5(fname,path))
1696end
1697
1698// group ID !!! very important for matching up files
1699Function V_getSample_GroupID(fname)
1700        String fname
1701       
1702        String path = "entry:sample:group_id"   
1703        return(V_getRealValueFromHDF5(fname,path))
1704end
1705
1706
1707//Sample Rotation Angle
1708Function V_getSampleRotationAngle(fname)
1709        String fname
1710       
1711        String path = "entry:sample:rotation_angle"     
1712        return(V_getRealValueFromHDF5(fname,path))
1713end
1714
1715//?? this is huber/chamber??
1716// TODO -- then where is the description of 10CB, etc...
1717Function/S V_getSampleHolderDescription(fname)
1718        String fname
1719
1720        String path = "entry:sample:sample_holder_description"
1721        Variable num=60
1722        return(V_getStringFromHDF5(fname,path,num))
1723End
1724
1725//Sample Thickness
1726// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
1727Function V_getSampleThickness(fname)
1728        String fname
1729       
1730        String path = "entry:sample:thickness" 
1731        return(V_getRealValueFromHDF5(fname,path))
1732end
1733
1734// sample transmission
1735Function V_getSampleTransmission(fname)
1736        String fname
1737       
1738        String path = "entry:sample:transmission"       
1739//      String path = "QKK0037737:data:Transmission"   
1740        return(V_getRealValueFromHDF5(fname,path))
1741end
1742
1743//transmission error (one sigma)
1744Function V_getSampleTransError(fname)
1745        String fname
1746       
1747        String path = "entry:sample:transmission_error"
1748        return(V_getRealValueFromHDF5(fname,path))
1749end
1750
1751
1752
1753
1754//// SAMPLE / DATA LOGS
1755// write this generic , call with the name of the environment log desired
1756//
1757// temperature_1
1758// temperature_2
1759// shear_field
1760// pressure
1761// magnetic_field
1762// electric_field
1763//
1764//////// (for example) electric_field (data folder)
1765
1766Function/S V_getLog_attachedTo(fname,logStr)
1767        String fname,logStr
1768
1769        String path = "entry:sample:"+logstr+":attached_to"
1770        Variable num=60
1771        return(V_getStringFromHDF5(fname,path,num))
1772End
1773
1774
1775Function/S V_getLog_measurement(fname,logStr)
1776        String fname,logStr
1777
1778        String path = "entry:sample:"+logstr+":measurement"
1779        Variable num=60
1780        return(V_getStringFromHDF5(fname,path,num))
1781End
1782
1783
1784Function/S V_getLog_Name(fname,logStr)
1785        String fname,logStr
1786
1787        String path = "entry:sample:"+logstr+":name"
1788        Variable num=60
1789        return(V_getStringFromHDF5(fname,path,num))
1790End
1791
1792
1793// TODO --
1794Function V_getLog_nomValue(fname,logStr)
1795        String fname,logStr
1796       
1797        String path = "entry:sample:"+logstr+":value"
1798        return(V_getRealValueFromHDF5(fname,path))
1799end
1800
1801////            value_log (data folder)
1802Function/S V_getLog_startTime(fname,logStr)
1803        String fname,logStr
1804
1805        String path = "entry:sample:"+logstr+":value_log:start"
1806        Variable num=60
1807        return(V_getStringFromHDF5(fname,path,num))
1808End
1809
1810// TODO --
1811Function V_getLog_avgValue(fname,logStr)
1812        String fname,logStr
1813       
1814        String path = "entry:sample:"+logstr+":value_log:average_value"
1815        return(V_getRealValueFromHDF5(fname,path))
1816end
1817
1818// TODO -- this needs to be a WAVE reference
1819// TODO -- verify that the field is really read in as "time0"
1820Function V_getLog_time(fname,logStr,outW)
1821        String fname,logStr
1822        Wave outW
1823       
1824        String path = "entry:sample:"+logstr+":value_log:time0"
1825        WAVE w = V_getRealWaveFromHDF5(fname,path)
1826
1827        outW = w
1828        return(0)
1829end
1830
1831
1832// TODO -- this needs to be a WAVE reference
1833Function V_getLog_Value(fname,logStr,outW)
1834        String fname,logStr
1835        Wave outW
1836       
1837        String path = "entry:sample:"+logstr+":value_log:value"
1838        WAVE w = V_getRealWaveFromHDF5(fname,path)
1839
1840        outW = w
1841        return(0)
1842end
1843
1844
1845
1846
1847
1848
1849
1850///////// REDUCTION
1851///////// REDUCTION
1852///////// REDUCTION
1853
1854
1855// TODO -- needs to be a WAVE
1856Function V_getAbsolute_Scaling(fname,outW)
1857        String fname
1858        Wave outW
1859       
1860        String path = "entry:reduction:absolute_scaling"       
1861        WAVE w = V_getRealWaveFromHDF5(fname,path)
1862
1863        outW = w
1864        return(0)
1865end
1866
1867// TODO -- needs to be a WAVE
1868Function V_getBoxCoordinates(fname,outW)
1869        String fname
1870        Wave outW
1871       
1872        String path = "entry:reduction:box_coordinates"
1873        WAVE w = V_getRealWaveFromHDF5(fname,path)
1874
1875        outW = w
1876        return(0)
1877end
1878
1879//box counts
1880Function V_getBoxCounts(fname)
1881        String fname
1882       
1883        String path = "entry:reduction:box_count"       
1884        return(V_getRealValueFromHDF5(fname,path))
1885end
1886
1887//box counts error
1888Function V_getBoxCountsError(fname)
1889        String fname
1890       
1891        String path = "entry:reduction:box_count_error"
1892        return(V_getRealValueFromHDF5(fname,path))
1893end
1894
1895Function/S V_getReductionComments(fname)
1896        String fname
1897
1898        String path = "entry:reduction:comments"       
1899        Variable num=60
1900        return(V_getStringFromHDF5(fname,path,num))
1901End
1902
1903
1904Function/S V_getReductionIntent(fname)
1905        String fname
1906
1907        String path = "entry:reduction:intent" 
1908        Variable num=60
1909        return(V_getStringFromHDF5(fname,path,num))
1910End
1911
1912
1913Function/S V_getLogFileName(fname)
1914        String fname
1915
1916        String path = "entry:reduction:sans_log_file_name"     
1917        Variable num=60
1918        return(V_getStringFromHDF5(fname,path,num))
1919End
1920
1921
1922Function/S V_getSensitivityFileName(fname)
1923        String fname
1924
1925        String path = "entry:reduction:sensitivity_file_name"   
1926        Variable num=60
1927        return(V_getStringFromHDF5(fname,path,num))
1928End
1929
1930Function/S V_getTransmissionFileName(fname)
1931        String fname
1932
1933        String path = "entry:reduction:transmission_file_name" 
1934        Variable num=60
1935        return(V_getStringFromHDF5(fname,path,num))
1936End
1937
1938Function/S V_getEmptyBeamFileName(fname)
1939        String fname
1940
1941        String path = "entry:reduction:empty_beam_file_name"   
1942        Variable num=60
1943        return(V_getStringFromHDF5(fname,path,num))
1944End
1945
1946
1947//whole detector trasmission
1948Function V_getSampleTransWholeDetector(fname)
1949        String fname
1950       
1951        String path = "entry:reduction:whole_trans"     
1952        return(V_getRealValueFromHDF5(fname,path))
1953end
1954
1955//whole detector trasmission error
1956Function V_getSampleTransWholeDetErr(fname)
1957        String fname
1958       
1959        String path = "entry:reduction:whole_trans_error"       
1960        return(V_getRealValueFromHDF5(fname,path))
1961end
1962
1963                       
1964/////                   pol_sans (data folder)
1965
1966Function/S V_getPolSANS_cellName(fname)
1967        String fname
1968
1969        String path = "entry:reduction:pol_sans:cell_name"     
1970        Variable num=60
1971        return(V_getStringFromHDF5(fname,path,num))
1972End
1973
1974
1975// TODO -- needs to be a WAVE
1976Function V_getPolSANS_cellParams(fname,outW)
1977        String fname
1978        Wave outW
1979       
1980        String path = "entry:reduction:pol_sans:cell_parameters"       
1981        WAVE w = V_getRealWaveFromHDF5(fname,path)
1982
1983        outW = w
1984        return(0)
1985end
1986
1987Function/S V_getPolSANS_PolSANSPurpose(fname)
1988        String fname
1989
1990        String path = "entry:reduction:pol_sans:pol_sans_purpose"       
1991        Variable num=60
1992        return(V_getStringFromHDF5(fname,path,num))
1993End
1994
1995                               
1996//////// TOP LEVEL DATA REPRESENTATION
1997//
1998// note that here the data is (supposed to be) a link, not the actual data
1999// Igor HDf implementation cannot follow links properly, as far as I know.
2000// so ignore them here, and focus on the image that may be possible to read
2001//
2002
2003//              data_B (data folder)
2004//                      data (wave) 1           //ignore this, it's a link
2005//                      variables (wave) 320
2006//                      thumbnail (data folder)
2007
2008//data (wave) "binary"
2009// TODO -- this will need to be completely replaced with a function that can
2010// read the binary image data. should be possible, but I don't know the details on either end...
2011Function/S V_getDataImage(fname,detStr)
2012        String fname,detStr
2013
2014        String path = "entry:data_"+detStr+":thumbnail:data"   
2015        Variable num=60
2016        return(V_getStringFromHDF5(fname,path,num))
2017End
2018
2019Function/S V_getDataImageDescription(fname,detStr)
2020        String fname,detStr
2021
2022        String path = "entry:data_"+detStr+":thumbnail:description"     
2023        Variable num=60
2024        return(V_getStringFromHDF5(fname,path,num))
2025End
2026                                                               
2027Function/S V_getDataImageType(fname,detStr)
2028        String fname,detStr
2029
2030        String path = "entry:data_"+detStr+":thumbnail:type"   
2031        Variable num=60
2032        return(V_getStringFromHDF5(fname,path,num))
2033End
2034
2035
2036
2037
2038
2039
2040
Note: See TracBrowser for help on using the repository browser.