Skip to content

Commit 255d74e

Browse files
committed
Name all arguments in connection table
1 parent e3d3ece commit 255d74e

File tree

1 file changed

+43
-23
lines changed

1 file changed

+43
-23
lines changed

example.py

Lines changed: 43 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@
6060

6161
# Create a BIAS Camera, tirggered to take photos with flag 3 of pulseblaster_0
6262
Camera(
63-
"andor_ixon_0",
64-
pulseblaster_0.direct_outputs,
65-
"flag 3",
63+
name="andor_ixon_0",
64+
parent_device=pulseblaster_0.direct_outputs,
65+
connection="flag 3",
6666
BIAS_port=42520,
6767
serial_number="0000",
6868
SDK="IMAQdx",
@@ -87,41 +87,55 @@
8787

8888
# Create the output/input channels on the above devices use the example1 conversion
8989
# class located in pythonlib/unitconversions/example.py with default paremeters
90-
AnalogOut("analog0", ni_card_1, "ao0", unit_conversion_class=example1)
90+
AnalogOut(
91+
name="analog0",
92+
parent_device=ni_card_1,
93+
connection="ao0",
94+
unit_conversion_class=example1,
95+
)
9196

9297
# same as above, but we are changing some parameters used in the conversion and
9398
# specifying a prefix to be used with units. You can now program in mA, uA, mGauss,
9499
# uGauss
95100
AnalogOut(
96-
"analog1",
97-
ni_card_1,
98-
"ao1",
101+
name="analog1",
102+
parent_device=ni_card_1,
103+
connection="ao1",
99104
unit_conversion_class=example1,
100105
unit_conversion_parameters={"a": 5, "b": 1, "magnitudes": ["m", "u"]},
101106
)
102-
AnalogOut("analog2", ni_card_0, "ao2")
103-
AnalogOut("analog3", ni_card_0, "ao3")
104-
AnalogIn("input1", ni_card_0, "ai0")
105-
DigitalOut("do0", ni_card_0, "port0/line2")
106-
Shutter("shutter1", ni_card_0, "port0/line1", delay=(0, 0))
107-
Shutter("shutter2", pulseblaster_0.direct_outputs, "flag 2", delay=(0, 0))
108-
DigitalOut("switch", pulseblaster_0.direct_outputs, "flag 4")
109-
110-
DDS("dds1", novatechdds9m_0, "channel 0")
111-
DDS("dds2", novatechdds9m_0, "channel 1")
112-
StaticDDS("dds5", novatechdds9m_0, "channel 2")
107+
AnalogOut(name="analog2", parent_device=ni_card_0, connection="ao2")
108+
AnalogOut(name="analog3", parent_device=ni_card_0, connection="ao3")
109+
AnalogIn(name="input1", parent_device=ni_card_0, connection="ai0")
110+
DigitalOut(name="do0", parent_device=ni_card_0, connection="port0/line2")
111+
Shutter(
112+
name="shutter1", parent_device=ni_card_0, connection="port0/line1", delay=(0, 0)
113+
)
114+
Shutter(
115+
name="shutter2",
116+
parent_device=pulseblaster_0.direct_outputs,
117+
connection="flag 2",
118+
delay=(0, 0),
119+
)
120+
DigitalOut(
121+
name="switch", parent_device=pulseblaster_0.direct_outputs, connection="flag 4"
122+
)
123+
124+
DDS(name="dds1", parent_device=novatechdds9m_0, connection="channel 0")
125+
DDS(name="dds2", parent_device=novatechdds9m_0, connection="channel 1")
126+
StaticDDS(name="dds5", parent_device=novatechdds9m_0, connection="channel 2")
113127
# The next DDS is special because it has the frequency and amplitude calibrated using
114128
# example2 and example3 classes from pythonlib/unitconversions/example.py
115129
DDS(
116-
"dds3",
117-
pulseblaster_0.direct_outputs,
118-
"dds 0",
130+
name="dds3",
131+
parent_device=pulseblaster_0.direct_outputs,
132+
connection="dds 0",
119133
freq_conv_class=example2,
120134
freq_conv_params={"a": 4, "b": 6},
121135
amp_conv_class=example3,
122136
amp_conv_params={"a": 2, "b": 22, "magnitudes": ["m"]},
123137
)
124-
DDS("dds4", pulseblaster_0.direct_outputs, "dds 1")
138+
DDS(name="dds4", parent_device=pulseblaster_0.direct_outputs, connection="dds 1")
125139

126140
# This sets up the inputs/counters/etc that will monitor
127141
# The first paremeter is the name for the WaitMonitor device
@@ -133,7 +147,13 @@
133147
# this channel should be physicaly connect to the external trigger of the master
134148
# pseudoclock.
135149
WaitMonitor(
136-
"wait_monitor", ni_card_0, "port0/line0", ni_card_0, "ctr0", ni_card_0, "pfi1"
150+
name="wait_monitor",
151+
parent_device=ni_card_0,
152+
connection="port0/line0",
153+
acquisition_device=ni_card_0,
154+
acquisition_connection="ctr0",
155+
timeout_device=ni_card_0,
156+
timeout_connection="pfi1",
137157
)
138158

139159
# A variable to define the acquisition rate used for the analog outputs below.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy