To receive notifications about scheduled maintenance, please subscribe to the mailing-list gitlab-operations@sympa.ethz.ch. You can subscribe to the mailing-list at https://sympa.ethz.ch

Commit 30c26c78 authored by mikolajr's avatar mikolajr
Browse files

Improve TiePie example

parent 93674b31
Pipeline #51427 passed with stages
in 15 minutes and 3 seconds
......@@ -27,61 +27,34 @@ tp.list_devices()
tp.enable_all_channels()
# Set general oscilloscope configuration
tp_config = {
"Sample frequency": 1e7,
"Record length": 10000,
"Pre sample ratio": 0,
"Range": 8,
"Coupling": "ACV",
"Resolution": 16,
}
tp_config = TiePieOscilloscope.SetScopeConfigGroup(
sample_frequency=1e7,
record_length=10000,
pre_sample_ratio=0,
range=8,
coupling=TiePieOscilloscope.ChannelCoupling.ACV,
resolution=16,
)
tp.set_scope_config(tp_config)
# Set configuration for each channel
channel1_config = {
"Channel": 1,
"Trigger hysteresis": 0.05,
"Range": 10,
"Trigger kind": "any",
"Trigger levels": 0.5,
"Trigger timeout": 10,
"Coupling": "ACV",
"Probe offset": 2,
}
channel2_config = {
"Channel": 2,
"Trigger hysteresis": 0.05,
"Range": 10,
"Trigger kind": "any",
"Trigger levels": 0.5,
"Trigger timeout": 10,
"Coupling": "ACV",
"Probe offset": 2,
}
channel3_config = {
"Channel": 3,
"Trigger hysteresis": 0.05,
"Range": 10,
"Trigger kind": "any",
"Trigger levels": 0.5,
"Trigger timeout": 10,
"Coupling": "ACV",
"Probe offset": 2,
channel_common_config = {
"trigger_hysteresis": 0.05,
"range": 10,
"trigger_kind": TiePieOscilloscope.TriggerKind.Any,
"trigger_levels": 0.5,
"trigger_timeout": 10,
"coupling": TiePieOscilloscope.ChannelCoupling.ACV,
"probe_offset": 2,
}
channel4_config = {
"Channel": 4,
"Trigger hysteresis": 0.05,
"Range": 10,
"Trigger kind": "any",
"Trigger levels": 0.5,
"Trigger timeout": 10,
"Coupling": "ACV",
"Probe offset": 2,
}
tp.set_channel_config(channel1_config)
tp.set_channel_config(channel2_config)
tp.set_channel_config(channel3_config)
tp.set_channel_config(channel4_config)
channel_configs = []
for i in range(4):
channel_configs[i] = TiePieOscilloscope.SetChannelConfigGroup(
channel=i + 1, **channel_common_config,
)
for channel_config in channel_configs:
tp.set_channel_config(channel_config)
# Let the oscilloscope gather data
data = tp.measure()
......@@ -91,10 +64,7 @@ data_array = tp.data_to_array(data)
# Write data to a csv file named "Example"
tp.write_to_csv("Example", data)
# Create list of channels configurations
channels_configs = [channel1_config, channel2_config, channel4_config]
# Write data to a xlsx file named "Example"
tp.write_to_xl(
"Example", data, scope_config=tp_config, channels_configs=channels_configs
"Example", data, scope_config=tp_config, channels_configs=channel_configs
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment