mirror of https://github.com/m-labs/artiq.git
doc: use sphinx-argparse
This commit is contained in:
parent
47aa634ab5
commit
9fb42e4952
|
@ -19,7 +19,7 @@ def clear_screen():
|
||||||
sys.stdout.write("\x1b[2J\x1b[H")
|
sys.stdout.write("\x1b[2J\x1b[H")
|
||||||
|
|
||||||
|
|
||||||
def _get_args():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="ARTIQ CLI client")
|
parser = argparse.ArgumentParser(description="ARTIQ CLI client")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-s", "--server", default="::1",
|
"-s", "--server", default="::1",
|
||||||
|
@ -80,7 +80,7 @@ def _get_args():
|
||||||
"what",
|
"what",
|
||||||
help="select object to show: queue/timed/devices/parameters")
|
help="select object to show: queue/timed/devices/parameters")
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def _parse_arguments(arguments):
|
def _parse_arguments(arguments):
|
||||||
|
@ -226,7 +226,7 @@ def _show_dict(args, notifier_name, display_fun):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = _get_args()
|
args = get_argparser().parse_args()
|
||||||
action = args.action.replace("-", "_")
|
action = args.action.replace("-", "_")
|
||||||
if action == "show":
|
if action == "show":
|
||||||
if args.what == "queue":
|
if args.what == "queue":
|
||||||
|
|
|
@ -5,18 +5,18 @@ import argparse
|
||||||
from artiq.protocols.pc_rpc import Client
|
from artiq.protocols.pc_rpc import Client
|
||||||
|
|
||||||
|
|
||||||
def _get_args():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="ARTIQ controller identification tool")
|
description="ARTIQ controller identification tool")
|
||||||
parser.add_argument("server",
|
parser.add_argument("server",
|
||||||
help="hostname or IP of the controller to connect to")
|
help="hostname or IP of the controller to connect to")
|
||||||
parser.add_argument("port", type=int,
|
parser.add_argument("port", type=int,
|
||||||
help="TCP port to use to connect to the controller")
|
help="TCP port to use to connect to the controller")
|
||||||
return parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = _get_args()
|
args = get_argparser().parse_args()
|
||||||
remote = Client(args.server, args.port, None)
|
remote = Client(args.server, args.port, None)
|
||||||
try:
|
try:
|
||||||
target_names, id_parameters = remote.get_rpc_id()
|
target_names, id_parameters = remote.get_rpc_id()
|
||||||
|
|
|
@ -13,7 +13,7 @@ from artiq.gui.parameters import ParametersWindow
|
||||||
from artiq.gui.rt_results import RTResults
|
from artiq.gui.rt_results import RTResults
|
||||||
|
|
||||||
|
|
||||||
def _get_args():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="ARTIQ GUI client")
|
parser = argparse.ArgumentParser(description="ARTIQ GUI client")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-s", "--server", default="::1",
|
"-s", "--server", default="::1",
|
||||||
|
@ -24,11 +24,11 @@ def _get_args():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--port-control", default=3251, type=int,
|
"--port-control", default=3251, type=int,
|
||||||
help="TCP port to connect to for control")
|
help="TCP port to connect to for control")
|
||||||
return parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = _get_args()
|
args = get_argparser().parse_args()
|
||||||
|
|
||||||
asyncio.set_event_loop_policy(gbulb.GtkEventLoopPolicy())
|
asyncio.set_event_loop_policy(gbulb.GtkEventLoopPolicy())
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
|
|
|
@ -11,7 +11,7 @@ from artiq.master.scheduler import Scheduler
|
||||||
from artiq.master.rt_results import RTResults
|
from artiq.master.rt_results import RTResults
|
||||||
|
|
||||||
|
|
||||||
def _get_args():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="ARTIQ master")
|
parser = argparse.ArgumentParser(description="ARTIQ master")
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--bind", default="::1",
|
"--bind", default="::1",
|
||||||
|
@ -22,11 +22,11 @@ def _get_args():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--port-control", default=3251, type=int,
|
"--port-control", default=3251, type=int,
|
||||||
help="TCP port to listen to for control")
|
help="TCP port to listen to for control")
|
||||||
return parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = _get_args()
|
args = get_argparser().parse_args()
|
||||||
|
|
||||||
ddb = FlatFileDB("ddb.pyon")
|
ddb = FlatFileDB("ddb.pyon")
|
||||||
pdb = FlatFileDB("pdb.pyon")
|
pdb = FlatFileDB("pdb.pyon")
|
||||||
|
|
|
@ -31,7 +31,7 @@ class SimpleParamLogger:
|
||||||
print("Parameter change: {} -> {}".format(name, value))
|
print("Parameter change: {} -> {}".format(name, value))
|
||||||
|
|
||||||
|
|
||||||
def _get_args():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="Local experiment running tool")
|
description="Local experiment running tool")
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ def _get_args():
|
||||||
parser.add_argument("arguments", nargs="*",
|
parser.add_argument("arguments", nargs="*",
|
||||||
help="run arguments")
|
help="run arguments")
|
||||||
|
|
||||||
return parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def _parse_arguments(arguments):
|
def _parse_arguments(arguments):
|
||||||
|
@ -61,7 +61,7 @@ def _parse_arguments(arguments):
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = _get_args()
|
args = get_argparser().parse_args()
|
||||||
|
|
||||||
ddb = FlatFileDB(args.ddb)
|
ddb = FlatFileDB(args.ddb)
|
||||||
pdb = FlatFileDB(args.pdb)
|
pdb = FlatFileDB(args.pdb)
|
||||||
|
|
|
@ -5,18 +5,20 @@ import argparse
|
||||||
from artiq.protocols.pc_rpc import Client
|
from artiq.protocols.pc_rpc import Client
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-s', '--server', default="::1",
|
parser.add_argument("-s", "--server", default="::1",
|
||||||
help="hostname or IP of the controller to connect to")
|
help="hostname or IP of the controller to connect to")
|
||||||
parser.add_argument('-p', '--port', default=3253, type=int,
|
parser.add_argument("-p", "--port", default=3253, type=int,
|
||||||
help="TCP port to use to connect to the controller")
|
help="TCP port to use to connect to the controller")
|
||||||
parser.add_argument('-a', '--attenuation', type=float,
|
parser.add_argument("-a", "--attenuation", type=float,
|
||||||
help="attenuation value to set")
|
help="attenuation value to set")
|
||||||
args = parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = get_argparser().parse_args()
|
||||||
remote = Client(args.server, args.port, "lda")
|
remote = Client(args.server, args.port, "lda")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if args.attenuation is None:
|
if args.attenuation is None:
|
||||||
print("Current attenuation: {}".format(remote.get_attenuation()))
|
print("Current attenuation: {}".format(remote.get_attenuation()))
|
||||||
|
|
|
@ -6,7 +6,7 @@ from artiq.devices.lda.driver import Lda, Ldasim
|
||||||
from artiq.protocols.pc_rpc import simple_server_loop
|
from artiq.protocols.pc_rpc import simple_server_loop
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-d', '--device', default="LDA-102",
|
parser.add_argument('-d', '--device', default="LDA-102",
|
||||||
choices=["LDA-102", "LDA-602", "sim"])
|
choices=["LDA-102", "LDA-602", "sim"])
|
||||||
|
@ -16,13 +16,15 @@ def main():
|
||||||
help="TCP port to listen to")
|
help="TCP port to listen to")
|
||||||
parser.add_argument('-s', '--serial', default=None,
|
parser.add_argument('-s', '--serial', default=None,
|
||||||
help="USB serial number of the device")
|
help="USB serial number of the device")
|
||||||
args = parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = get_argparser().parse_args()
|
||||||
if args.device == "sim":
|
if args.device == "sim":
|
||||||
lda = Ldasim()
|
lda = Ldasim()
|
||||||
else:
|
else:
|
||||||
lda = Lda(args.serial, args.device)
|
lda = Lda(args.serial, args.device)
|
||||||
|
|
||||||
simple_server_loop({"lda": lda},
|
simple_server_loop({"lda": lda},
|
||||||
args.bind, args.port)
|
args.bind, args.port)
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ import numpy as np
|
||||||
from artiq.protocols.pc_rpc import Client
|
from artiq.protocols.pc_rpc import Client
|
||||||
|
|
||||||
|
|
||||||
def _get_args():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="""PDQ2 client.
|
parser = argparse.ArgumentParser(description="""PDQ2 client.
|
||||||
Evaluates times and voltages, interpolates and uploads
|
Evaluates times and voltages, interpolates and uploads
|
||||||
them to the controller.""")
|
them to the controller.""")
|
||||||
|
@ -49,11 +49,11 @@ def _get_args():
|
||||||
action="store_true", help="do reset before")
|
action="store_true", help="do reset before")
|
||||||
parser.add_argument("-b", "--bit", default=False,
|
parser.add_argument("-b", "--bit", default=False,
|
||||||
action="store_true", help="do bit test")
|
action="store_true", help="do bit test")
|
||||||
return parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = _get_args()
|
args = get_argparser().parse_args()
|
||||||
dev = Client(args.server, args.port, "pdq2")
|
dev = Client(args.server, args.port, "pdq2")
|
||||||
dev.init()
|
dev.init()
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ from artiq.devices.pdq2.driver import Pdq2
|
||||||
from artiq.protocols.pc_rpc import simple_server_loop
|
from artiq.protocols.pc_rpc import simple_server_loop
|
||||||
|
|
||||||
|
|
||||||
def _get_args():
|
def get_argparser():
|
||||||
parser = argparse.ArgumentParser(description="PDQ2 controller")
|
parser = argparse.ArgumentParser(description="PDQ2 controller")
|
||||||
parser.add_argument("--bind", default="::1",
|
parser.add_argument("--bind", default="::1",
|
||||||
help="hostname or IP address to bind to")
|
help="hostname or IP address to bind to")
|
||||||
|
@ -19,11 +19,11 @@ def _get_args():
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-d", "--debug", default=False, action="store_true",
|
"-d", "--debug", default=False, action="store_true",
|
||||||
help="debug communications")
|
help="debug communications")
|
||||||
return parser.parse_args()
|
return parser
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
args = _get_args()
|
args = get_argparser().parse_args()
|
||||||
|
|
||||||
if args.debug:
|
if args.debug:
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
|
@ -32,6 +32,7 @@ import os
|
||||||
extensions = [
|
extensions = [
|
||||||
'sphinx.ext.autodoc',
|
'sphinx.ext.autodoc',
|
||||||
'sphinx.ext.mathjax',
|
'sphinx.ext.mathjax',
|
||||||
|
'sphinxarg.ext',
|
||||||
]
|
]
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
|
@ -48,7 +49,7 @@ master_doc = 'index'
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = 'ARTIQ'
|
project = 'ARTIQ'
|
||||||
copyright = '2014, M-Labs / NIST Ion Storage Group'
|
copyright = '2014-2015, M-Labs / NIST Ion Storage Group'
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
|
|
@ -17,6 +17,13 @@ Each driver is run in a separate "controller" that exposes a RPC interface (base
|
||||||
.. automodule:: artiq.devices.pdq2
|
.. automodule:: artiq.devices.pdq2
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.pdq2_controller.get_argparser
|
||||||
|
:prog: pdq2_controller
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.pdq2_client.get_argparser
|
||||||
|
:prog: pdq2_client
|
||||||
|
|
||||||
:mod:`artiq.devices.lda` module
|
:mod:`artiq.devices.lda` module
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
@ -24,6 +31,14 @@ Each driver is run in a separate "controller" that exposes a RPC interface (base
|
||||||
.. automodule:: artiq.devices.lda.driver
|
.. automodule:: artiq.devices.lda.driver
|
||||||
:members:
|
:members:
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.lda_controller.get_argparser
|
||||||
|
:prog: lda_controller
|
||||||
|
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.lda_client.get_argparser
|
||||||
|
:prog: lda_client
|
||||||
|
|
||||||
Default TCP port list
|
Default TCP port list
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
@ -9,8 +9,10 @@ Contents:
|
||||||
installing
|
installing
|
||||||
getting_started
|
getting_started
|
||||||
writing_a_driver
|
writing_a_driver
|
||||||
|
management_system
|
||||||
core_language_reference
|
core_language_reference
|
||||||
core_drivers_reference
|
core_drivers_reference
|
||||||
protocols_reference
|
protocols_reference
|
||||||
drivers_reference
|
drivers_reference
|
||||||
|
utilities
|
||||||
fpga_board_ports
|
fpga_board_ports
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
Management system
|
||||||
|
=================
|
||||||
|
|
||||||
|
Master
|
||||||
|
------
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.artiq_master.get_argparser
|
||||||
|
:prog: artiq_master
|
||||||
|
|
||||||
|
Command-line client
|
||||||
|
-------------------
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.artiq_client.get_argparser
|
||||||
|
:prog: artiq_client
|
||||||
|
|
||||||
|
GUI client
|
||||||
|
----------
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.artiq_gui.get_argparser
|
||||||
|
:prog: artiq_gui
|
|
@ -1,5 +1,5 @@
|
||||||
Management reference
|
Protocols reference
|
||||||
====================
|
===================
|
||||||
|
|
||||||
:mod:`artiq.protocols.asyncio_server` module
|
:mod:`artiq.protocols.asyncio_server` module
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
Utilities
|
||||||
|
=========
|
||||||
|
|
||||||
|
Local running tool
|
||||||
|
------------------
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.artiq_run.get_argparser
|
||||||
|
:prog: artiq_run
|
||||||
|
|
||||||
|
Controller identification tool
|
||||||
|
------------------------------
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.artiq_ctlid.get_argparser
|
||||||
|
:prog: artiq_ctlid
|
2
setup.py
2
setup.py
|
@ -15,7 +15,7 @@ setup(
|
||||||
long_description=open("README.rst").read(),
|
long_description=open("README.rst").read(),
|
||||||
license="BSD",
|
license="BSD",
|
||||||
install_requires=[
|
install_requires=[
|
||||||
"sphinx", "pyserial", "numpy", "scipy", "prettytable"
|
"sphinx", "sphinx-argparse", "pyserial", "numpy", "scipy", "prettytable"
|
||||||
],
|
],
|
||||||
extras_require={},
|
extras_require={},
|
||||||
dependency_links=[],
|
dependency_links=[],
|
||||||
|
|
Loading…
Reference in New Issue