lasp/examples/DaqConfigurations.ipynb

120 lines
2.4 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Assemble a set of configurations (one for input, one for output)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"#!make -j -C ~/wip/mycode/lasp"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from lasp import *"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import lasp\n",
"print(lasp.__version__)\n",
"ds = lasp.DeviceInfo.getDeviceInfo()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"for i, d in enumerate(ds):\n",
" print(f'{i}: ' + d.device_name)\n",
"di = ds[0]\n",
"do = ds[1]"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"iconfig = lasp.DaqConfiguration(di)\n",
"oconfig = lasp.DaqConfiguration(do)\n",
"ds = lasp.DaqConfigurations(False, iconfig, oconfig)\n",
"oconfig.outchannel_config[0].enabled = True\n",
"oconfig.outchannel_config[1].enabled = True\n",
"iconfig.inchannel_config[0].enabled = True\n",
"iconfig.inchannel_config[1].enabled = True"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Save configuration to a preset\n",
"# ds.save('test')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Load all configurations present\n",
"ds.loadAll()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Print some stuff\n",
"print('Out channels:',do.noutchannels)\n",
"print('In channels:',di.ninchannels)"
]
}
],
"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
}