boris-behav-obs 8.27.6__py2.py3-none-any.whl → 8.27.7__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- boris/README.TXT +22 -0
- boris/add_modifier.ui +330 -0
- boris/converters.ui +289 -0
- boris/core.py +1 -1
- boris/core.qrc +67 -0
- boris/core.ui +1585 -0
- boris/edit_event.ui +240 -0
- boris/icons/logo_eye.ico +0 -0
- boris/observation.ui +848 -0
- boris/param_panel.ui +379 -0
- boris/preferences.py +2 -2
- boris/preferences.ui +588 -0
- boris/project.py +23 -5
- boris/project.ui +1074 -0
- boris/project_functions.py +19 -10
- boris/utilities.py +13 -0
- boris/version.py +2 -2
- boris_behav_obs-8.27.7.dist-info/LICENSE.TXT +674 -0
- {boris_behav_obs-8.27.6.dist-info → boris_behav_obs-8.27.7.dist-info}/METADATA +1 -1
- {boris_behav_obs-8.27.6.dist-info → boris_behav_obs-8.27.7.dist-info}/RECORD +24 -12
- {boris_behav_obs-8.27.6.dist-info → boris}/LICENSE.TXT +0 -0
- {boris_behav_obs-8.27.6.dist-info → boris_behav_obs-8.27.7.dist-info}/WHEEL +0 -0
- {boris_behav_obs-8.27.6.dist-info → boris_behav_obs-8.27.7.dist-info}/entry_points.txt +0 -0
- {boris_behav_obs-8.27.6.dist-info → boris_behav_obs-8.27.7.dist-info}/top_level.txt +0 -0
boris/project_functions.py
CHANGED
|
@@ -379,15 +379,16 @@ def check_project_integrity(
|
|
|
379
379
|
media_file_available: bool = True,
|
|
380
380
|
) -> str:
|
|
381
381
|
"""
|
|
382
|
-
check project integrity
|
|
383
|
-
check if behaviors
|
|
384
|
-
check unpaired state events
|
|
385
|
-
check if timestamp between -2147483647 and 2147483647 (2**31 - 1)
|
|
386
|
-
check if behavior belong to behavioral category that do not more exist
|
|
387
|
-
check for leading and trailing spaces and special chars in modifiers
|
|
388
|
-
check if media file are available
|
|
389
|
-
check if media length available
|
|
390
|
-
check independent variables
|
|
382
|
+
check project integrity:
|
|
383
|
+
* check if coded behaviors are defined in ethogram
|
|
384
|
+
* check unpaired state events
|
|
385
|
+
* check if timestamp between -2147483647 and 2147483647 (2**31 - 1)
|
|
386
|
+
* check if behavior belong to behavioral category that do not more exist
|
|
387
|
+
* check for leading and trailing spaces and special chars in modifiers
|
|
388
|
+
* check if media file are available (optional)
|
|
389
|
+
* check if media length available
|
|
390
|
+
* check independent variables
|
|
391
|
+
* check if coded subjects are defines
|
|
391
392
|
|
|
392
393
|
Args:
|
|
393
394
|
pj (dict): BORIS project
|
|
@@ -398,7 +399,7 @@ def check_project_integrity(
|
|
|
398
399
|
Returns:
|
|
399
400
|
str: message
|
|
400
401
|
"""
|
|
401
|
-
out = ""
|
|
402
|
+
out: str = ""
|
|
402
403
|
|
|
403
404
|
# check if coded behaviors are defined in ethogram
|
|
404
405
|
r = check_coded_behaviors(pj)
|
|
@@ -521,6 +522,14 @@ def check_project_integrity(
|
|
|
521
522
|
f" is not allowed for {var_label} (choose between {defined_set_var_label[var_label]})<br>"
|
|
522
523
|
)
|
|
523
524
|
|
|
525
|
+
# check if coded subjects are defined in the subjects list
|
|
526
|
+
subjects_list: list = [pj[cfg.SUBJECTS][x]["name"] for x in pj[cfg.SUBJECTS]]
|
|
527
|
+
coded_subjects = set(util.flatten_list([[y[1] for y in pj[cfg.OBSERVATIONS][x].get(cfg.EVENTS, [])] for x in pj[cfg.OBSERVATIONS]]))
|
|
528
|
+
|
|
529
|
+
for subject in coded_subjects:
|
|
530
|
+
if subject and subject not in subjects_list:
|
|
531
|
+
out += f"The coded subject <b>{subject}</b> is not defined in the subjects list.<br>You can use the <b>Explore project</b> to fix it.<br><br>"
|
|
532
|
+
|
|
524
533
|
return out
|
|
525
534
|
|
|
526
535
|
|
boris/utilities.py
CHANGED
|
@@ -505,6 +505,19 @@ def group_events(pj: dict, obs_id: str, include_modifiers: bool = False) -> dict
|
|
|
505
505
|
return {"error": ""}
|
|
506
506
|
|
|
507
507
|
|
|
508
|
+
def flatten_list(nested_list) -> list:
|
|
509
|
+
"""
|
|
510
|
+
Flatten a list of lists.
|
|
511
|
+
"""
|
|
512
|
+
flattened: list = []
|
|
513
|
+
for item in nested_list:
|
|
514
|
+
if isinstance(item, list):
|
|
515
|
+
flattened.extend(flatten_list(item))
|
|
516
|
+
else:
|
|
517
|
+
flattened.append(item)
|
|
518
|
+
return flattened
|
|
519
|
+
|
|
520
|
+
|
|
508
521
|
def get_current_states_modifiers_by_subject(
|
|
509
522
|
state_behaviors_codes: list, events: list, subjects: dict, time_: dec, include_modifiers: bool = False
|
|
510
523
|
) -> dict:
|
boris/version.py
CHANGED