Importing observation list from excel
Closed this issue · 1 comments
Hello!
I have been getting this error (see below) when trying to import an observation list from excel. Weirdly enough, the observation list loads into BORIS without issue, but the second I use the media player or try to edit/export the observation list the program crashes and I receive the error. I've tried different formats (.XLSX, CSV, .ODS, and .JSON) but none work (only .XLSX and .ODS load into BORIS to begin with). This error occurs through every project.
The import observation list matrix that I use is (hope you can see screenshot):
If cant see screenshot it is (time is in seconds):
time subject code modifier comment
5
10
20
Error message******
An error has occured!
to improve the software please report this problem at:
https://github.com/olivierfriard/BORIS/issues
Please no screenshot, the error message was copied to the clipboard.
Thank you for your collaboration!
BORIS version: 8.27.1
OS: Windows 10 10.0.19042
CPU: AMD64 Intel64 Family 6 Model 158 Stepping 10, GenuineIntel
Python 3.12.4 (64-bit)
Qt 5.15.2 - PyQt 5.15.10
MPV library version: 2.1
MPV library file path: C:\Users\Behave\BORIS Setup\Lib\site-packages\boris\misc\mpv-2.dll
Error succeded at 2024-07-11 15:03
Traceback (most recent call last):
File "C:\Users\Behave\BORIS Setup\Lib\site-packages\boris\core.py", line 4306, in mpv_timer_out
self.currentStates = util.get_current_states_modifiers_by_subject(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Behave\BORIS Setup\Lib\site-packages\boris\utilities.py", line 527, in get_current_states_modifiers_by_subject
if [x for x in events if x[cfg.EVENT_TIME_FIELD_IDX].is_nan()]:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'int' object has no attribute 'is_nan'
Is this a known error or am I doing something incorrectly probably (could've sworn it worked 2-3 weeks ago)?
I got it working.
I changed in utilities.py:
import numpy as np
and this line:
if [x for x in events if x[cfg.EVENT_TIME_FIELD_IDX].is_nan()]:
is changed into this line:
if [x for x in events if np.isnan(x[cfg.EVENT_TIME_FIELD_IDX])]:
Now it works to import an observation list from excel.