Changeset 70 for sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_DataReadWrite.ipf
- Timestamp:
- Mar 29, 2007 4:02:33 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_DataReadWrite.ipf
r69 r70 829 829 // 830 830 831 //returns a string containg the transmision stored in the file that is 832 //currently in the "type" folder (not from the binary header) 833 //returns "none" if the value (in RealsRead) cannot be found 834 // 835 Function/S GetTrans(type) 836 String type 837 838 String name="root:"+type+":realsread" 839 WAVE reals = $name 840 if(waveExists(reals)) 841 return(num2str(reals[4])) 842 else 843 return("none") 844 endif 845 End 846 847 //returns a string containg the sample thickness stored in the file that is 848 //currently in the "type" folder (not from the binary header) 849 //returns "none" if the value (in RealsRead) cannot be found 850 // 851 Function/S GetThick(type) 852 String type 853 854 String name="root:"+type+":realsread" 855 WAVE reals = $name 856 if(waveExists(reals)) 857 return(num2str(reals[5])) 858 else 859 return("none") 860 endif 861 End 831 862 832 863 833 /////***************** … … 936 906 Return(0) 937 907 End 908 909 // read specific bits of information from the header 910 // each of these operations MUST take care of open/close on their own 911 912 Function/S getStringFromHeader(fname,start,num) 913 String fname //full path:name 914 Variable start,num //starting byte and number of characters to read 915 916 String str 917 Variable refnum 918 Open/R refNum as fname 919 FSetPos refNum,start 920 FReadLine/N=(num) refNum,str 921 Close refnum 922 923 return(str) 924 End 925 // file suffix (4 characters @ byte 19) 926 Function/S getSuffix(fname) 927 String fname 928 929 return(getStringFromHeader(fname,19,4)) 930 End 931 932 // sample label (60 characters @ byte 98) 933 Function/S getSampleLabel(fname) 934 String fname 935 936 return(getStringFromHeader(fname,98,60)) 937 End 938 939 // read a single real value with GBLoadWave 940 Function getRealValueFromHeader(fname,start) 941 String fname 942 Variable start 943 944 String GBLoadStr="GBLoadWave/O/N=tempGBwave/T={2,2}/J=2/W=1/Q" 945 946 GBLoadStr += "/S="+num2str(start)+"/U=1" + "\"" + fname + "\"" 947 Execute GBLoadStr 948 Wave w=$"tempGBWave0" 949 950 return(w[0]) 951 End 952 953 //SDD is at byte 260 954 Function getSDD(fname) 955 String fname 956 957 return(getRealValueFromHeader(fname,260)) 958 end 959 //reads the wavelength from a reduced data file (not very reliable) 960 // - does not work with NSORTed files 961 // - only used in FIT/RPA (which itself is almost NEVER used...) 962 // 963 Function GetLambdaFromReducedData(tempName) 964 String tempName 965 966 String junkString 967 Variable lambdaFromFile, fileVar 968 lambdaFromFile = 6.0 969 Open/R/P=catPathName fileVar as tempName 970 FReadLine fileVar, junkString 971 FReadLine fileVar, junkString 972 FReadLine fileVar, junkString 973 if(strsearch(LowerStr(junkString),"lambda",0) != -1) 974 FReadLine/N=11 fileVar, junkString 975 FReadLine/N=10 fileVar, junkString 976 lambdaFromFile = str2num(junkString) 977 endif 978 Close fileVar 979 980 return(lambdaFromFile) 981 End 982
Note: See TracChangeset
for help on using the changeset viewer.