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

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

few fixes to event mode for SANS

major changes to VSANS basic R/W routines to keep up-to-date with the latest data file definition. Still needs to be tested for correct paths, entries, etc.

File size: 51.9 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
178//Function/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))
184//End
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)
261//Function V_getFileWriteTime(fname)
262//      String fname
263//     
264//      String path = "entry:file_time"
265//      return(V_getRealValueFromHDF5(fname,path))
266//End
267
268// TODO - should be the file name as saved on disk, currently it's not
269Function/S V_getFile_name(fname)
270        String fname
271       
272        String path = "entry:file_name"
273        Variable num=60
274        return(V_getStringFromHDF5(fname,path,num))
275End
276               
277//
278Function/S V_getHDF_version(fname)
279        String fname
280       
281        String path = "entry:hdf_version"       
282        Variable num=60
283        return(V_getStringFromHDF5(fname,path,num))
284End
285
286// TODO -- not mine, added somewhere by Nexus writer?
287Function/S V_getProgram_name(fname)
288        String fname
289       
290        String path = "entry:program_name"     
291        Variable num=60
292        return(V_getStringFromHDF5(fname,path,num))
293End
294
295// TODO -- not mine, added somewhere by Nexus writer?
296// data collection start time
297Function/S V_getDataStartTime(fname)
298        String fname
299       
300        String path = "entry:start_time"       
301        Variable num=60
302        return(V_getStringFromHDF5(fname,path,num))
303End
304               
305// title of experiment
306Function/S V_getTitle(fname)
307        String fname
308       
309        String path = "entry:title"     
310        Variable num=60
311        return(V_getStringFromHDF5(fname,path,num))
312end
313       
314       
315               
316////////// USER
317////////// USER
318////////// USER
319
320// list of user names
321// TODO -- currently not written out to data file??
322Function/S V_getUserNames(fname)
323        String fname
324       
325        String path = "entry:user:name"
326        Variable num=60
327        return(V_getStringFromHDF5(fname,path,num))
328end
329
330
331//////// CONTROL
332//////// CONTROL
333//////// CONTROL
334
335// TODO -- for the control section, document each of the fields
336
337Function V_getCount_end(fname)
338        String fname
339       
340        String path = "entry:control:count_end"
341        return(V_getRealValueFromHDF5(fname,path))
342end
343
344
345Function V_getCount_start(fname)
346        String fname
347       
348        String path = "entry:control:count_start"       
349        return(V_getRealValueFromHDF5(fname,path))
350end
351
352
353Function V_getCount_time(fname)
354        String fname
355       
356        String path = "entry:control:count_time"       
357        return(V_getRealValueFromHDF5(fname,path))
358end
359
360
361Function V_getCount_time_preset(fname)
362        String fname
363       
364        String path = "entry:control:count_time_preset"
365        return(V_getRealValueFromHDF5(fname,path))
366end
367
368
369Function V_getDetector_counts(fname)
370        String fname
371       
372        String path = "entry:control:detector_counts"   
373        return(V_getRealValueFromHDF5(fname,path))
374end
375
376
377Function V_getDetector_preset(fname)
378        String fname
379       
380        String path = "entry:control:detector_preset"   
381        return(V_getRealValueFromHDF5(fname,path))
382end
383
384
385Function V_getIntegral(fname)
386        String fname
387       
388        String path = "entry:control:integral" 
389        return(V_getRealValueFromHDF5(fname,path))
390end
391
392// control mode for data acquisition, "timer"
393// TODO - what are the enumerated types for this?
394Function/S V_getControlMode(fname)
395        String fname
396       
397        String path = "entry:control:mode"     
398        Variable num=60
399        return(V_getStringFromHDF5(fname,path,num))
400End
401
402//monitor count
403Function V_getMonitorCount(fname)
404        String fname
405       
406        String path = "entry:control:monitor_counts"   
407        return(V_getRealValueFromHDF5(fname,path))
408end
409
410Function V_getMonitor_preset(fname)
411        String fname
412       
413        String path = "entry:control:monitor_preset"   
414        return(V_getRealValueFromHDF5(fname,path))
415end
416
417// TODO - what are the enumerated types for this?
418Function V_getPreset(fname)
419        String fname
420       
421        String path = "entry:control:preset"   
422        return(V_getRealValueFromHDF5(fname,path))
423end
424
425
426
427
428
429//////// INSTRUMENT
430//////// INSTRUMENT
431//////// INSTRUMENT
432
433// TODO -- this does not appear to be written out
434Function/S V_getLocalContact(fname)
435        String fname
436
437        String path = "entry:instrument:local_contact"
438        Variable num=60
439        return(V_getStringFromHDF5(fname,path,num))
440End
441
442Function/S V_getInstrumentName(fname)
443        String fname
444
445        String path = "entry:instrument:name"
446        Variable num=60
447        return(V_getStringFromHDF5(fname,path,num))
448End
449
450Function/S V_getInstrumentType(fname)
451        String fname
452
453        String path = "entry:instrument:type"
454        Variable num=60
455        return(V_getStringFromHDF5(fname,path,num))
456End
457
458////// INSTRUMENT/ATTENUATOR
459// TODO - be sure of the definition of these terms
460//
461
462// transmission value for the attenuator in the beam
463// use this, but if something wrong, the tables are present
464Function V_getAttenuator_transmission(fname)
465        String fname
466       
467        String path = "entry:instrument:attenuator:attenuator_transmission"     
468        return(V_getRealValueFromHDF5(fname,path))
469end
470
471// transmission value (error) for the attenuator in the beam
472// use this, but if something wrong, the tables are present
473Function V_getAttenuator_trans_err(fname)
474        String fname
475       
476        String path = "entry:instrument:attenuator:attenuator_transmission_error"       
477        return(V_getRealValueFromHDF5(fname,path))
478end
479
480// desired thickness
481Function V_getAtten_desired_thickness(fname)
482        String fname
483       
484        String path = "entry:instrument:attenuator:desired_thickness"   
485        return(V_getRealValueFromHDF5(fname,path))
486end
487
488
489// distance from the attenuator to the sample (units??)
490Function V_getAttenDistance(fname)
491        String fname
492       
493        String path = "entry:instrument:attenuator:distance"   
494        return(V_getRealValueFromHDF5(fname,path))
495end
496
497
498//// attenuator index, to use in the lookup table of transmission values
499//Function V_getAttenIndex(fname)
500//      String fname
501//     
502//      String path = "entry:instrument:attenuator:index"       
503//      return(V_getRealValueFromHDF5(fname,path))
504//end
505
506// table of the attenuation factor error
507Function/WAVE V_getAttenIndex_error_table(fname)
508        String fname
509       
510        String path = "entry:instrument:attenuator:index_error_table"
511        WAVE w = V_getRealWaveFromHDF5(fname,path)
512       
513        return w
514end
515
516// table of the attenuation factor
517Function/WAVE V_getAttenIndex_table(fname)
518        String fname
519       
520        String path = "entry:instrument:attenuator:index_table"
521        WAVE w = V_getRealWaveFromHDF5(fname,path)
522
523        return w
524end
525
526//
527//// status "in or out"
528//Function/S V_getAttenStatus(fname)
529//      String fname
530//
531//      String path = "entry:instrument:attenuator:status"
532//      Variable num=60
533//      return(V_getStringFromHDF5(fname,path,num))
534//End
535
536// this is equivalent to "status" - if anything is dropped in the beam
537Function V_getAtten_number(fname)
538        String fname
539       
540        String path = "entry:instrument:attenuator:num_atten_dropped"   
541        return(V_getRealValueFromHDF5(fname,path))
542end
543
544// thickness of the attenuator (PMMA) - units??
545Function V_getAttenThickness(fname)
546        String fname
547       
548        String path = "entry:instrument:attenuator:thickness"   
549        return(V_getRealValueFromHDF5(fname,path))
550end
551
552
553// type of material for the atteunator
554Function/S V_getAttenType(fname)
555        String fname
556
557        String path = "entry:instrument:attenuator:type"
558        Variable num=60
559        return(V_getStringFromHDF5(fname,path,num))
560End
561
562
563////// INSTRUMENT/BEAM
564// instrument/beam/chopper (data folder)
565Function V_getChopperAngular_opening(fname)
566        String fname
567       
568        String path = "entry:instrument:beam:chopper:angular_opening"   
569        return(V_getRealValueFromHDF5(fname,path))
570end
571
572Function V_getChopDistance_from_sample(fname)
573        String fname
574       
575        String path = "entry:instrument:beam:chopper:distance_from_sample"     
576        return(V_getRealValueFromHDF5(fname,path))
577end
578
579Function V_getChopDistance_from_source(fname)
580        String fname
581       
582        String path = "entry:instrument:beam:chopper:distance_from_source"     
583        return(V_getRealValueFromHDF5(fname,path))
584end
585
586Function V_getChopperDuty_cycle(fname)
587        String fname
588       
589        String path = "entry:instrument:beam:chopper:duty_cycle"       
590        return(V_getRealValueFromHDF5(fname,path))
591end
592
593Function V_getChopperRotation_speed(fname)
594        String fname
595       
596        String path = "entry:instrument:beam:chopper:rotation_speed"   
597        return(V_getRealValueFromHDF5(fname,path))
598end
599
600Function V_getChopperSlits(fname)
601        String fname
602       
603        String path = "entry:instrument:beam:chopper:slits"     
604        return(V_getRealValueFromHDF5(fname,path))
605end
606
607Function/S V_getChopperStatus(fname)
608        String fname
609
610        String path = "entry:instrument:beam:chopper:status"
611        Variable num=60
612        return(V_getStringFromHDF5(fname,path,num))
613End
614
615Function/S V_getChopperType(fname)
616        String fname
617
618        String path = "entry:instrument:beam:chopper:type"
619        Variable num=60
620        return(V_getStringFromHDF5(fname,path,num))
621End
622
623
624// instrument/beam/flipper (data folder)
625Function V_getFlipperDriving_current(fname)
626        String fname
627       
628        String path = "entry:instrument:beam:flipper:driving_current"   
629        return(V_getRealValueFromHDF5(fname,path))
630end
631
632Function V_getFlipperFrequency(fname)
633        String fname
634       
635        String path = "entry:instrument:beam:flipper:frequency"
636        return(V_getRealValueFromHDF5(fname,path))
637end
638
639Function/S V_getFlipperstatus(fname)
640        String fname
641
642        String path = "entry:instrument:beam:flipper:status"
643        Variable num=60
644        return(V_getStringFromHDF5(fname,path,num))
645End
646
647Function V_getFlipperTransmitted_power(fname)
648        String fname
649       
650        String path = "entry:instrument:beam:flipper:transmitted_power"
651        return(V_getRealValueFromHDF5(fname,path))
652end
653
654Function/S V_getFlipperWaveform(fname)
655        String fname
656
657        String path = "entry:instrument:beam:flipper:waveform"
658        Variable num=60
659        return(V_getStringFromHDF5(fname,path,num))
660End
661
662// instrument/beam/monochromator (data folder)
663Function/S V_getMonochromatorType(fname)
664        String fname
665
666        String path = "entry:instrument:beam:monochromator:type"
667        Variable num=60
668        return(V_getStringFromHDF5(fname,path,num))
669End
670
671Function V_getWavelength(fname)
672        String fname
673       
674        String path = "entry:instrument:beam:monochromator:wavelength" 
675        return(V_getRealValueFromHDF5(fname,path))
676end
677
678Function V_getWavelength_spread(fname)
679        String fname
680       
681        String path = "entry:instrument:beam:monochromator:wavelength_spread"   
682        return(V_getRealValueFromHDF5(fname,path))
683end
684
685// instrument/beam/monochromator/crystal (data folder)
686Function V_getCrystalEnergy(fname)
687        String fname
688       
689        String path = "entry:instrument:beam:monochromator:crystal:energy"     
690        return(V_getRealValueFromHDF5(fname,path))
691end
692
693Function V_getCrystalHorizontal_aperture(fname)
694        String fname
695       
696        String path = "entry:instrument:beam:monochromator:crystal:horizontal_aperture"
697        return(V_getRealValueFromHDF5(fname,path))
698end
699
700Function V_getCrystalHoriz_curvature(fname)
701        String fname
702       
703        String path = "entry:instrument:beam:monochromator:crystal:horizontal_curvature"       
704        return(V_getRealValueFromHDF5(fname,path))
705end
706
707Function V_getCrystalLattice_parameter(fname)
708        String fname
709       
710        String path = "entry:instrument:beam:monochromator:crystal:lattice_parameter"   
711        return(V_getRealValueFromHDF5(fname,path))
712end
713
714Function V_getCrystalDistance(fname)
715        String fname
716       
717        String path = "entry:instrument:beam:monochromator:crystal:distance"   
718        return(V_getRealValueFromHDF5(fname,path))
719end
720
721Function V_getCrystalReflection(fname)
722        String fname
723       
724        String path = "entry:instrument:beam:monochromator:crystal:reflection" 
725        return(V_getRealValueFromHDF5(fname,path))
726end
727
728Function V_getCrystalRotation(fname)
729        String fname
730       
731        String path = "entry:instrument:beam:monochromator:crystal:rotation"   
732        return(V_getRealValueFromHDF5(fname,path))
733end
734
735Function/S V_getCrystalStatus(fname)
736        String fname
737
738        String path = "entry:instrument:beam:monochromator:crystal:status"
739        Variable num=60
740        return(V_getStringFromHDF5(fname,path,num))
741End
742
743Function V_getCrystalVertical_aperture(fname)
744        String fname
745       
746        String path = "entry:instrument:beam:monochromator:crystal:vertical_aperture"   
747        return(V_getRealValueFromHDF5(fname,path))
748end
749
750Function V_getCrystalVertical_curvature(fname)
751        String fname
752       
753        String path = "entry:instrument:beam:monochromator:crystal:vertical_curvature" 
754        return(V_getRealValueFromHDF5(fname,path))
755end
756
757Function V_getCrystalWavelength(fname)
758        String fname
759       
760        String path = "entry:instrument:beam:monochromator:crystal:wavelength" 
761        return(V_getRealValueFromHDF5(fname,path))
762end
763
764Function V_getCrystalWavelength_spread(fname)
765        String fname
766       
767        String path = "entry:instrument:beam:monochromator:crystal:wavelength_spread"   
768        return(V_getRealValueFromHDF5(fname,path))
769end
770
771Function V_getCrystalWavevector(fname)
772        String fname
773       
774        String path = "entry:instrument:beam:monochromator:crystal:wavevector" 
775        return(V_getRealValueFromHDF5(fname,path))
776end
777
778// instrument/beam/monochromator/velocity_selector (data folder)
779Function V_getVSDistance(fname)
780        String fname
781       
782        String path = "entry:instrument:beam:monochromator:velocity_selector:distance" 
783        return(V_getRealValueFromHDF5(fname,path))
784end
785
786Function V_getVSRotation_speed(fname)
787        String fname
788       
789        String path = "entry:instrument:beam:monochromator:velocity_selector:rotation_speed"   
790        return(V_getRealValueFromHDF5(fname,path))
791end
792
793Function/S V_getVelSelStatus(fname)
794        String fname
795
796        String path = "entry:instrument:beam:monochromator:velocity_selector:status"
797        Variable num=60
798        return(V_getStringFromHDF5(fname,path,num))
799End
800
801Function/WAVE V_getVSTable_parameters(fname)
802        String fname
803       
804        String path = "entry:instrument:beam:monochromator:velocity_selector:table_parameters" 
805        WAVE w = V_getRealWaveFromHDF5(fname,path)
806
807        return w
808end
809
810//Function V_getVSTable(fname)
811//      String fname
812//     
813//      String path = "entry:instrument:beam:monochromator:velocity_selector:table"     
814//      return(V_getRealValueFromHDF5(fname,path))
815//end
816
817// TODO: this may not exist for VSANS???
818Function V_getVS_tilt(fname)
819        String fname
820       
821        String path = "entry:instrument:beam:monochromator:velocity_selector:vs_tilt"   
822        return(V_getRealValueFromHDF5(fname,path))
823end
824
825Function V_getVSWavelength(fname)
826        String fname
827       
828        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength"       
829        return(V_getRealValueFromHDF5(fname,path))
830end
831
832Function V_getVSWavelength_spread(fname)
833        String fname
834       
835        String path = "entry:instrument:beam:monochromator:velocity_selector:wavelength_spread"
836        return(V_getRealValueFromHDF5(fname,path))
837end
838
839// instrument/beam/monochromator/white_beam (data folder)
840Function/S V_getWhiteBeamStatus(fname)
841        String fname
842
843        String path = "entry:instrument:beam:monochromator:white_beam:status"
844        Variable num=60
845        return(V_getStringFromHDF5(fname,path,num))
846End
847
848Function V_getWhiteBeamWavelength(fname)
849        String fname
850       
851        String path = "entry:instrument:beam:monochromator:white_beam:wavelength"       
852        return(V_getRealValueFromHDF5(fname,path))
853end
854
855Function V_getWhiteBeamWavelength_spread(fname)
856        String fname
857       
858        String path = "entry:instrument:beam:monochromator:white_beam:wavelength_spread"       
859        return(V_getRealValueFromHDF5(fname,path))
860end
861
862// instrument/beam/polarizer (data folder)
863Function/S V_getPolarizerComposition(fname)
864        String fname
865
866        String path = "entry:instrument:beam:polarizer:composition"
867        Variable num=60
868        return(V_getStringFromHDF5(fname,path,num))
869End
870
871Function V_getPolarizerEfficiency(fname)
872        String fname
873       
874        String path = "entry:instrument:beam:polarizer:efficiency"     
875        return(V_getRealValueFromHDF5(fname,path))
876end
877
878Function/S V_getPolarizerStatus(fname)
879        String fname
880
881        String path = "entry:instrument:beam:polarizer:status"
882        Variable num=60
883        return(V_getStringFromHDF5(fname,path,num))
884End
885
886Function/S V_getPolarizerType(fname)
887        String fname
888
889        String path = "entry:instrument:beam:polarizer:type"
890        Variable num=60
891        return(V_getStringFromHDF5(fname,path,num))
892End
893
894// instrument/beam/polarizer_analyzer (data folder)
895Function V_getPolAnaCell_index(fname)
896        String fname
897
898        String path = "entry:instrument:beam:polarizer_analyzer:cell_index"
899        return(V_getRealValueFromHDF5(fname,path))
900End
901
902Function/S V_getPolAnaCell_name(fname)
903        String fname
904
905        String path = "entry:instrument:beam:polarizer_analyzer:cell_name"
906        Variable num=60
907        return(V_getStringFromHDF5(fname,path,num))
908End
909
910Function/WAVE V_getPolAnaCell_parameters(fname)
911        String fname
912
913        String path = "entry:instrument:beam:polarizer_analyzer:cell_parameters"
914        WAVE w = V_getRealWaveFromHDF5(fname,path)
915
916        return w
917End
918
919Function V_getPolAnaGuideFieldCur_1(fname)
920        String fname
921
922        String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_1"
923        return(V_getRealValueFromHDF5(fname,path))
924End
925
926Function V_getPolAnaGuideFieldCur_2(fname)
927        String fname
928
929        String path = "entry:instrument:beam:polarizer_analyzer:guide_field_current_2"
930        return(V_getRealValueFromHDF5(fname,path))
931End
932
933Function V_getPolAnaSolenoid_current(fname)
934        String fname
935
936        String path = "entry:instrument:beam:polarizer_analyzer:solenoid_current"
937        return(V_getRealValueFromHDF5(fname,path))
938End
939
940Function/S V_getPolAnaStatus(fname)
941        String fname
942
943        String path = "entry:instrument:beam:polarizer_analyzer:status"
944        Variable num=60
945        return(V_getStringFromHDF5(fname,path,num))
946End
947
948                                       
949/////// INSTRUMENT/BEAM MONITORS
950
951//beam_monitor_low (data folder)
952Function V_getBeamMonLowData(fname)
953        String fname
954
955        String path = "entry:instrument:beam_monitor_low:data"
956        return(V_getRealValueFromHDF5(fname,path))
957End
958
959Function V_getBeamMonLowEfficiency(fname)
960        String fname
961
962        String path = "entry:instrument:beam_monitor_low:efficiency"
963        return(V_getRealValueFromHDF5(fname,path))
964End
965
966Function V_getBeamMonLowDistance(fname)
967        String fname
968
969        String path = "entry:instrument:beam_monitor_low:distance"
970        return(V_getRealValueFromHDF5(fname,path))
971End
972
973Function V_getBeamMonLowSaved_count(fname)
974        String fname
975
976        String path = "entry:instrument:beam_monitor_low:saved_count"
977        return(V_getRealValueFromHDF5(fname,path))
978End
979
980Function/S V_getBeamMonLowType(fname)
981        String fname
982
983        String path = "entry:instrument:beam_monitor_low:type"
984        Variable num=60
985        return(V_getStringFromHDF5(fname,path,num))
986End
987
988//beam_monitor_norm (data folder)
989Function V_getBeamMonNormData(fname)
990        String fname
991
992        String path = "entry:instrument:beam_monitor_norm:data"
993        return(V_getRealValueFromHDF5(fname,path))
994End
995
996Function V_getBeamMonNormEfficiency(fname)
997        String fname
998
999        String path = "entry:instrument:beam_monitor_norm:efficiency"
1000        return(V_getRealValueFromHDF5(fname,path))
1001End
1002
1003Function V_getBeamMonNormDistance(fname)
1004        String fname
1005
1006        String path = "entry:instrument:beam_monitor_norm:distance"
1007        return(V_getRealValueFromHDF5(fname,path))
1008End
1009
1010Function V_getBeamMonNormSaved_count(fname)
1011        String fname
1012
1013        String path = "entry:instrument:beam_monitor_norm:saved_count"
1014        return(V_getRealValueFromHDF5(fname,path))
1015End
1016
1017Function/S V_getBeamMonNormType(fname)
1018        String fname
1019
1020        String path = "entry:instrument:beam_monitor_norm:type"
1021        Variable num=60
1022        return(V_getStringFromHDF5(fname,path,num))
1023End
1024
1025//beam_stop C2 (data folder)
1026Function/S V_getBeamStopC2Description(fname)
1027        String fname
1028
1029        String path = "entry:instrument:beam_stop_C2:description"
1030        Variable num=60
1031        return(V_getStringFromHDF5(fname,path,num))
1032End
1033
1034Function V_getBeamStopC2Dist_to_det(fname)
1035        String fname
1036
1037        String path = "entry:instrument:beam_stop_C2:distance_to_detector"
1038        return(V_getRealValueFromHDF5(fname,path))
1039End
1040
1041//TODO -- not sure what this really means
1042Function V_getBeamStopC2num_beamstops(fname)
1043        String fname
1044
1045        String path = "entry:instrument:beam_stop_C2:num_beamstops"
1046        return(V_getRealValueFromHDF5(fname,path))
1047End
1048
1049Function V_getBeamStopC2_x_pos(fname)
1050        String fname
1051
1052        String path = "entry:instrument:beam_stop_C2:x_pos"
1053        return(V_getRealValueFromHDF5(fname,path))
1054End
1055
1056Function V_getBeamStopC2_y_pos(fname)
1057        String fname
1058
1059        String path = "entry:instrument:beam_stop_C2:y_pos"
1060        return(V_getRealValueFromHDF5(fname,path))
1061End
1062
1063// beam stop shape parameters
1064Function V_getBeamStopC2_height(fname)
1065        String fname
1066
1067        String path = "entry:instrument:beam_stop_C2:shape:height"
1068        return(V_getRealValueFromHDF5(fname,path))
1069End
1070
1071Function V_getBeamStopC2_width(fname)
1072        String fname
1073
1074        String path = "entry:instrument:beam_stop_C2:shape:width"
1075        return(V_getRealValueFromHDF5(fname,path))
1076End
1077
1078// == diameter if shape = CIRCLE
1079Function V_getBeamStopC2_size(fname)
1080        String fname
1081
1082        String path = "entry:instrument:beam_stop_C2:shape:size"
1083        return(V_getRealValueFromHDF5(fname,path))
1084End
1085
1086Function/S V_getBeamStopC2_shape(fname)
1087        String fname
1088
1089        Variable num=60
1090        String path = "entry:instrument:beam_stop_C2:shape:shape"
1091        return(V_getStringFromHDF5(fname,path,num))
1092End
1093
1094
1095//beam_stop C3 (data folder)
1096Function/S V_getBeamStopC3Description(fname)
1097        String fname
1098
1099        String path = "entry:instrument:beam_stop_C3:description"
1100        Variable num=60
1101        return(V_getStringFromHDF5(fname,path,num))
1102End
1103
1104Function V_getBeamStopC3Dist_to_det(fname)
1105        String fname
1106
1107        String path = "entry:instrument:beam_stop_C3:distance_to_detector"
1108        return(V_getRealValueFromHDF5(fname,path))
1109End
1110
1111//TODO -- not sure what this really means
1112Function V_getBeamStopC3num_beamstops(fname)
1113        String fname
1114
1115        String path = "entry:instrument:beam_stop_C3:num_beamstops"
1116        return(V_getRealValueFromHDF5(fname,path))
1117End
1118
1119Function V_getBeamStopC3_x_pos(fname)
1120        String fname
1121
1122        String path = "entry:instrument:beam_stop_C3:x_pos"
1123        return(V_getRealValueFromHDF5(fname,path))
1124End
1125
1126Function V_getBeamStopC3_y_pos(fname)
1127        String fname
1128
1129        String path = "entry:instrument:beam_stop_C3:y_pos"
1130        return(V_getRealValueFromHDF5(fname,path))
1131End
1132
1133// beam stop shape parameters
1134Function V_getBeamStopC3_height(fname)
1135        String fname
1136
1137        String path = "entry:instrument:beam_stop_C3:shape:height"
1138        return(V_getRealValueFromHDF5(fname,path))
1139End
1140
1141Function V_getBeamStopC3_width(fname)
1142        String fname
1143
1144        String path = "entry:instrument:beam_stop_C3:shape:width"
1145        return(V_getRealValueFromHDF5(fname,path))
1146End
1147
1148// == diameter if shape = CIRCLE
1149Function V_getBeamStopC3_size(fname)
1150        String fname
1151
1152        String path = "entry:instrument:beam_stop_C3:shape:size"
1153        return(V_getRealValueFromHDF5(fname,path))
1154End
1155
1156Function/S V_getBeamStopC3_shape(fname)
1157        String fname
1158
1159        Variable num=60
1160        String path = "entry:instrument:beam_stop_C3:shape:shape"
1161        return(V_getStringFromHDF5(fname,path,num))
1162End
1163
1164
1165
1166
1167//// INSTRUMENT/COLLIMATOR
1168//collimator (data folder)
1169
1170// this is now defined as text, due to selections from GUI
1171Function/S V_getNumberOfGuides(fname)
1172        String fname
1173
1174        Variable num=60
1175        String path = "entry:instrument:collimator:number_guides"
1176        return(V_getStringFromHDF5(fname,path,num))
1177End
1178
1179//                              geometry (data folder)
1180//                                      shape (data folder)
1181Function/S V_getGuideShape(fname)
1182        String fname
1183
1184        String path = "entry:instrument:collimator:geometry:shape:shape"
1185        Variable num=60
1186        return(V_getStringFromHDF5(fname,path,num))
1187End
1188
1189Function V_getGuideSize(fname)
1190        String fname
1191
1192        String path = "entry:instrument:collimator:geometry:shape:size"
1193        return(V_getRealValueFromHDF5(fname,path))
1194End
1195
1196//                      converging_pinholes (data folder)
1197Function/S V_getConvPinholeStatus(fname)
1198        String fname
1199
1200        String path = "entry:instrument:converging_pinholes:status"
1201        Variable num=60
1202        return(V_getStringFromHDF5(fname,path,num))
1203End
1204
1205//                      converging_slits (not used)
1206
1207////// INSTRUMENT/DETECTORS
1208//                      detector_B (data folder)
1209//
1210// only defined for the "B" detector, and may not be necessary?
1211// TODO -- write to return an ARRAY
1212Function/WAVE V_getDet_cal_x(fname,detStr)
1213        String fname,detStr
1214
1215        if(cmpstr(detStr,"B") == 0)
1216                String path = "entry:instrument:detector_"+detStr+":cal_x"
1217                WAVE w = V_getRealWaveFromHDF5(fname,path)
1218
1219                return w
1220        else
1221                return $""
1222        endif
1223End
1224
1225// only defined for the "B" detector, and may not be necessary?
1226// TODO -- write to return an ARRAY
1227Function/WAVE V_getDet_cal_y(fname,detStr)
1228        String fname,detStr
1229
1230        if(cmpstr(detStr,"B") == 0)
1231                String path = "entry:instrument:detector_"+detStr+":cal_y"
1232                WAVE w = V_getRealWaveFromHDF5(fname,path)
1233       
1234                return w
1235        else
1236                return $""
1237        endif
1238End
1239
1240//  Pixels are not square
1241// so the FHWM will be different in each direction. May need to return
1242// "dummy" value for "B" detector if pixels there are square
1243Function V_getDet_pixel_fwhm_x(fname,detStr)
1244        String fname,detStr
1245
1246        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_x"
1247
1248        return(V_getRealValueFromHDF5(fname,path))
1249End
1250
1251// Pixels are not square
1252// so the FHWM will be different in each direction. May need to return
1253// "dummy" value for "B" detector if pixels there are square
1254Function V_getDet_pixel_fwhm_y(fname,detStr)
1255        String fname,detStr
1256
1257        String path = "entry:instrument:detector_"+detStr+":pixel_fwhm_y"
1258
1259        return(V_getRealValueFromHDF5(fname,path))
1260End
1261
1262Function V_getDet_pixel_num_x(fname,detStr)
1263        String fname,detStr
1264
1265        String path = "entry:instrument:detector_"+detStr+":pixel_num_x"
1266        return(V_getRealValueFromHDF5(fname,path))
1267End
1268
1269Function V_getDet_pixel_num_y(fname,detStr)
1270        String fname,detStr
1271
1272        String path = "entry:instrument:detector_"+detStr+":pixel_num_y"
1273        return(V_getRealValueFromHDF5(fname,path))
1274End
1275
1276//// only defined for the "B" detector, and only to satisfy NXsas
1277//Function V_getDet_azimuthalAngle(fname,detStr)
1278//      String fname,detStr
1279//
1280//      if(cmpstr(detStr,"B") == 0)
1281//              String path = "entry:instrument:detector_"+detStr+":azimuthal_angle"
1282//              return(V_getRealValueFromHDF5(fname,path))
1283//      else
1284//              return(0)
1285//      endif
1286//End
1287
1288Function V_getDet_beam_center_x(fname,detStr)
1289        String fname,detStr
1290
1291        String path = "entry:instrument:detector_"+detStr+":beam_center_x"
1292        return(V_getRealValueFromHDF5(fname,path))
1293End
1294
1295Function V_getDet_beam_center_y(fname,detStr)
1296        String fname,detStr
1297
1298        String path = "entry:instrument:detector_"+detStr+":beam_center_y"
1299        return(V_getRealValueFromHDF5(fname,path))
1300End
1301
1302
1303//TODO
1304//
1305// x and y center in mm is currently not part of the NExus definition
1306//  does it need to be?
1307// these lookups will fail if they have not been generated locally!
1308Function V_getDet_beam_center_x_mm(fname,detStr)
1309        String fname,detStr
1310
1311        String path = "entry:instrument:detector_"+detStr+":beam_center_x_mm"
1312        return(V_getRealValueFromHDF5(fname,path))
1313End
1314
1315//TODO
1316//
1317// x and y center in mm is currently not part of the NExus definition
1318//  does it need to be?
1319// these lookups will fail if they have not been generated locally!
1320Function V_getDet_beam_center_y_mm(fname,detStr)
1321        String fname,detStr
1322
1323        String path = "entry:instrument:detector_"+detStr+":beam_center_y_mm"
1324        return(V_getRealValueFromHDF5(fname,path))
1325End
1326
1327
1328
1329Function/WAVE V_getDetectorDataW(fname,detStr)
1330        String fname,detStr
1331
1332        String path = "entry:instrument:detector_"+detStr+":data"
1333        WAVE w = V_getRealWaveFromHDF5(fname,path)
1334
1335        return w
1336End
1337
1338//
1339// TODO -- this does not exist in the raw data, but does in the processed data
1340// !!! how to handle this?? Binning routines need the error wave
1341//
1342Function/WAVE V_getDetectorDataErrW(fname,detStr)
1343        String fname,detStr
1344
1345        String path = "entry:instrument:detector_"+detStr+":linear_data_error"
1346        WAVE w = V_getRealWaveFromHDF5(fname,path)
1347
1348        return w
1349End
1350
1351// TODO -- write this function to return a WAVE with the data
1352// either as a wave reference, or as an input parameter
1353// ALSO -- the "B" deadtime will be a single value (probably)
1354//  but the tube banks will be 1D arrays of values, one per tube
1355Function/WAVE V_getDetector_deadtime(fname,detStr)
1356        String fname,detStr
1357
1358        String path = "entry:instrument:detector_"+detStr+":dead_time"
1359        if(cmpstr(detStr,"B") == 0)
1360                return $""
1361        else   
1362                WAVE w = V_getRealWaveFromHDF5(fname,path)
1363                return w
1364        endif
1365End
1366
1367// for "B" only
1368Function V_getDetector_deadtime_B(fname,detStr)
1369        String fname,detStr
1370
1371        String path = "entry:instrument:detector_"+detStr+":dead_time"
1372        if(cmpstr(detStr,"B") == 0)
1373                return(V_getRealValueFromHDF5(fname,path))
1374        else   
1375                return(0)
1376        endif
1377End
1378
1379Function/S V_getDetDescription(fname,detStr)
1380        String fname,detStr
1381
1382        String path = "entry:instrument:detector_"+detStr+":description"
1383        Variable num=60
1384        return(V_getStringFromHDF5(fname,path,num))
1385End
1386
1387Function V_getDet_distance(fname,detStr)
1388        String fname,detStr
1389
1390        String path = "entry:instrument:detector_"+detStr+":distance"
1391        return(V_getRealValueFromHDF5(fname,path))
1392End
1393
1394//// only defined for the "B" detector, and only to satisfy NXsas
1395//Function V_getDet_equatorial_angle(fname,detStr)
1396//      String fname,detStr
1397//
1398//      if(cmpstr(detStr,"B") == 0)
1399//              String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1400//              return(V_getRealValueFromHDF5(fname,path))
1401//      else
1402//              return(0)
1403//      endif
1404//End
1405
1406Function/S V_getDetEventFileName(fname,detStr)
1407        String fname,detStr
1408
1409        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1410        Variable num=60
1411        return(V_getStringFromHDF5(fname,path,num))
1412End
1413
1414Function V_getDet_IntegratedCount(fname,detStr)
1415        String fname,detStr
1416
1417        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1418        return(V_getRealValueFromHDF5(fname,path))
1419End
1420
1421Function V_getDet_LateralOffset(fname,detStr)
1422        String fname,detStr
1423
1424        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1425        return(V_getRealValueFromHDF5(fname,path))
1426End
1427
1428//Function V_getDet_VerticalOffset(fname,detStr)
1429//      String fname,detStr
1430//
1431//      String path = "entry:instrument:detector_"+detStr+":vertical_offset"
1432//      return(V_getRealValueFromHDF5(fname,path))
1433//End
1434
1435
1436//// only defined for the "B" detector, and only to satisfy NXsas
1437//Function V_getDet_polar_angle(fname,detStr)
1438//      String fname,detStr
1439//
1440//      if(cmpstr(detStr,"B") == 0)
1441//              String path = "entry:instrument:detector_"+detStr+":polar_angle"
1442//              return(V_getRealValueFromHDF5(fname,path))
1443//      else
1444//              return(0)
1445//      endif
1446//End
1447
1448//// only defined for the "B" detector, and only to satisfy NXsas
1449//Function V_getDet_rotational_angle(fname,detStr)
1450//      String fname,detStr
1451//
1452//      if(cmpstr(detStr,"B") == 0)
1453//              String path = "entry:instrument:detector_"+detStr+":rotational_angle"
1454//              return(V_getRealValueFromHDF5(fname,path))
1455//      else
1456//              return(0)
1457//      endif
1458//End
1459
1460Function/S V_getDetSettings(fname,detStr)
1461        String fname,detStr
1462
1463        String path = "entry:instrument:detector_"+detStr+":settings"
1464        Variable num=60
1465        return(V_getStringFromHDF5(fname,path,num))
1466End
1467
1468//// really has no meaning at all
1469//Function V_getDet_size(fname,detStr)
1470//      String fname,detStr
1471//
1472//      String path = "entry:instrument:detector_"+detStr+":size"
1473//      return(V_getRealValueFromHDF5(fname,path))
1474//End
1475
1476Function/S V_getDetType(fname,detStr)
1477        String fname,detStr
1478
1479        String path = "entry:instrument:detector_"+detStr+":type"
1480        Variable num=60
1481        return(V_getStringFromHDF5(fname,path,num))
1482End
1483
1484Function V_getDet_x_pixel_size(fname,detStr)
1485        String fname,detStr
1486
1487        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1488        return(V_getRealValueFromHDF5(fname,path))
1489End
1490
1491Function V_getDet_y_pixel_size(fname,detStr)
1492        String fname,detStr
1493
1494        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1495        return(V_getRealValueFromHDF5(fname,path))
1496End
1497
1498/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1499
1500Function V_getDet_numberOfTubes(fname,detStr)
1501        String fname,detStr
1502
1503        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1504        if(cmpstr(detStr,"B") == 0)
1505                return(0)
1506        else
1507                return(V_getRealValueFromHDF5(fname,path))
1508        endif
1509End
1510
1511// TODO -- be clear on how this is defined. Separation as defined from what point? Units?
1512Function V_getDetPanelSeparation(fname,detStr)
1513        String fname,detStr
1514
1515        String path = "entry:instrument:detector_"+detStr+":separation"
1516        if(cmpstr(detStr,"B") == 0)
1517                return(0)
1518        else
1519                return(V_getRealValueFromHDF5(fname,path))
1520        endif
1521End
1522
1523// TODO -- write this function to return a WAVE with the data
1524// either as a wave reference, or as an input parameter
1525Function/WAVE V_getDetTube_spatialCalib(fname,detStr)
1526        String fname,detStr
1527
1528        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1529        if(cmpstr(detStr,"B") == 0)
1530                return $("")    // return should be null
1531        else
1532                WAVE w = V_getRealWaveFromHDF5(fname,path)
1533                return w
1534        endif
1535End
1536
1537//// TODO -- be clear on how this is defined.
1538//Function V_getDet_tubeIndex(fname,detStr)
1539//      String fname,detStr
1540//
1541//      String path = "entry:instrument:detector_"+detStr+":tube_index"
1542//      if(cmpstr(detStr,"B") == 0)
1543//              return(0)
1544//      else
1545//              return(V_getRealValueFromHDF5(fname,path))
1546//      endif
1547//End
1548
1549Function/S V_getDet_tubeOrientation(fname,detStr)
1550        String fname,detStr
1551
1552        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1553        Variable num=60
1554        if(cmpstr(detStr,"B") == 0)
1555                return("")
1556        else
1557                return(V_getStringFromHDF5(fname,path,num))
1558        endif
1559End
1560
1561// TODO -- be clear on how this is defined. Units?
1562Function V_getDet_tubeWidth(fname,detStr)
1563        String fname,detStr
1564
1565        String path = "entry:instrument:detector_"+detStr+":tube_width"
1566        if(cmpstr(detStr,"B") == 0)
1567                return(0)
1568        else
1569                return(V_getRealValueFromHDF5(fname,path))
1570        endif
1571End
1572
1573//////////////////////
1574
1575// INSTRUMENT/LENSES    /APERTURES
1576//  lenses (data folder)
1577
1578Function V_getLensCurvature(fname)
1579        String fname
1580
1581        String path = "entry:instrument:lenses:curvature"
1582        return(V_getRealValueFromHDF5(fname,path))
1583End
1584
1585Function/S V_getLensesFocusType(fname)
1586        String fname
1587
1588        String path = "entry:instrument:lenses:focus_type"
1589        Variable num=60
1590        return(V_getStringFromHDF5(fname,path,num))
1591End
1592
1593Function V_getLensDistance(fname)
1594        String fname
1595
1596        String path = "entry:instrument:lenses:lens_distance"
1597        return(V_getRealValueFromHDF5(fname,path))
1598End
1599
1600Function/S V_getLensGeometry(fname)
1601        String fname
1602
1603        String path = "entry:instrument:lenses:lens_geometry"
1604        Variable num=60
1605        return(V_getStringFromHDF5(fname,path,num))
1606End
1607
1608Function/S V_getLensMaterial(fname)
1609        String fname
1610
1611        String path = "entry:instrument:lenses:lens_material"
1612        Variable num=60
1613        return(V_getStringFromHDF5(fname,path,num))
1614End
1615
1616Function V_getNumber_of_Lenses(fname)
1617        String fname
1618
1619        String path = "entry:instrument:lenses:number_of_lenses"
1620        return(V_getRealValueFromHDF5(fname,path))
1621End
1622
1623Function V_getNumber_of_prisms(fname)
1624        String fname
1625
1626        String path = "entry:instrument:lenses:number_of_prisms"
1627        return(V_getRealValueFromHDF5(fname,path))
1628End
1629
1630Function V_getPrism_distance(fname)
1631        String fname
1632
1633        String path = "entry:instrument:lenses:prism_distance"
1634        return(V_getRealValueFromHDF5(fname,path))
1635End
1636
1637Function/S V_getPrismMaterial(fname)
1638        String fname
1639
1640        String path = "entry:instrument:lenses:prism_material"
1641        Variable num=60
1642        return(V_getStringFromHDF5(fname,path,num))
1643End
1644
1645// status of lens/prism = lens | prism | both | out
1646Function/S V_getLensPrismStatus(fname)
1647        String fname
1648
1649        String path = "entry:instrument:lenses:status"
1650        Variable num=60
1651        return(V_getStringFromHDF5(fname,path,num))
1652End
1653       
1654
1655
1656
1657///////  sample_aperture (1) (data folder)
1658Function/S V_getSampleAp_Description(fname)
1659        String fname
1660
1661        String path = "entry:instrument:sample_aperture:description"
1662        Variable num=60
1663        return(V_getStringFromHDF5(fname,path,num))
1664End
1665
1666Function V_getSampleAp_distance(fname)
1667        String fname
1668
1669        String path = "entry:instrument:sample_aperture:distance"
1670        return(V_getRealValueFromHDF5(fname,path))
1671End
1672
1673//      shape (data folder)
1674Function/S V_getSampleAp_shape(fname)
1675        String fname
1676
1677        String path = "entry:instrument:sample_aperture:shape:shape"
1678        Variable num=60
1679        return(V_getStringFromHDF5(fname,path,num))
1680End
1681
1682// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1683Function/S V_getSampleAp_size(fname)
1684        String fname
1685
1686        String path = "entry:instrument:sample_aperture:shape:size"
1687        Variable num=60
1688        return(V_getStringFromHDF5(fname,path,num))
1689End
1690
1691Function V_getSampleAp_height(fname)
1692        String fname
1693
1694        String path = "entry:instrument:sample_aperture:shape:height"
1695        return(V_getRealValueFromHDF5(fname,path))
1696End
1697
1698Function V_getSampleAp_width(fname)
1699        String fname
1700
1701        String path = "entry:instrument:sample_aperture:shape:width"
1702        return(V_getRealValueFromHDF5(fname,path))
1703End
1704
1705
1706
1707///////  sample_aperture_2 (data folder)
1708
1709Function/S V_getSampleAp2_Description(fname)
1710        String fname
1711
1712        String path = "entry:instrument:sample_aperture_2:description"
1713        Variable num=60
1714        return(V_getStringFromHDF5(fname,path,num))
1715End
1716
1717Function V_getSampleAp2_distance(fname)
1718        String fname
1719
1720        String path = "entry:instrument:sample_aperture_2:distance"
1721        return(V_getRealValueFromHDF5(fname,path))
1722End
1723
1724//      shape (data folder)
1725Function/S V_getSampleAp2_shape(fname)
1726        String fname
1727
1728        String path = "entry:instrument:sample_aperture_2:shape:shape"
1729        Variable num=60
1730        return(V_getStringFromHDF5(fname,path,num))
1731End
1732
1733// this returns REAL, DIFFERENT than SampleAp1
1734Function V_getSampleAp2_size(fname)
1735        String fname
1736
1737        String path = "entry:instrument:sample_aperture_2:shape:size"
1738        return(V_getRealValueFromHDF5(fname,path))
1739End
1740
1741Function V_getSampleAp2_height(fname)
1742        String fname
1743
1744        String path = "entry:instrument:sample_aperture_2:shape:height"
1745        return(V_getRealValueFromHDF5(fname,path))
1746End
1747
1748Function V_getSampleAp2_width(fname)
1749        String fname
1750
1751        String path = "entry:instrument:sample_aperture_2:shape:width"
1752        return(V_getRealValueFromHDF5(fname,path))
1753End
1754
1755       
1756//////  sample_table (data folder)
1757// location  = "CHAMBER" or HUBER
1758Function/S V_getSampleTableLocation(fname)
1759        String fname
1760
1761        String path = "entry:instrument:sample_table:location"
1762        Variable num=60
1763        return(V_getStringFromHDF5(fname,path,num))
1764End
1765
1766// TODO - verify the meaning
1767//      offset_distance (?? for center of sample table vs. sample position)
1768Function V_getSampleTableOffset(fname)
1769        String fname
1770
1771        String path = "entry:instrument:sample_table:offset_distance"
1772        return(V_getRealValueFromHDF5(fname,path))
1773End     
1774       
1775//  source (data folder)
1776//name "NCNR"
1777Function/S V_getSourceName(fname)
1778        String fname
1779
1780        String path = "entry:instrument:source:name"
1781        Variable num=60
1782        return(V_getStringFromHDF5(fname,path,num))
1783End
1784
1785//      power -- nominal only, not connected to any real number
1786Function V_getReactorPower(fname)
1787        String fname
1788
1789        String path = "entry:instrument:source:power"
1790        return(V_getRealValueFromHDF5(fname,path))
1791End     
1792
1793//probe (wave) "neutron"
1794Function/S V_getSourceProbe(fname)
1795        String fname
1796
1797        String path = "entry:instrument:source:probe"
1798        Variable num=60
1799        return(V_getStringFromHDF5(fname,path,num))
1800End
1801
1802//type (wave) "Reactor Neutron Source"
1803Function/S V_getSourceType(fname)
1804        String fname
1805
1806        String path = "entry:instrument:source:type"
1807        Variable num=60
1808        return(V_getStringFromHDF5(fname,path,num))
1809End
1810
1811       
1812///////  source_aperture (data folder)
1813
1814Function/S V_getSourceAp_Description(fname)
1815        String fname
1816
1817        String path = "entry:instrument:source_aperture:description"
1818        Variable num=60
1819        return(V_getStringFromHDF5(fname,path,num))
1820End
1821
1822Function V_getSourceAp_distance(fname)
1823        String fname
1824
1825        String path = "entry:instrument:source_aperture:distance"
1826        return(V_getRealValueFromHDF5(fname,path))
1827End
1828
1829//      shape (data folder)
1830Function/S V_getSourceAp_shape(fname)
1831        String fname
1832
1833        String path = "entry:instrument:source_aperture:shape:shape"
1834        Variable num=60
1835        return(V_getStringFromHDF5(fname,path,num))
1836End
1837
1838// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1839Function/S V_getSourceAp_size(fname)
1840        String fname
1841
1842        String path = "entry:instrument:source_aperture:shape:size"
1843        Variable num=60
1844        return(V_getStringFromHDF5(fname,path,num))
1845End
1846
1847Function V_getSourceAp_height(fname)
1848        String fname
1849
1850        String path = "entry:instrument:source_aperture:shape:height"
1851        return(V_getRealValueFromHDF5(fname,path))
1852End
1853
1854Function V_getSourceAp_width(fname)
1855        String fname
1856
1857        String path = "entry:instrument:source_aperture:shape:width"
1858        return(V_getRealValueFromHDF5(fname,path))
1859End
1860
1861
1862//////// SAMPLE
1863//////// SAMPLE
1864//////// SAMPLE
1865
1866//Sample position in changer (returned as TEXT)
1867Function/S V_getSamplePosition(fname)
1868        String fname
1869       
1870        String path = "entry:sample:changer_position"   
1871        Variable num=60
1872        return(V_getStringFromHDF5(fname,path,num))
1873end
1874
1875// sample label
1876Function/S V_getSampleDescription(fname)
1877        String fname
1878
1879        String path = "entry:sample:description"
1880        Variable num=60
1881        return(V_getStringFromHDF5(fname,path,num))
1882End
1883
1884// for a z-stage??
1885Function V_getSampleElevation(fname)
1886        String fname
1887       
1888        String path = "entry:sample:elevation" 
1889        return(V_getRealValueFromHDF5(fname,path))
1890end
1891
1892//no meaning to this...
1893Function V_getSample_equatorial_ang(fname)
1894        String fname
1895       
1896        String path = "entry:sample:equatorial_angle"   
1897        return(V_getRealValueFromHDF5(fname,path))
1898end
1899
1900// group ID !!! very important for matching up files
1901Function V_getSample_GroupID(fname)
1902        String fname
1903       
1904        String path = "entry:sample:group_id"   
1905        return(V_getRealValueFromHDF5(fname,path))
1906end
1907
1908
1909//Sample Rotation Angle
1910Function V_getSampleRotationAngle(fname)
1911        String fname
1912       
1913        String path = "entry:sample:rotation_angle"     
1914        return(V_getRealValueFromHDF5(fname,path))
1915end
1916
1917//?? this is huber/chamber??
1918// TODO -- then where is the description of 10CB, etc...
1919Function/S V_getSampleHolderDescription(fname)
1920        String fname
1921
1922        String path = "entry:sample:sample_holder_description"
1923        Variable num=60
1924        return(V_getStringFromHDF5(fname,path,num))
1925End
1926
1927//Sample Thickness
1928// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
1929Function V_getSampleThickness(fname)
1930        String fname
1931       
1932        String path = "entry:sample:thickness" 
1933        return(V_getRealValueFromHDF5(fname,path))
1934end
1935
1936Function V_getSampleTranslation(fname)
1937        String fname
1938       
1939        String path = "entry:sample:translation"       
1940        return(V_getRealValueFromHDF5(fname,path))
1941end
1942
1943// sample transmission
1944Function V_getSampleTransmission(fname)
1945        String fname
1946       
1947        String path = "entry:sample:transmission"       
1948//      String path = "QKK0037737:data:Transmission"   
1949        return(V_getRealValueFromHDF5(fname,path))
1950end
1951
1952//transmission error (one sigma)
1953Function V_getSampleTransError(fname)
1954        String fname
1955       
1956        String path = "entry:sample:transmission_error"
1957        return(V_getRealValueFromHDF5(fname,path))
1958end
1959
1960
1961
1962
1963//// SAMPLE / DATA LOGS
1964// write this generic , call with the name of the environment log desired
1965//
1966// temperature_1
1967// temperature_2
1968// shear_field
1969// pressure
1970// magnetic_field
1971// electric_field
1972//
1973//////// (for example) electric_field (data folder)
1974
1975Function/S V_getLog_attachedTo(fname,logStr)
1976        String fname,logStr
1977
1978        String path = "entry:sample:"+logstr+":attached_to"
1979        Variable num=60
1980        return(V_getStringFromHDF5(fname,path,num))
1981End
1982
1983
1984Function/S V_getLog_measurement(fname,logStr)
1985        String fname,logStr
1986
1987        String path = "entry:sample:"+logstr+":measurement"
1988        Variable num=60
1989        return(V_getStringFromHDF5(fname,path,num))
1990End
1991
1992
1993Function/S V_getLog_Name(fname,logStr)
1994        String fname,logStr
1995
1996        String path = "entry:sample:"+logstr+":name"
1997        Variable num=60
1998        return(V_getStringFromHDF5(fname,path,num))
1999End
2000
2001
2002// TODO --
2003Function V_getLog_nomValue(fname,logStr)
2004        String fname,logStr
2005       
2006        String path = "entry:sample:"+logstr+":value"
2007        return(V_getRealValueFromHDF5(fname,path))
2008end
2009
2010////            value_log (data folder)
2011Function/S V_getLog_startTime(fname,logStr)
2012        String fname,logStr
2013
2014        String path = "entry:sample:"+logstr+":value_log:start"
2015        Variable num=60
2016        return(V_getStringFromHDF5(fname,path,num))
2017End
2018
2019// TODO -- thes currently do not exist...
2020//
2021//// TODO --
2022//Function V_getLog_avgValue(fname,logStr)
2023//      String fname,logStr
2024//     
2025//      String path = "entry:sample:"+logstr+":value_log:average_value"
2026//      return(V_getRealValueFromHDF5(fname,path))
2027//end
2028//
2029//// TODO -- this needs to be a WAVE reference
2030//// TODO -- verify that the field is really read in as "time0"
2031//Function V_getLog_time(fname,logStr,outW)
2032//      String fname,logStr
2033//      Wave outW
2034//     
2035//      String path = "entry:sample:"+logstr+":value_log:time0"
2036//      WAVE w = V_getRealWaveFromHDF5(fname,path)
2037//
2038//      outW = w
2039//      return(0)
2040//end
2041//
2042//
2043//// TODO -- this needs to be a WAVE reference
2044//Function V_getLog_Value(fname,logStr,outW)
2045//      String fname,logStr
2046//      Wave outW
2047//     
2048//      String path = "entry:sample:"+logstr+":value_log:value"
2049//      WAVE w = V_getRealWaveFromHDF5(fname,path)
2050//
2051//      outW = w
2052//      return(0)
2053//end
2054
2055
2056
2057
2058
2059
2060
2061///////// REDUCTION
2062///////// REDUCTION
2063///////// REDUCTION
2064
2065
2066// TODO -- needs to be a WAVE
2067Function/WAVE V_getAbsolute_Scaling(fname)
2068        String fname
2069       
2070        String path = "entry:reduction:absolute_scaling"       
2071        WAVE w = V_getRealWaveFromHDF5(fname,path)
2072       
2073        return w
2074end
2075
2076// TODO -- needs to be a WAVE
2077Function/WAVE V_getBoxCoordinates(fname)
2078        String fname
2079       
2080        String path = "entry:reduction:box_coordinates"
2081        WAVE w = V_getRealWaveFromHDF5(fname,path)
2082
2083        return w
2084end
2085
2086//box counts
2087Function V_getBoxCounts(fname)
2088        String fname
2089       
2090        String path = "entry:reduction:box_count"       
2091        return(V_getRealValueFromHDF5(fname,path))
2092end
2093
2094//box counts error
2095Function V_getBoxCountsError(fname)
2096        String fname
2097       
2098        String path = "entry:reduction:box_count_error"
2099        return(V_getRealValueFromHDF5(fname,path))
2100end
2101
2102Function/S V_getReductionComments(fname)
2103        String fname
2104
2105        String path = "entry:reduction:comments"       
2106        Variable num=60
2107        return(V_getStringFromHDF5(fname,path,num))
2108End
2109
2110
2111Function/S V_getReductionIntent(fname)
2112        String fname
2113
2114        String path = "entry:reduction:intent" 
2115        Variable num=60
2116        return(V_getStringFromHDF5(fname,path,num))
2117End
2118
2119
2120Function/S V_getLogFileName(fname)
2121        String fname
2122
2123        String path = "entry:reduction:sans_log_file_name"     
2124        Variable num=60
2125        return(V_getStringFromHDF5(fname,path,num))
2126End
2127
2128
2129Function/S V_getSensitivityFileName(fname)
2130        String fname
2131
2132        String path = "entry:reduction:sensitivity_file_name"   
2133        Variable num=60
2134        return(V_getStringFromHDF5(fname,path,num))
2135End
2136
2137Function/S V_getTransmissionFileName(fname)
2138        String fname
2139
2140        String path = "entry:reduction:transmission_file_name" 
2141        Variable num=60
2142        return(V_getStringFromHDF5(fname,path,num))
2143End
2144
2145Function/S V_getEmptyBeamFileName(fname)
2146        String fname
2147
2148        String path = "entry:reduction:empty_beam_file_name"   
2149        Variable num=60
2150        return(V_getStringFromHDF5(fname,path,num))
2151End
2152
2153Function/S V_getEmptyFileName(fname)
2154        String fname
2155
2156        String path = "entry:reduction:empty_file_name"
2157        Variable num=60
2158        return(V_getStringFromHDF5(fname,path,num))
2159End
2160
2161Function/S V_getMaskFileName(fname)
2162        String fname
2163
2164        String path = "entry:reduction:mask_file_name" 
2165        Variable num=60
2166        return(V_getStringFromHDF5(fname,path,num))
2167End
2168
2169
2170//whole detector trasmission
2171Function V_getSampleTransWholeDetector(fname)
2172        String fname
2173       
2174        String path = "entry:reduction:whole_trans"     
2175        return(V_getRealValueFromHDF5(fname,path))
2176end
2177
2178//whole detector trasmission error
2179Function V_getSampleTransWholeDetErr(fname)
2180        String fname
2181       
2182        String path = "entry:reduction:whole_trans_error"       
2183        return(V_getRealValueFromHDF5(fname,path))
2184end
2185
2186                       
2187/////                   pol_sans (data folder)
2188
2189Function/S V_getPolSANS_cellName(fname)
2190        String fname
2191
2192        String path = "entry:reduction:pol_sans:cell_name"     
2193        Variable num=60
2194        return(V_getStringFromHDF5(fname,path,num))
2195End
2196
2197
2198Function/WAVE V_getPolSANS_cellParams(fname)
2199        String fname
2200       
2201        String path = "entry:reduction:pol_sans:cell_parameters"       
2202        WAVE w = V_getRealWaveFromHDF5(fname,path)
2203
2204        return w
2205end
2206
2207Function/S V_getPolSANS_PolSANSPurpose(fname)
2208        String fname
2209
2210        String path = "entry:reduction:pol_sans:pol_sans_purpose"       
2211        Variable num=60
2212        return(V_getStringFromHDF5(fname,path,num))
2213End
2214
2215                               
2216//////// TOP LEVEL DATA REPRESENTATION
2217//
2218// note that here the data is (supposed to be) a link, not the actual data
2219// Igor HDf implementation cannot follow links properly, as far as I know.
2220// so ignore them here, and focus on the image that may be possible to read
2221//
2222
2223//              data_B (data folder)
2224//                      data (wave) 1           //ignore this, it's a link
2225//                      variables (wave) 320
2226//                      thumbnail (data folder)
2227
2228////data (wave) "binary"
2229//// TODO -- this will need to be completely replaced with a function that can
2230//// read the binary image data. should be possible, but I don't know the details on either end...
2231//Function/S V_getDataImage(fname,detStr)
2232//      String fname,detStr
2233//
2234//      String path = "entry:data_"+detStr+":thumbnail:data"   
2235//      Variable num=60
2236//      return(V_getStringFromHDF5(fname,path,num))
2237//End
2238//
2239//Function/S V_getDataImageDescription(fname,detStr)
2240//      String fname,detStr
2241//
2242//      String path = "entry:data_"+detStr+":thumbnail:description"     
2243//      Variable num=60
2244//      return(V_getStringFromHDF5(fname,path,num))
2245//End
2246//                                                             
2247//Function/S V_getDataImageType(fname,detStr)
2248//      String fname,detStr
2249//
2250//      String path = "entry:data_"+detStr+":thumbnail:type"   
2251//      Variable num=60
2252//      return(V_getStringFromHDF5(fname,path,num))
2253//End
2254//
2255//
2256
2257
Note: See TracBrowser for help on using the repository browser.