Exemplo n.º 1
0
        if self._line == 'left':
            self.A1 = deriv[arg]
            self.B1 = yval-self.A1*xval
            liney = self.A1*linex + self.B1

            self.plot.setCurveData(self.foo, linex, liney)
        elif self._line == 'right':
            self.A3 = deriv[arg]
            self.B3 = yval-self.A3*xval
            liney = self.A3*linex + self.B3
            self.plot.setCurveData(self.foo2, linex, liney)

        self.A2 = deriv[inflarg]
        self.B2 = infly-self.A2*inflx

        liney = self.A2*linex + self.B2

        #liney = infly + deriv[inflarg]*(linex-inflx)
        self.plot.setCurveData(self.foom, linex, liney)
        if hasattr(self, 'A3') and hasattr(self, 'A1'):
            Ton = -(self.B2-self.B1)/(self.A2-self.A1)
            Tend = -(self.B3-self.B2)/(self.A3-self.A2)
            st = "T<sub>f</sub>=%f<br>T<sub>on</sub>=%f, T<sub>end</sub>=%f<br>"%(inflx,Ton,Tend)
            self.plot.setMarkerLabel(self.texte, st)
#            print >>sys.stderr, st


        self.view.redraw()

extension('graph-mode', AnalyzeGlassTransition)
Exemplo n.º 2
0
def integrate(x, y):
    dx = x[1:]-x[:-1]
    dy = y[1:]-y[:-1]

    r = y[1:] * dx
    t = dy * dx

    return concatenate([[0], add.accumulate(r+t)])

class Eraser(GraphTool):
    def __init__(self, graph, view, plot):
        self.graph, self.view, self.plot = graph, view, plot
    name = "Erase data points"
    image = 'eraser'
extension('graph-mode', Eraser)

@extension('dataset-tool')
@options(name='Hide')
def hide(graph, view):
    for d in view.datasets:
        d.range = (0, -1)

@extension('dataset-tool')
@options(name='Full Range')
def full(graph, view):
    range_l = min(d.minx for d in view.datasets)
    range_r = max(d.maxx for d in view.datasets)
    for d in view.datasets:
        d.range = (range_l, range_r)