Changeset 224
- Timestamp:
- Dec 5, 2007 4:42:16 PM (15 years ago)
- Location:
- sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/Includes_v500.ipf
r143 r224 65 65 Menu "SANSBeta" 66 66 "FillEMPUsingSelection" 67 "GuessEveryTransFile s"67 "GuessEveryTransFile" 68 68 "GuessSelectedTransFiles" 69 69 "ClearSelectedTransAssignments" -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/MainPanel.ipf
r143 r224 237 237 Button MainButtonC,pos={250,8},size={50,20},proc=HelpMainButtonProc,title="Help" 238 238 Button MainButtonC,help={"Display the help file"} 239 Button MainButtonD,pos={320,8},size={80,20},proc=SR_OpenTracTicketPage,title="Feedback" 240 Button MainButtonD,help={"Submit bug reports or feature requests"} 239 241 240 242 TabControl MainTab,pos={7,49},size={410,202},tabLabel(0)="Raw Data",proc=MainTabProc … … 360 362 End 361 363 364 // 365 Function SR_OpenTracTicketPage(ctrlName) 366 String ctrlName 367 DoAlert 1,"Your web broser will open to a page where you can submit your bug report or feature request. OK?" 368 if(V_flag==1) 369 BrowseURL "http://danse.chem.utk.edu/trac/newticket" 370 endif 371 End 362 372 363 373 //******************************** -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/NSORT.ipf
r213 r224 1719 1719 //Print "combine the files" 1720 1720 SendSelectionToTable() 1721 break ;1721 break 1722 1722 // case "no": 1723 // break ;1723 // break 1724 1724 // case "maybe": 1725 1725 // // do something because "maybe" was chosen 1726 // break ;1726 // break 1727 1727 endswitch //on selection 1728 1728 endif -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/SANS_Utilities.ipf
r116 r224 235 235 End 236 236 237 Proc GuessEveryTransFile s(num)237 Proc GuessEveryTransFile(num) 238 238 Variable num=6 239 239 GuessAllTransFiles(num) -
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/Transmission.ipf
r116 r224 158 158 159 159 Edit/K=1/W=(30,30,500,250) T_EMP_Filenames, T_Filenames, T_Labels, T_SDD, T_Lambda, T_Transmission, T_Whole as "TransmissionFiles" 160 161 SetWindow kwTopWin hook=GuessFromTableHook, hookevents=1 // mouse down events 162 160 163 String name="TransFileTable" 161 164 DoWindow/C $name … … 1554 1557 End 1555 1558 1556 //given a selection of the samplefiles, try to find the corresponding transmission file1559 //given a selection of the SAMPLE files, try to find the corresponding transmission file 1557 1560 // 1558 1561 Function GuessTransFile(charsToUse,row) … … 1605 1608 End 1606 1609 1610 //given a single transmission file, try to find the corresponding scattering file(s) 1611 // 1612 // apply TWO criteria 1613 // (1) the label must match "well enough" 1614 // (2) the wavelength must be the same 1615 // 1616 // passes the matching rows in the sample table back 1617 // 1618 Function GuessTransToScattFiles(charsToUse,row,matchRows) 1619 Variable charsToUse,row //number of characers to use from the beginning of the label, and the row of the transmission file 1620 Wave matchRows //rows where (potential) matches found. initially zero points 1621 1622 Wave/T sw = root:myGlobals:TransHeaderInfo:S_Labels //Sample file labels 1623 Wave/T tw = root:myGlobals:TransHeaderInfo:T_Labels //trans file labels 1624 Wave/T tnam = root:myGlobals:TransHeaderInfo:T_FileNames //trans file names 1625 Wave/T snam = root:myGlobals:TransHeaderInfo:S_TRANS_FileNames //Scattering - trans correspondence 1626 Wave sLam = root:myGlobals:TransHeaderInfo:S_Lambda //Scattering file wavelength 1627 Wave tLam = root:myGlobals:TransHeaderInfo:T_Lambda //Transmission file wavelength 1628 1629 Variable num,ii,found 1630 String transStr = "",testStr="" 1631 1632 transStr = (tw[row])[0,charsToUse-1] //string to try and match 1633 transStr += "*" 1634 1635 //loop over ALL sample files 1636 num=numpnts(sw) 1637 ii=0 1638 do 1639 testStr=sw[ii] 1640 found = stringmatch(testStr, transStr ) 1641 if( (found == 1) && (sLam[ii] == tLam[row]) ) // both must match 1642 Print "Match Found at: ",transStr,snam[ii],sw[ii] 1643 InsertPoints numpnts(matchRows), 1, matchRows 1644 matchRows[numpnts(matchRows)-1] = ii 1645 endif 1646 ii+=1 1647 while(ii<num) 1648 1649 //method 2 *UNTESTED* 1650 // transStr = (tw[row])[0,charsToUse-1] //string to try and match 1651 // num=numpnts(sw) 1652 // ii=0 1653 // do 1654 // testStr=sw[ii] 1655 // found = strsearch(testStr,transStr,0,2) //start from zero, ignore case 1656 // if(found != -1) 1657 // Print "Match Found at: ",transStr,snam[ii],sw[ii] 1658 // InsertPoints numpnts(matchRows), 1, matchRows 1659 // matchRows[numpnts(matchRows)-1] = ii 1660 //// snam[ii] = tnam[row] //write the file name into the table 1661 // endif 1662 // ii+=1 1663 // while(ii<num) 1664 1665 // Print "No Match found" 1666 return(0) 1667 End 1668 1669 //get a single selection from the Trans table 1670 // find all of the matching scattering files (rows) 1671 // ask the user if the selections are OK 1672 // if NOT OK, do nothing 1673 // if OK: make the assignments, and immediately calculate the transmission 1674 // 1675 Function fGuessTransToScattFiles(numChars) 1676 Variable numChars 1677 1678 Variable ii,row 1679 Variable transTableExists 1680 Make/O/D/N=0 root:myGlobals:TransHeaderInfo:matchRows 1681 Wave matchRows=root:myGlobals:TransHeaderInfo:matchRows 1682 1683 transTableExists = WinType("TransFileTable") 1684 if (transTableExists != 0) 1685 GetSelection table,transFileTable,1 1686 row = V_startRow 1687 GuessTransToScattFiles(numChars,row,matchRows) 1688 else 1689 Print "Transmission->Scattering File table is not open" 1690 return (1) 1691 endif 1692 1693 Wave/T sw = root:myGlobals:TransHeaderInfo:S_Labels //Sample file labels 1694 Wave/T tw = root:myGlobals:TransHeaderInfo:T_Labels //trans file labels 1695 Wave/T tnam = root:myGlobals:TransHeaderInfo:T_FileNames //trans file names 1696 Wave/T snam = root:myGlobals:TransHeaderInfo:S_TRANS_FileNames //Scattering - trans correspondence 1697 1698 Variable num=numpnts(matchRows) 1699 String result="",tmpStr 1700 for(ii=0;ii<num;ii+=1) 1701 sprintf tmpStr,"%s* Matches file: %s %s\r",(tw[row])[0,numChars-1],snam[matchRows[ii]],sw[matchRows[ii]] 1702 result += tmpStr 1703 endfor 1704 1705 if(cmpstr(result,"")==0) 1706 result = "No match found for "+ (tw[row])[0,numChars-1] 1707 endif 1708 1709 Print result 1710 Print "*******" 1711 1712 String/G root:myGlobals:TransHeaderInfo:gResultStr = result 1713 DoWindow/F ConfirmGuess //it really shouldn't exist... 1714 if(V_flag==1) 1715 TitleBox title0,pos={9,5},variable=root:myGlobals:TransHeaderInfo:gResultStr 1716 else 1717 NewPanel /W=(763,44,1284,181) as "Confirm Guess" 1718 DoWindow/C ConfirmGuess 1719 TitleBox title0,pos={9,5},size={501,32} 1720 TitleBox title0,variable= root:myGlobals:TransHeaderInfo:gResultStr 1721 Button button0,pos={9,107},size={190,20},proc=DoAssignTransButtonProc,title="Assign Transmission Files" 1722 Button button2,pos={341,108},size={90,20},proc=DoTryAgainButtonProc,title="Try Again" 1723 ToolsGrid snap=1,visible=1 1724 endif 1725 1726 PauseForUser ConfirmGuess 1727 // figure out from the return code what the user did... 1728 // 1 = OK, accept guess (assign, and calculate immediately) 1729 // 2 = try again 1730 // 0 = cancel, don't do anything (not used, simply try again) 1731 NVAR guessOK = root:myGlobals:TransHeaderInfo:GuessOK 1732 1733 // switch here... 1734 switch(guessOK) // numeric switch 1735 case 1: 1736 // accept guess (assign, and calculate immediately) 1737 for(ii=0;ii<num;ii+=1) 1738 snam[matchRows[ii]] = tnam[row] 1739 AssignSelTransFilesToData(matchRows[ii],matchRows[ii]) 1740 CalcSelTransFromHeader(matchRows[ii],matchRows[ii]) //does only that sample file 1741 endfor 1742 break 1743 case 2: //try again (with more / fewer characters?) 1744 // does nothing right now 1745 break 1746 case 0: 1747 // do nothing 1748 break 1749 default: 1750 // do nothing 1751 endswitch 1752 1753 return(0) 1754 End 1755 1756 // a hook attached to the Transmission Files Table 1757 // given a single selected Trans File, popup gives choices 1758 // to guess using "n" characters, then dispatch accordingly 1759 Function GuessFromTableHook(infoStr) 1760 String infoStr 1761 String event= StringByKey("EVENT",infoStr) 1762 // Print "EVENT= ",event 1763 1764 String menuStr="" 1765 menuStr += "Guess using 3 characters;" 1766 menuStr += "Guess using 6 characters;" 1767 menuStr += "Guess using 9 characters;" 1768 menuStr += "Guess using 12 characters;" 1769 menuStr += "Guess using 15 characters;" 1770 menuStr += "Guess using 18 characters;" 1771 1772 strswitch(event) 1773 case "mousedown": 1774 Variable xpix= NumberByKey("MOUSEX",infoStr) 1775 Variable ypix= NumberByKey("MOUSEY",infoStr) 1776 Variable modif= NumberByKey("MODIFIERS",infoStr) 1777 //print modif 1778 if(modif & 2^1) //bit 1 set, shift key is down 1779 PopupContextualMenu/C=(xpix, ypix) menuStr 1780 strswitch(S_selection) 1781 case "Guess using 3 characters": 1782 fGuessTransToScattFiles(3) 1783 break 1784 case "Guess using 6 characters": 1785 fGuessTransToScattFiles(6) 1786 break 1787 case "Guess using 9 characters": 1788 fGuessTransToScattFiles(9) 1789 break 1790 case "Guess using 12 characters": 1791 fGuessTransToScattFiles(12) 1792 break 1793 case "Guess using 15 characters": 1794 fGuessTransToScattFiles(15) 1795 break 1796 case "Guess using 18 characters": 1797 fGuessTransToScattFiles(18) 1798 break 1799 endswitch //on selection 1800 endif 1801 endswitch // on event 1802 1803 return 0 1804 End 1805 1806 // sets a flag if the user thinks that the guess was correct, and wants to use the 1807 // identified files for the transmission 1808 Function DoAssignTransButtonProc(ba) : ButtonControl 1809 STRUCT WMButtonAction &ba 1810 1811 switch( ba.eventCode ) 1812 case 2: // mouse up 1813 // click code here 1814 //Print "Assigned stuff, and left." 1815 Variable/G root:myGlobals:TransHeaderInfo:GuessOK= 1 1816 DoWindow/K ConfirmGuess 1817 break 1818 endswitch 1819 1820 1821 return 0 1822 End 1823 1824 // files are wrong, let the user try it again 1825 // sets a flag, nothing else 1826 Function DoTryAgainButtonProc(ba) : ButtonControl 1827 STRUCT WMButtonAction &ba 1828 1829 switch( ba.eventCode ) 1830 case 2: // mouse up 1831 // click code here 1832 Variable/G root:myGlobals:TransHeaderInfo:GuessOK= 2 1833 DoWindow/K ConfirmGuess 1834 //Print "Try Again" 1835 break 1836 endswitch 1837 1838 return 0 1839 End 1840 1841 // not used 1842 Function DoCancelGuessButtonProc(ba) : ButtonControl 1843 STRUCT WMButtonAction &ba 1844 1845 switch( ba.eventCode ) 1846 case 2: // mouse up 1847 // click code here 1848 //just kill the panel, don't do anything 1849 Variable/G root:myGlobals:TransHeaderInfo:GuessOK= 0 1850 DoWindow/K ConfirmGuess 1851 break 1852 endswitch 1853 1854 return 0 1855 End 1856 1607 1857 Function GuessAllTransFiles(numChars) 1608 1858 Variable numChars
Note: See TracChangeset
for help on using the changeset viewer.