Changeset 303


Ignore:
Timestamp:
Mar 28, 2008 4:03:47 PM (15 years ago)
Author:
srkline
Message:

WIN OS-level default of .txt extension for saved files has been removed. Requested file name is now properly used.

NSORT: incorrect scaling when a single file was used has been fixed (was only a problem if preview was used)
NSORT: files written now have the file labels from the input files (1, 2, or 3)

Location:
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.10
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.10/MaskUtils.ipf

    r260 r303  
    491491        Variable refnum,ii=0,jj=0,dummy,num=pixelsX 
    492492        String fullpath="" 
    493         Open/D refnum as fullpath               //won't actually open the file 
    494         If(cmpstr(S_filename,"")==0) 
     493         
     494        PathInfo/S catPathName 
     495        fullPath = DoSaveFileDialog("Save data as")             //won't actually open the file 
     496        If(cmpstr(fullPath,"")==0) 
    495497                //user cancel, don't write out a file 
    496498                Close/A 
    497499                Abort "no data file was written" 
    498500        Endif 
    499         fullpath = S_filename 
    500501         
    501502        Make /B/O/N=(pixelsX) byteWave 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.10/NSORT.ipf

    r260 r303  
    235235        Variable dialog = 1 
    236236        if(dialog) 
    237                 Open/D refnum as fullpath               //won't actually open the file 
    238                 If(cmpstr(S_filename,"")==0) 
     237                PathInfo/S catPathName 
     238                fullPath = DoSaveFileDialog("Save data as")             //won't actually open the file 
     239                If(cmpstr(fullPath,"")==0) 
    239240                        //user cancel, don't write out a file 
    240241                        Close/A 
    241242                        Abort "no data file was written" 
    242243                Endif 
    243                 fullpath = S_filename 
    244244                //Print "dialog fullpath = ",fullpath 
    245245        Endif 
     246         
     247        // read in the header information from each of the combined files and put this information in the file header 
     248        String dum,hdr1="none\r\n",hdr2="none\r\n",hdr3="none\r\n" 
     249        PathInfo catPathName 
     250         
     251        // the first file exists, check anyways 
     252        if(cmpstr(firstFileName,"none") !=0) 
     253                Open/R refNum as S_Path+firstFileName 
     254                FReadLine refNum, dum 
     255                FReadLine refNum, hdr1                  //just grab the second line 
     256                Close refNum 
     257        endif 
     258        //second file 
     259        if(cmpstr(secondFileName,"none") !=0) 
     260                Open/R refNum as S_Path+secondFileName 
     261                FReadLine refNum, dum 
     262                FReadLine refNum, hdr2                  //just grab the second line 
     263                Close refNum 
     264        endif 
     265        // third file 
     266        if(cmpstr(thirdFileName,"none") !=0) 
     267                Open/R refNum as S_Path+thirdFileName 
     268                FReadLine refNum, dum 
     269                FReadLine refNum, hdr3                  //just grab the second line 
     270                Close refNum 
     271        endif 
    246272         
    247273        String formatStr = "%15.4g %15.4g %15.4g\r\n" 
     
    249275        Open refNum as fullpath 
    250276         
    251         fprintf refnum,"FILE CREATED: %s \r\n",date() 
     277        fprintf refnum, "COMBINED FILE CREATED: %s \r\n",date() 
     278         
     279        fprintf refnum, "FIRST File %s",hdr1            //new, Mar 2008 
     280        fprintf refnum, "SECOND File %s",hdr2           //new, Mar 2008 
     281        fprintf refnum, "THIRD File %s",hdr3            //new, Mar 2008 
     282         
    252283        fprintf refNum, "NSORT-ed   %s \t  +  %s\t  + %s\r\n",firstFileName, secondFileName,thirdFileName 
    253284        fprintf refNum, "normalized to   %s\r\n",normTo 
    254285        fprintf refNum, "multiplicative factor 1-2 = %12.8g\t multiplicative factor 2-3 = %12.8g\r\n",norm12,norm23 
    255         fprintf refnum,"The 3 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm) |\r\n" 
     286        fprintf refnum, "The 3 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm) |\r\n" 
    256287        wfprintf refnum, formatStr, q3,i3,sig3 
    257288         
     
    319350         
    320351        if(dialog) 
    321                 Open/D refnum as fullpath               //won't actually open the file 
    322                 If(cmpstr(S_filename,"")==0) 
     352                PathInfo/S catPathName 
     353                fullPath = DoSaveFileDialog("Save data as")             //won't actually open the file 
     354                If(cmpstr(fullPath,"")==0) 
    323355                        //user cancel, don't write out a file 
    324356                        Close/A 
    325357                        Abort "no data file was written" 
    326358                Endif 
    327                 fullpath = S_filename 
    328359                //Print "dialog fullpath = ",fullpath 
    329360        Endif 
     361         
     362        // read in the header information from each of the combined files and put this information in the file header 
     363        String dum,hdr1="none\r\n",hdr2="none\r\n",hdr3="none\r\n" 
     364        PathInfo catPathName 
     365         
     366        // the first file exists, check anyways 
     367        if(cmpstr(firstFileName,"none") !=0) 
     368                Open/R refNum as S_Path+firstFileName 
     369                FReadLine refNum, dum 
     370                FReadLine refNum, hdr1                  //just grab the second line 
     371                Close refNum 
     372        endif 
     373        //second file 
     374        if(cmpstr(secondFileName,"none") !=0) 
     375                Open/R refNum as S_Path+secondFileName 
     376                FReadLine refNum, dum 
     377                FReadLine refNum, hdr2                  //just grab the second line 
     378                Close refNum 
     379        endif 
     380        // third file 
     381        if(cmpstr(thirdFileName,"none") !=0) 
     382                Open/R refNum as S_Path+thirdFileName 
     383                FReadLine refNum, dum 
     384                FReadLine refNum, hdr3                  //just grab the second line 
     385                Close refNum 
     386        endif 
     387         
    330388         
    331389        String formatStr = "%15.4g %15.4g %15.4g %15.4g %15.4g %15.4g\r\n" 
     
    333391        Open refNum as fullpath 
    334392         
    335         fprintf refnum,"FILE CREATED: %s \r\n",date() 
     393        fprintf refnum, "COMBINED FILE CREATED: %s \r\n",date() 
     394         
     395        fprintf refnum, "FIRST File %s",hdr1            //new, Mar 2008 
     396        fprintf refnum, "SECOND File %s",hdr2           //new, Mar 2008 
     397        fprintf refnum, "THIRD File %s",hdr3            //new, Mar 2008 
     398         
    336399        fprintf refNum, "NSORT-ed   %s \t  +  %s\t  + %s\r\n",firstFileName, secondFileName,thirdFileName 
    337400        fprintf refNum, "normalized to   %s\r\n",normTo 
    338401        fprintf refNum, "multiplicative factor 1-2 = %12.8g\t multiplicative factor 2-3 = %12.8g\r\n",norm12,norm23 
    339         fprintf refnum,"The 6 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm) | sigmaQ | meanQ | ShadowFactor|\r\n" 
     402        fprintf refnum, "The 6 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm) | sigmaQ | meanQ | ShadowFactor|\r\n" 
    340403        wfprintf refnum, formatStr, q3,i3,sig3,sq3,qb3,fs3 
    341404         
     
    628691        // Put here the dialog that says if ANY of the datasets had 3-column data, the results will all have only three columns 
    629692        // Set the number of output columns 
    630         Variable isAThree = 0, isASix = 0 
    631         String fileStr="" 
     693        Variable isAThree = 0, isASix = 0,err 
     694        String fileStr="",tempName 
    632695 
    633696        NVAR Columns1 = root:myGlobals:NSORT:gColumns1 
     
    645708         
    646709        //is there just one data set? if so, then dispatch to a simpler routine, since no normalization is needed 
    647         ControlInfo popup_2             //if MedQSet is "none", then so is HighQSet 
     710        ControlInfo/W=NSORT_Panel popup_2               //if MedQSet is "none", then so is HighQSet 
    648711        fileStr = S_Value 
    649712        if(cmpstr(fileStr,"none") == 0) 
     713                // just like in the rescaling routines, always RELOAD the data  !!! 
     714                //load file1 
     715                ControlInfo/W=NSORT_Panel popup_1 
     716                fileStr = S_Value 
     717                //get a valid file based on this partialName and catPathName 
     718                tempName = FindValidFilename(fileStr) 
     719                 
     720                //prepend path to tempName for read routine  
     721                PathInfo catPathName 
     722                tempName = S_path + tempName 
     723                err = LoadDataForNSORT(tempName,1) 
     724                //////end load file1 
     725         
    650726                //send just the trimmed (LowQ) set to be written out 
    651727                WAVE lowq = $"TrimLowQSet_q" 
    652728                WAVE lowi = $"TrimLowQSet_i" 
    653729                WAVE lows = $"TrimLowQSet_s" 
    654                 WAVE/Z lowsq = $"TrimLowQSet_sq" 
     730                WAVE/Z lowsq = $"TrimLowQSet_sq"                //these may not exist 
    655731                WAVE/Z lowqb = $"TrimLowQSet_qb" 
    656732                WAVE/Z lowfs = $"TrimLowQSet_fs" 
    657733                NVAR scaleFactor= root:myGlobals:NSORT:gScale1_2 
     734                 
    658735                // 
    659736                lowi *= scaleFactor 
    660737                lows *= scaleFactor 
    661738                 
    662                 ControlInfo popup_1 
     739                ControlInfo/W=NSORT_Panel PreviewCheck 
     740                if( V_Value==1 )                //if ==1, just preview and exit 
     741                        return(0) 
     742                endif 
     743                         
     744                ControlInfo/W=NSORT_Panel popup_1 
    663745                if(isAThree) 
    664746                        Write3ColNSORTedFile(lowq,lowi,lows,S_Value,"none","none",S_Value,scaleFactor,1) 
     
    681763         
    682764        //do the normalization and update the global scale factors displayed in the Panel 
    683         Variable err = DoAutoScaleFromPanel(checked)                    // DoAutoScaleFromPanel writes out the datafile 
     765        err = DoAutoScaleFromPanel(checked)                     // DoAutoScaleFromPanel writes out the datafile 
    684766 
    685767        //  just get the new list - don't actually "pop" the menu, or the selected item will change 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.10/ProDiv.ipf

    r260 r303  
    4545        tempData *= 4 
    4646         
    47         Open/D refnum as fullpath         //won't actually open the file 
    48         If(cmpstr(S_filename,"")==0) 
     47        PathInfo/S catPathName 
     48        fullPath = DoSaveFileDialog("Save data as")       //won't actually open the file 
     49        If(cmpstr(fullPath,"")==0) 
    4950                //user cancel, don't write out a file 
    5051          Close/A 
    5152          Abort "no data file was written" 
    5253        Endif 
    53         fullpath = S_filename 
    5454         
    5555        Make/B/O/N=(hdrBytes) hdrWave 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.10/ProtocolAsPanel.ipf

    r260 r303  
    18631863                Wave/T textPath = $textStr 
    18641864                If(WaveExists(textPath) == 1) 
    1865                         newFileName = GetNameFromHeader(textPath[0]) 
     1865                        newFileName = UpperStr(GetNameFromHeader(textPath[0])) 
    18661866                else 
    18671867                        newFileName = ""                        //if the header is missing? 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.10/WriteQIS.ipf

    r300 r303  
    271271        if(dialog) 
    272272                PathInfo/S catPathName 
    273                 Open/D refnum as fullpath               //won't actually open the file 
    274                 If(cmpstr(S_filename,"")==0) 
     273                fullPath = DoSaveFileDialog("Save data as")             //won't actually open the file 
     274                If(cmpstr(fullPath,"")==0) 
    275275                        //user cancel, don't write out a file 
    276276                        Close/A 
    277277                        Abort "no data file was written" 
    278278                Endif 
    279                 fullpath = S_filename 
    280279                //Print "dialog fullpath = ",fullpath 
    281280        Endif 
     
    818817        String outputPath 
    819818         
    820         Open/D/M=msg refNum 
     819        Open/D/M=msg/T="????" refNum 
    821820        outputPath = S_fileName 
    822821         
Note: See TracChangeset for help on using the changeset viewer.