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

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

more additions to start the work file flow of converting RAW folder to a WORK folder. Raw_to_Work will be the function that sequentially applies the corrections. All corrections can be turned on/off with preferences.

File size: 46.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
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
468// distance from the attenuator to the sample (units??)
469Function V_getAttenDistance(fname)
470        String fname
471       
472        String path = "entry:instrument:attenuator:distance"   
473        return(V_getRealValueFromHDF5(fname,path))
474end
475
476
477// attenuator index, to use in the lookup table of transmission values
478Function V_getAttenIndex(fname)
479        String fname
480       
481        String path = "entry:instrument:attenuator:index"       
482        return(V_getRealValueFromHDF5(fname,path))
483end
484
485
486// table of the attenuation factor
487Function V_getAttenIndex_table(fname,outW)
488        String fname
489        Wave outW
490       
491        String path = "entry:instrument:attenuator:index_table"
492        WAVE w = V_getRealWaveFromHDF5(fname,path)
493
494        outW = w
495        return(0)
496end
497
498
499// status "in or out"
500Function/S V_getAttenStatus(fname)
501        String fname
502
503        String path = "entry:instrument:attenuator:status"
504        Variable num=60
505        return(V_getStringFromHDF5(fname,path,num))
506End
507
508// thickness of the attenuator (PMMA) - units??
509Function V_getAttenThickness(fname)
510        String fname
511       
512        String path = "entry:instrument:attenuator:thickness"   
513        return(V_getRealValueFromHDF5(fname,path))
514end
515
516
517// type of material for the atteunator
518Function/S V_getAttenType(fname)
519        String fname
520
521        String path = "entry:instrument:attenuator:type"
522        Variable num=60
523        return(V_getStringFromHDF5(fname,path,num))
524End
525
526
527////// INSTRUMENT/BEAM
528// instrument/beam/chopper (data folder)
529Function V_getChopperAngular_opening(fname)
530        String fname
531       
532        String path = "entry:instrument:beam:chopper:angular_opening"   
533        return(V_getRealValueFromHDF5(fname,path))
534end
535
536Function V_getChopDistance_from_sample(fname)
537        String fname
538       
539        String path = "entry:instrument:beam:chopper:distance_from_sample"     
540        return(V_getRealValueFromHDF5(fname,path))
541end
542
543Function V_getChopDistance_from_source(fname)
544        String fname
545       
546        String path = "entry:instrument:beam:chopper:distance_from_source"     
547        return(V_getRealValueFromHDF5(fname,path))
548end
549
550Function V_getChopperDuty_cycle(fname)
551        String fname
552       
553        String path = "entry:instrument:beam:chopper:duty_cycle"       
554        return(V_getRealValueFromHDF5(fname,path))
555end
556
557Function V_getChopperRotation_speed(fname)
558        String fname
559       
560        String path = "entry:instrument:beam:chopper:rotation_speed"   
561        return(V_getRealValueFromHDF5(fname,path))
562end
563
564Function V_getChopperSlits(fname)
565        String fname
566       
567        String path = "entry:instrument:beam:chopper:slits"     
568        return(V_getRealValueFromHDF5(fname,path))
569end
570
571Function/S V_getChopperstatus(fname)
572        String fname
573
574        String path = "entry:instrument:beam:chopper:status"
575        Variable num=60
576        return(V_getStringFromHDF5(fname,path,num))
577End
578
579Function/S V_getChoppertype(fname)
580        String fname
581
582        String path = "entry:instrument:beam:chopper:type"
583        Variable num=60
584        return(V_getStringFromHDF5(fname,path,num))
585End
586
587
588// instrument/beam/flipper (data folder)
589Function V_getFlipperDriving_current(fname)
590        String fname
591       
592        String path = "entry:instrument:beam:flipper:driving_current"   
593        return(V_getRealValueFromHDF5(fname,path))
594end
595
596Function V_getFlipperFrequency(fname)
597        String fname
598       
599        String path = "entry:instrument:beam:flipper:frequency"
600        return(V_getRealValueFromHDF5(fname,path))
601end
602
603Function/S V_getFlipperstatus(fname)
604        String fname
605
606        String path = "entry:instrument:beam:flipper:status"
607        Variable num=60
608        return(V_getStringFromHDF5(fname,path,num))
609End
610
611Function V_getFlipperTransmitted_power(fname)
612        String fname
613       
614        String path = "entry:instrument:beam:flipper:transmitted_power"
615        return(V_getRealValueFromHDF5(fname,path))
616end
617
618Function/S V_getFlipperWaveform(fname)
619        String fname
620
621        String path = "entry:instrument:beam:flipper:waveform"
622        Variable num=60
623        return(V_getStringFromHDF5(fname,path,num))
624End
625
626// instrument/beam/monochromator (data folder)
627Function/S V_getMonochromatorType(fname)
628        String fname
629
630        String path = "entry:instrument:beam:monochromator:type"
631        Variable num=60
632        return(V_getStringFromHDF5(fname,path,num))
633End
634
635Function V_getWavelength(fname)
636        String fname
637       
638        String path = "entry:instrument:beam:monochromator:wavelength" 
639        return(V_getRealValueFromHDF5(fname,path))
640end
641
642Function V_getWavelength_spread(fname)
643        String fname
644       
645        String path = "entry:instrument:beam:monochromator:wavelength_spread"   
646        return(V_getRealValueFromHDF5(fname,path))
647end
648
649// instrument/beam/monochromator/crystal (data folder)
650Function V_getCrystalEnergy(fname)
651        String fname
652       
653        String path = "entry:instrument:beam:monochromator:crystal:energy"     
654        return(V_getRealValueFromHDF5(fname,path))
655end
656
657Function V_getCrystalHorizontal_aperture(fname)
658        String fname
659       
660        String path = "entry:instrument:beam:monochromator:crystal:horizontal_aperture"
661        return(V_getRealValueFromHDF5(fname,path))
662end
663
664Function V_getCrystalHoriz_curvature(fname)
665        String fname
666       
667        String path = "entry:instrument:beam:monochromator:crystal:horizontal_curvature"       
668        return(V_getRealValueFromHDF5(fname,path))
669end
670
671Function V_getCrystalLattice_parameter(fname)
672        String fname
673       
674        String path = "entry:instrument:beam:monochromator:crystal:lattice_parameter"   
675        return(V_getRealValueFromHDF5(fname,path))
676end
677
678Function V_getCrystalDistance(fname)
679        String fname
680       
681        String path = "entry:instrument:beam:monochromator:crystal:distance"   
682        return(V_getRealValueFromHDF5(fname,path))
683end
684
685Function V_getCrystalReflection(fname)
686        String fname
687       
688        String path = "entry:instrument:beam:monochromator:crystal:reflection" 
689        return(V_getRealValueFromHDF5(fname,path))
690end
691
692Function V_getCrystalRotation(fname)
693        String fname
694       
695        String path = "entry:instrument:beam:monochromator:crystal:rotation"   
696        return(V_getRealValueFromHDF5(fname,path))
697end
698
699Function/S V_getCrystalStatus(fname)
700        String fname
701
702        String path = "entry:instrument:beam:monochromator:crystal:status"
703        Variable num=60
704        return(V_getStringFromHDF5(fname,path,num))
705End
706
707Function V_getCrystalVertical_aperture(fname)
708        String fname
709       
710        String path = "entry:instrument:beam:monochromator:crystal:vertical_aperture"   
711        return(V_getRealValueFromHDF5(fname,path))
712end
713
714Function V_getCrystalVertical_curvature(fname)
715        String fname
716       
717        String path = "entry:instrument:beam:monochromator:crystal:vertical_curvature" 
718        return(V_getRealValueFromHDF5(fname,path))
719end
720
721Function V_getCrystalWavelength(fname)
722        String fname
723       
724        String path = "entry:instrument:beam:monochromator:crystal:wavelength" 
725        return(V_getRealValueFromHDF5(fname,path))
726end
727
728Function V_getCrystalWavelength_spread(fname)
729        String fname
730       
731        String path = "entry:instrument:beam:monochromator:crystal:wavelength_spread"   
732        return(V_getRealValueFromHDF5(fname,path))
733end
734
735Function V_getCrystalWavevector(fname)
736        String fname
737       
738        String path = "entry:instrument:beam:monochromator:crystal:wavevector" 
739        return(V_getRealValueFromHDF5(fname,path))
740end
741
742// instrument/beam/monochromator/velocity_selector (data folder)
743Function V_getVSDistance(fname)
744        String fname
745       
746        String path = "entry:instrument:beam:monochromator:velocity_selector:distance" 
747        return(V_getRealValueFromHDF5(fname,path))
748end
749
750Function V_getVSRotation_speed(fname)
751        String fname
752       
753        String path = "entry:instrument:beam:monochromator:velocity_selector:rotation_speed"   
754        return(V_getRealValueFromHDF5(fname,path))
755end
756
757Function/S V_getVelSelStatus(fname)
758        String fname
759
760        String path = "entry:instrument:beam:monochromator:velocity_selector:status"
761        Variable num=60
762        return(V_getStringFromHDF5(fname,path,num))
763End
764
765Function V_getVSTable(fname,outW)
766        String fname
767        Wave outW
768       
769        String path = "entry:instrument:beam:monochromator:velocity_selector:table"     
770        WAVE w = V_getRealWaveFromHDF5(fname,path)
771
772        outW = w
773        return(0)
774end
775
776Function V_getVSTable_parameters(fname)
777        String fname
778       
779        String path = "entry:instrument:beam:monochromator:velocity_selector:table_parameters" 
780        return(V_getRealValueFromHDF5(fname,path))
781end
782
783Function V_getVS_tilt(fname)
784        String fname
785       
786        String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt"   
787        return(V_getRealValueFromHDF5(fname,path))
788end
789
790Function V_getVSWavelength(fname)
791        String fname
792       
793        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength"       
794        return(V_getRealValueFromHDF5(fname,path))
795end
796
797Function V_getVSWavelength_spread(fname)
798        String fname
799       
800        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength_spread"
801        return(V_getRealValueFromHDF5(fname,path))
802end
803
804// instrument/beam/monochromator/white_beam (data folder)
805Function/S V_getWhiteBeamStatus(fname)
806        String fname
807
808        String path = "entry:instrument:beam:monochromator:white_beam:status"
809        Variable num=60
810        return(V_getStringFromHDF5(fname,path,num))
811End
812
813Function V_getWhiteBeamWavelength(fname)
814        String fname
815       
816        String path = "entry:instrument:beam:monochromator:white_beam:wavelength"       
817        return(V_getRealValueFromHDF5(fname,path))
818end
819
820Function V_getWhiteBeamWavelength_spread(fname)
821        String fname
822       
823        String path = "entry:instrument:beam:monochromator:white_beam:wavelength_spread"       
824        return(V_getRealValueFromHDF5(fname,path))
825end
826
827// instrument/beam/polarizer (data folder)
828Function/S V_getPolarizerComposition(fname)
829        String fname
830
831        String path = "entry:instrument:beam:polarizer:composition"
832        Variable num=60
833        return(V_getStringFromHDF5(fname,path,num))
834End
835
836Function V_getPolarizerEfficiency(fname)
837        String fname
838       
839        String path = "entry:instrument:beam:polarizer:efficiency"     
840        return(V_getRealValueFromHDF5(fname,path))
841end
842
843Function/S V_getPolarizerStatus(fname)
844        String fname
845
846        String path = "entry:instrument:beam:polarizer:status"
847        Variable num=60
848        return(V_getStringFromHDF5(fname,path,num))
849End
850
851Function/S V_getPolarizerType(fname)
852        String fname
853
854        String path = "entry:instrument:beam:polarizer:type"
855        Variable num=60
856        return(V_getStringFromHDF5(fname,path,num))
857End
858
859// instrument/beam/polarizer_analyzer (data folder)
860Function V_getPolAnaCell_index(fname)
861        String fname
862
863        String path = "entry:instrument:beam:polarizer_analyzer:cell_index"
864        return(V_getRealValueFromHDF5(fname,path))
865End
866
867Function/S V_getPolAnaCell_name(fname)
868        String fname
869
870        String path = "entry:instrument:beam:polarizer_analyzer:cell_name"
871        Variable num=60
872        return(V_getStringFromHDF5(fname,path,num))
873End
874
875Function V_getPolAnaCell_parameters(fname,outW)
876        String fname
877        Wave outW
878
879        String path = "entry:instrument:beam:polarizer_analyzer:cell_parameters"
880        WAVE w = V_getRealWaveFromHDF5(fname,path)
881
882        outW = w
883        return(0)
884End
885
886Function V_getPolAnaGuideFieldCur_1(fname)
887        String fname
888
889        String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_1"
890        return(V_getRealValueFromHDF5(fname,path))
891End
892
893Function V_getPolAnaGuideFieldCur_2(fname)
894        String fname
895
896        String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_2"
897        return(V_getRealValueFromHDF5(fname,path))
898End
899
900Function V_getPolAnaSolenoid_current(fname)
901        String fname
902
903        String path = "entry:instrument:beam:polarizer_analyzer:solenoid_current"
904        return(V_getRealValueFromHDF5(fname,path))
905End
906
907Function/S V_getPolAnaStatus(fname)
908        String fname
909
910        String path = "entry:instrument:beam:polarizer_analyzer:status"
911        Variable num=60
912        return(V_getStringFromHDF5(fname,path,num))
913End
914
915                                       
916/////// INSTRUMENT/BEAM MONITORS
917
918//beam_monitor_low (data folder)
919Function V_getBeamMonLowData(fname)
920        String fname
921
922        String path = "entry:instrument:beam_monitor_low:data"
923        return(V_getRealValueFromHDF5(fname,path))
924End
925
926Function V_getBeamMonLowEfficiency(fname)
927        String fname
928
929        String path = "entry:instrument:beam_monitor_low:efficiency"
930        return(V_getRealValueFromHDF5(fname,path))
931End
932
933Function V_getBeamMonLowDistance(fname)
934        String fname
935
936        String path = "entry:instrument:beam_monitor_low:distance"
937        return(V_getRealValueFromHDF5(fname,path))
938End
939
940Function V_getBeamMonLowSaved_count(fname)
941        String fname
942
943        String path = "entry:instrument:beam_monitor_low:saved_count"
944        return(V_getRealValueFromHDF5(fname,path))
945End
946
947Function/S V_getBeamMonLowType(fname)
948        String fname
949
950        String path = "entry:instrument:beam_monitor_low:type"
951        Variable num=60
952        return(V_getStringFromHDF5(fname,path,num))
953End
954
955//beam_monitor_norm (data folder)
956Function V_getBeamMonNormData(fname)
957        String fname
958
959        String path = "entry:instrument:beam_monitor_norm:data"
960        return(V_getRealValueFromHDF5(fname,path))
961End
962
963Function V_getBeamMonNormEfficiency(fname)
964        String fname
965
966        String path = "entry:instrument:beam_monitor_norm:efficiency"
967        return(V_getRealValueFromHDF5(fname,path))
968End
969
970Function V_getBeamMonNormDistance(fname)
971        String fname
972
973        String path = "entry:instrument:beam_monitor_norm:distance"
974        return(V_getRealValueFromHDF5(fname,path))
975End
976
977Function V_getBeamMonNormSaved_count(fname)
978        String fname
979
980        String path = "entry:instrument:beam_monitor_norm:saved_count"
981        return(V_getRealValueFromHDF5(fname,path))
982End
983
984Function/S V_getBeamMonNormType(fname)
985        String fname
986
987        String path = "entry:instrument:beam_monitor_norm:type"
988        Variable num=60
989        return(V_getStringFromHDF5(fname,path,num))
990End
991
992//beam_stop (data folder)
993Function/S V_getBeamStopDescription(fname)
994        String fname
995
996        String path = "entry:instrument:beam_stop:description"
997        Variable num=60
998        return(V_getStringFromHDF5(fname,path,num))
999End
1000
1001Function V_getBeamStopDist_to_det(fname)
1002        String fname
1003
1004        String path = "entry:instrument:beam_stop:distance_to_detector"
1005        return(V_getRealValueFromHDF5(fname,path))
1006End
1007
1008Function V_getBeamStop_x_pos(fname)
1009        String fname
1010
1011        String path = "entry:instrument:beam_stop:x_pos"
1012        return(V_getRealValueFromHDF5(fname,path))
1013End
1014
1015Function V_getBeamStop_y_pos(fname)
1016        String fname
1017
1018        String path = "entry:instrument:beam_stop:y_pos"
1019        return(V_getRealValueFromHDF5(fname,path))
1020End
1021
1022//// INSTRUMENT/COLLIMATOR
1023//collimator (data folder)
1024Function V_getNumberOfGuides(fname)
1025        String fname
1026
1027        String path = "entry:instrument:collimator:number_guides"
1028        return(V_getRealValueFromHDF5(fname,path))
1029End
1030
1031//                              geometry (data folder)
1032//                                      shape (data folder)
1033Function/S V_getGuideShape(fname)
1034        String fname
1035
1036        String path = "entry:instrument:collimator:geometry:shape:shape"
1037        Variable num=60
1038        return(V_getStringFromHDF5(fname,path,num))
1039End
1040
1041Function V_getGuideSize(fname)
1042        String fname
1043
1044        String path = "entry:instrument:collimator:geometry:shape:size"
1045        return(V_getRealValueFromHDF5(fname,path))
1046End
1047
1048//                      converging_pinholes (data folder)
1049Function/S V_getConvPinholeStatus(fname)
1050        String fname
1051
1052        String path = "entry:instrument:converging_pinholes:status"
1053        Variable num=60
1054        return(V_getStringFromHDF5(fname,path,num))
1055End
1056
1057//                      converging_slits (not used)
1058
1059////// INSTRUMENT/DETECTORS
1060//                      detector_B (data folder)
1061//
1062// only defined for the "B" detector, and may not be necessary?
1063// TODO -- write to return an ARRAY
1064Function V_getDet_cal_x(fname,detStr,outW)
1065        String fname,detStr
1066        Wave outW
1067
1068        if(cmpstr(detStr,"B") == 0)
1069                String path = "entry:instrument:detector_"+detStr+":cal_x"
1070                WAVE w = V_getRealWaveFromHDF5(fname,path)
1071
1072                outW = w
1073                return(0)
1074        else
1075                return(0)
1076        endif
1077End
1078
1079// only defined for the "B" detector, and may not be necessary?
1080// TODO -- write to return an ARRAY
1081Function V_getDet_cal_y(fname,detStr,outW)
1082        String fname,detStr
1083        Wave outW
1084
1085        if(cmpstr(detStr,"B") == 0)
1086                String path = "entry:instrument:detector_"+detStr+":cal_y"
1087                WAVE w = V_getRealWaveFromHDF5(fname,path)
1088       
1089                outW = w
1090                return(0)
1091        else
1092                return(0)
1093        endif
1094End
1095
1096// TODO -- write and X and Y version of this. Pixels are not square
1097// so the FHWM will be different in each direction. May need to return
1098// "dummy" value for "B" detector if pixels there are square
1099Function V_getDet_pixel_fwhm_x(fname,detStr)
1100        String fname,detStr
1101
1102        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_x"
1103
1104// TODO -- different behavior for "B"
1105        if(cmpstr(detStr,"B") == 0)
1106                return(V_getRealValueFromHDF5(fname,path))
1107        else
1108                return(V_getRealValueFromHDF5(fname,path))
1109        endif
1110End
1111
1112// TODO -- write and X and Y version of this. Pixels are not square
1113// so the FHWM will be different in each direction. May need to return
1114// "dummy" value for "B" detector if pixels there are square
1115Function V_getDet_pixel_fwhm_y(fname,detStr)
1116        String fname,detStr
1117
1118        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_y"
1119
1120// TODO -- different behavior for "B"
1121        if(cmpstr(detStr,"B") == 0)
1122                return(V_getRealValueFromHDF5(fname,path))
1123        else
1124                return(V_getRealValueFromHDF5(fname,path))
1125        endif
1126End
1127
1128Function V_getDet_pixel_num_x(fname,detStr)
1129        String fname,detStr
1130
1131        String path = "entry:instrument:detector_"+detStr+":pixel_num_x"
1132        return(V_getRealValueFromHDF5(fname,path))
1133End
1134
1135Function V_getDet_pixel_num_y(fname,detStr)
1136        String fname,detStr
1137
1138        String path = "entry:instrument:detector_"+detStr+":pixel_num_y"
1139        return(V_getRealValueFromHDF5(fname,path))
1140End
1141
1142// only defined for the "B" detector, and only to satisfy NXsas
1143Function V_getDet_azimuthalAngle(fname,detStr)
1144        String fname,detStr
1145
1146        if(cmpstr(detStr,"B") == 0)
1147                String path = "entry:instrument:detector_"+detStr+":azimuthal_angle"
1148                return(V_getRealValueFromHDF5(fname,path))
1149        else
1150                return(0)
1151        endif
1152End
1153
1154Function V_getDet_beam_center_x(fname,detStr)
1155        String fname,detStr
1156
1157        String path = "entry:instrument:detector_"+detStr+":beam_center_x"
1158        return(V_getRealValueFromHDF5(fname,path))
1159End
1160
1161Function V_getDet_beam_center_y(fname,detStr)
1162        String fname,detStr
1163
1164        String path = "entry:instrument:detector_"+detStr+":beam_center_y"
1165        return(V_getRealValueFromHDF5(fname,path))
1166End
1167
1168// TODO -- write this function to return a WAVE with the data
1169// either as a wave reference, or as an input parameter
1170Function/WAVE V_getDetectorDataW(fname,detStr)
1171        String fname,detStr
1172
1173        String path = "entry:instrument:detector_"+detStr+":data"
1174        WAVE w = V_getRealWaveFromHDF5(fname,path)
1175
1176        return w
1177End
1178
1179// TODO -- write this function to return a WAVE with the data
1180// either as a wave reference, or as an input parameter
1181Function/WAVE V_getDetectorDataErrW(fname,detStr)
1182        String fname,detStr
1183
1184        String path = "entry:instrument:detector_"+detStr+":linear_data_error"
1185        WAVE w = V_getRealWaveFromHDF5(fname,path)
1186
1187        return w
1188End
1189
1190// TODO -- write this function to return a WAVE with the data
1191// either as a wave reference, or as an input parameter
1192// ALSO -- the "B" deadtime will be a single value (probably)
1193//  but the tube banks will be 1D arrays of values, one per tube
1194Function/WAVE V_getDetector_deadtime(fname,detStr)
1195        String fname,detStr
1196
1197        String path = "entry:instrument:detector_"+detStr+":dead_time"
1198        WAVE w = V_getRealWaveFromHDF5(fname,path)
1199
1200        return w
1201End
1202
1203
1204Function/S V_getDetDescription(fname,detStr)
1205        String fname,detStr
1206
1207        String path = "entry:instrument:detector_"+detStr+":description"
1208        Variable num=60
1209        return(V_getStringFromHDF5(fname,path,num))
1210End
1211
1212Function V_getDet_distance(fname,detStr)
1213        String fname,detStr
1214
1215        String path = "entry:instrument:detector_"+detStr+":distance"
1216        return(V_getRealValueFromHDF5(fname,path))
1217End
1218
1219// only defined for the "B" detector, and only to satisfy NXsas
1220Function V_getDet_equatorial_angle(fname,detStr)
1221        String fname,detStr
1222
1223        if(cmpstr(detStr,"B") == 0)
1224                String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1225                return(V_getRealValueFromHDF5(fname,path))
1226        else
1227                return(0)
1228        endif
1229End
1230
1231Function/S V_getDetEventFileName(fname,detStr)
1232        String fname,detStr
1233
1234        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1235        Variable num=60
1236        return(V_getStringFromHDF5(fname,path,num))
1237End
1238
1239Function V_getDet_IntegratedCount(fname,detStr)
1240        String fname,detStr
1241
1242        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1243        return(V_getRealValueFromHDF5(fname,path))
1244End
1245
1246Function V_getDet_LateralOffset(fname,detStr)
1247        String fname,detStr
1248
1249        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1250        return(V_getRealValueFromHDF5(fname,path))
1251End
1252
1253// only defined for the "B" detector, and only to satisfy NXsas
1254Function V_getDet_polar_angle(fname,detStr)
1255        String fname,detStr
1256
1257        if(cmpstr(detStr,"B") == 0)
1258                String path = "entry:instrument:detector_"+detStr+":polar_angle"
1259                return(V_getRealValueFromHDF5(fname,path))
1260        else
1261                return(0)
1262        endif
1263End
1264
1265// only defined for the "B" detector, and only to satisfy NXsas
1266Function V_getDet_rotational_angle(fname,detStr)
1267        String fname,detStr
1268
1269        if(cmpstr(detStr,"B") == 0)
1270                String path = "entry:instrument:detector_"+detStr+":rotational_angle"
1271                return(V_getRealValueFromHDF5(fname,path))
1272        else
1273                return(0)
1274        endif
1275End
1276
1277Function/S V_getDetSettings(fname,detStr)
1278        String fname,detStr
1279
1280        String path = "entry:instrument:detector_"+detStr+":settings"
1281        Variable num=60
1282        return(V_getStringFromHDF5(fname,path,num))
1283End
1284
1285// really has no meaning at all
1286Function V_getDet_size(fname,detStr)
1287        String fname,detStr
1288
1289        String path = "entry:instrument:detector_"+detStr+":size"
1290        return(V_getRealValueFromHDF5(fname,path))
1291End
1292
1293Function/S V_getDetType(fname,detStr)
1294        String fname,detStr
1295
1296        String path = "entry:instrument:detector_"+detStr+":type"
1297        Variable num=60
1298        return(V_getStringFromHDF5(fname,path,num))
1299End
1300
1301Function V_getDet_x_pixel_size(fname,detStr)
1302        String fname,detStr
1303
1304        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1305        return(V_getRealValueFromHDF5(fname,path))
1306End
1307
1308Function V_getDet_y_pixel_size(fname,detStr)
1309        String fname,detStr
1310
1311        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1312        return(V_getRealValueFromHDF5(fname,path))
1313End
1314
1315/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1316
1317Function V_getDet_numberOfTubes(fname,detStr)
1318        String fname,detStr
1319
1320        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1321        if(cmpstr(detStr,"B") == 0)
1322                return(0)
1323        else
1324                return(V_getRealValueFromHDF5(fname,path))
1325        endif
1326End
1327
1328// TODO -- be clear on how this is defined. Separation as defined from what point? Units?
1329Function V_getDetPanelSeparation(fname,detStr)
1330        String fname,detStr
1331
1332        String path = "entry:instrument:detector_"+detStr+":separation"
1333        if(cmpstr(detStr,"B") == 0)
1334                return(0)
1335        else
1336                return(V_getRealValueFromHDF5(fname,path))
1337        endif
1338End
1339
1340// TODO -- write this function to return a WAVE with the data
1341// either as a wave reference, or as an input parameter
1342Function V_getDetTube_spatialCalib(fname,detStr,outW)
1343        String fname,detStr
1344        Wave outW
1345
1346        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1347        if(cmpstr(detStr,"B") == 0)
1348                return(0)
1349        else
1350                WAVE w = V_getRealWaveFromHDF5(fname,path)
1351       
1352                outW = w
1353                return(0)
1354        endif
1355End
1356
1357// TODO -- be clear on how this is defined.
1358Function V_getDet_tubeIndex(fname,detStr)
1359        String fname,detStr
1360
1361        String path = "entry:instrument:detector_"+detStr+":tube_index"
1362        if(cmpstr(detStr,"B") == 0)
1363                return(0)
1364        else
1365                return(V_getRealValueFromHDF5(fname,path))
1366        endif
1367End
1368
1369Function/S V_getDet_tubeOrientation(fname,detStr)
1370        String fname,detStr
1371
1372        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1373        Variable num=60
1374        if(cmpstr(detStr,"B") == 0)
1375                return("")
1376        else
1377                return(V_getStringFromHDF5(fname,path,num))
1378        endif
1379End
1380
1381// TODO -- be clear on how this is defined. Units?
1382Function V_getDet_tubeWidth(fname,detStr)
1383        String fname,detStr
1384
1385        String path = "entry:instrument:detector_"+detStr+":tube_width"
1386        if(cmpstr(detStr,"B") == 0)
1387                return(0)
1388        else
1389                return(V_getRealValueFromHDF5(fname,path))
1390        endif
1391End
1392
1393//////////////////////
1394
1395// INSTRUMENT/LENSES    /APERTURES
1396//  lenses (data folder)
1397
1398Function V_getLensCurvature(fname)
1399        String fname
1400
1401        String path = "entry:instrument:lenses:curvature"
1402        return(V_getRealValueFromHDF5(fname,path))
1403End
1404
1405Function/S V_getLensesFocusType(fname)
1406        String fname
1407
1408        String path = "entry:instrument:lenses:focus_type"
1409        Variable num=60
1410        return(V_getStringFromHDF5(fname,path,num))
1411End
1412
1413Function V_getLensDistance(fname)
1414        String fname
1415
1416        String path = "entry:instrument:lenses:lens_distance"
1417        return(V_getRealValueFromHDF5(fname,path))
1418End
1419
1420Function/S V_getLensGeometry(fname)
1421        String fname
1422
1423        String path = "entry:instrument:lenses:lens_geometry"
1424        Variable num=60
1425        return(V_getStringFromHDF5(fname,path,num))
1426End
1427
1428Function/S V_getLensMaterial(fname)
1429        String fname
1430
1431        String path = "entry:instrument:lenses:lens_material"
1432        Variable num=60
1433        return(V_getStringFromHDF5(fname,path,num))
1434End
1435
1436Function V_getNumber_of_Lenses(fname)
1437        String fname
1438
1439        String path = "entry:instrument:lenses:number_of_lenses"
1440        return(V_getRealValueFromHDF5(fname,path))
1441End
1442
1443Function V_getNumber_of_prisms(fname)
1444        String fname
1445
1446        String path = "entry:instrument:lenses:number_of_prisms"
1447        return(V_getRealValueFromHDF5(fname,path))
1448End
1449
1450Function V_getPrism_distance(fname)
1451        String fname
1452
1453        String path = "entry:instrument:lenses:prism_distance"
1454        return(V_getRealValueFromHDF5(fname,path))
1455End
1456
1457Function/S V_getPrismMaterial(fname)
1458        String fname
1459
1460        String path = "entry:instrument:lenses:prism_material"
1461        Variable num=60
1462        return(V_getStringFromHDF5(fname,path,num))
1463End
1464
1465// status of lens/prism = lens | prism | both | out
1466Function/S V_getLensPrismStatus(fname)
1467        String fname
1468
1469        String path = "entry:instrument:lenses:status"
1470        Variable num=60
1471        return(V_getStringFromHDF5(fname,path,num))
1472End
1473       
1474
1475///////  sample_aperture (data folder)
1476
1477Function/S V_getSampleAp_Description(fname)
1478        String fname
1479
1480        String path = "entry:instrument:sample_aperture:description"
1481        Variable num=60
1482        return(V_getStringFromHDF5(fname,path,num))
1483End
1484
1485Function V_getSampleAp_distance(fname)
1486        String fname
1487
1488        String path = "entry:instrument:sample_aperture:distance"
1489        return(V_getRealValueFromHDF5(fname,path))
1490End
1491//      shape (data folder)
1492
1493Function/S V_getSampleAp_shape(fname)
1494        String fname
1495
1496        String path = "entry:instrument:sample_aperture:shape:shape"
1497        Variable num=60
1498        return(V_getStringFromHDF5(fname,path,num))
1499End
1500
1501// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1502// and will need to return more than a single dimension
1503// TODO -- be careful of the UNITS
1504Function V_getSampleAp_size(fname,outW)
1505        String fname
1506        Wave outW
1507
1508        String path = "entry:instrument:sample_aperture:shape:size"
1509        WAVE w = V_getRealWaveFromHDF5(fname,path)
1510
1511        outW = w
1512        return(0)
1513End             
1514
1515///////  sample_aperture_2 (data folder)
1516
1517Function/S V_getSampleAp2_Description(fname)
1518        String fname
1519
1520        String path = "entry:instrument:sample_aperture_2:description"
1521        Variable num=60
1522        return(V_getStringFromHDF5(fname,path,num))
1523End
1524
1525Function V_getSampleAp2_distance(fname)
1526        String fname
1527
1528        String path = "entry:instrument:sample_aperture_2:distance"
1529        return(V_getRealValueFromHDF5(fname,path))
1530End
1531//      shape (data folder)
1532
1533Function/S V_getSampleAp2_shape(fname)
1534        String fname
1535
1536        String path = "entry:instrument:sample_aperture_2:shape:shape"
1537        Variable num=60
1538        return(V_getStringFromHDF5(fname,path,num))
1539End
1540
1541// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1542// and will need to return more than a single dimension
1543// TODO -- be careful of the UNITS
1544Function V_getSampleAp2_size(fname,outW)
1545        String fname
1546        Wave outW
1547
1548        String path = "entry:instrument:sample_aperture_2:shape:size"
1549        WAVE w = V_getRealWaveFromHDF5(fname,path)
1550
1551        outW = w
1552        return(0)
1553End             
1554               
1555//////  sample_table (data folder)
1556// location  = "CHAMBER" or HUBER
1557Function/S V_getSampleTableLocation(fname)
1558        String fname
1559
1560        String path = "entry:instrument:sample_table:location"
1561        Variable num=60
1562        return(V_getStringFromHDF5(fname,path,num))
1563End
1564
1565// TODO - verify the meaning
1566//      offset_distance (?? for center of sample table vs. sample position)
1567Function V_getSampleTableOffset(fname)
1568        String fname
1569
1570        String path = "entry:instrument:sample_table:offset_distance"
1571        return(V_getRealValueFromHDF5(fname,path))
1572End     
1573       
1574//  source (data folder)
1575//name "NCNR"
1576Function/S V_getSourceName(fname)
1577        String fname
1578
1579        String path = "entry:instrument:source:name"
1580        Variable num=60
1581        return(V_getStringFromHDF5(fname,path,num))
1582End
1583
1584//      power -- nominal only, not connected to any real number
1585Function V_getReactorPower(fname)
1586        String fname
1587
1588        String path = "entry:instrument:source:power"
1589        return(V_getRealValueFromHDF5(fname,path))
1590End     
1591
1592//probe (wave) "neutron"
1593Function/S V_getSourceProbe(fname)
1594        String fname
1595
1596        String path = "entry:instrument:source:probe"
1597        Variable num=60
1598        return(V_getStringFromHDF5(fname,path,num))
1599End
1600
1601//type (wave) "Reactor Neutron Source"
1602Function/S V_getSourceType(fname)
1603        String fname
1604
1605        String path = "entry:instrument:source:type"
1606        Variable num=60
1607        return(V_getStringFromHDF5(fname,path,num))
1608End
1609
1610       
1611///////  source_aperture (data folder)
1612
1613Function/S V_getSourceAp_Description(fname)
1614        String fname
1615
1616        String path = "entry:instrument:source_aperture:description"
1617        Variable num=60
1618        return(V_getStringFromHDF5(fname,path,num))
1619End
1620
1621Function V_getSourceAp_distance(fname)
1622        String fname
1623
1624        String path = "entry:instrument:source_aperture:distance"
1625        return(V_getRealValueFromHDF5(fname,path))
1626End
1627//      shape (data folder)
1628
1629Function/S V_getSourceAp_shape(fname)
1630        String fname
1631
1632        String path = "entry:instrument:source_aperture:shape:shape"
1633        Variable num=60
1634        return(V_getStringFromHDF5(fname,path,num))
1635End
1636
1637// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1638// and will need to return more than a single dimension
1639// TODO -- be careful of the UNITS
1640Function V_getSourceAp_size(fname,outW)
1641        String fname
1642        Wave outW
1643
1644        String path = "entry:instrument:source_aperture:shape:size"
1645        WAVE w = V_getRealWaveFromHDF5(fname,path)
1646
1647        outW = w
1648        return(0)
1649End             
1650
1651
1652
1653
1654//////// SAMPLE
1655//////// SAMPLE
1656//////// SAMPLE
1657
1658//Sample position in changer
1659// TODO -- in the NexusWriter, this ends up as a STRING -- which is wrong. it needs to be FP
1660Function V_getSamplePosition(fname)
1661        String fname
1662       
1663        String path = "entry:sample:changer_position"   
1664        return(V_getRealValueFromHDF5(fname,path))
1665end
1666
1667// sample label
1668// TODO: value of num is currently not used
1669Function/S V_getSampleDescription(fname)
1670        String fname
1671
1672        String path = "entry:sample:description"
1673        Variable num=60
1674        return(V_getStringFromHDF5(fname,path,num))
1675End
1676
1677//no meaning to this...
1678Function V_getSample_equatorial_ang(fname)
1679        String fname
1680       
1681        String path = "entry:sample:equatorial_angle"   
1682        return(V_getRealValueFromHDF5(fname,path))
1683end
1684
1685// group ID !!! very important for matching up files
1686Function V_getSample_GroupID(fname)
1687        String fname
1688       
1689        String path = "entry:sample:group_id"   
1690        return(V_getRealValueFromHDF5(fname,path))
1691end
1692
1693
1694//Sample Rotation Angle
1695Function V_getSampleRotationAngle(fname)
1696        String fname
1697       
1698        String path = "entry:sample:rotation_angle"     
1699        return(V_getRealValueFromHDF5(fname,path))
1700end
1701
1702//?? this is huber/chamber??
1703// TODO -- then where is the description of 10CB, etc...
1704Function/S V_getSampleHolderDescription(fname)
1705        String fname
1706
1707        String path = "entry:sample:sample_holder_description"
1708        Variable num=60
1709        return(V_getStringFromHDF5(fname,path,num))
1710End
1711
1712//Sample Thickness
1713// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
1714Function V_getSampleThickness(fname)
1715        String fname
1716       
1717        String path = "entry:sample:thickness" 
1718        return(V_getRealValueFromHDF5(fname,path))
1719end
1720
1721// sample transmission
1722Function V_getSampleTransmission(fname)
1723        String fname
1724       
1725        String path = "entry:sample:transmission"       
1726//      String path = "QKK0037737:data:Transmission"   
1727        return(V_getRealValueFromHDF5(fname,path))
1728end
1729
1730//transmission error (one sigma)
1731Function V_getSampleTransError(fname)
1732        String fname
1733       
1734        String path = "entry:sample:transmission_error"
1735        return(V_getRealValueFromHDF5(fname,path))
1736end
1737
1738
1739
1740
1741//// SAMPLE / DATA LOGS
1742// write this generic , call with the name of the environment log desired
1743//
1744// temperature_1
1745// temperature_2
1746// shear_field
1747// pressure
1748// magnetic_field
1749// electric_field
1750//
1751//////// (for example) electric_field (data folder)
1752
1753Function/S V_getLog_attachedTo(fname,logStr)
1754        String fname,logStr
1755
1756        String path = "entry:sample:"+logstr+":attached_to"
1757        Variable num=60
1758        return(V_getStringFromHDF5(fname,path,num))
1759End
1760
1761
1762Function/S V_getLog_measurement(fname,logStr)
1763        String fname,logStr
1764
1765        String path = "entry:sample:"+logstr+":measurement"
1766        Variable num=60
1767        return(V_getStringFromHDF5(fname,path,num))
1768End
1769
1770
1771Function/S V_getLog_Name(fname,logStr)
1772        String fname,logStr
1773
1774        String path = "entry:sample:"+logstr+":name"
1775        Variable num=60
1776        return(V_getStringFromHDF5(fname,path,num))
1777End
1778
1779
1780// TODO --
1781Function V_getLog_nomValue(fname,logStr)
1782        String fname,logStr
1783       
1784        String path = "entry:sample:"+logstr+":value"
1785        return(V_getRealValueFromHDF5(fname,path))
1786end
1787
1788////            value_log (data folder)
1789Function/S V_getLog_startTime(fname,logStr)
1790        String fname,logStr
1791
1792        String path = "entry:sample:"+logstr+":value_log:start"
1793        Variable num=60
1794        return(V_getStringFromHDF5(fname,path,num))
1795End
1796
1797// TODO --
1798Function V_getLog_avgValue(fname,logStr)
1799        String fname,logStr
1800       
1801        String path = "entry:sample:"+logstr+":value_log:average_value"
1802        return(V_getRealValueFromHDF5(fname,path))
1803end
1804
1805// TODO -- this needs to be a WAVE reference
1806// TODO -- verify that the field is really read in as "time0"
1807Function V_getLog_time(fname,logStr,outW)
1808        String fname,logStr
1809        Wave outW
1810       
1811        String path = "entry:sample:"+logstr+":value_log:time0"
1812        WAVE w = V_getRealWaveFromHDF5(fname,path)
1813
1814        outW = w
1815        return(0)
1816end
1817
1818
1819// TODO -- this needs to be a WAVE reference
1820Function V_getLog_Value(fname,logStr,outW)
1821        String fname,logStr
1822        Wave outW
1823       
1824        String path = "entry:sample:"+logstr+":value_log:value"
1825        WAVE w = V_getRealWaveFromHDF5(fname,path)
1826
1827        outW = w
1828        return(0)
1829end
1830
1831
1832
1833
1834
1835
1836
1837///////// REDUCTION
1838///////// REDUCTION
1839///////// REDUCTION
1840
1841
1842// TODO -- needs to be a WAVE
1843Function V_getAbsolute_Scaling(fname,outW)
1844        String fname
1845        Wave outW
1846       
1847        String path = "entry:reduction:absolute_scaling"       
1848        WAVE w = V_getRealWaveFromHDF5(fname,path)
1849
1850        outW = w
1851        return(0)
1852end
1853
1854// TODO -- needs to be a WAVE
1855Function V_getBoxCoordinates(fname,outW)
1856        String fname
1857        Wave outW
1858       
1859        String path = "entry:reduction:box_coordinates"
1860        WAVE w = V_getRealWaveFromHDF5(fname,path)
1861
1862        outW = w
1863        return(0)
1864end
1865
1866//box counts
1867Function V_getBoxCounts(fname)
1868        String fname
1869       
1870        String path = "entry:reduction:box_count"       
1871        return(V_getRealValueFromHDF5(fname,path))
1872end
1873
1874//box counts error
1875Function V_getBoxCountsError(fname)
1876        String fname
1877       
1878        String path = "entry:reduction:box_count_error"
1879        return(V_getRealValueFromHDF5(fname,path))
1880end
1881
1882Function/S V_getReductionComments(fname)
1883        String fname
1884
1885        String path = "entry:reduction:comments"       
1886        Variable num=60
1887        return(V_getStringFromHDF5(fname,path,num))
1888End
1889
1890
1891Function/S V_getReductionIntent(fname)
1892        String fname
1893
1894        String path = "entry:reduction:intent" 
1895        Variable num=60
1896        return(V_getStringFromHDF5(fname,path,num))
1897End
1898
1899
1900Function/S V_getLogFileName(fname)
1901        String fname
1902
1903        String path = "entry:reduction:sans_log_file_name"     
1904        Variable num=60
1905        return(V_getStringFromHDF5(fname,path,num))
1906End
1907
1908
1909Function/S V_getSensitivityFileName(fname)
1910        String fname
1911
1912        String path = "entry:reduction:sensitivity_file_name"   
1913        Variable num=60
1914        return(V_getStringFromHDF5(fname,path,num))
1915End
1916
1917Function/S V_getTransmissionFileName(fname)
1918        String fname
1919
1920        String path = "entry:reduction:transmission_file_name" 
1921        Variable num=60
1922        return(V_getStringFromHDF5(fname,path,num))
1923End
1924
1925Function/S V_getEmptyBeamFileName(fname)
1926        String fname
1927
1928        String path = "entry:reduction:empty_beam_file_name"   
1929        Variable num=60
1930        return(V_getStringFromHDF5(fname,path,num))
1931End
1932
1933
1934//whole detector trasmission
1935Function V_getSampleTransWholeDetector(fname)
1936        String fname
1937       
1938        String path = "entry:reduction:whole_trans"     
1939        return(V_getRealValueFromHDF5(fname,path))
1940end
1941
1942//whole detector trasmission error
1943Function V_getSampleTransWholeDetErr(fname)
1944        String fname
1945       
1946        String path = "entry:reduction:whole_trans_error"       
1947        return(V_getRealValueFromHDF5(fname,path))
1948end
1949
1950                       
1951/////                   pol_sans (data folder)
1952
1953Function/S V_getPolSANS_cellName(fname)
1954        String fname
1955
1956        String path = "entry:reduction:pol_sans:cell_name"     
1957        Variable num=60
1958        return(V_getStringFromHDF5(fname,path,num))
1959End
1960
1961
1962// TODO -- needs to be a WAVE
1963Function V_getPolSANS_cellParams(fname,outW)
1964        String fname
1965        Wave outW
1966       
1967        String path = "entry:reduction:pol_sans:cell_parameters"       
1968        WAVE w = V_getRealWaveFromHDF5(fname,path)
1969
1970        outW = w
1971        return(0)
1972end
1973
1974Function/S V_getPolSANS_PolSANSPurpose(fname)
1975        String fname
1976
1977        String path = "entry:reduction:pol_sans:pol_sans_purpose"       
1978        Variable num=60
1979        return(V_getStringFromHDF5(fname,path,num))
1980End
1981
1982                               
1983//////// TOP LEVEL DATA REPRESENTATION
1984//
1985// note that here the data is (supposed to be) a link, not the actual data
1986// Igor HDf implementation cannot follow links properly, as far as I know.
1987// so ignore them here, and focus on the image that may be possible to read
1988//
1989
1990//              data_B (data folder)
1991//                      data (wave) 1           //ignore this, it's a link
1992//                      variables (wave) 320
1993//                      thumbnail (data folder)
1994
1995//data (wave) "binary"
1996// TODO -- this will need to be completely replaced with a function that can
1997// read the binary image data. should be possible, but I don't know the details on either end...
1998Function/S V_getDataImage(fname,detStr)
1999        String fname,detStr
2000
2001        String path = "entry:data_"+detStr+":thumbnail:data"   
2002        Variable num=60
2003        return(V_getStringFromHDF5(fname,path,num))
2004End
2005
2006Function/S V_getDataImageDescription(fname,detStr)
2007        String fname,detStr
2008
2009        String path = "entry:data_"+detStr+":thumbnail:description"     
2010        Variable num=60
2011        return(V_getStringFromHDF5(fname,path,num))
2012End
2013                                                               
2014Function/S V_getDataImageType(fname,detStr)
2015        String fname,detStr
2016
2017        String path = "entry:data_"+detStr+":thumbnail:type"   
2018        Variable num=60
2019        return(V_getStringFromHDF5(fname,path,num))
2020End
2021
2022
2023
2024
2025
2026
2027
Note: See TracBrowser for help on using the repository browser.