Changeset 555 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Timestamp:
- Sep 14, 2009 11:59:44 AM (13 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ProtocolAsPanel.ipf
r510 r555 1913 1913 default: 1914 1914 WriteWaves_W_Protocol(activeType,fullpath,dialog) 1915 //WriteXMLWaves_W_Protocol(activeType,fullpath,dialog) 1915 1916 endswitch 1916 1917 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WriteQIS.ipf
r544 r555 858 858 return(0) 859 859 End 860 861 862 //for writing out data (q-i-s) from the "type" folder, and including reduction information 863 //if fullpath is a complete HD path:filename, no dialog will be presented 864 //if fullpath is just a filename, the save dialog will be presented 865 //if dialog = 1, a dialog will always be presented 866 // 867 // root:myGlobals:Protocols:gProtoStr is the name of the currently active protocol 868 // 869 Function WriteXMLWaves_W_Protocol(type,fullpath,dialog) 870 String type,fullpath 871 Variable dialog //=1 will present dialog for name 872 873 Struct NISTXMLfile nf 874 875 String destStr="" 876 destStr = "root:Packages:NIST:"+type 877 878 Variable refNum 879 String formatStr = "%15.4g %15.4g %15.4g %15.4g %15.4g %15.4g\r\n" 880 String fname,ave="C",hdrStr1="",hdrStr2="" 881 Variable step=1 882 883 //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 884 WAVE intw=$(destStr + ":integersRead") 885 WAVE rw=$(destStr + ":realsRead") 886 WAVE/T textw=$(destStr + ":textRead") 887 WAVE qvals =$(destStr + ":qval") 888 WAVE inten=$(destStr + ":aveint") 889 WAVE sig=$(destStr + ":sigave") 890 WAVE qbar = $(destStr + ":QBar") 891 WAVE sigmaq = $(destStr + ":SigmaQ") 892 WAVE fsubs = $(destStr + ":fSubS") 893 894 895 SVAR gProtoStr = root:myGlobals:Protocols:gProtoStr 896 Wave/T proto=$("root:myGlobals:Protocols:"+gProtoStr) 897 898 899 //check each wave 900 If(!(WaveExists(intw))) 901 Abort "intw DNExist BinaryWrite_W_Protocol()" 902 Endif 903 If(!(WaveExists(rw))) 904 Abort "rw DNExist BinaryWrite_W_Protocol()" 905 Endif 906 If(!(WaveExists(textw))) 907 Abort "textw DNExist BinaryWrite_W_Protocol()" 908 Endif 909 If(!(WaveExists(qvals))) 910 Abort "qvals DNExist BinaryWrite_W_Protocol()" 911 Endif 912 If(!(WaveExists(inten))) 913 Abort "inten DNExist BinaryWrite_W_Protocol()" 914 Endif 915 If(!(WaveExists(sig))) 916 Abort "sig DNExist BinaryWrite_W_Protocol()" 917 Endif 918 If(!(WaveExists(qbar))) 919 Abort "qbar DNExist BinaryWrite_W_Protocol()" 920 Endif 921 If(!(WaveExists(sigmaq))) 922 Abort "sigmaq DNExist BinaryWrite_W_Protocol()" 923 Endif 924 If(!(WaveExists(fsubs))) 925 Abort "fsubs DNExist BinaryWrite_W_Protocol()" 926 Endif 927 If(!(WaveExists(proto))) 928 Abort "current protocol wave DNExist BinaryWrite_W_Protocol()" 929 Endif 930 931 if(dialog) 932 PathInfo/S catPathName 933 fullPath = DoSaveFileDialog("Save data as") 934 If(cmpstr(fullPath,"")==0) 935 //user cancel, don't write out a file 936 Close/A 937 Abort "no data file was written" 938 Endif 939 //Print "dialog fullpath = ",fullpath 940 Endif 941 942 SVAR samFiles = $("root:Packages:NIST:"+type+":fileList") 943 //actually open the file here 944 //Open refNum as fullpath 945 946 //Data 947 Wave nf.Q = qvals 948 nf.unitsQ = "1/A" 949 Wave nf.I = inten 950 nf.unitsI = "1/cm" 951 Wave nf.Idev = sig 952 nf.unitsIdev = "1/cm" 953 Wave nf.Qdev = sigmaq 954 nf.unitsQdev = "1/A" 955 Wave nf.Qmean = qbar 956 nf.unitsQmean = "1/A" 957 Wave nf.Shadowfactor = fSubS 958 nf.unitsShadowfactor = "none" 959 960 961 //write out the standard header information 962 //fprintf refnum,"FILE: %s\t\t CREATED: %s\r\n",textw[0],textw[1] 963 964 //AJJ to fix with sensible values 965 nf.run = "Test" 966 String acct = textw[3] 967 nf.nameSASinstrument = acct[1,3] 968 nf.SASnote = "" 969 // 970 nf.sample_ID = textw[6] 971 nf.title = textw[6] 972 nf.radiation = "neutron" 973 nf.wavelength = rw[26] 974 nf.unitswavelength = "A" 975 nf.offset_angle = rw[19] 976 nf.unitsoffset_angle = "cm" 977 nf.SDD = rw[18] 978 nf.unitsSDD = "m" 979 nf.sample_transmission = rw[4] 980 nf.sample_thickness = rw[5] 981 nf.unitssample_thickness = "mm" 982 983 nf.beamcenter_X = rw[16] 984 nf.beamcenter_Y = rw[17] 985 nf.unitsbeamcenter_X = "pixels" 986 nf.unitsbeamcenter_Y = "pixels" 987 nf.source_aperture = rw[23] 988 nf.typesource_aperture = "pinhole" 989 nf.unitssource_aperture = "mm" 990 nf.sample_aperture = rw[24] 991 nf.typesample_aperture = "pinhole" 992 nf.unitssample_aperture = "mm" 993 //nf.collimation_length = total length - rw[25] 994 nf.wavelength_spread = rw[27] 995 nf.unitswavelength_spread = "percent" 996 //Do something with beamstop (rw[21]) 997 nf.detector_name = textW[9] 998 // fprintf refnum,"MON CNT LAMBDA DET ANG DET DIST TRANS THICK AVE STEP\r\n" 999 // fprintf refnum,hdrStr1 1000 1001 // fprintf refnum,"BCENT(X,Y) A1(mm) A2(mm) A1A2DIST(m) DL/L BSTOP(mm) DET_TYP \r\n" 1002 // fprintf refnum,hdrStr2 1003 1004 //insert protocol information here 1005 //-1 list of sample files 1006 //0 - bkg 1007 //1 - emp 1008 //2 - div 1009 //3 - mask 1010 //4 - abs params c2-c5 1011 //5 - average params 1012 nf.SASprocessnote = "SAM: "+samFiles+"\n" 1013 nf.SASprocessnote += "BGD: "+proto[0]+"\n" 1014 nf.SASprocessnote += "EMP: "+Proto[1]+"\n" 1015 nf.SASprocessnote += "DIV: "+Proto[2]+"\n" 1016 nf.SASprocessnote += "MASK: "+Proto[3]+"\n" 1017 nf.SASprocessnote += "ABS Parameters (3-6): "+Proto[4]+"\n" 1018 nf.SASprocessnote += "Average Choices: "+Proto[5]+"\n" 1019 1020 nf.nameSASProcess = "NIST IGOR" 1021 1022 //Close refnum 1023 1024 writeNISTXML(fullpath, nf) 1025 1026 SetDataFolder root: //(redundant) 1027 1028 //write confirmation of write operation to history area 1029 Print "Averaged XML File written: ", GetFileNameFromPathNoSemi(fullPath) 1030 KillWaves/Z tempShortProto 1031 Return(0) 1032 End
Note: See TracChangeset
for help on using the changeset viewer.