Changeset 881


Ignore:
Timestamp:
Dec 4, 2009 5:13:39 PM (11 years ago)
Author:
toby
Message:

# on 2006/04/30 23:13:59, toby did:
remove last of background function #3
compute Q in same manner as in calcbak (results still differ)

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  
    13821382    set good 1
    13831383
    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
    14021386    set termlist {}
    14031387    for {set j 0} {$j < $o} {incr j} {
     
    14851469
    14861470# convert x values to Q
    1487 proc toQ {xlist hst} {
     1471proc bkgtoQ {xlist hst} {
    14881472    global expmap
    14891473    if {[string range $expmap(htype_$hst) 2 2] == "T"} {
    1490         return [toftoQ $xlist $hst]
     1474        return [bkgtof2Q $xlist $hst]
    14911475    } elseif {[string range $expmap(htype_$hst) 2 2] == "C"} {
    14921476        return [tttoQ $xlist $hst]
     
    14971481    }
    14981482}
    1499 # convert tof to Q
    1500 proc toftoQ {toflist hst} {
     1483# convert tof to Q (as done in BKG routines -- no zero or difa)
     1484proc bkgtof2Q {toflist hst} {
    15011485    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.}]
    15051486    set 2pi [expr {4.*acos(0.)}]
    15061487    set ans {}
     
    15111492            lappend ans 0.
    15121493        } 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}]
    15161495        }
    15171496    }
     
    15841563        }
    15851564        return $blist
    1586     } elseif {$num == 3} {
    1587         set Qlist [toQ $tlist $hst]
    1588         foreach Q $Qlist tofm $tlist {
    1589             set i 0
    1590             set j -1
    1591             foreach t $terms {
    1592                 incr i
    1593                 if {$i == 1} {
    1594                     set bkg $t
    1595                 } elseif {$i == 2} {
    1596                     set bkg [expr {$bkg + $tofm * $t}]
    1597                 } else {
    1598                     incr j
    1599                     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 $bkg
    1605         }
    1606         return $blist
    16071565    } elseif {$num == 4} {
    1608         set Qlist [toQ $tlist $hst]
     1566        set Qlist [bkgtoQ $tlist $hst]
    16091567        foreach Q $Qlist {
    16101568            set i -1
     
    16231581        return $blist
    16241582    } elseif {$num == 5} {
    1625         set Qlist [toQ $tlist $hst]
     1583        set Qlist [bkgtoQ $tlist $hst]
    16261584        foreach Q $Qlist {
    16271585            set i -1
     
    16401598        return $blist
    16411599    } elseif {$num == 6} {
    1642         set Qlist [toQ $tlist $hst]
     1600        set Qlist [bkgtoQ $tlist $hst]
    16431601        foreach Q $Qlist {
    16441602            set i 0
     
    17051663        return $deriv
    17061664    } elseif {$num == 3} {
    1707         set Q [toQ $tof $hst]
     1665        set Q [bkgtoQ $tof $hst]
    17081666        set j -1
    17091667        #set n [expr {2 + ($nterms - 2)/2}]
     
    17221680        return $deriv
    17231681    } elseif {$num == 4} {
    1724         set Q [toQ $tof $hst]
     1682        set Q [bkgtoQ $tof $hst]
    17251683        set QT 1
    17261684        for {set i 0} {$i < $nterms} {incr i} {
     
    17331691        return $deriv
    17341692    } elseif {$num == 5} {
    1735         set Q [toQ $tof $hst]
     1693        set Q [bkgtoQ $tof $hst]
    17361694        set QT 1
    17371695        for {set i 0} {$i < $nterms} {incr i} {
     
    17441702        return $deriv
    17451703    } elseif {$num == 6} {
    1746         set Q [toQ $tof $hst]
     1704        set Q [bkgtoQ $tof $hst]
    17471705        set QT 1
    17481706        for {set i 1} {$i <= $nterms} {incr i} {
Note: See TracChangeset for help on using the changeset viewer.