Skip to content

Commit 886623e

Browse files
author
Dilmi Wickramanayake
committed
Revert changes
1 parent 9efb83a commit 886623e

File tree

5 files changed

+13
-32
lines changed

5 files changed

+13
-32
lines changed

examples/nidaqmx_analog_input_filtering/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,7 @@ Script demonstrates analog input data getting continuously acquired, and being f
1616

1717
### Usage
1818

19+
poetry install --with examples
20+
poetry run examples/nidaqmx_analog_input_filtering/nidaqmx_analog_input_filtering.py
1921
Run `poetry run examples/nidaqmx_analog_input_filtering/nidaqmx_analog_input_filtering.py`
2022

examples/niscope/niscope_ex_fetch_forever.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
try:
4747
print(f"Press Ctrl + C to stop")
4848
while True:
49-
offset = session._fetch_offset
49+
offset = session.meas_array_offset
5050
gain = session.meas_array_gain
5151
for i in range(len(waveforms)):
5252
time.sleep(0.2)

examples/simple_graph/amplitude_enum.py

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,35 @@
11
"""Example of using nipanel to display a sine wave graph using st_echarts."""
2-
32
import math
43
import time
54
from pathlib import Path
65

76
import numpy as np
8-
from amplitude_enum import AmplitudeEnum
97

108
import nipanel
119

10+
1211
panel_script_path = Path(__file__).with_name("simple_graph_panel.py")
1312
panel = nipanel.create_panel(panel_script_path)
1413

1514
amplitude = 1.0
1615
frequency = 1.0
1716
num_points = 100
18-
1917
try:
2018
print(f"Panel URL: {panel.panel_url}")
2119
print("Press Ctrl+C to exit")
2220

2321
# Generate and update the sine wave data periodically
2422
while True:
25-
amplitude_enum = AmplitudeEnum(panel.get_value("amplitude_enum", AmplitudeEnum.SMALL.value))
26-
base_frequency = panel.get_value("base_frequency", 1.0)
27-
28-
# Slowly vary the total frequency for a more dynamic visualization
29-
frequency = base_frequency + 0.5 * math.sin(time.time() / 5.0)
3023
time_points = np.linspace(0, num_points, num_points)
31-
sine_values = amplitude_enum.value * np.sin(frequency * time_points)
32-
33-
panel.set_value("frequency", frequency)
24+
sine_values = amplitude * np.sin(frequency * time_points)
3425

3526
panel.set_value("time_points", time_points.tolist())
3627
panel.set_value("sine_values", sine_values.tolist())
28+
panel.set_value("amplitude", amplitude)
29+
panel.set_value("frequency", frequency)
3730

3831
# Slowly vary the frequency for a more dynamic visualization
3932
frequency = 1.0 + 0.5 * math.sin(time.time() / 5.0)
4033
time.sleep(0.1)
41-
4234
except KeyboardInterrupt:
43-
print("Exiting...")
35+
print("Exiting...")

examples/simple_graph/simple_graph_panel.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
"""A Streamlit visualization panel for the simple_graph.py example script."""
2-
32
import streamlit as st
43
from streamlit_echarts import st_echarts
54

65
import nipanel
76

7+
88
st.set_page_config(page_title="Simple Graph Example", page_icon="📈", layout="wide")
99
st.title("Simple Graph Example")
1010

@@ -13,21 +13,20 @@
1313
sine_values = panel.get_value("sine_values", [0.0])
1414
amplitude = panel.get_value("amplitude", 1.0)
1515
frequency = panel.get_value("frequency", 1.0)
16-
1716
col1, col2, col3, col4, col5 = st.columns(5)
1817
with col1:
1918
st.metric("Amplitude", f"{amplitude:.2f}")
2019
with col2:
2120
st.metric("Frequency", f"{frequency:.2f} Hz")
2221
with col3:
2322
st.metric("Min Value", f"{min(sine_values):.3f}")
24-
25-
with col5:
23+
with col4:
2624
st.metric("Max Value", f"{max(sine_values):.3f}")
25+
with col5:
26+
st.metric("Data Points", len(sine_values))
2727

2828
# Prepare data for echarts
2929
data = [{"value": [x, y]} for x, y in zip(time_points, sine_values)]
30-
3130
# Configure the chart options
3231
options = {
3332
"animation": False, # Disable animation for smoother updates
@@ -52,6 +51,5 @@
5251
}
5352
],
5453
}
55-
5654
# Display the chart
57-
st_echarts(options=options, height="400px", key="graph")
55+
st_echarts(options=options, height="400px", key="graph")

0 commit comments

Comments
 (0)