artiq/frontend/lda_client.py

30 lines
884 B
Python
Raw Normal View History

2014-11-25 19:51:10 +08:00
#!/usr/bin/env python3
2014-11-25 19:51:10 +08:00
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
2014-12-10 12:01:31 +08:00
def main():
2014-11-25 19:51:10 +08:00
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--server', default="::1",
2014-12-11 14:10:15 +08:00
help="hostname or IP of the controller to connect to")
2014-11-25 19:56:28 +08:00
parser.add_argument('-p', '--port', default=8890, type=int,
2014-12-11 14:10:15 +08:00
help="TCP port to use to connect to the controller")
2014-11-25 19:51:10 +08:00
parser.add_argument('-a', '--attenuation', type=float,
2014-12-11 14:10:15 +08:00
help="attenuation value to set")
2014-11-25 19:51:10 +08:00
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()
2014-12-10 12:01:31 +08:00
if __name__ == "__main__":
main()