Skip to content

Commit 957ef54

Browse files
author
Dilmi Wickramanayake
committed
fixed mypy & lint errors
1 parent 0f7ddc1 commit 957ef54

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

examples/nidaqmx_analog_input_filtering/nidaqmx_analog_input_filtering.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
from pathlib import Path
44

55
import nidaqmx
6-
import numpy as numpy
76
from nidaqmx.constants import (
87
AcquisitionType,
98
CurrentShuntResistorLocation,
@@ -16,7 +15,6 @@
1615
Slope,
1716
StrainGageBridgeType,
1817
TerminalConfiguration,
19-
Timescale,
2018
)
2119
from settings_enum import AnalogPause, PauseWhen
2220

@@ -35,6 +33,7 @@
3533
panel.set_value("is_running", True)
3634
panel.set_value("stop_button", False)
3735

36+
# How to use nidaqmx: https://nidaqmx-python.readthedocs.io/en/stable/
3837
with nidaqmx.Task() as task:
3938
chan_type = panel.get_value("chan_type", "1")
4039
if chan_type == "1":

examples/nidaqmx_analog_input_filtering/nidaqmx_analog_input_filtering_panel.py

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
1-
"""Streamlit visualization script to display data acquired by nidaqmx_continuous_analog_input.py."""
1+
"""Streamlit visualization script to display data acquired by nidaqmx_analog_input_filtering.py."""
22

3+
import extra_streamlit_components as stx # type: ignore[import-untyped]
34
import streamlit as st
4-
from streamlit_echarts import st_echarts
5-
import extra_streamlit_components as stx
6-
from settings_enum import PauseWhen, AnalogPause
75
from nidaqmx.constants import (
8-
TerminalConfiguration,
9-
SampleTimingType,
10-
FilterResponse,
116
CurrentShuntResistorLocation,
7+
CurrentUnits,
128
Edge,
13-
Slope,
9+
FilterResponse,
1410
LoggingMode,
15-
CurrentUnits,
11+
Slope,
1612
StrainGageBridgeType,
13+
TerminalConfiguration,
1714
)
18-
import time
15+
from settings_enum import AnalogPause, PauseWhen
16+
from streamlit_echarts import st_echarts
17+
1918
import nipanel
2019
from nipanel.controls import enum_selectbox
2120

@@ -47,9 +46,9 @@
4746
with left_col:
4847
st.write(panel.get_value("is_running", False))
4948
if is_running:
50-
st.button(r"⏹️ Stop", key="stop_button")
49+
st.button("Stop", key="stop_button")
5150
else:
52-
st.button(r"▶️ Run", key="run_button")
51+
st.button("Run", key="run_button")
5352

5453

5554
st.markdown(
@@ -229,7 +228,7 @@
229228
format_func=lambda x: x[0],
230229
index=0,
231230
)
232-
pause_when = PauseWhen[pause_when[0]]
231+
pause_when = PauseWhen[pause_when[0]] # type: ignore
233232
panel.set_value("pause_when", pause_when)
234233
with tab4:
235234
st.write(
@@ -260,7 +259,7 @@
260259
format_func=lambda x: x[0],
261260
index=0,
262261
)
263-
analog_pause = AnalogPause[analog_pause[0]]
262+
analog_pause = AnalogPause[analog_pause[0]] # type: ignore
264263
panel.set_value("analog_pause", analog_pause)
265264

266265
with tab7:
@@ -318,7 +317,7 @@
318317
key="max_value_current",
319318
disabled=panel.get_value("is_running", False),
320319
)
321-
current = panel.set_value("max_value_current", max_value_current)
320+
current = panel.set_value("max_value_current", max_value_current) # type:ignore
322321
shunt_resistor_value = st.number_input(
323322
"Shunt Resistor Value",
324323
value=249.0,

examples/nidaqmx_analog_input_filtering/settings_enum.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44

55

66
class PauseWhen(enum.StrEnum):
7+
"""Pause When Trigger Setting."""
8+
79
HIGH = "High"
810
LOW = "Low"
911

1012

1113
class AnalogPause(enum.StrEnum):
14+
"""Analog Pause Trigger."""
15+
1216
ABOVE = "ABOVE"
1317
BELOW = "BELOW"

examples/simple_graph/simple_graph_panel.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
"""A Streamlit visualization panel for the simple_graph.py example script."""
22

33
import streamlit as st
4-
from amplitude_enum import AmplitudeEnum
54
from streamlit_echarts import st_echarts
65

76
import nipanel
@@ -25,8 +24,7 @@
2524

2625
with col5:
2726
st.metric("Max Value", f"{max(sine_values):.3f}")
28-
with col6:
29-
st.metric("Data Points", len(sine_values))
27+
3028
# Prepare data for echarts
3129
data = [{"value": [x, y]} for x, y in zip(time_points, sine_values)]
3230

0 commit comments

Comments
 (0)