- Timestamp:
- Jul 6, 2012 5:29:38 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/BT5_AddFiles.ipf
r807 r857 12 12 // - it can be repeated multiple times to add more than two files together 13 13 // - the two added files are listed in the title of the summed file. 14 // -- see AddBT5AndSave() if you want something that cen be automated to bypass the user dialogs. 14 15 15 16 // Adding two data sets: … … 758 759 LoadAndAddUSANS(file1,file2) 759 760 760 End 761 String filen = file1[0,strlen(file1)-5]+"_SUM"+".BT5" 762 763 GetAddedFileName(filen) 764 End 765 766 Proc GetAddedFileName(newName) 767 String newName 768 Prompt newName, "Enter new FileName" 769 770 SaveAddedBT5Files(newName,1) // 1 asks to confirm the name w/ a dialog 771 End 772 773 774 // this procedure will add two and name without any dialogs. Pass it the three names 775 // if the save name is null, you'll get a dialog 776 Proc AddBT5AndSave(file1,file2,filen) 777 String file1,file2,filen="TMP.BT5" 778 Prompt file1, "First File", popup, BT5FileList("") 779 Prompt file2, "Second File", popup, BT5FileList("") 780 Prompt filen, "output file name" 781 782 LoadAndAddUSANS(file1,file2) 783 784 // String filen = file1[0,strlen(file1)-5]+"_SUM"+".BT5" 785 786 PathInfo savePathName 787 filen = S_Path + filen 788 SaveAddedBT5Files(filen,0) //0==no dialog 789 790 End 791 792 761 793 762 794 Function/S BT5FileList(filter) … … 896 928 endfor 897 929 898 // write out the final file (=tw3) 899 filen = file1[0,strlen(file1)-5]+"_SUM"+ext 930 // // write out the final file (=tw3) 931 // filen = file1[0,strlen(file1)-5]+"_SUM"+ext 932 // 933 // if(dialog) 934 // PathInfo/S savePathName 935 // fullPath = DoSaveFileDialog("Save data as",fname=filen) 936 // If(cmpstr(fullPath,"")==0) 937 // //user cancel, don't write out a file 938 // Close/A 939 // Abort "no data file was written" 940 // Endif 941 // //Print "dialog fullpath = ",fullpath 942 // Endif 943 // 944 // Open refNum as fullPath 945 // wfprintf refnum, "%s",tw3 946 // Close refnum 947 // 948 // //killwaves/Z tw1,tw2,tw3 949 950 return(0) 951 end 952 953 // if you bypass the dialog, newname needs to be a full path 954 Function SaveAddedBT5Files(newName,dialog) 955 String newName 956 Variable dialog 957 958 Variable refnum 959 String fullPath 960 961 WAVE/T tw3=tw3 900 962 901 963 if(dialog) 902 964 PathInfo/S savePathName 903 fullPath = DoSaveFileDialog("Save data as",fname= filen)965 fullPath = DoSaveFileDialog("Save data as",fname=newName) 904 966 If(cmpstr(fullPath,"")==0) 905 967 //user cancel, don't write out a file … … 907 969 Abort "no data file was written" 908 970 Endif 971 newName=FullPath 909 972 //Print "dialog fullpath = ",fullpath 910 973 Endif 911 912 Open refNum as fullPath 974 975 976 Open refNum as newName 913 977 wfprintf refnum, "%s",tw3 914 978 Close refnum 915 916 //killwaves/Z tw1,tw2,tw3 917 979 918 980 return(0) 919 end981 End 920 982 921 983 //returns count time and start/stop angles as written in header
Note: See TracChangeset
for help on using the changeset viewer.