Changeset 857
- Timestamp:
- Jul 6, 2012 5:29:38 PM (10 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Common/Packages/PlotManager/PlotUtils2D_v40.ipf
r838 r857 98 98 99 99 endif //8-columns 100 100 101 102 // the very bad case where users don't supply the error data... 101 103 if(numCols == 3) 102 104 // put the names of the 3 loaded waves into local names … … 158 160 159 161 endif //3-columns 162 163 // with 4-columns, assume that they are qx,qy,I, err 164 if(numCols == 4) 165 // put the names of the 3 loaded waves into local names 166 n0 = StringFromList(0, S_waveNames ,";" ) 167 n1 = StringFromList(1, S_waveNames ,";" ) 168 n2 = StringFromList(2, S_waveNames ,";" ) 169 n3 = StringFromList(3, S_waveNames ,";" ) 170 171 //remove the semicolon AND period from file names 172 w0 = CleanupName((S_fileName + "_qx"),0) 173 w1 = CleanupName((S_fileName + "_qy"),0) 174 w2 = CleanupName((S_fileName + "_i"),0) 175 w3 = CleanupName((S_fileName + "_iErr"),0) //make a name for the error wave, to be generated here 176 177 String baseStr=w1[0,strlen(w1)-4] 178 if(DataFolderExists("root:"+baseStr)) 179 DoAlert 1,"The file "+S_filename+" has already been loaded. Do you want to load the new data file, overwriting the data in memory?" 180 if(V_flag==2) //user selected No, don't load the data 181 SetDataFolder root: 182 KillWaves/Z $n0,$n1,$n2,$n3 // kill the default waveX that were loaded 183 return //quits the macro 184 endif 185 SetDataFolder $("root:"+baseStr) 186 else 187 NewDataFolder/S $("root:"+baseStr) 188 endif 189 190 //read in the 18 lines of header (18th line starts w/ ASCII... 19th line is blank) 191 Make/O/T/N=18 header 192 Variable refnum,ii 193 string tmpStr="" 194 Open/R refNum as (path+filename) 195 ii=0 196 do 197 tmpStr = "" 198 FReadLine refNum, tmpStr 199 header[ii] = tmpStr 200 ii+=1 201 while(ii < 18) 202 Close refnum 203 204 ////overwrite the existing data, if it exists 205 Duplicate/O $("root:"+n0), $w0 206 Duplicate/O $("root:"+n1), $w1 207 Duplicate/O $("root:"+n2), $w2 208 Duplicate/O $("root:"+n3), $w3 209 210 endif //4-columns 160 211 161 212 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ANSTO_Utils.ipf
r795 r857 396 396 End 397 397 398 399 //function to test a file to see if it is a DIV file 400 // 401 // returns truth 0/1 402 // 403 // called by many procedures (both external and local) 404 // 405 Function CheckIfDIVData(fname) 406 String fname 407 408 409 // if(your test here) 410 // //true, is DIV data file 411 Return(1) 412 // else 413 // //some other file 414 // Return(0) 415 // Endif 416 417 End 418 398 419 Function isScatFile(fname) 399 420 String fname -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/FACILITY_Utils.ipf
r795 r857 259 259 // if(your test here) 260 260 // //true, is raw data file 261 // Return(1) 262 // else 263 // //some other file 264 // Return(0) 265 // Endif 266 267 End 268 269 //function to test a file to see if it is a DIV file 270 // 271 // returns truth 0/1 272 // 273 // called by many procedures (both external and local) 274 // 275 Function CheckIfDIVData(fname) 276 String fname 277 278 279 // if(your test here) 280 // //true, is DIV data file 261 281 // Return(1) 262 282 // else -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_Utils.ipf
r795 r857 450 450 End 451 451 452 //function to test a file to see if it is a DIV file 453 // 454 // returns truth 0/1 455 // 456 // called by many procedures (both external and local) 457 // 458 Function CheckIfDIVData(fname) 459 String fname 460 461 462 // if(your test here) 463 // //true, is DIV file data file 464 Return(1) 465 // else 466 // //some other file 467 // Return(0) 468 // Endif 469 470 End 452 471 453 472 // function returns 1 if file is a transmission file, 0 if not -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/KIST_Utils.ipf
r807 r857 267 267 End 268 268 269 //function to test a file to see if it is a DIV file 270 // 271 // returns truth 0/1 272 // 273 // called by many procedures (both external and local) 274 // 275 Function CheckIfDIVData(fname) 276 String fname 277 278 279 // if(your test here) 280 // //true, is DIV data file 281 // Return(1) 282 // else 283 // //some other file 284 // Return(0) 285 // Endif 286 287 End 269 288 270 289 // function returns 1 if file is a transmission file, 0 if not -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf
r838 r857 831 831 Return(0) 832 832 Endif 833 End 834 835 //function to test a file to see if it is a DIV file 836 // 837 // returns truth 0/1 838 // 839 // called by many procedures (both external and local) 840 // 841 Function CheckIfDIVData(fname) 842 String fname 843 844 845 Variable refnum,totalBytes 846 // String testStr="" 847 848 Open/R/T="????TEXT" refNum as fname 849 if(strlen(s_filename) == 0) //user cancel (/Z not used, so V_flag not set) 850 return(0) 851 endif 852 853 //get the total number of bytes in the file 854 FStatus refNum 855 totalBytes = V_logEOF 856 //Print totalBytes 857 if(totalBytes < 100) 858 Close refNum 859 return(0) //not a raw file 860 endif 861 // FSetPos refNum,75 862 // FReadLine/N=3 refNum,testStr 863 Close refNum 864 865 if(totalBytes == 66116) // && ( cmpstr(testStr,"RAW")==0 || cmpstr(testStr,"SIM")==0)) 866 //true, is raw data file 867 Return(1) 868 else 869 //some other file 870 Return(0) 871 Endif 872 833 873 End 834 874 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ProtocolAsPanel.ipf
r853 r857 2109 2109 endif 2110 2110 #else 2111 if(strlen(junkStr)==0 || CheckIfRawData(junkStr)) //for NCNR, not raw is sufficient, but better in the future toconfirm it is DIV if either is false, exit2111 if(strlen(junkStr)==0 || !CheckIfDIVData(junkStr)) //for NCNR, and other data confirm it is DIV if either is false, exit 2112 2112 SetDataFolder root: 2113 2113 Abort "No DIV (PLEX) file selected. Please use setABSParams again, selecting the empty beam file and then the detector sensitivity (Plex_) file" -
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.