Skip to content

Commit

Permalink
Updating example_pydaq_gui.ipynb
Browse files Browse the repository at this point in the history
  • Loading branch information
samirmartins committed Aug 5, 2024
1 parent 54bb35c commit 2255e9d
Showing 1 changed file with 3 additions and 113 deletions.
116 changes: 3 additions & 113 deletions examples/example_pydaq_gui.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -26,126 +26,16 @@
"cell_type": "code",
"id": "initial_id",
"metadata": {
"collapsed": true,
"ExecuteTime": {
"end_time": "2024-07-30T14:51:55.169991Z",
"start_time": "2024-07-30T14:45:12.523602Z"
}
"collapsed": true
},
"source": [
"from pydaq.pydaq_global import PydaqGui\n",
"\n",
"# Launch the interface\n",
"gui = PydaqGui() # You can use this object to access the data"
],
"outputs": [
{
"ename": "IndexError",
"evalue": "list index out of range",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mIndexError\u001B[0m Traceback (most recent call last)",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\pydaq\\guis\\getdata_arduino_widget.py:84\u001B[0m, in \u001B[0;36mGetData_Arduino_Widget.start_func_get_data\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 80\u001B[0m g\u001B[38;5;241m.\u001B[39merror_path \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mTrue\u001B[39;00m\n\u001B[0;32m 82\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m g\u001B[38;5;241m.\u001B[39merror_path:\n\u001B[0;32m 83\u001B[0m \u001B[38;5;66;03m# Calling data aquisition method\u001B[39;00m\n\u001B[1;32m---> 84\u001B[0m \u001B[43mg\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mget_data_arduino\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 85\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39msignals\u001B[38;5;241m.\u001B[39mreturned\u001B[38;5;241m.\u001B[39memit(g)\n",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\pydaq\\get_data.py:207\u001B[0m, in \u001B[0;36mGetData.get_data_arduino\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 204\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mser\u001B[38;5;241m.\u001B[39mreset_input_buffer() \u001B[38;5;66;03m# Reseting serial input buffer\u001B[39;00m\n\u001B[0;32m 205\u001B[0m \u001B[38;5;66;03m# print(self.ser.read(14).split())\u001B[39;00m\n\u001B[0;32m 206\u001B[0m \u001B[38;5;66;03m# Get the last complete value\u001B[39;00m\n\u001B[1;32m--> 207\u001B[0m temp \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mint\u001B[39m(\u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mser\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mread\u001B[49m\u001B[43m(\u001B[49m\u001B[38;5;241;43m14\u001B[39;49m\u001B[43m)\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43msplit\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\u001B[43m[\u001B[49m\u001B[38;5;241;43m-\u001B[39;49m\u001B[38;5;241;43m2\u001B[39;49m\u001B[43m]\u001B[49m\u001B[38;5;241m.\u001B[39mdecode(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mUTF-8\u001B[39m\u001B[38;5;124m\"\u001B[39m)) \u001B[38;5;241m*\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mard_vpb\n\u001B[0;32m 208\u001B[0m \u001B[38;5;66;03m# temp = 5\u001B[39;00m\n\u001B[0;32m 209\u001B[0m \u001B[38;5;66;03m# Queue data in a list\u001B[39;00m\n\u001B[0;32m 210\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mdata\u001B[38;5;241m.\u001B[39mappend(temp)\n",
"\u001B[1;31mIndexError\u001B[0m: list index out of range"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Iteration: 0 of 20\n",
"Iteration: 1 of 20\n",
"Iteration: 2 of 20\n",
"Iteration: 3 of 20\n",
"Iteration: 4 of 20\n",
"Iteration: 5 of 20\n",
"Iteration: 6 of 20\n",
"Iteration: 7 of 20\n",
"Iteration: 8 of 20\n",
"Iteration: 9 of 20\n",
"Iteration: 10 of 20\n",
"Iteration: 11 of 20\n",
"Iteration: 12 of 20\n",
"Iteration: 13 of 20\n",
"Iteration: 14 of 20\n",
"Iteration: 15 of 20\n",
"Iteration: 16 of 20\n",
"Iteration: 17 of 20\n",
"Iteration: 18 of 20\n",
"Iteration: 19 of 20\n",
"Iteration: 20 of 20\n",
"\n",
"Saving data ...\n",
"\n",
"Data saved ...\n"
]
},
{
"ename": "SerialException",
"evalue": "could not open port 'COM6': PermissionError(13, 'Acesso negado.', None, 5)",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mSerialException\u001B[0m Traceback (most recent call last)",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\pydaq\\guis\\senddata_arduino_widget.py:85\u001B[0m, in \u001B[0;36mSendData_Arduino_Widget.start_func_send_data\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 81\u001B[0m s\u001B[38;5;241m.\u001B[39merror_path \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mTrue\u001B[39;00m\n\u001B[0;32m 83\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m s\u001B[38;5;241m.\u001B[39merror_path:\n\u001B[0;32m 84\u001B[0m \u001B[38;5;66;03m# Calling send data method\u001B[39;00m\n\u001B[1;32m---> 85\u001B[0m \u001B[43ms\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43msend_data_arduino\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 86\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39msignals\u001B[38;5;241m.\u001B[39mreturned\u001B[38;5;241m.\u001B[39memit(s)\n",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\pydaq\\send_data.py:176\u001B[0m, in \u001B[0;36mSendData.send_data_arduino\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 173\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mcycles \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlen\u001B[39m(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mdata)\n\u001B[0;32m 175\u001B[0m \u001B[38;5;66;03m# Opening ports and serial communication\u001B[39;00m\n\u001B[1;32m--> 176\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_open_serial\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 178\u001B[0m \u001B[38;5;66;03m# Rearranjing data to be send and also loaded data\u001B[39;00m\n\u001B[0;32m 179\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mdata_send \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlist\u001B[39m(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mdata)\u001B[38;5;241m.\u001B[39mcopy()\n",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\pydaq\\utils\\base.py:58\u001B[0m, in \u001B[0;36mBase._open_serial\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 55\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mser\u001B[38;5;241m.\u001B[39mport \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mcom_port \u001B[38;5;66;03m# Defining port\u001B[39;00m\n\u001B[0;32m 57\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mser\u001B[38;5;241m.\u001B[39misOpen(): \u001B[38;5;66;03m# Open port if not openned\u001B[39;00m\n\u001B[1;32m---> 58\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mser\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mopen\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\venv\\lib\\site-packages\\serial\\serialwin32.py:64\u001B[0m, in \u001B[0;36mSerial.open\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 62\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_port_handle \u001B[38;5;241m==\u001B[39m win32\u001B[38;5;241m.\u001B[39mINVALID_HANDLE_VALUE:\n\u001B[0;32m 63\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_port_handle \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mNone\u001B[39;00m \u001B[38;5;66;03m# 'cause __del__ is called anyway\u001B[39;00m\n\u001B[1;32m---> 64\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m SerialException(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mcould not open port \u001B[39m\u001B[38;5;132;01m{!r}\u001B[39;00m\u001B[38;5;124m: \u001B[39m\u001B[38;5;132;01m{!r}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;241m.\u001B[39mformat(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mportstr, ctypes\u001B[38;5;241m.\u001B[39mWinError()))\n\u001B[0;32m 66\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[0;32m 67\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_overlapped_read \u001B[38;5;241m=\u001B[39m win32\u001B[38;5;241m.\u001B[39mOVERLAPPED()\n",
"\u001B[1;31mSerialException\u001B[0m: could not open port 'COM6': PermissionError(13, 'Acesso negado.', None, 5)"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"21\n",
"Iteration: 0 of 20\n"
]
},
{
"ename": "SerialException",
"evalue": "could not open port 'COM6': PermissionError(13, 'Acesso negado.', None, 5)",
"output_type": "error",
"traceback": [
"\u001B[1;31m---------------------------------------------------------------------------\u001B[0m",
"\u001B[1;31mSerialException\u001B[0m Traceback (most recent call last)",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\pydaq\\guis\\senddata_arduino_widget.py:85\u001B[0m, in \u001B[0;36mSendData_Arduino_Widget.start_func_send_data\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 81\u001B[0m s\u001B[38;5;241m.\u001B[39merror_path \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mTrue\u001B[39;00m\n\u001B[0;32m 83\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m s\u001B[38;5;241m.\u001B[39merror_path:\n\u001B[0;32m 84\u001B[0m \u001B[38;5;66;03m# Calling send data method\u001B[39;00m\n\u001B[1;32m---> 85\u001B[0m \u001B[43ms\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43msend_data_arduino\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 86\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39msignals\u001B[38;5;241m.\u001B[39mreturned\u001B[38;5;241m.\u001B[39memit(s)\n",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\pydaq\\send_data.py:176\u001B[0m, in \u001B[0;36mSendData.send_data_arduino\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 173\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mcycles \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlen\u001B[39m(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mdata)\n\u001B[0;32m 175\u001B[0m \u001B[38;5;66;03m# Opening ports and serial communication\u001B[39;00m\n\u001B[1;32m--> 176\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43m_open_serial\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n\u001B[0;32m 178\u001B[0m \u001B[38;5;66;03m# Rearranjing data to be send and also loaded data\u001B[39;00m\n\u001B[0;32m 179\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mdata_send \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mlist\u001B[39m(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mdata)\u001B[38;5;241m.\u001B[39mcopy()\n",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\pydaq\\utils\\base.py:58\u001B[0m, in \u001B[0;36mBase._open_serial\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 55\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mser\u001B[38;5;241m.\u001B[39mport \u001B[38;5;241m=\u001B[39m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mcom_port \u001B[38;5;66;03m# Defining port\u001B[39;00m\n\u001B[0;32m 57\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;129;01mnot\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mser\u001B[38;5;241m.\u001B[39misOpen(): \u001B[38;5;66;03m# Open port if not openned\u001B[39;00m\n\u001B[1;32m---> 58\u001B[0m \u001B[38;5;28;43mself\u001B[39;49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mser\u001B[49m\u001B[38;5;241;43m.\u001B[39;49m\u001B[43mopen\u001B[49m\u001B[43m(\u001B[49m\u001B[43m)\u001B[49m\n",
"File \u001B[1;32mD:\\Outros Codigos\\Pydaq_Pyside6\\pydaq\\venv\\lib\\site-packages\\serial\\serialwin32.py:64\u001B[0m, in \u001B[0;36mSerial.open\u001B[1;34m(self)\u001B[0m\n\u001B[0;32m 62\u001B[0m \u001B[38;5;28;01mif\u001B[39;00m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_port_handle \u001B[38;5;241m==\u001B[39m win32\u001B[38;5;241m.\u001B[39mINVALID_HANDLE_VALUE:\n\u001B[0;32m 63\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_port_handle \u001B[38;5;241m=\u001B[39m \u001B[38;5;28;01mNone\u001B[39;00m \u001B[38;5;66;03m# 'cause __del__ is called anyway\u001B[39;00m\n\u001B[1;32m---> 64\u001B[0m \u001B[38;5;28;01mraise\u001B[39;00m SerialException(\u001B[38;5;124m\"\u001B[39m\u001B[38;5;124mcould not open port \u001B[39m\u001B[38;5;132;01m{!r}\u001B[39;00m\u001B[38;5;124m: \u001B[39m\u001B[38;5;132;01m{!r}\u001B[39;00m\u001B[38;5;124m\"\u001B[39m\u001B[38;5;241m.\u001B[39mformat(\u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39mportstr, ctypes\u001B[38;5;241m.\u001B[39mWinError()))\n\u001B[0;32m 66\u001B[0m \u001B[38;5;28;01mtry\u001B[39;00m:\n\u001B[0;32m 67\u001B[0m \u001B[38;5;28mself\u001B[39m\u001B[38;5;241m.\u001B[39m_overlapped_read \u001B[38;5;241m=\u001B[39m win32\u001B[38;5;241m.\u001B[39mOVERLAPPED()\n",
"\u001B[1;31mSerialException\u001B[0m: could not open port 'COM6': PermissionError(13, 'Acesso negado.', None, 5)"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Iteration: 1 of 20\n",
"Iteration: 2 of 20\n",
"Iteration: 3 of 20\n",
"Iteration: 4 of 20\n",
"Iteration: 5 of 20\n",
"Iteration: 6 of 20\n",
"Iteration: 7 of 20\n",
"Iteration: 8 of 20\n",
"Iteration: 9 of 20\n",
"Iteration: 10 of 20\n",
"Iteration: 11 of 20\n",
"Iteration: 12 of 20\n",
"Iteration: 13 of 20\n",
"Iteration: 14 of 20\n",
"Iteration: 15 of 20\n",
"Iteration: 16 of 20\n",
"Iteration: 17 of 20\n",
"Iteration: 18 of 20\n",
"Iteration: 19 of 20\n",
"Iteration: 20 of 20\n"
]
}
],
"execution_count": 1
"outputs": [],
"execution_count": null
},
{
"metadata": {},
Expand Down

0 comments on commit 2255e9d

Please sign in to comment.