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

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

changes to a few analysis models to make these Igor 7-ready

adding mask editing utilities

many changes to event mode for easier processing of split lists

updated event mode help file

+ lots more!

File size: 52.8 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//// DONE - this does not exist for VSANS - per JGB 4/2016
818//Function 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))
823//end
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_NominalDistance(fname,detStr)
1388        String fname,detStr
1389
1390        String path = "entry:instrument:detector_"+detStr+":distance"
1391        return(V_getRealValueFromHDF5(fname,path))
1392End
1393
1394//this is a DERIVED distance, since the nominal sdd is for the carriage (=LR panels)
1395Function V_getDet_ActualDistance(fname,detStr)
1396        String fname,detStr
1397
1398        Variable sdd
1399        sdd = V_getDet_NominalDistance(fname,detStr)            //[cm]
1400        sdd += V_getDet_TBSetback(fname,detStr)/10              // written in [mm], convert to [cm], returns 0 for L/R/B panels
1401               
1402        return(sdd)
1403End
1404
1405//// only defined for the "B" detector, and only to satisfy NXsas
1406//Function V_getDet_equatorial_angle(fname,detStr)
1407//      String fname,detStr
1408//
1409//      if(cmpstr(detStr,"B") == 0)
1410//              String path = "entry:instrument:detector_"+detStr+":equatorial_angle"
1411//              return(V_getRealValueFromHDF5(fname,path))
1412//      else
1413//              return(0)
1414//      endif
1415//End
1416
1417Function/S V_getDetEventFileName(fname,detStr)
1418        String fname,detStr
1419
1420        String path = "entry:instrument:detector_"+detStr+":event_file_name"
1421        Variable num=60
1422        return(V_getStringFromHDF5(fname,path,num))
1423End
1424
1425Function V_getDet_IntegratedCount(fname,detStr)
1426        String fname,detStr
1427
1428        String path = "entry:instrument:detector_"+detStr+":integrated_count"
1429        return(V_getRealValueFromHDF5(fname,path))
1430End
1431
1432Function V_getDet_LateralOffset(fname,detStr)
1433        String fname,detStr
1434
1435        String path = "entry:instrument:detector_"+detStr+":lateral_offset"
1436        return(V_getRealValueFromHDF5(fname,path))
1437End
1438
1439// TODO - be sure this is defined correctly (with correct units!)
1440// -- only returns for T/B detectors
1441Function V_getDet_TBSetback(fname,detStr)
1442        String fname,detStr
1443
1444        if(cmpstr(detStr,"B") == 0)
1445                return(0)
1446        endif
1447        if(cmpstr(detStr,"FR") == 0 || cmpstr(detStr,"FL") == 0)
1448                return(0)
1449        endif
1450        if(cmpstr(detStr,"MR") == 0 || cmpstr(detStr,"ML") == 0)
1451                return(0)
1452        endif   
1453       
1454        String path = "entry:instrument:detector_"+detStr+":setback"
1455        return(V_getRealValueFromHDF5(fname,path))
1456       
1457       
1458End
1459
1460//Function V_getDet_VerticalOffset(fname,detStr)
1461//      String fname,detStr
1462//
1463//      String path = "entry:instrument:detector_"+detStr+":vertical_offset"
1464//      return(V_getRealValueFromHDF5(fname,path))
1465//End
1466
1467
1468//// only defined for the "B" detector, and only to satisfy NXsas
1469//Function V_getDet_polar_angle(fname,detStr)
1470//      String fname,detStr
1471//
1472//      if(cmpstr(detStr,"B") == 0)
1473//              String path = "entry:instrument:detector_"+detStr+":polar_angle"
1474//              return(V_getRealValueFromHDF5(fname,path))
1475//      else
1476//              return(0)
1477//      endif
1478//End
1479
1480//// only defined for the "B" detector, and only to satisfy NXsas
1481//Function V_getDet_rotational_angle(fname,detStr)
1482//      String fname,detStr
1483//
1484//      if(cmpstr(detStr,"B") == 0)
1485//              String path = "entry:instrument:detector_"+detStr+":rotational_angle"
1486//              return(V_getRealValueFromHDF5(fname,path))
1487//      else
1488//              return(0)
1489//      endif
1490//End
1491
1492Function/S V_getDetSettings(fname,detStr)
1493        String fname,detStr
1494
1495        String path = "entry:instrument:detector_"+detStr+":settings"
1496        Variable num=60
1497        return(V_getStringFromHDF5(fname,path,num))
1498End
1499
1500//// really has no meaning at all
1501//Function V_getDet_size(fname,detStr)
1502//      String fname,detStr
1503//
1504//      String path = "entry:instrument:detector_"+detStr+":size"
1505//      return(V_getRealValueFromHDF5(fname,path))
1506//End
1507
1508Function/S V_getDetType(fname,detStr)
1509        String fname,detStr
1510
1511        String path = "entry:instrument:detector_"+detStr+":type"
1512        Variable num=60
1513        return(V_getStringFromHDF5(fname,path,num))
1514End
1515
1516Function V_getDet_x_pixel_size(fname,detStr)
1517        String fname,detStr
1518
1519        String path = "entry:instrument:detector_"+detStr+":x_pixel_size"
1520        return(V_getRealValueFromHDF5(fname,path))
1521End
1522
1523Function V_getDet_y_pixel_size(fname,detStr)
1524        String fname,detStr
1525
1526        String path = "entry:instrument:detector_"+detStr+":y_pixel_size"
1527        return(V_getRealValueFromHDF5(fname,path))
1528End
1529
1530/////////                       detector_FB (data folder) + ALL other PANEL DETECTORS
1531
1532Function V_getDet_numberOfTubes(fname,detStr)
1533        String fname,detStr
1534
1535        String path = "entry:instrument:detector_"+detStr+":number_of_tubes"
1536        if(cmpstr(detStr,"B") == 0)
1537                return(0)
1538        else
1539                return(V_getRealValueFromHDF5(fname,path))
1540        endif
1541End
1542
1543// TODO -- be clear on how this is defined. Separation as defined from what point? Units?
1544Function V_getDetPanelSeparation(fname,detStr)
1545        String fname,detStr
1546
1547        String path = "entry:instrument:detector_"+detStr+":separation"
1548        if(cmpstr(detStr,"B") == 0)
1549                return(0)
1550        else
1551                return(V_getRealValueFromHDF5(fname,path))
1552        endif
1553End
1554
1555// TODO -- write this function to return a WAVE with the data
1556// either as a wave reference, or as an input parameter
1557Function/WAVE V_getDetTube_spatialCalib(fname,detStr)
1558        String fname,detStr
1559
1560        String path = "entry:instrument:detector_"+detStr+":spatial_calibration"
1561        if(cmpstr(detStr,"B") == 0)
1562                return $("")    // return should be null
1563        else
1564                WAVE w = V_getRealWaveFromHDF5(fname,path)
1565                return w
1566        endif
1567End
1568
1569//// TODO -- be clear on how this is defined.
1570//Function V_getDet_tubeIndex(fname,detStr)
1571//      String fname,detStr
1572//
1573//      String path = "entry:instrument:detector_"+detStr+":tube_index"
1574//      if(cmpstr(detStr,"B") == 0)
1575//              return(0)
1576//      else
1577//              return(V_getRealValueFromHDF5(fname,path))
1578//      endif
1579//End
1580
1581Function/S V_getDet_tubeOrientation(fname,detStr)
1582        String fname,detStr
1583
1584        String path = "entry:instrument:detector_"+detStr+":tube_orientation"
1585        Variable num=60
1586        if(cmpstr(detStr,"B") == 0)
1587                return("")
1588        else
1589                return(V_getStringFromHDF5(fname,path,num))
1590        endif
1591End
1592
1593// TODO -- be clear on how this is defined. Units?
1594Function V_getDet_tubeWidth(fname,detStr)
1595        String fname,detStr
1596
1597        String path = "entry:instrument:detector_"+detStr+":tube_width"
1598        if(cmpstr(detStr,"B") == 0)
1599                return(0)
1600        else
1601                return(V_getRealValueFromHDF5(fname,path))
1602        endif
1603End
1604
1605//////////////////////
1606
1607// INSTRUMENT/LENSES    /APERTURES
1608//  lenses (data folder)
1609
1610Function V_getLensCurvature(fname)
1611        String fname
1612
1613        String path = "entry:instrument:lenses:curvature"
1614        return(V_getRealValueFromHDF5(fname,path))
1615End
1616
1617Function/S V_getLensesFocusType(fname)
1618        String fname
1619
1620        String path = "entry:instrument:lenses:focus_type"
1621        Variable num=60
1622        return(V_getStringFromHDF5(fname,path,num))
1623End
1624
1625Function V_getLensDistance(fname)
1626        String fname
1627
1628        String path = "entry:instrument:lenses:lens_distance"
1629        return(V_getRealValueFromHDF5(fname,path))
1630End
1631
1632Function/S V_getLensGeometry(fname)
1633        String fname
1634
1635        String path = "entry:instrument:lenses:lens_geometry"
1636        Variable num=60
1637        return(V_getStringFromHDF5(fname,path,num))
1638End
1639
1640Function/S V_getLensMaterial(fname)
1641        String fname
1642
1643        String path = "entry:instrument:lenses:lens_material"
1644        Variable num=60
1645        return(V_getStringFromHDF5(fname,path,num))
1646End
1647
1648Function V_getNumber_of_Lenses(fname)
1649        String fname
1650
1651        String path = "entry:instrument:lenses:number_of_lenses"
1652        return(V_getRealValueFromHDF5(fname,path))
1653End
1654
1655Function V_getNumber_of_prisms(fname)
1656        String fname
1657
1658        String path = "entry:instrument:lenses:number_of_prisms"
1659        return(V_getRealValueFromHDF5(fname,path))
1660End
1661
1662Function V_getPrism_distance(fname)
1663        String fname
1664
1665        String path = "entry:instrument:lenses:prism_distance"
1666        return(V_getRealValueFromHDF5(fname,path))
1667End
1668
1669Function/S V_getPrismMaterial(fname)
1670        String fname
1671
1672        String path = "entry:instrument:lenses:prism_material"
1673        Variable num=60
1674        return(V_getStringFromHDF5(fname,path,num))
1675End
1676
1677// status of lens/prism = lens | prism | both | out
1678Function/S V_getLensPrismStatus(fname)
1679        String fname
1680
1681        String path = "entry:instrument:lenses:status"
1682        Variable num=60
1683        return(V_getStringFromHDF5(fname,path,num))
1684End
1685       
1686
1687
1688
1689///////  sample_aperture (1) (data folder)
1690Function/S V_getSampleAp_Description(fname)
1691        String fname
1692
1693        String path = "entry:instrument:sample_aperture:description"
1694        Variable num=60
1695        return(V_getStringFromHDF5(fname,path,num))
1696End
1697
1698Function V_getSampleAp_distance(fname)
1699        String fname
1700
1701        String path = "entry:instrument:sample_aperture:distance"
1702        return(V_getRealValueFromHDF5(fname,path))
1703End
1704
1705//      shape (data folder)
1706Function/S V_getSampleAp_shape(fname)
1707        String fname
1708
1709        String path = "entry:instrument:sample_aperture:shape:shape"
1710        Variable num=60
1711        return(V_getStringFromHDF5(fname,path,num))
1712End
1713
1714// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1715Function/S V_getSampleAp_size(fname)
1716        String fname
1717
1718        String path = "entry:instrument:sample_aperture:shape:size"
1719        Variable num=60
1720        return(V_getStringFromHDF5(fname,path,num))
1721End
1722
1723Function V_getSampleAp_height(fname)
1724        String fname
1725
1726        String path = "entry:instrument:sample_aperture:shape:height"
1727        return(V_getRealValueFromHDF5(fname,path))
1728End
1729
1730Function V_getSampleAp_width(fname)
1731        String fname
1732
1733        String path = "entry:instrument:sample_aperture:shape:width"
1734        return(V_getRealValueFromHDF5(fname,path))
1735End
1736
1737
1738
1739///////  sample_aperture_2 (data folder)
1740
1741Function/S V_getSampleAp2_Description(fname)
1742        String fname
1743
1744        String path = "entry:instrument:sample_aperture_2:description"
1745        Variable num=60
1746        return(V_getStringFromHDF5(fname,path,num))
1747End
1748
1749Function V_getSampleAp2_distance(fname)
1750        String fname
1751
1752        String path = "entry:instrument:sample_aperture_2:distance"
1753        return(V_getRealValueFromHDF5(fname,path))
1754End
1755
1756//      shape (data folder)
1757Function/S V_getSampleAp2_shape(fname)
1758        String fname
1759
1760        String path = "entry:instrument:sample_aperture_2:shape:shape"
1761        Variable num=60
1762        return(V_getStringFromHDF5(fname,path,num))
1763End
1764
1765// this returns REAL, DIFFERENT than SampleAp1
1766Function V_getSampleAp2_size(fname)
1767        String fname
1768
1769        String path = "entry:instrument:sample_aperture_2:shape:size"
1770        return(V_getRealValueFromHDF5(fname,path))
1771End
1772
1773Function V_getSampleAp2_height(fname)
1774        String fname
1775
1776        String path = "entry:instrument:sample_aperture_2:shape:height"
1777        return(V_getRealValueFromHDF5(fname,path))
1778End
1779
1780Function V_getSampleAp2_width(fname)
1781        String fname
1782
1783        String path = "entry:instrument:sample_aperture_2:shape:width"
1784        return(V_getRealValueFromHDF5(fname,path))
1785End
1786
1787       
1788//////  sample_table (data folder)
1789// location  = "CHAMBER" or HUBER
1790Function/S V_getSampleTableLocation(fname)
1791        String fname
1792
1793        String path = "entry:instrument:sample_table:location"
1794        Variable num=60
1795        return(V_getStringFromHDF5(fname,path,num))
1796End
1797
1798// TODO - verify the meaning
1799//      offset_distance (?? for center of sample table vs. sample position)
1800Function V_getSampleTableOffset(fname)
1801        String fname
1802
1803        String path = "entry:instrument:sample_table:offset_distance"
1804        return(V_getRealValueFromHDF5(fname,path))
1805End     
1806       
1807//  source (data folder)
1808//name "NCNR"
1809Function/S V_getSourceName(fname)
1810        String fname
1811
1812        String path = "entry:instrument:source:name"
1813        Variable num=60
1814        return(V_getStringFromHDF5(fname,path,num))
1815End
1816
1817//      power -- nominal only, not connected to any real number
1818Function V_getReactorPower(fname)
1819        String fname
1820
1821        String path = "entry:instrument:source:power"
1822        return(V_getRealValueFromHDF5(fname,path))
1823End     
1824
1825//probe (wave) "neutron"
1826Function/S V_getSourceProbe(fname)
1827        String fname
1828
1829        String path = "entry:instrument:source:probe"
1830        Variable num=60
1831        return(V_getStringFromHDF5(fname,path,num))
1832End
1833
1834//type (wave) "Reactor Neutron Source"
1835Function/S V_getSourceType(fname)
1836        String fname
1837
1838        String path = "entry:instrument:source:type"
1839        Variable num=60
1840        return(V_getStringFromHDF5(fname,path,num))
1841End
1842
1843       
1844///////  source_aperture (data folder)
1845
1846Function/S V_getSourceAp_Description(fname)
1847        String fname
1848
1849        String path = "entry:instrument:source_aperture:description"
1850        Variable num=60
1851        return(V_getStringFromHDF5(fname,path,num))
1852End
1853
1854Function V_getSourceAp_distance(fname)
1855        String fname
1856
1857        String path = "entry:instrument:source_aperture:distance"
1858        return(V_getRealValueFromHDF5(fname,path))
1859End
1860
1861//      shape (data folder)
1862Function/S V_getSourceAp_shape(fname)
1863        String fname
1864
1865        String path = "entry:instrument:source_aperture:shape:shape"
1866        Variable num=60
1867        return(V_getStringFromHDF5(fname,path,num))
1868End
1869
1870// this returns TEXT, due to GUI input, == to diameter if CIRCLE
1871Function/S V_getSourceAp_size(fname)
1872        String fname
1873
1874        String path = "entry:instrument:source_aperture:shape:size"
1875        Variable num=60
1876        return(V_getStringFromHDF5(fname,path,num))
1877End
1878
1879Function V_getSourceAp_height(fname)
1880        String fname
1881
1882        String path = "entry:instrument:source_aperture:shape:height"
1883        return(V_getRealValueFromHDF5(fname,path))
1884End
1885
1886Function V_getSourceAp_width(fname)
1887        String fname
1888
1889        String path = "entry:instrument:source_aperture:shape:width"
1890        return(V_getRealValueFromHDF5(fname,path))
1891End
1892
1893
1894//////// SAMPLE
1895//////// SAMPLE
1896//////// SAMPLE
1897
1898//Sample position in changer (returned as TEXT)
1899Function/S V_getSamplePosition(fname)
1900        String fname
1901       
1902        String path = "entry:sample:changer_position"   
1903        Variable num=60
1904        return(V_getStringFromHDF5(fname,path,num))
1905end
1906
1907// sample label
1908Function/S V_getSampleDescription(fname)
1909        String fname
1910
1911        String path = "entry:sample:description"
1912        Variable num=60
1913        return(V_getStringFromHDF5(fname,path,num))
1914End
1915
1916// for a z-stage??
1917Function V_getSampleElevation(fname)
1918        String fname
1919       
1920        String path = "entry:sample:elevation" 
1921        return(V_getRealValueFromHDF5(fname,path))
1922end
1923
1924//no meaning to this...
1925Function V_getSample_equatorial_ang(fname)
1926        String fname
1927       
1928        String path = "entry:sample:equatorial_angle"   
1929        return(V_getRealValueFromHDF5(fname,path))
1930end
1931
1932// group ID !!! very important for matching up files
1933Function V_getSample_GroupID(fname)
1934        String fname
1935       
1936        String path = "entry:sample:group_id"   
1937        return(V_getRealValueFromHDF5(fname,path))
1938end
1939
1940
1941//Sample Rotation Angle
1942Function V_getSampleRotationAngle(fname)
1943        String fname
1944       
1945        String path = "entry:sample:rotation_angle"     
1946        return(V_getRealValueFromHDF5(fname,path))
1947end
1948
1949//?? this is huber/chamber??
1950// TODO -- then where is the description of 10CB, etc...
1951Function/S V_getSampleHolderDescription(fname)
1952        String fname
1953
1954        String path = "entry:sample:sample_holder_description"
1955        Variable num=60
1956        return(V_getStringFromHDF5(fname,path,num))
1957End
1958
1959//Sample Thickness
1960// TODO -- somehow, this is not set correctly in the acquisition, so NaN results
1961Function V_getSampleThickness(fname)
1962        String fname
1963       
1964        String path = "entry:sample:thickness" 
1965        return(V_getRealValueFromHDF5(fname,path))
1966end
1967
1968Function V_getSampleTranslation(fname)
1969        String fname
1970       
1971        String path = "entry:sample:translation"       
1972        return(V_getRealValueFromHDF5(fname,path))
1973end
1974
1975// sample transmission
1976Function V_getSampleTransmission(fname)
1977        String fname
1978       
1979        String path = "entry:sample:transmission"       
1980//      String path = "QKK0037737:data:Transmission"   
1981        return(V_getRealValueFromHDF5(fname,path))
1982end
1983
1984//transmission error (one sigma)
1985Function V_getSampleTransError(fname)
1986        String fname
1987       
1988        String path = "entry:sample:transmission_error"
1989        return(V_getRealValueFromHDF5(fname,path))
1990end
1991
1992
1993
1994
1995//// SAMPLE / DATA LOGS
1996// write this generic , call with the name of the environment log desired
1997//
1998// temperature_1
1999// temperature_2
2000// shear_field
2001// pressure
2002// magnetic_field
2003// electric_field
2004//
2005//////// (for example) electric_field (data folder)
2006
2007Function/S V_getLog_attachedTo(fname,logStr)
2008        String fname,logStr
2009
2010        String path = "entry:sample:"+logstr+":attached_to"
2011        Variable num=60
2012        return(V_getStringFromHDF5(fname,path,num))
2013End
2014
2015
2016Function/S V_getLog_measurement(fname,logStr)
2017        String fname,logStr
2018
2019        String path = "entry:sample:"+logstr+":measurement"
2020        Variable num=60
2021        return(V_getStringFromHDF5(fname,path,num))
2022End
2023
2024
2025Function/S V_getLog_Name(fname,logStr)
2026        String fname,logStr
2027
2028        String path = "entry:sample:"+logstr+":name"
2029        Variable num=60
2030        return(V_getStringFromHDF5(fname,path,num))
2031End
2032
2033
2034// TODO --
2035Function V_getLog_nomValue(fname,logStr)
2036        String fname,logStr
2037       
2038        String path = "entry:sample:"+logstr+":value"
2039        return(V_getRealValueFromHDF5(fname,path))
2040end
2041
2042////            value_log (data folder)
2043Function/S V_getLog_startTime(fname,logStr)
2044        String fname,logStr
2045
2046        String path = "entry:sample:"+logstr+":value_log:start"
2047        Variable num=60
2048        return(V_getStringFromHDF5(fname,path,num))
2049End
2050
2051// TODO -- thes currently do not exist...
2052//
2053//// TODO --
2054//Function V_getLog_avgValue(fname,logStr)
2055//      String fname,logStr
2056//     
2057//      String path = "entry:sample:"+logstr+":value_log:average_value"
2058//      return(V_getRealValueFromHDF5(fname,path))
2059//end
2060//
2061//// TODO -- this needs to be a WAVE reference
2062//// TODO -- verify that the field is really read in as "time0"
2063//Function V_getLog_time(fname,logStr,outW)
2064//      String fname,logStr
2065//      Wave outW
2066//     
2067//      String path = "entry:sample:"+logstr+":value_log:time0"
2068//      WAVE w = V_getRealWaveFromHDF5(fname,path)
2069//
2070//      outW = w
2071//      return(0)
2072//end
2073//
2074//
2075//// TODO -- this needs to be a WAVE reference
2076//Function V_getLog_Value(fname,logStr,outW)
2077//      String fname,logStr
2078//      Wave outW
2079//     
2080//      String path = "entry:sample:"+logstr+":value_log:value"
2081//      WAVE w = V_getRealWaveFromHDF5(fname,path)
2082//
2083//      outW = w
2084//      return(0)
2085//end
2086
2087
2088
2089
2090
2091
2092
2093///////// REDUCTION
2094///////// REDUCTION
2095///////// REDUCTION
2096
2097
2098// TODO -- needs to be a WAVE
2099Function/WAVE V_getAbsolute_Scaling(fname)
2100        String fname
2101       
2102        String path = "entry:reduction:absolute_scaling"       
2103        WAVE w = V_getRealWaveFromHDF5(fname,path)
2104       
2105        return w
2106end
2107
2108// TODO -- needs to be a WAVE
2109Function/WAVE V_getBoxCoordinates(fname)
2110        String fname
2111       
2112        String path = "entry:reduction:box_coordinates"
2113        WAVE w = V_getRealWaveFromHDF5(fname,path)
2114
2115        return w
2116end
2117
2118//box counts
2119Function V_getBoxCounts(fname)
2120        String fname
2121       
2122        String path = "entry:reduction:box_count"       
2123        return(V_getRealValueFromHDF5(fname,path))
2124end
2125
2126//box counts error
2127Function V_getBoxCountsError(fname)
2128        String fname
2129       
2130        String path = "entry:reduction:box_count_error"
2131        return(V_getRealValueFromHDF5(fname,path))
2132end
2133
2134Function/S V_getReductionComments(fname)
2135        String fname
2136
2137        String path = "entry:reduction:comments"       
2138        Variable num=60
2139        return(V_getStringFromHDF5(fname,path,num))
2140End
2141
2142
2143Function/S V_getReductionIntent(fname)
2144        String fname
2145
2146        String path = "entry:reduction:intent" 
2147        Variable num=60
2148        return(V_getStringFromHDF5(fname,path,num))
2149End
2150
2151
2152Function/S V_getLogFileName(fname)
2153        String fname
2154
2155        String path = "entry:reduction:sans_log_file_name"     
2156        Variable num=60
2157        return(V_getStringFromHDF5(fname,path,num))
2158End
2159
2160
2161Function/S V_getSensitivityFileName(fname)
2162        String fname
2163
2164        String path = "entry:reduction:sensitivity_file_name"   
2165        Variable num=60
2166        return(V_getStringFromHDF5(fname,path,num))
2167End
2168
2169Function/S V_getTransmissionFileName(fname)
2170        String fname
2171
2172        String path = "entry:reduction:transmission_file_name" 
2173        Variable num=60
2174        return(V_getStringFromHDF5(fname,path,num))
2175End
2176
2177Function/S V_getEmptyBeamFileName(fname)
2178        String fname
2179
2180        String path = "entry:reduction:empty_beam_file_name"   
2181        Variable num=60
2182        return(V_getStringFromHDF5(fname,path,num))
2183End
2184
2185Function/S V_getEmptyFileName(fname)
2186        String fname
2187
2188        String path = "entry:reduction:empty_file_name"
2189        Variable num=60
2190        return(V_getStringFromHDF5(fname,path,num))
2191End
2192
2193Function/S V_getMaskFileName(fname)
2194        String fname
2195
2196        String path = "entry:reduction:mask_file_name" 
2197        Variable num=60
2198        return(V_getStringFromHDF5(fname,path,num))
2199End
2200
2201
2202//whole detector trasmission
2203Function V_getSampleTransWholeDetector(fname)
2204        String fname
2205       
2206        String path = "entry:reduction:whole_trans"     
2207        return(V_getRealValueFromHDF5(fname,path))
2208end
2209
2210//whole detector trasmission error
2211Function V_getSampleTransWholeDetErr(fname)
2212        String fname
2213       
2214        String path = "entry:reduction:whole_trans_error"       
2215        return(V_getRealValueFromHDF5(fname,path))
2216end
2217
2218                       
2219/////                   pol_sans (data folder)
2220
2221Function/S V_getPolSANS_cellName(fname)
2222        String fname
2223
2224        String path = "entry:reduction:pol_sans:cell_name"     
2225        Variable num=60
2226        return(V_getStringFromHDF5(fname,path,num))
2227End
2228
2229
2230Function/WAVE V_getPolSANS_cellParams(fname)
2231        String fname
2232       
2233        String path = "entry:reduction:pol_sans:cell_parameters"       
2234        WAVE w = V_getRealWaveFromHDF5(fname,path)
2235
2236        return w
2237end
2238
2239Function/S V_getPolSANS_PolSANSPurpose(fname)
2240        String fname
2241
2242        String path = "entry:reduction:pol_sans:pol_sans_purpose"       
2243        Variable num=60
2244        return(V_getStringFromHDF5(fname,path,num))
2245End
2246
2247                               
2248//////// TOP LEVEL DATA REPRESENTATION
2249//
2250// note that here the data is (supposed to be) a link, not the actual data
2251// Igor HDf implementation cannot follow links properly, as far as I know.
2252// so ignore them here, and focus on the image that may be possible to read
2253//
2254
2255//              data_B (data folder)
2256//                      data (wave) 1           //ignore this, it's a link
2257//                      variables (wave) 320
2258//                      thumbnail (data folder)
2259
2260////data (wave) "binary"
2261//// TODO -- this will need to be completely replaced with a function that can
2262//// read the binary image data. should be possible, but I don't know the details on either end...
2263//Function/S V_getDataImage(fname,detStr)
2264//      String fname,detStr
2265//
2266//      String path = "entry:data_"+detStr+":thumbnail:data"   
2267//      Variable num=60
2268//      return(V_getStringFromHDF5(fname,path,num))
2269//End
2270//
2271//Function/S V_getDataImageDescription(fname,detStr)
2272//      String fname,detStr
2273//
2274//      String path = "entry:data_"+detStr+":thumbnail:description"     
2275//      Variable num=60
2276//      return(V_getStringFromHDF5(fname,path,num))
2277//End
2278//                                                             
2279//Function/S V_getDataImageType(fname,detStr)
2280//      String fname,detStr
2281//
2282//      String path = "entry:data_"+detStr+":thumbnail:type"   
2283//      Variable num=60
2284//      return(V_getStringFromHDF5(fname,path,num))
2285//End
2286//
2287//
2288
2289
Note: See TracBrowser for help on using the repository browser.