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

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

more additions and corrections to the V_get and V_write functions

creating a folder (not root) for the raw data files to be loaded

File size: 46.1 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 (data folder)
1058Function/S V_getConvSlitStatus(fname)
1059        String fname
1060
1061        String path = "entry:instrument:converging_slits:status"
1062        Variable num=60
1063        return(V_getStringFromHDF5(fname,path,num))
1064End
1065
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 V_getDetectorData(fname,detStr,outW)
1179        String fname,detStr
1180        Wave outW
1181
1182        String path = "entry:instrument:detector_"+detStr+":data"
1183        WAVE w = V_getRealWaveFromHDF5(fname,path)
1184
1185        outW = w
1186        return(0)
1187End
1188
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 V_getDetector_deadtime(fname,detStr,outW)
1195        String fname,detStr
1196        Wave outW
1197
1198        String path = "entry:instrument:detector_"+detStr+":dead_time"
1199        WAVE w = V_getRealWaveFromHDF5(fname,path)
1200
1201        outW = w
1202        return(0)
1203End
1204
1205
1206Function/S V_getDetDescription(fname,detStr)
1207        String fname,detStr
1208
1209        String path = "entry:instrument:detector_"+detStr+":description"
1210        Variable num=60
1211        return(V_getStringFromHDF5(fname,path,num))
1212End
1213
1214Function V_getDet_distance(fname,detStr)
1215        String fname,detStr
1216
1217        String path = "entry:instrument:detector_"+detStr+":distance"
1218        return(V_getRealValueFromHDF5(fname,path))
1219End
1220
1221// only defined for the "B" detector, and only to satisfy NXsas
1222Function V_getDet_equatorial_angle(fname,detStr)
1223        String fname,detStr
1224
1225        if(cmpstr(detStr,"B") == 0)
1226                String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1227                return(V_getRealValueFromHDF5(fname,path))
1228        else
1229                return(0)
1230        endif
1231End
1232
1233Function/S V_getDetEventFileName(fname,detStr)
1234        String fname,detStr
1235
1236        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1237        Variable num=60
1238        return(V_getStringFromHDF5(fname,path,num))
1239End
1240
1241Function V_getDet_IntegratedCount(fname,detStr)
1242        String fname,detStr
1243
1244        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1245        return(V_getRealValueFromHDF5(fname,path))
1246End
1247
1248Function V_getDet_LateralOffset(fname,detStr)
1249        String fname,detStr
1250
1251        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1252        return(V_getRealValueFromHDF5(fname,path))
1253End
1254
1255// only defined for the "B" detector, and only to satisfy NXsas
1256Function V_getDet_polar_angle(fname,detStr)
1257        String fname,detStr
1258
1259        if(cmpstr(detStr,"B") == 0)
1260                String path = "entry:instrument:detector_"+detStr+":polar_angle"
1261                return(V_getRealValueFromHDF5(fname,path))
1262        else
1263                return(0)
1264        endif
1265End
1266
1267// only defined for the "B" detector, and only to satisfy NXsas
1268Function V_getDet_rotational_angle(fname,detStr)
1269        String fname,detStr
1270
1271        if(cmpstr(detStr,"B") == 0)
1272                String path = "entry:instrument:detector_"+detStr+":rotational_angle"
1273                return(V_getRealValueFromHDF5(fname,path))
1274        else
1275                return(0)
1276        endif
1277End
1278
1279Function/S V_getDetSettings(fname,detStr)
1280        String fname,detStr
1281
1282        String path = "entry:instrument:detector_"+detStr+":settings"
1283        Variable num=60
1284        return(V_getStringFromHDF5(fname,path,num))
1285End
1286
1287// really has no meaning at all
1288Function V_getDet_size(fname,detStr)
1289        String fname,detStr
1290
1291        String path = "entry:instrument:detector_"+detStr+":size"
1292        return(V_getRealValueFromHDF5(fname,path))
1293End
1294
1295Function/S V_getDetType(fname,detStr)
1296        String fname,detStr
1297
1298        String path = "entry:instrument:detector_"+detStr+":type"
1299        Variable num=60
1300        return(V_getStringFromHDF5(fname,path,num))
1301End
1302
1303Function V_getDet_x_pixel_size(fname,detStr)
1304        String fname,detStr
1305
1306        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1307        return(V_getRealValueFromHDF5(fname,path))
1308End
1309
1310Function V_getDet_y_pixel_size(fname,detStr)
1311        String fname,detStr
1312
1313        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1314        return(V_getRealValueFromHDF5(fname,path))
1315End
1316
1317/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1318
1319Function V_getDet_numberOfTubes(fname,detStr)
1320        String fname,detStr
1321
1322        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1323        if(cmpstr(detStr,"B") == 0)
1324                return(0)
1325        else
1326                return(V_getRealValueFromHDF5(fname,path))
1327        endif
1328End
1329
1330// TODO -- be clear on how this is defined. Separation as defined from what point? Units?
1331Function V_getDetPanelSeparation(fname,detStr)
1332        String fname,detStr
1333
1334        String path = "entry:instrument:detector_"+detStr+":separation"
1335        if(cmpstr(detStr,"B") == 0)
1336                return(0)
1337        else
1338                return(V_getRealValueFromHDF5(fname,path))
1339        endif
1340End
1341
1342// TODO -- write this function to return a WAVE with the data
1343// either as a wave reference, or as an input parameter
1344Function V_getDetTube_spatialCalib(fname,detStr,outW)
1345        String fname,detStr
1346        Wave outW
1347
1348        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1349        if(cmpstr(detStr,"B") == 0)
1350                return(0)
1351        else
1352                WAVE w = V_getRealWaveFromHDF5(fname,path)
1353       
1354                outW = w
1355                return(0)
1356        endif
1357End
1358
1359// TODO -- be clear on how this is defined.
1360Function V_getDet_tubeIndex(fname,detStr)
1361        String fname,detStr
1362
1363        String path = "entry:instrument:detector_"+detStr+":tube_index"
1364        if(cmpstr(detStr,"B") == 0)
1365                return(0)
1366        else
1367                return(V_getRealValueFromHDF5(fname,path))
1368        endif
1369End
1370
1371Function/S V_getDet_tubeOrientation(fname,detStr)
1372        String fname,detStr
1373
1374        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1375        Variable num=60
1376        if(cmpstr(detStr,"B") == 0)
1377                return("")
1378        else
1379                return(V_getStringFromHDF5(fname,path,num))
1380        endif
1381End
1382
1383// TODO -- be clear on how this is defined. Units?
1384Function V_getDet_tubeWidth(fname,detStr)
1385        String fname,detStr
1386
1387        String path = "entry:instrument:detector_"+detStr+":tube_width"
1388        if(cmpstr(detStr,"B") == 0)
1389                return(0)
1390        else
1391                return(V_getRealValueFromHDF5(fname,path))
1392        endif
1393End
1394
1395//////////////////////
1396
1397// INSTRUMENT/LENSES    /APERTURES
1398//  lenses (data folder)
1399
1400Function V_getLensCurvature(fname)
1401        String fname
1402
1403        String path = "entry:instrument:lenses:curvature"
1404        return(V_getRealValueFromHDF5(fname,path))
1405End
1406
1407Function/S V_getLensesFocusType(fname)
1408        String fname
1409
1410        String path = "entry:instrument:lenses:focus_type"
1411        Variable num=60
1412        return(V_getStringFromHDF5(fname,path,num))
1413End
1414
1415Function V_getLensDistance(fname)
1416        String fname
1417
1418        String path = "entry:instrument:lenses:lens_distance"
1419        return(V_getRealValueFromHDF5(fname,path))
1420End
1421
1422Function/S V_getLensGeometry(fname)
1423        String fname
1424
1425        String path = "entry:instrument:lenses:lens_geometry"
1426        Variable num=60
1427        return(V_getStringFromHDF5(fname,path,num))
1428End
1429
1430Function/S V_getLensMaterial(fname)
1431        String fname
1432
1433        String path = "entry:instrument:lenses:lens_material"
1434        Variable num=60
1435        return(V_getStringFromHDF5(fname,path,num))
1436End
1437
1438Function V_getNumber_of_Lenses(fname)
1439        String fname
1440
1441        String path = "entry:instrument:lenses:number_of_lenses"
1442        return(V_getRealValueFromHDF5(fname,path))
1443End
1444
1445Function V_getNumber_of_prisms(fname)
1446        String fname
1447
1448        String path = "entry:instrument:lenses:number_of_prisms"
1449        return(V_getRealValueFromHDF5(fname,path))
1450End
1451
1452Function V_getPrism_distance(fname)
1453        String fname
1454
1455        String path = "entry:instrument:lenses:prism_distance"
1456        return(V_getRealValueFromHDF5(fname,path))
1457End
1458
1459Function/S V_getPrismMaterial(fname)
1460        String fname
1461
1462        String path = "entry:instrument:lenses:prism_material"
1463        Variable num=60
1464        return(V_getStringFromHDF5(fname,path,num))
1465End
1466
1467// status of lens/prism = lens | prism | both | out
1468Function/S V_getLensPrismStatus(fname)
1469        String fname
1470
1471        String path = "entry:instrument:lenses:status"
1472        Variable num=60
1473        return(V_getStringFromHDF5(fname,path,num))
1474End
1475       
1476
1477///////  sample_aperture (data folder)
1478
1479Function/S V_getSampleAp_Description(fname)
1480        String fname
1481
1482        String path = "entry:instrument:sample_aperture:description"
1483        Variable num=60
1484        return(V_getStringFromHDF5(fname,path,num))
1485End
1486
1487Function V_getSampleAp_distance(fname)
1488        String fname
1489
1490        String path = "entry:instrument:sample_aperture:distance"
1491        return(V_getRealValueFromHDF5(fname,path))
1492End
1493//      shape (data folder)
1494
1495Function/S V_getSampleAp_shape(fname)
1496        String fname
1497
1498        String path = "entry:instrument:sample_aperture:shape:shape"
1499        Variable num=60
1500        return(V_getStringFromHDF5(fname,path,num))
1501End
1502
1503// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1504// and will need to return more than a single dimension
1505// TODO -- be careful of the UNITS
1506Function V_getSampleAp_size(fname,outW)
1507        String fname
1508        Wave outW
1509
1510        String path = "entry:instrument:sample_aperture:shape:size"
1511        WAVE w = V_getRealWaveFromHDF5(fname,path)
1512
1513        outW = w
1514        return(0)
1515End             
1516
1517///////  sample_aperture_2 (data folder)
1518
1519Function/S V_getSampleAp2_Description(fname)
1520        String fname
1521
1522        String path = "entry:instrument:sample_aperture_2:description"
1523        Variable num=60
1524        return(V_getStringFromHDF5(fname,path,num))
1525End
1526
1527Function V_getSampleAp2_distance(fname)
1528        String fname
1529
1530        String path = "entry:instrument:sample_aperture_2:distance"
1531        return(V_getRealValueFromHDF5(fname,path))
1532End
1533//      shape (data folder)
1534
1535Function/S V_getSampleAp2_shape(fname)
1536        String fname
1537
1538        String path = "entry:instrument:sample_aperture_2:shape:shape"
1539        Variable num=60
1540        return(V_getStringFromHDF5(fname,path,num))
1541End
1542
1543// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1544// and will need to return more than a single dimension
1545// TODO -- be careful of the UNITS
1546Function V_getSampleAp2_size(fname,outW)
1547        String fname
1548        Wave outW
1549
1550        String path = "entry:instrument:sample_aperture_2:shape:size"
1551        WAVE w = V_getRealWaveFromHDF5(fname,path)
1552
1553        outW = w
1554        return(0)
1555End             
1556               
1557//////  sample_table (data folder)
1558// location  = "CHAMBER" or HUBER
1559Function/S V_getSampleTableLocation(fname)
1560        String fname
1561
1562        String path = "entry:instrument:sample_table:location"
1563        Variable num=60
1564        return(V_getStringFromHDF5(fname,path,num))
1565End
1566
1567// TODO - verify the meaning
1568//      offset_distance (?? for center of sample table vs. sample position)
1569Function V_getSampleTableOffset(fname)
1570        String fname
1571
1572        String path = "entry:instrument:sample_table:offset_distance"
1573        return(V_getRealValueFromHDF5(fname,path))
1574End     
1575       
1576//  source (data folder)
1577//name "NCNR"
1578Function/S V_getSourceName(fname)
1579        String fname
1580
1581        String path = "entry:instrument:source:name"
1582        Variable num=60
1583        return(V_getStringFromHDF5(fname,path,num))
1584End
1585
1586//      power -- nominal only, not connected to any real number
1587Function V_getReactorPower(fname)
1588        String fname
1589
1590        String path = "entry:instrument:source:power"
1591        return(V_getRealValueFromHDF5(fname,path))
1592End     
1593
1594//probe (wave) "neutron"
1595Function/S V_getSourceProbe(fname)
1596        String fname
1597
1598        String path = "entry:instrument:source:probe"
1599        Variable num=60
1600        return(V_getStringFromHDF5(fname,path,num))
1601End
1602
1603//type (wave) "Reactor Neutron Source"
1604Function/S V_getSourceType(fname)
1605        String fname
1606
1607        String path = "entry:instrument:source:type"
1608        Variable num=60
1609        return(V_getStringFromHDF5(fname,path,num))
1610End
1611
1612       
1613///////  source_aperture (data folder)
1614
1615Function/S V_getSourceAp_Description(fname)
1616        String fname
1617
1618        String path = "entry:instrument:source_aperture:description"
1619        Variable num=60
1620        return(V_getStringFromHDF5(fname,path,num))
1621End
1622
1623Function V_getSourceAp_distance(fname)
1624        String fname
1625
1626        String path = "entry:instrument:source_aperture:distance"
1627        return(V_getRealValueFromHDF5(fname,path))
1628End
1629//      shape (data folder)
1630
1631Function/S V_getSourceAp_shape(fname)
1632        String fname
1633
1634        String path = "entry:instrument:source_aperture:shape:shape"
1635        Variable num=60
1636        return(V_getStringFromHDF5(fname,path,num))
1637End
1638
1639// TODO -- this needs to return a WAVE, since the shape may be circle, or rectangle
1640// and will need to return more than a single dimension
1641// TODO -- be careful of the UNITS
1642Function V_getSourceAp_size(fname,outW)
1643        String fname
1644        Wave outW
1645
1646        String path = "entry:instrument:source_aperture:shape:size"
1647        WAVE w = V_getRealWaveFromHDF5(fname,path)
1648
1649        outW = w
1650        return(0)
1651End             
1652
1653
1654
1655
1656//////// SAMPLE
1657//////// SAMPLE
1658//////// SAMPLE
1659
1660//Sample position in changer
1661// TODO -- in the NexusWriter, this ends up as a STRING -- which is wrong. it needs to be FP
1662Function V_getSamplePosition(fname)
1663        String fname
1664       
1665        String path = "entry:sample:changer_position"   
1666        return(V_getRealValueFromHDF5(fname,path))
1667end
1668
1669// sample label
1670// TODO: value of num is currently not used
1671Function/S V_getSampleDescription(fname)
1672        String fname
1673
1674        String path = "entry:sample:description"
1675        Variable num=60
1676        return(V_getStringFromHDF5(fname,path,num))
1677End
1678
1679//no meaning to this...
1680Function V_getSample_equatorial_ang(fname)
1681        String fname
1682       
1683        String path = "entry:sample:equatorial_angle"   
1684        return(V_getRealValueFromHDF5(fname,path))
1685end
1686
1687// group ID !!! very important for matching up files
1688Function V_getSample_GroupID(fname)
1689        String fname
1690       
1691        String path = "entry:sample:group_id"   
1692        return(V_getRealValueFromHDF5(fname,path))
1693end
1694
1695
1696//Sample Rotation Angle
1697Function V_getSampleRotationAngle(fname)
1698        String fname
1699       
1700        String path = "entry:sample:rotation_angle"     
1701        return(V_getRealValueFromHDF5(fname,path))
1702end
1703
1704//?? this is huber/chamber??
1705// TODO -- then where is the description of 10CB, etc...
1706Function/S V_getSampleHolderDescription(fname)
1707        String fname
1708
1709        String path = "entry:sample:sample_holder_description"
1710        Variable num=60
1711        return(V_getStringFromHDF5(fname,path,num))
1712End
1713
1714//Sample Thickness
1715// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
1716Function V_getSampleThickness(fname)
1717        String fname
1718       
1719        String path = "entry:sample:thickness" 
1720        return(V_getRealValueFromHDF5(fname,path))
1721end
1722
1723// sample transmission
1724Function V_getSampleTransmission(fname)
1725        String fname
1726       
1727        String path = "entry:sample:transmission"       
1728//      String path = "QKK0037737:data:Transmission"   
1729        return(V_getRealValueFromHDF5(fname,path))
1730end
1731
1732//transmission error (one sigma)
1733Function V_getSampleTransError(fname)
1734        String fname
1735       
1736        String path = "entry:sample:transmission_error"
1737        return(V_getRealValueFromHDF5(fname,path))
1738end
1739
1740
1741
1742
1743//// SAMPLE / DATA LOGS
1744// write this generic , call with the name of the environment log desired
1745//
1746// temperature_1
1747// temperature_2
1748// shear_field
1749// pressure
1750// magnetic_field
1751// electric_field
1752//
1753//////// (for example) electric_field (data folder)
1754
1755Function/S V_getLog_attachedTo(fname,logStr)
1756        String fname,logStr
1757
1758        String path = "entry:sample:"+logstr+":attached_to"
1759        Variable num=60
1760        return(V_getStringFromHDF5(fname,path,num))
1761End
1762
1763
1764Function/S V_getLog_measurement(fname,logStr)
1765        String fname,logStr
1766
1767        String path = "entry:sample:"+logstr+":measurement"
1768        Variable num=60
1769        return(V_getStringFromHDF5(fname,path,num))
1770End
1771
1772
1773Function/S V_getLog_Name(fname,logStr)
1774        String fname,logStr
1775
1776        String path = "entry:sample:"+logstr+":name"
1777        Variable num=60
1778        return(V_getStringFromHDF5(fname,path,num))
1779End
1780
1781
1782// TODO --
1783Function V_getLog_nomValue(fname,logStr)
1784        String fname,logStr
1785       
1786        String path = "entry:sample:"+logstr+":value"
1787        return(V_getRealValueFromHDF5(fname,path))
1788end
1789
1790////            value_log (data folder)
1791Function/S V_getLog_startTime(fname,logStr)
1792        String fname,logStr
1793
1794        String path = "entry:sample:"+logstr+":value_log:start"
1795        Variable num=60
1796        return(V_getStringFromHDF5(fname,path,num))
1797End
1798
1799// TODO --
1800Function V_getLog_avgValue(fname,logStr)
1801        String fname,logStr
1802       
1803        String path = "entry:sample:"+logstr+":value_log:average_value"
1804        return(V_getRealValueFromHDF5(fname,path))
1805end
1806
1807// TODO -- this needs to be a WAVE reference
1808// TODO -- verify that the field is really read in as "time0"
1809Function V_getLog_time(fname,logStr,outW)
1810        String fname,logStr
1811        Wave outW
1812       
1813        String path = "entry:sample:"+logstr+":value_log:time0"
1814        WAVE w = V_getRealWaveFromHDF5(fname,path)
1815
1816        outW = w
1817        return(0)
1818end
1819
1820
1821// TODO -- this needs to be a WAVE reference
1822Function V_getLog_Value(fname,logStr,outW)
1823        String fname,logStr
1824        Wave outW
1825       
1826        String path = "entry:sample:"+logstr+":value_log:value"
1827        WAVE w = V_getRealWaveFromHDF5(fname,path)
1828
1829        outW = w
1830        return(0)
1831end
1832
1833
1834
1835
1836
1837
1838
1839///////// REDUCTION
1840///////// REDUCTION
1841///////// REDUCTION
1842
1843
1844// TODO -- needs to be a WAVE
1845Function V_getAbsolute_Scaling(fname,outW)
1846        String fname
1847        Wave outW
1848       
1849        String path = "entry:reduction:absolute_scaling"       
1850        WAVE w = V_getRealWaveFromHDF5(fname,path)
1851
1852        outW = w
1853        return(0)
1854end
1855
1856// TODO -- needs to be a WAVE
1857Function V_getBoxCoordinates(fname,outW)
1858        String fname
1859        Wave outW
1860       
1861        String path = "entry:reduction:box_coordinates"
1862        WAVE w = V_getRealWaveFromHDF5(fname,path)
1863
1864        outW = w
1865        return(0)
1866end
1867
1868//box counts
1869Function V_getBoxCounts(fname)
1870        String fname
1871       
1872        String path = "entry:reduction:box_count"       
1873        return(V_getRealValueFromHDF5(fname,path))
1874end
1875
1876//box counts error
1877Function V_getBoxCountsError(fname)
1878        String fname
1879       
1880        String path = "entry:reduction:box_count_error"
1881        return(V_getRealValueFromHDF5(fname,path))
1882end
1883
1884Function/S V_getReductionComments(fname)
1885        String fname
1886
1887        String path = "entry:reduction:comments"       
1888        Variable num=60
1889        return(V_getStringFromHDF5(fname,path,num))
1890End
1891
1892
1893Function/S V_getReductionIntent(fname)
1894        String fname
1895
1896        String path = "entry:reduction:intent" 
1897        Variable num=60
1898        return(V_getStringFromHDF5(fname,path,num))
1899End
1900
1901
1902Function/S V_getLogFileName(fname)
1903        String fname
1904
1905        String path = "entry:reduction:sans_log_file_name"     
1906        Variable num=60
1907        return(V_getStringFromHDF5(fname,path,num))
1908End
1909
1910
1911Function/S V_getSensitivityFileName(fname)
1912        String fname
1913
1914        String path = "entry:reduction:sensitivity_file_name"   
1915        Variable num=60
1916        return(V_getStringFromHDF5(fname,path,num))
1917End
1918
1919Function/S V_getTransmissionFileName(fname)
1920        String fname
1921
1922        String path = "entry:reduction:transmission_file_name" 
1923        Variable num=60
1924        return(V_getStringFromHDF5(fname,path,num))
1925End
1926
1927Function/S V_getEmptyBeamFileName(fname)
1928        String fname
1929
1930        String path = "entry:reduction:empty_beam_file_name"   
1931        Variable num=60
1932        return(V_getStringFromHDF5(fname,path,num))
1933End
1934
1935
1936//whole detector trasmission
1937Function V_getSampleTransWholeDetector(fname)
1938        String fname
1939       
1940        String path = "entry:reduction:whole_trans"     
1941        return(V_getRealValueFromHDF5(fname,path))
1942end
1943
1944//whole detector trasmission error
1945Function V_getSampleTransWholeDetErr(fname)
1946        String fname
1947       
1948        String path = "entry:reduction:whole_trans_error"       
1949        return(V_getRealValueFromHDF5(fname,path))
1950end
1951
1952                       
1953/////                   pol_sans (data folder)
1954
1955Function/S V_getPolSANS_cellName(fname)
1956        String fname
1957
1958        String path = "entry:reduction:pol_sans:cell_name"     
1959        Variable num=60
1960        return(V_getStringFromHDF5(fname,path,num))
1961End
1962
1963
1964// TODO -- needs to be a WAVE
1965Function V_getPolSANS_cellParams(fname,outW)
1966        String fname
1967        Wave outW
1968       
1969        String path = "entry:reduction:pol_sans:cell_parameters"       
1970        WAVE w = V_getRealWaveFromHDF5(fname,path)
1971
1972        outW = w
1973        return(0)
1974end
1975
1976Function/S V_getPolSANS_PolSANSPurpose(fname)
1977        String fname
1978
1979        String path = "entry:reduction:pol_sans:pol_sans_purpose"       
1980        Variable num=60
1981        return(V_getStringFromHDF5(fname,path,num))
1982End
1983
1984                               
1985//////// TOP LEVEL DATA REPRESENTATION
1986//
1987// note that here the data is (supposed to be) a link, not the actual data
1988// Igor HDf implementation cannot follow links properly, as far as I know.
1989// so ignore them here, and focus on the image that may be possible to read
1990//
1991
1992//              data_B (data folder)
1993//                      data (wave) 1           //ignore this, it's a link
1994//                      variables (wave) 320
1995//                      thumbnail (data folder)
1996
1997//data (wave) "binary"
1998// TODO -- this will need to be completely replaced with a function that can
1999// read the binary image data. should be possible, but I don't know the details on either end...
2000Function/S V_getDataImage(fname,detStr)
2001        String fname,detStr
2002
2003        String path = "entry:data_"+detStr+":thumbnail:data"   
2004        Variable num=60
2005        return(V_getStringFromHDF5(fname,path,num))
2006End
2007
2008Function/S V_getDataImageDescription(fname,detStr)
2009        String fname,detStr
2010
2011        String path = "entry:data_"+detStr+":thumbnail:description"     
2012        Variable num=60
2013        return(V_getStringFromHDF5(fname,path,num))
2014End
2015                                                               
2016Function/S V_getDataImageType(fname,detStr)
2017        String fname,detStr
2018
2019        String path = "entry:data_"+detStr+":thumbnail:type"   
2020        Variable num=60
2021        return(V_getStringFromHDF5(fname,path,num))
2022End
2023
2024
2025
2026
2027
2028
2029
Note: See TracBrowser for help on using the repository browser.