Changeset 631


Ignore:
Timestamp:
Feb 19, 2010 10:18:56 AM (13 years ago)
Author:
srkline
Message:

Some changes to the installer files to look in new paths, not complete yet at all.

Added proper error handling for all 4 cases in the new 1D Arithmetic panel. Also fixed a typo that was always removing set 2 from the display when the result was calculated.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Common/DataSetHandling.ipf

    r612 r631  
    605605                        // state of the checkbox 
    606606                        ControlInfo/W=$(win) DANoDS2_cb 
    607                         if(V_flag) 
     607                        if(V_Value) 
    608608                                DS2 = "NullSolvent" 
    609609                        endif 
     
    976976         
    977977        result_i = set1_i - (set2Scale*interp(set1_q[p],set2_q,set2_i)) 
    978         result_s = sqrt(set1_s^2 + set2Scale^2*interp(set1_q[p],set2_q,set2_s)) 
     978        result_s = sqrt(set1_s^2 + (set2Scale*interp(set1_q[p],set2_q,set2_s))^2 ) 
    979979        //Calculate result error wave - can we produce corrected Q error?  
    980980         
     
    10041004        //Do addition of I waves - including interpolation if necessary.  
    10051005        Wave result_i = $(resultPath+resultName+"_i") 
     1006        Wave result_s = $(resultPath+resultName+"_s") 
    10061007        Wave set1_i = $(set1Path+set1Name+"_i") 
    10071008        Wave set1_q = $(set1Path+set1Name+"_q") 
     1009        Wave set1_s = $(set1Path+set1Name+"_s") 
    10081010        Wave set2_i = $(set2Path+set2Name+"_i") 
    10091011        Wave set2_q = $(set2Path+set2Name+"_q") 
     1012        Wave set2_s = $(set2Path+set2Name+"_s") 
     1013         
    10101014        result_i =  set1_i + set2Scale*interp(set1_q[p],set2_q,set2_i)   
    1011          
    1012         //Calculate result error wave - can we produce corrected Q error?  
    1013  
     1015        //Calculate result error wave (note that this is identical to subtraction) 
     1016        result_s = sqrt(set1_s^2 + (set2Scale*interp(set1_q[p],set2_q,set2_s))^2 ) 
     1017 
     1018        //  - can we produce corrected Q error?  
    10141019        //Generate history string to record what was done? 
    10151020        return 0 
     
    10381043        //Do multiplcation of I waves - including interpolation if necessary.  
    10391044        Wave result_i = $(resultPath+resultName+"_i") 
     1045        Wave result_s = $(resultPath+resultName+"_s") 
    10401046        Wave set1_i = $(set1Path+set1Name+"_i") 
    10411047        Wave set1_q = $(set1Path+set1Name+"_q") 
     1048        Wave set1_s = $(set1Path+set1Name+"_s") 
    10421049        Wave set2_i = $(set2Path+set2Name+"_i") 
    10431050        Wave set2_q = $(set2Path+set2Name+"_q") 
     1051        Wave set2_s = $(set2Path+set2Name+"_s") 
     1052         
    10441053        result_i =  set1_i*set2Scale*interp(set1_q[p],set2_q,set2_i) 
    1045                  
    1046          
    1047         //Calculate result error wave - can we produce corrected Q error?  
     1054        //Calculate result error wave 
     1055        // sum each of the relative errors, interpolating set 2 intensity and error as needed 
     1056        // then sqrt 
     1057        result_s = (set2Scale*interp(set1_q[p],set2_q,set2_i)*set1_s)^2 
     1058        result_s += (set2Scale*set1_i*interp(set1_q[p],set2_q,set2_s))^2 
     1059        result_s = sqrt(result_s) 
     1060 
     1061        // - can we produce corrected Q error?  
    10481062 
    10491063        //Generate history string to record what was done? 
     
    10731087        //Do division of I waves - including interpolation if necessary.  
    10741088        Wave result_i = $(resultPath+resultName+"_i") 
     1089        Wave result_s = $(resultPath+resultName+"_s") 
    10751090        Wave set1_i = $(set1Path+set1Name+"_i") 
    10761091        Wave set1_q = $(set1Path+set1Name+"_q") 
     1092        Wave set1_s = $(set1Path+set1Name+"_s") 
    10771093        Wave set2_i = $(set2Path+set2Name+"_i") 
    10781094        Wave set2_q = $(set2Path+set2Name+"_q") 
     1095        Wave set2_s = $(set2Path+set2Name+"_s") 
     1096         
    10791097        result_i =  set1_i/(set2Scale*interp(set1_q[p],set2_q,set2_i)   ) 
    1080          
    1081         //Calculate result error wave - can we produce corrected Q error?  
     1098        //Calculate result error wave 
     1099        // sum each of the relative errors, interpolating set 2 intensity and error as needed 
     1100        // then sqrt 
     1101        result_s = (set1_s/set2Scale/interp(set1_q[p],set2_q,set2_i))^2 
     1102        result_s += (interp(set1_q[p],set2_q,set2_s)*set1_i/set2Scale/interp(set1_q[p],set2_q,set2_i)^2)^2 
     1103        result_s = sqrt(result_s) 
     1104 
     1105        // - can we produce corrected Q error?  
    10821106         
    10831107        //Generate history string to record what was done? 
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Installer/FilesToRemove++.itx

    r413 r631  
    99X SetScale/P x 0,1,"", IExtFolders; SetScale y 0,0,"", IExtFolders 
    1010 
    11 WAVES/T IExtFiles       IHFolders 
     11WAVES/T IExtFiles 
    1212BEGIN 
    13         "SANS_Analysis.xop"     "Put in Igor Help Files" 
    14         "NCNR_Extensions"       "NCNR_Help_Files" 
     13        "SANS_Analysis.xop" 
     14        "NCNR_Extensions" 
     15        "XMLutils.xop" 
     16        "MonteCarlo.xop" 
    1517END 
    1618X SetScale/P x 0,1,"", IExtFiles; SetScale y 0,0,"", IExtFiles 
     19 
     20WAVES/T IHFolders 
     21BEGIN 
     22        "Put in Igor Help Files" 
     23        "NCNR_Help_Files" 
     24END 
    1725X SetScale/P x 0,1,"", IHFolders; SetScale y 0,0,"", IHFolders 
    1826 
     
    3038        "SANS_Analysis_Docs_09JUN06.ihf" 
    3139        "SANS_Model_Docs_09JUN06.ihf" 
     40        "BetaSANSRednTools_APR08.ihf" 
     41        "SANS_Analysis_Docs_v4.00.ihf" 
     42        "SANS_Model_Docs_v4.00.ihf" 
     43        "SANS_Reduction_Help_v5.10.ihf" 
     44        "USANSReductionHelp_v2.21.ihf" 
    3245        "Put in Igor Help Files" 
    3346        "NCNR_Help_Files" 
  • sans/Dev/trunk/NCNR_User_Procedures/Common/Installer/NCNR_Install.ipf

    r570 r631  
    2222// package-6.001 
    2323// - lots more diagnostics added 
     24 
     25// FEB 2010 - now make use of the user-specific procedure path. It's always writeable, and not in the application folder 
     26// -- now I need to search both locations to move old stuff out 
     27// -- then install clean into the new user path (userPathStr) 
     28// 
    2429 
    2530Function InstallNCNRMacros(forceInstall) 
     
    7479         
    7580 
    76         String igorPathStr,homePathStr 
     81        String igorPathStr,homePathStr,userPathStr 
    7782        PathInfo Igor 
    7883        igorPathStr = S_Path            //these have trailing colons 
    7984        PathInfo home                                   //the location where this was run from... 
    8085        homePathStr = S_Path 
     86        // the Igor 6.1 User Procedure Path, same sub-folders as in Igor App Folder 
     87        userPathStr=RemoveEnding(SpecialDirPath("Igor Pro User Files",0,0,0),":")+":" 
    8188         
    8289        // clean up old stuff, moving to home:old_moved_files 
     
    8693        variable i=0, AliasSet=0, isThere = 0 
    8794        String tmpStr 
    88          
    89 // clean up the Igor Extensions 
     95 
     96 
     97////////////////////////////////////////////////////////////////////// 
     98         
     99////// clean up the Igor Extensions (first the old path -- in the App folder) 
    90100        NewPath /Q/O ExPath, igorPathStr+"Igor Extensions:" 
    91101        PathInfo ExPath 
     
    93103        string strFileList = IndexedFile(ExPath, -1, "????" ) 
    94104         
     105        //files first 
    95106        Wave/T extFiles=root:IExtFiles 
    96          
    97107        for (i=0; i<itemsInList(strFileList); i+=1) 
    98108                tmpStr = StringFromList(i,strFileList) 
     
    107117        Wave/T extFolders=root:IExtFolders 
    108118        strFileList = IndexedDir(ExPath, -1, 0 ) 
     119         
    109120        for (i=0; i<itemsInList(strFileList); i+=1) 
    110121                tmpStr = StringFromList(i,strFileList) 
     
    115126                endif 
    116127        endfor 
    117          
    118 // clean up the user procedures (files first) 
     128 
     129////// then clean up the Igor Extensions (now look in the User Path, by changing the definition of ExPath) 
     130        NewPath /Q/O ExPath, userPathStr+"Igor Extensions:" 
     131        PathInfo ExPath 
     132        extPathStr = S_Path  
     133        strFileList = IndexedFile(ExPath, -1, "????" ) 
     134                 
     135        for (i=0; i<itemsInList(strFileList); i+=1) 
     136                tmpStr = StringFromList(i,strFileList) 
     137                isThere = CheckForMatch(tmpStr,extFiles) 
     138                if(isThere) 
     139                        MoveFile/O/P=ExPath tmpStr as homePathStr+"NCNR_Moved_Files:"+tmpStr 
     140                        Print "Move file "+ tmpStr + " from Igor Extensions: "+num2str(V_flag) 
     141                endif 
     142        endfor 
     143         
     144        //then anything that shows up as a folder 
     145        strFileList = IndexedDir(ExPath, -1, 0 ) 
     146        for (i=0; i<itemsInList(strFileList); i+=1) 
     147                tmpStr = StringFromList(i,strFileList) 
     148                isThere = CheckForMatch(tmpStr,extFolders) 
     149                if(isThere) 
     150                        MoveFolder extPathStr+tmpStr as homePathStr+"NCNR_Moved_Files:NCNR_Moved_Folders:"+tmpStr 
     151                        Print "Move folder "+ tmpStr + " from Igor Extensions: "+num2str(V_flag) 
     152                endif 
     153        endfor 
     154 
     155////////////////////////////////////////////////////////////////////// 
     156         
     157/////// clean up the User Procedures -- in the APP folder 
    119158        NewPath /Q/O UPPath, igorPathStr+"User Procedures:" 
    120159        PathInfo UPPath 
     
    122161        strFileList = IndexedFile(UPPath, -1, "????" )                  //for files 
    123162         
     163        // (files first) 
    124164        Wave/T UPFilesWave=root:UPFiles 
    125          
    126165        for (i=0; i<itemsInList(strFileList); i+=1) 
    127166                tmpStr = StringFromList(i,strFileList) 
     
    133172        endfor 
    134173         
    135 // clean up the user procedures (folders second) 
     174        //(folders second) 
    136175        strFileList = IndexedDir(UPPath, -1, 0)                 //for folders, just the names, not full paths 
    137          
    138176        Wave/T UPFoldersWave=root:UPFolders 
    139177         
     
    148186        endfor 
    149187 
    150 // now try to move the  Igor Help files out 
     188/////// now clean up the User Procedures -- in the User Folder 
     189        NewPath /Q/O UPPath, userPathStr+"User Procedures:" 
     190        PathInfo UPPath 
     191        UPPathStr = S_Path 
     192        strFileList = IndexedFile(UPPath, -1, "????" )                  //for files 
     193         
     194        // (files first) 
     195        for (i=0; i<itemsInList(strFileList); i+=1) 
     196                tmpStr = StringFromList(i,strFileList) 
     197                isThere = CheckForMatch(tmpStr,UPFilesWave) 
     198                if(isThere) 
     199                        MoveFile/O/P=UPPath tmpStr as homePathStr+"NCNR_Moved_Files:"+tmpStr 
     200                        Print "Move file "+ tmpStr + " from User Procedures: "+num2str(V_flag) 
     201                endif 
     202        endfor 
     203         
     204        //(folders second) 
     205        strFileList = IndexedDir(UPPath, -1, 0)                 //for folders, just the names, not full paths 
     206                 
     207        for (i=0; i<itemsInList(strFileList); i+=1) 
     208                tmpStr = StringFromList(i,strFileList) 
     209                isThere = CheckForMatch(tmpStr,UPFoldersWave) 
     210                if(isThere) 
     211                // THIS is the problem, when NCNR_Help_Files is moved - it is in use 
     212                        MoveFolder/Z UPPathStr + tmpStr as homePathStr+"NCNR_Moved_Files:NCNR_Moved_Folders:"+tmpStr 
     213                        Print "Move folder "+ tmpStr + " from User Procedures: "+num2str(V_flag) 
     214                endif 
     215        endfor 
     216 
     217 
     218////////////////////////////////////////////////////////////////////// 
     219 
     220 
     221 
     222/////// now try to clean up the Igor Help Files (in the APP folder) 
    151223        NewPath /Q/O IHPath, igorPathStr+"Igor Help Files:" 
    152224        PathInfo IHPath 
     
    154226        strFileList = IndexedFile(IHPath, -1, "????" )                  //for files 
    155227         
     228        // files first 
    156229        Wave/T IHFilesWave=root:IHFiles 
    157230         
     
    168241        Wave/T IHFilesWave=root:IHFolders 
    169242        strFileList = IndexedDir(IHPath, -1, 0)  
     243         
    170244        for (i=0; i<itemsInList(strFileList); i+=1) 
    171245                tmpStr = StringFromList(i,strFileList) 
     
    177251        endfor 
    178252         
    179 // INSTALL the new stuff 
    180 //(1) copy the items to install to the User Procedures folder 
    181 //(2) set up the aliases from there 
     253        /////// now try the Igor Help Files (in the USER folder) 
     254        NewPath /Q/O IHPath, userPathStr+"Igor Help Files:" 
     255        PathInfo IHPath 
     256        IHPathStr = S_Path 
     257        strFileList = IndexedFile(IHPath, -1, "????" )                  //for files 
     258         
     259        // files first   
     260        for (i=0; i<itemsInList(strFileList); i+=1) 
     261                tmpStr = StringFromList(i,strFileList) 
     262                isThere = CheckForMatch(tmpStr,IHFilesWave) 
     263                if(isThere) 
     264                        MoveFile/O/P=IHPath tmpStr as homePathStr+"NCNR_Moved_Files:"+tmpStr 
     265                        Print "Move file "+ tmpStr + " from Igor Help Files: "+num2str(V_flag) 
     266                endif 
     267        endfor   
     268         
     269        // then anything that shows up as a folder 
     270        strFileList = IndexedDir(IHPath, -1, 0)  
     271         
     272        for (i=0; i<itemsInList(strFileList); i+=1) 
     273                tmpStr = StringFromList(i,strFileList) 
     274                isThere = CheckForMatch(tmpStr,IHFolders) 
     275                if(isThere) 
     276                        MoveFolder IHPathStr + tmpStr as homePathStr+"NCNR_Moved_Files:NCNR_Moved_Folders:"+tmpStr 
     277                        Print "Move folder "+ tmpStr + " from Igor Help Files: "+num2str(V_flag) 
     278                endif 
     279        endfor 
     280 
     281 
     282 
     283// at this point all of the old stuff is cleaned up as best as I can 
     284// 
     285// at this point the paths point to the User Folder, not in the App folder       
     286         
     287         
     288         
     289         
     290//////////// INSTALL the new stuff 
     291// 
     292//(1) copy the items to install to the User Special Folder 
     293//(2) --- now I don't need to set up aliases! they are just there 
    182294// 
    183295// the old ones should be gone already, so just put in the new ones 
     
    185297// they may not be possible to remove, so try to overwrite... 
    186298 
    187 //  and then create shortcuts for XOP and help files 
    188 //      MoveFolder/Z=1/O homePathStr+"NCNR_Help_Files" as UPPathStr+"NCNR_Help_Files" 
    189 //      Print "Move folder NCNR_Help_Files into User Procedures, overwrite if needed: "+num2str(V_flag) 
    190 //      if(V_Flag != 0) 
    191                 MoveFolder/Z=1 homePathStr+"NCNR_Help_Files" as UPPathStr+"NCNR_Help_Files" 
    192                 Print "******Move folder NCNR_Help_Files into User Procedures, NO overwite: "+num2str(V_flag) 
     299        NewPath /Q/O SpecialPath, userPathStr 
     300 
     301// the help files 
     302        MoveFolder/Z=1 homePathStr+"NCNR_Help_Files" as IHPathStr+"NCNR_Help_Files" 
     303        Print "******Move folder NCNR_Help_Files into User Special Folder, NO overwite: "+num2str(V_flag) 
     304 
     305// not needed now 
     306//      CreateAliasShortcut/O/P=SpecialPath "NCNR_Help_Files" as igorPathStr+"Igor Help Files:NCNR_Help_Files" 
     307//      Print "Creating shortcut from NCNR_Help_Files into Igor Help Files: "+num2str(V_flag) 
     308         
     309 
     310// the User Procedures   
     311        MoveFolder/Z=1 homePathStr+"NCNR_User_Procedures" as UPPathStr+"NCNR_User_Procedures" 
     312        Print "*******Move folder NCNR_User_Procedures into User Procedures, NO overwrite: "+num2str(V_flag) 
     313         
     314// don't need an alias for the UserProcedures - they're already here.... 
     315 
     316 
     317// Igor Extensions 
     318        MoveFolder/Z=1 homePathStr+"NCNR_Extensions" as UPPathStr+"NCNR_Extensions" 
     319        Print "*******Move folder NCNR_Extensions into User Procedures, NO overwrite: "+num2str(V_flag) 
     320//       
     321// not needed now 
     322//      if(isMac) 
     323//              CreateAliasShortcut/O/P=UPPath "NCNR_Extensions:Mac_XOP" as igorPathStr+"Igor Extensions:NCNR_Extensions" 
     324//      else 
     325//              CreateAliasShortcut/O/P=UPPath "NCNR_Extensions:Win_XOP" as igorPathStr+"Igor Extensions:NCNR_Extensions" 
    193326//      endif 
    194         CreateAliasShortcut/O/P=UPPath "NCNR_Help_Files" as igorPathStr+"Igor Help Files:NCNR_Help_Files" 
    195         Print "Creating shortcut from NCNR_Help_Files into Igor Help Files: "+num2str(V_flag) 
    196          
    197          
    198 //      MoveFolder/Z=1/O homePathStr+"NCNR_User_Procedures" as UPPathStr+"NCNR_User_Procedures" 
    199 //      Print "Move folder NCNR_User_Procedures into User Procedures, overwrite if needed: "+num2str(V_flag) 
    200 //      if(V_flag !=0) 
    201                 MoveFolder/Z=1 homePathStr+"NCNR_User_Procedures" as UPPathStr+"NCNR_User_Procedures" 
    202                 Print "*******Move folder NCNR_User_Procedures into User Procedures, NO overwrite: "+num2str(V_flag) 
    203 //      endif    
    204         // don't need an alias for the UserProcedures - they're already here.... 
    205  
    206  
    207 //      MoveFolder/Z=1/O homePathStr+"NCNR_Extensions" as UPPathStr+"NCNR_Extensions" 
    208 //      Print "Move folder NCNR_Extensions into User Procedures, overwrite if needed: "+num2str(V_flag) 
    209 //      if(V_flag !=0) 
    210                 MoveFolder/Z=1 homePathStr+"NCNR_Extensions" as UPPathStr+"NCNR_Extensions" 
    211                 Print "*******Move folder NCNR_Extensions into User Procedures, NO overwrite: "+num2str(V_flag) 
    212 //      endif 
    213         if(isMac) 
    214                 CreateAliasShortcut/O/P=UPPath "NCNR_Extensions:Mac_XOP" as igorPathStr+"Igor Extensions:NCNR_Extensions" 
    215         else 
    216                 CreateAliasShortcut/O/P=UPPath "NCNR_Extensions:Win_XOP" as igorPathStr+"Igor Extensions:NCNR_Extensions" 
    217         endif 
    218         Print "Creating shortcut for XOP into Igor Extensions: "+num2str(V_flag) 
     327//      Print "Creating shortcut for XOP into Igor Extensions: "+num2str(V_flag) 
    219328         
    220329 
    221330// put shortcuts to the template in the "top" folder 
    222 //?? 
     331// 
    223332        NewPath/O/Q UtilPath, homePathStr+"NCNR_SANS_Utilities:" 
    224333        strFileList = IndexedFile(UtilPath,-1,".pxt")    
     
    233342//              endif 
    234343        endfor 
    235          
    236 // old method, used shortcuts from main package (risky if user deletes them) 
    237 //      CreateAliasShortcut/O/P=home "NCNR_Help_Files" as igorPathStr+"Igor Help Files:NCNR_Help_Files" 
    238 //      CreateAliasShortcut/O/P=home "NCNR_User_Procedures" as igorPathStr+"User Procedures:NCNR_User_Procedures" 
    239 //      if(isMac) 
    240 //              CreateAliasShortcut/O/P=home "NCNR_Extensions:Mac XOP" as igorPathStr+"Igor Extensions:NCNR_Extensions" 
    241 //      else 
    242 //              CreateAliasShortcut/O/P=home "NCNR_Extensions:Win XOP" as igorPathStr+"Igor Extensions:NCNR_Extensions" 
    243 //      endif 
    244          
     344 
    245345 
    246346// installation is done, quit to start fresh 
Note: See TracChangeset for help on using the changeset viewer.