2022-09-28 07:41:02 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
|
|
|
"cell_type": "markdown",
|
|
|
|
"id": "2406f830",
|
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
|
|
|
"# Test DAQ input on a device"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "e3d3280f",
|
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-28 07:41:02 +00:00
|
|
|
"source": [
|
2022-10-10 17:29:24 +00:00
|
|
|
"# !make -j -C ~/wip/mycode/lasp"
|
2022-09-28 07:41:02 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "d12f103c",
|
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-28 07:41:02 +00:00
|
|
|
"source": [
|
|
|
|
"import lasp\n",
|
|
|
|
"# Get handle to stream manager\n",
|
|
|
|
"mgr = lasp.StreamMgr.getInstance()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "f44b1946",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
|
|
|
"ds = mgr.getDeviceInfo()"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "db0f3bb7",
|
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-28 07:41:02 +00:00
|
|
|
"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",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "5c84d454",
|
|
|
|
"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",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "a020f86f",
|
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-28 07:41:02 +00:00
|
|
|
"source": [
|
|
|
|
"print('Out channels:',d.noutchannels)\n",
|
|
|
|
"print('In channels:',d.ninchannels)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "034b5f5e",
|
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-28 07:41:02 +00:00
|
|
|
"source": [
|
|
|
|
"# Start a stream with a configuration\n",
|
|
|
|
"mgr.startStream(config)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "59326eda-f249-4a9b-9191-a784b01694b9",
|
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-28 07:41:02 +00:00
|
|
|
"source": [
|
2022-10-10 17:29:24 +00:00
|
|
|
"rec = lasp.Recording('test', mgr, 1.0)"
|
2022-09-28 07:41:02 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "5defa804",
|
|
|
|
"metadata": {},
|
2022-10-10 17:29:24 +00:00
|
|
|
"outputs": [],
|
2022-09-28 07:41:02 +00:00
|
|
|
"source": [
|
|
|
|
"mgr.stopStream(lasp.StreamMgr.StreamType.input)"
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2022-10-10 17:29:24 +00:00
|
|
|
"execution_count": null,
|
2022-09-28 07:41:02 +00:00
|
|
|
"id": "d12f8c4a",
|
|
|
|
"metadata": {},
|
|
|
|
"outputs": [],
|
|
|
|
"source": [
|
2022-10-10 17:29:24 +00:00
|
|
|
"mgr.stopAllStreams()"
|
2022-09-28 07:41:02 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
2022-10-10 17:29:24 +00:00
|
|
|
"display_name": "Python 3 (ipykernel)",
|
2022-09-28 07:41:02 +00:00
|
|
|
"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",
|
2022-10-10 17:29:24 +00:00
|
|
|
"version": "3.8.10"
|
2022-09-28 07:41:02 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 5
|
|
|
|
}
|