예제 #1
0
def update_output(_, value):
    global tab
    time = np.linspace(-0.000045, 0.000045, 1e3)
    zero = dict(
        data=[dict(x=time, y=[0] * len(time), marker={'color': '#2a3f5f'})],
        layout=go.Layout(
            xaxis={
                'title': 's',
                'color': '#506784',
                'titlefont': dict(
                    family='Dosis',
                    size=15,
                )
            },
            yaxis={
                'title': 'Voltage (mV)',
                'color': '#506784',
                'titlefont': dict(
                    family='Dosis',
                    size=15,
                )
            },
            margin={
                'l': 40,
                'b': 40,
                't': 0,
                'r': 50
            },
            plot_bgcolor='#F3F6FA',
        ))

    if tab is not value:
        if '' + str(value) in runs:
            tab = value
            return runs['' + str(value)][0]
        tab = value
        return zero

    else:
        figure = {
            'data':
            osc.get_data(),
            'layout':
            go.Layout(
                xaxis={
                    'title': 's',
                    'color': '#506784',
                    'titlefont': dict(
                        family='Dosis',
                        size=15,
                    )
                },
                yaxis={
                    'title': 'Voltage (mV)',
                    'color': '#506784',
                    'titlefont': dict(
                        family='Dosis',
                        size=15,
                    ),
                    'autorange': False,
                    'range': [-10, 10]
                },
                margin={
                    'l': 40,
                    'b': 40,
                    't': 0,
                    'r': 50
                },
                plot_bgcolor='#F3F6FA',
            )
        }

        runs['' + str(value)] = figure, str(fgen.get_wave()) + " | " + \
            str(fgen.get_frequency()) + "Hz" + " | " + \
            str(fgen.get_amplitude()) + "mV" + " | " +  \
            str(fgen.get_offset()) + "mV"

        # wait to update the runs variable
        sleep(0.10)

        return figure
예제 #2
0
def update_output(_, value):
    global tab
    time = np.linspace(-0.000045, 0.000045, 1e3)
    zero = dict(
        data=[dict(x=time, y=[0] * len(time), marker={"color": "#2a3f5f"})],
        layout=go.Layout(
            xaxis={
                "title": "s",
                "color": "#506784",
                "titlefont": dict(family="Dosis", size=15),
            },
            yaxis={
                "title": "Voltage (mV)",
                "color": "#506784",
                "titlefont": dict(family="Dosis", size=15),
            },
            margin={
                "l": 40,
                "b": 40,
                "t": 0,
                "r": 50
            },
            plot_bgcolor="#F3F6FA",
        ),
    )

    if tab is not value:
        if "" + str(value) in runs:
            tab = value
            return runs["" + str(value)][0]
        tab = value
        return zero

    else:
        figure = {
            "data":
            osc.get_data(),
            "layout":
            go.Layout(
                xaxis={
                    "title": "s",
                    "color": "#506784",
                    "titlefont": dict(family="Dosis", size=15),
                },
                yaxis={
                    "title": "Voltage (mV)",
                    "color": "#506784",
                    "titlefont": dict(family="Dosis", size=15),
                    "autorange": False,
                    "range": [-10, 10],
                },
                margin={
                    "l": 40,
                    "b": 40,
                    "t": 0,
                    "r": 50
                },
                plot_bgcolor="#F3F6FA",
            ),
        }

        runs["" + str(value)] = (
            figure,
            str(fgen.get_wave()) + " | " + str(fgen.get_frequency()) + "Hz" +
            " | " + str(fgen.get_amplitude()) + "mV" + " | " +
            str(fgen.get_offset()) + "mV",
        )

        # wait to update the runs variable
        sleep(0.10)

        return figure
예제 #3
0
                             on='true',
                             label="Oscilloscope",
                             labelPosition='bottom',
                             color="#447EFF")
         ],
                  className='six columns',
                  style={'margin-bottom': '15px'}),
     ],
              style={'margin': '15px 0'})
 ],
          className='row power-settings-tab'),
 html.Div([
     html.Div([html.H3("FUNCTION", id="function-title")],
              className='Title'),
     html.Div([
         daq.Knob(value=fgen.get_frequency(),
                  id="frequency-input",
                  label="Frequency (Hz)",
                  labelPosition="bottom",
                  size=75,
                  color="#447EFF",
                  scale={'interval': 1E5},
                  max=2.5E6,
                  min=1E5,
                  className='four columns'),
         daq.Knob(value=fgen.get_amplitude(),
                  id="amplitude-input",
                  label="Amplitude (mV)",
                  labelPosition="bottom",
                  size=75,
                  scale={'labelInterval': 10},