185 lines
4.6 KiB
Plaintext
185 lines
4.6 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "740b4091",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Test DAQ input on a device"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 1,
|
|
"id": "ac06df04",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"make: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
|
"make[1]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
|
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
|
"\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_dsp_lib\u001b[0m\n",
|
|
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
|
"[ 42%] Built target lasp_dsp_lib\n",
|
|
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
|
"\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_device_lib\u001b[0m\n",
|
|
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
|
"[ 67%] Built target lasp_device_lib\n",
|
|
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
|
"\u001b[35m\u001b[1mConsolidate compiler generated dependencies of target lasp_cpp\u001b[0m\n",
|
|
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
|
"make[2]: Entering directory '/home/anne/wip/mycode/lasp'\n",
|
|
"[ 71%] \u001b[32mBuilding CXX object src/lasp/CMakeFiles/lasp_cpp.dir/pybind11/lasp_dsp_pybind.cpp.o\u001b[0m\n",
|
|
"[ 75%] \u001b[32m\u001b[1mLinking CXX shared module lasp_cpp.cpython-310-x86_64-linux-gnu.so\u001b[0m\n",
|
|
"make[2]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
|
"[100%] Built target lasp_cpp\n",
|
|
"make[1]: Leaving directory '/home/anne/wip/mycode/lasp'\n",
|
|
"make: Leaving directory '/home/anne/wip/mycode/lasp'\n"
|
|
]
|
|
}
|
|
],
|
|
"source": [
|
|
"# !make -j -C ~/wip/mycode/lasp"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "ce0dd691",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import lasp\n",
|
|
"# Get handle to stream manager\n",
|
|
"mgr = lasp.StreamMgr.getInstance()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "3cd242a8",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"ds = mgr.getDeviceInfo()"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "a5d878e9",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Search for a device\n",
|
|
"for i, d in enumerate(ds):\n",
|
|
" print(f'{i}: ' + d.device_name)\n",
|
|
"d = ds[0]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "a456054e",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Check the available block sizes\n",
|
|
"d.availableFramesPerBlock"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "6d5b281e",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Create a configuration and enable some input channels\n",
|
|
"config = lasp.DaqConfiguration(d)\n",
|
|
"config.inchannel_config[0].enabled = True\n",
|
|
"config.inchannel_config[1].enabled = True\n",
|
|
"# Choose a different number of frames per block\n",
|
|
"config.framesPerBlockIndex = 4"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "1ead3995",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"print('Out channels:',d.noutchannels)\n",
|
|
"print('In channels:',d.ninchannels)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "12db8306",
|
|
"metadata": {
|
|
"tags": []
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# Start a stream with a configuration\n",
|
|
"mgr.startStream(config)\n",
|
|
"\n",
|
|
"def cb(data):\n",
|
|
" # raise RuntimeError('hh')\n",
|
|
" print(data.shape)\n",
|
|
"i = lasp.InDataHandler(mgr, cb)\n",
|
|
"import time\n",
|
|
"#time.sleep(4)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "4d9f0103",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"mgr.stopStream(lasp.StreamMgr.StreamType.input)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "61b7282f",
|
|
"metadata": {
|
|
"scrolled": true
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"del i"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.8.10"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|