2014-11-25 19:51:10 +08:00
|
|
|
#!/usr/bin/env python3
|
2014-11-29 11:03:52 +08:00
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
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()
|