Changeset 881
- Timestamp:
- Dec 4, 2009 5:13:39 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/liveplot
- Property rcs:date changed from 2006/02/22 00:31:31 to 2006/04/30 23:13:59
- Property rcs:lines changed from +5 -3 to +16 -58
- Property rcs:rev changed from 1.43 to 1.44
r869 r881 1382 1382 set good 1 1383 1383 1384 # if {$expgui(FitFunction) == 3} { 1385 # set expgui(RadiiList) {} 1386 # for {set j 0} {$j < ($expgui(FitOrder) - 2)/2} {incr j} { 1387 # lappend expgui(RadiiList) $bkgeditbox(r$j) 1388 # if {[catch {expr $bkgeditbox(r$j)}]} { 1389 # $top.r$j.e config -fg red 1390 # set good 0 1391 # } elseif {$bkgeditbox(r$j) == 0} { 1392 # $top.r$j.e config -fg red 1393 # set good 0 1394 # } else { 1395 # $top.r$j.e config -fg black 1396 # } 1397 # } 1398 # set o [expr {2 + ($expgui(FitOrder) - 2)/2}] 1399 # } else { 1400 set o $expgui(FitOrder) 1401 # } 1384 set o $expgui(FitOrder) 1385 1402 1386 set termlist {} 1403 1387 for {set j 0} {$j < $o} {incr j} { … … 1485 1469 1486 1470 # convert x values to Q 1487 proc toQ {xlist hst} {1471 proc bkgtoQ {xlist hst} { 1488 1472 global expmap 1489 1473 if {[string range $expmap(htype_$hst) 2 2] == "T"} { 1490 return [ toftoQ $xlist $hst]1474 return [bkgtof2Q $xlist $hst] 1491 1475 } elseif {[string range $expmap(htype_$hst) 2 2] == "C"} { 1492 1476 return [tttoQ $xlist $hst] … … 1497 1481 } 1498 1482 } 1499 # convert tof to Q 1500 proc toftoQ {toflist hst} {1483 # convert tof to Q (as done in BKG routines -- no zero or difa) 1484 proc bkgtof2Q {toflist hst} { 1501 1485 set difc [expr {[histinfo $hst difc]/1000.}] 1502 set difc2 [expr {$difc*$difc}]1503 set difa [expr {[histinfo $hst difa]/1000.}]1504 set zero [expr {[histinfo $hst zero]/1000.}]1505 1486 set 2pi [expr {4.*acos(0.)}] 1506 1487 set ans {} … … 1511 1492 lappend ans 0. 1512 1493 } else { 1513 set td [expr {$tof-$zero}] 1514 lappend ans [expr {$2pi * \ 1515 ($difc2*$difc+2.0*$difa*$td)/($td*($difc2+$difa*$td))}] 1494 lappend ans [expr {$2pi * $difc / $tof}] 1516 1495 } 1517 1496 } … … 1584 1563 } 1585 1564 return $blist 1586 } elseif {$num == 3} {1587 set Qlist [toQ $tlist $hst]1588 foreach Q $Qlist tofm $tlist {1589 set i 01590 set j -11591 foreach t $terms {1592 incr i1593 if {$i == 1} {1594 set bkg $t1595 } elseif {$i == 2} {1596 set bkg [expr {$bkg + $tofm * $t}]1597 } else {1598 incr j1599 set r [lindex $rlist $j]1600 set QR [expr {$Q * $r}]1601 set bkg [expr {$bkg + $t * sin($QR)/$QR}]1602 }1603 }1604 lappend blist $bkg1605 }1606 return $blist1607 1565 } elseif {$num == 4} { 1608 set Qlist [ toQ $tlist $hst]1566 set Qlist [bkgtoQ $tlist $hst] 1609 1567 foreach Q $Qlist { 1610 1568 set i -1 … … 1623 1581 return $blist 1624 1582 } elseif {$num == 5} { 1625 set Qlist [ toQ $tlist $hst]1583 set Qlist [bkgtoQ $tlist $hst] 1626 1584 foreach Q $Qlist { 1627 1585 set i -1 … … 1640 1598 return $blist 1641 1599 } elseif {$num == 6} { 1642 set Qlist [ toQ $tlist $hst]1600 set Qlist [bkgtoQ $tlist $hst] 1643 1601 foreach Q $Qlist { 1644 1602 set i 0 … … 1705 1663 return $deriv 1706 1664 } elseif {$num == 3} { 1707 set Q [ toQ $tof $hst]1665 set Q [bkgtoQ $tof $hst] 1708 1666 set j -1 1709 1667 #set n [expr {2 + ($nterms - 2)/2}] … … 1722 1680 return $deriv 1723 1681 } elseif {$num == 4} { 1724 set Q [ toQ $tof $hst]1682 set Q [bkgtoQ $tof $hst] 1725 1683 set QT 1 1726 1684 for {set i 0} {$i < $nterms} {incr i} { … … 1733 1691 return $deriv 1734 1692 } elseif {$num == 5} { 1735 set Q [ toQ $tof $hst]1693 set Q [bkgtoQ $tof $hst] 1736 1694 set QT 1 1737 1695 for {set i 0} {$i < $nterms} {incr i} { … … 1744 1702 return $deriv 1745 1703 } elseif {$num == 6} { 1746 set Q [ toQ $tof $hst]1704 set Q [bkgtoQ $tof $hst] 1747 1705 set QT 1 1748 1706 for {set i 1} {$i <= $nterms} {incr i} {
Note: See TracChangeset
for help on using the changeset viewer.