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

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

lots of changes to 1D averaging and the plotting routines, detector corrections, and basic reads

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