2015-03-24 08:16:39 +08:00
FAQ
###
How do I ...
============
2015-05-03 20:42:42 +08:00
prevent my first RTIO command from causing an underflow?
--------------------------------------------------------
The RTIO timestamp counter starts counting at zero at the beginning of the first kernel run on the core device. The first RTIO event is programmed with a small timestamp above zero. If the kernel needs more time than this timestamp to produce the event, an underflow will occur. You can prevent it by calling `` break_realtime `` just before programming the first event.
2015-03-25 23:37:17 +08:00
override the `sysclk` frequency of just one DDS?
2015-03-25 03:12:40 +08:00
------------------------------------------------
2015-03-24 08:16:39 +08:00
2015-03-25 23:17:49 +08:00
Override the parameter using an argument in the DDB.
2015-03-24 08:16:39 +08:00
organize parameters in folders?
-------------------------------
2015-05-03 20:42:42 +08:00
Use GUI auto-completion and filtering.
2015-03-24 08:16:39 +08:00
Names need to be unique.
enforce functional dependencies between parameters?
---------------------------------------------------
2015-03-25 23:37:17 +08:00
If you want to override a parameter `` b `` in the PDB to be `` b = 2*a `` ,
2015-03-25 23:17:49 +08:00
use wrapper experiments, overriding parameters by passing them to the
experiment's constructor.
2015-03-24 08:16:39 +08:00
2015-03-25 23:37:17 +08:00
get rid of `` DBKeys `` ?
----------------------
2015-03-24 08:16:39 +08:00
2015-03-25 23:37:17 +08:00
`` DBKeys `` references keys in PDB, DDB and RDB.
2015-03-24 08:16:39 +08:00
write a generator feeding a kernel feeding an analyze function?
---------------------------------------------------------------
Like this::
def run(self):
self.parse(self.pipe(iter(range(10))))
def pipe(self, gen):
for i in gen:
r = self.do(i)
yield r
def parse(self, gen):
for i in gen:
pass
@kernel
def do(self, i):
return i
2015-03-25 23:37:17 +08:00
create and use variable lengths arrays in kernels?
--------------------------------------------------
2015-03-24 08:16:39 +08:00
Don't. Preallocate everything. Or chunk it and e.g. read 100 events per
function call, push them upstream and retry until the gate time closes.
2015-03-25 23:17:49 +08:00
execute multiple slow controller RPCs in parallel without losing time?
----------------------------------------------------------------------
2015-03-24 08:16:39 +08:00
2015-03-25 23:37:17 +08:00
Use `` threading.Thread `` : portable, fast, simple for one-shot calls.
2015-03-24 08:16:39 +08:00
2015-03-25 23:17:49 +08:00
write part of my experiment as a coroutine/asyncio task/generator?
------------------------------------------------------------------
2015-03-24 08:16:39 +08:00
2015-03-25 23:37:17 +08:00
You can not change the API that your experiment exposes: `` __init__() `` ,
`` build() `` , `` run() `` and `` analyze() `` need to be regular functions, not
2015-03-25 23:17:49 +08:00
generators or asyncio coroutines. That would make reusing your own code in
2015-03-25 03:12:40 +08:00
sub-experiments difficult and fragile. You can however always use the
2015-03-25 23:37:17 +08:00
scheduler API to achieve the same (`` scheduler.yield(duration=0) `` )
2015-03-25 23:17:49 +08:00
or wrap your own generators/coroutines/tasks in regular functions that
2015-03-25 03:12:40 +08:00
you then expose as part of the API.
2015-06-23 23:05:46 +08:00
list the serial devices attached to my Linux/Windows system?
------------------------------------------------------------
You can do it by running::
$ python3 -m serial.tools.list_ports -v
It will give you the `` /dev/ttyUSBxx `` (or the `` COMxx `` for Windows) device
names.
The `` hwid: `` field gives you the string you can pass via the `` hwgrep:// ``
feature of pyserial
`serial_for_url() <http://pyserial.sourceforge.net/pyserial_api.html#serial.serial_for_url> `_
in order to open a serial device.
2015-06-24 00:14:25 +08:00
The preferred way to specify a serial device is to make use of the `` hwgrep:// ``
URL: it allows to select the serial device by its USB vendor ID, product
ID and/or serial number. Those never change, unlike the device file name.
2015-06-23 23:05:46 +08:00
See the :ref: `TDC001 documentation <tdc001-controller-usage-example>` for an example of `` hwgrep:// `` usage.