Пример #1
0
    def __init__(self, data):
        self.X = data.T[0]
        self.Y = data.T[1]

        pframe = wxmplot.PlotFrame()
        pframe.plot(self.X,
                    self.Y,
                    title="Counts per voltage",
                    xlabel="Voltage (V)",
                    ylabel="Counts",
                    marker='+',
                    size=5,
                    color='Black')
        pframe.Show()
Пример #2
0
    def plot_wxmplot(self, arg=None):
        frame = wxmplot.PlotFrame()
        filename = os.path.join(self.result_dir, self.result_name,
                                self.result.filename)
        f = open(filename, 'r')
        names = f.readline().split(',')
        columns = len(names)
        value_arrays = []
        for i in range(columns):
            value_arrays.append([])

        base_time = None
        for line in f:
            values = line.split(',')
            if base_time is None:
                base_time = float(values[0])
            t = round(float(values[0]) - base_time, 2)
            value_arrays[0].append(t)
            for i in range(1, columns):
                try:
                    v = float(values[i])
                    value_arrays[i].append(v)
                except Exception as e:
                    value_arrays[i].append(0)
                    pass

        time_array = numpy.array(value_arrays[0])
        for i in range(1, columns):
            value_array = numpy.array(value_arrays[i])
            frame.oplot(time_array, value_array, label=names[i])
        '''
        r = numpy.recfromcsv(filename, case_sensitive=True)
        print(repr(r))
        print r.dtype
        names = r.dtype.names
        x = names[0]
        print r[x]
        for name in names[1:]:
            # print name, r[x], r[name]
            frame.oplot(r[x], r[name])
        '''
        # pframe.plot(x, y1, title='Test 2 Axes with different y scales',
        #            xlabel='x (mm)', ylabel='y1', ymin=-0.75, ymax=0.75)
        # pframe.oplot(x, y2, y2label='y2', side='right', ymin=0)

        frame.SetTitle(self.result.name)
        frame.Show()
Пример #3
0
def demo_simplest():
    noise = np.random.normal
    n = 201
    x = np.linspace(0, 100, n)
    y1 = np.sin(x / 3.4) / (0.2 * x + 2) + noise(size=n, scale=0.1)
    y2 = 92 + 65 * np.cos(x / 16.) * np.exp(-x * x / 7e3) + noise(size=n,
                                                                  scale=0.3)

    app = wx.App()
    pframe = wxmplot.PlotFrame()

    pframe.plot(x,
                y1,
                title='Test 2 Axes with different y scales',
                xlabel='x (mm)',
                ylabel='y1',
                ymin=-0.75,
                ymax=0.75)
    pframe.oplot(x, y2, y2label='y2', side='right', ymin=0)
    pframe.Show()
    app.MainLoop()
Пример #4
0
    def plot_wxmplot(self, arg=None):
        frame = wxmplot.PlotFrame()
        filename = os.path.join(self.result_dir, self.result_name, self.result.filename)
        f = open(filename, 'r')
        names = f.readline().split(',')
        columns = len(names)
        value_arrays = []
        for i in range(columns):
            value_arrays.append([])

        base_time = None
        for line in f:
            values = line.split(',')
            if base_time is None:
                base_time = float(values[0])
            t = round(float(values[0]) - base_time, 2)
            value_arrays[0].append(t)
            for i in range(1, columns):
                try:
                    v = float(values[i])
                    value_arrays[i].append(v)
                except Exception, e:
                    value_arrays[i].append('nan')
                    pass
Пример #5
0
    def SetupPlot(self):
        '''
        this sets up the plots
        using the xmplot described on
        https://newville.github.io/wxmplot/plotpanel.html
        '''
        self.PL_FRAME = PL.PlotFrame(parent=None)
        self.PL_FRAME.set_title('tank level ')

        # here I play with a datetime array which will be the x
        start = dt.datetime(2000, 1, 1)
        starty = 10.
        startx = 2.

        #dt_array = np.array([start + dt.timedelta(hours=i) for i in range(24)])
        #Create emtpy numpy arrays
        x_array = np.array([])
        y_array = np.array([])
        dt_array = np.array([])
        # now append elements
        for k in range(10000):

            x_array = np.append(x_array, startx + k)
            dt_array = np.append(dt_array, start + dt.timedelta(hours=k))
            #y_array = np.append(y_array,starty+k)
            y = np.random.random()
            y_array = np.append(y_array, np.sin(k) * y)
        print

        self.PL_FRAME.plot(x_array,
                           y_array,
                           marker='*',
                           markersize=4,
                           drawstyles='steps-mid')

        self.PL_FRAME.Show()
Пример #6
0
#!/usr/bin/python
#
# simple example of wxMPlot
import sys
import wx
import numpy
import wxmplot

x = numpy.arange(0.0, 10.0, 0.1)
y = numpy.sin(2 * x) / (x + 2)
app = wx.App()

pframe = wxmplot.PlotFrame(output_title='simple')
pframe.plot(x, y, title='Test Plot', xlabel=r'  ${ R \mathrm{(\AA)}}$  ')

pframe.write_message('WXMPlot PlotFrame example: Try Help->Quick Reference')
pframe.Show()
#
app.MainLoop()
Пример #7
0
inputs = kl.Input((INPUT_DIM, 1))
prev = TemporalConvNet([160], 8, 0.1)(inputs, training=True)
prev = kl.Dense(1, activation='softmax')(prev)
model = tf.keras.Model(inputs, prev)
model.summary()
model.compile(optimizer=optimizer, loss='mse')

tlosses = list(np.linspace(0, 0, 1000))
vlosses = list(np.linspace(0, 0, 1000))

ilosses = np.linspace(0, 1000, 1000)
i = 0

app = wx.App()
frame = wxmplot.PlotFrame()

frame.plot(ilosses, tlosses, color='red')
frame.oplot(ilosses, vlosses, color='darkgreen')
frame.Show()
threading.Thread(target=app.MainLoop).start()

epoch_range = trange(100)
for e in epoch_range:
    batch_range = trange(100)
    train_gen = None
    valid_gen = None

    for b in batch_range:
        train_block = next_block(train_files, train_gen, INPUT_DIM)
        valid_block = next_block(valid_files, valid_gen, INPUT_DIM)
Пример #8
0
#!/usr/bin/python
#

import wx
import numpy as np
import wxmplot

x = np.linspace(0, 5, 201)

traces = []

for i in range(20):
    traces.append(
        (x, np.sqrt(x) * np.sin(0.25 * (i + 1) * x) * np.exp(-x / 2)))

app = wx.App()

pframe = wxmplot.PlotFrame(output_title='Plot Multiple')
pframe.plot_many(traces,
                 title='Test Plotting 20 traces with plot_many()',
                 xlabel=r'x (mm)')

pframe.write_message('WXMPlot PlotFrame example: Try Help->Quick Reference')
pframe.Show()
#
app.MainLoop()