forked from M-Labs/artiq
1
0
Fork 0
artiq/artiq/devices/lda/lda-client.py

27 lines
865 B
Python
Raw Normal View History

2014-11-25 19:51:10 +08:00
#!/usr/bin/env python3
import argparse
2014-11-25 19:56:28 +08:00
from artiq.management.pc_rpc import Client
2014-11-25 19:51:10 +08:00
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--server', default="::1",
help="The IP address or hostname of the controller")
2014-11-25 19:56:28 +08:00
parser.add_argument('-p', '--port', default=8890, type=int,
2014-11-25 19:51:10 +08:00
help="The TCP port the controller listens to")
parser.add_argument('-a', '--attenuation', type=float,
help="The attenuation value you want to set")
args = parser.parse_args()
remote = Client(args.server, args.port, "lda")
try:
if args.attenuation is None:
2014-11-25 19:56:28 +08:00
print("Current attenuation: {}".format(remote.get_attenuation()))
2014-11-25 19:51:10 +08:00
else:
2014-11-25 19:56:28 +08:00
remote.set_attenuation(args.attenuation)
finally:
2014-11-25 19:51:10 +08:00
remote.close_rpc()