boris-behav-obs 8.27.2__py2.py3-none-any.whl → 8.27.4__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/export_events.py CHANGED
@@ -461,6 +461,8 @@ def export_aggregated_events(self):
461
461
  _, max_modifiers = export_observation.export_aggregated_events(self.pj, parameters, obs_id)
462
462
  tot_max_modifiers = max(tot_max_modifiers, max_modifiers)
463
463
 
464
+ logging.debug(f"tot_max_modifiers: {tot_max_modifiers}")
465
+
464
466
  data_grouped_obs = tablib.Dataset()
465
467
 
466
468
  mem_command: str = "" # remember user choice when file already exists
@@ -517,6 +519,8 @@ def export_aggregated_events(self):
517
519
  if not r:
518
520
  QMessageBox.warning(None, cfg.programName, msg, QMessageBox.Ok | QMessageBox.Default, QMessageBox.NoButton)
519
521
 
522
+ """
523
+ # disabled after introduction of the force_number_modifiers parameter in export_aggregated_events function
520
524
  if len(data_single_obs_sorted) and max_modifiers < tot_max_modifiers:
521
525
  for i in range(tot_max_modifiers - max_modifiers):
522
526
  data_single_obs_sorted.insert_col(
@@ -524,9 +528,12 @@ def export_aggregated_events(self):
524
528
  col=[""] * (len(list(data_single_obs_sorted))),
525
529
  header=f"Modif #{i}",
526
530
  )
531
+ """
532
+
527
533
  data_grouped_obs.extend(data_single_obs_sorted)
528
534
 
529
535
  data_grouped_obs_all = tablib.Dataset(headers=list(fields_type(tot_max_modifiers).keys()))
536
+
530
537
  data_grouped_obs_all.extend(data_grouped_obs)
531
538
  data_grouped_obs_all.title = "Aggregated events"
532
539
 
boris/preferences_ui.py CHANGED
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
- # Form implementation generated from reading ui file 'preferences.ui'
3
+ # Form implementation generated from reading ui file 'boris/preferences.ui'
4
4
  #
5
5
  # Created by: PyQt5 UI code generator 5.15.6
6
6
  #
@@ -331,7 +331,7 @@ class Ui_prefDialog(object):
331
331
  self.pb_reset_category_colors.setText(_translate("prefDialog", "Reset colors to default"))
332
332
  self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_colors), _translate("prefDialog", "Plot colors"))
333
333
  self.label_9.setText(_translate("prefDialog", "Toolbar icons size"))
334
- self.cb_darkmode.setText(_translate("prefDialog", "Dark mode"))
334
+ self.cb_darkmode.setText(_translate("prefDialog", "Dark mode (should be necessary to relaunch BORIS)"))
335
335
  self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_interface), _translate("prefDialog", "Interface"))
336
336
  self.pb_refresh.setText(_translate("prefDialog", "Refresh"))
337
337
  self.pbCancel.setText(_translate("prefDialog", "Cancel"))
boris/project.py CHANGED
@@ -578,7 +578,7 @@ class projectDialog(QDialog, Ui_dlgProject):
578
578
  # convert modifier shortcuts
579
579
  if self.twBehaviors.item(row, cfg.behavioursFields[cfg.MODIFIERS]).text():
580
580
  modifiers_dict = (
581
- eval(self.twBehaviors.item(row, cfg.behavioursFields[cfg.MODIFIERS]).text())
581
+ json.loads(self.twBehaviors.item(row, cfg.behavioursFields[cfg.MODIFIERS]).text())
582
582
  if self.twBehaviors.item(row, cfg.behavioursFields[cfg.MODIFIERS]).text()
583
583
  else {}
584
584
  )
@@ -593,7 +593,7 @@ class projectDialog(QDialog, Ui_dlgProject):
593
593
  except Exception:
594
594
  logging.warning("error during conversion of modifier short cut to lower case")
595
595
 
596
- self.twBehaviors.item(row, cfg.behavioursFields[cfg.MODIFIERS]).setText(str(modifiers_dict))
596
+ self.twBehaviors.item(row, cfg.behavioursFields[cfg.MODIFIERS]).setText(json.dumps(modifiers_dict))
597
597
 
598
598
  def convert_subjects_keys_to_lower_case(self):
599
599
  """
@@ -796,7 +796,7 @@ class projectDialog(QDialog, Ui_dlgProject):
796
796
  else:
797
797
  QMessageBox.information(self, cfg.programName, "Change the behavior type on first column to select a coding map")
798
798
 
799
- # check if double click on category
799
+ # check if double click on behavior type
800
800
  if column == cfg.behavioursFields["type"]:
801
801
  self.behavior_type_doubleclicked(row)
802
802
 
@@ -808,6 +808,7 @@ class projectDialog(QDialog, Ui_dlgProject):
808
808
  if column == cfg.behavioursFields[cfg.BEHAVIOR_CATEGORY]:
809
809
  self.category_doubleclicked(row)
810
810
 
811
+ # check if double click on modifiers
811
812
  if column == cfg.behavioursFields[cfg.MODIFIERS]:
812
813
  # check if behavior has coding map
813
814
  if (
@@ -1735,12 +1736,6 @@ class projectDialog(QDialog, Ui_dlgProject):
1735
1736
  QMessageBox.critical(self, cfg.programName, "Error removing leading/trailing spaces in modifiers")
1736
1737
 
1737
1738
  else:
1738
- """
1739
- if row["modifiers"]:
1740
- row["modifiers"] = eval(row["modifiers"])
1741
- else:
1742
- row["modifiers"] = {}
1743
- """
1744
1739
  row["modifiers"] = json.loads(row["modifiers"]) if row["modifiers"] else {}
1745
1740
  else:
1746
1741
  row[field] = ""
@@ -133,7 +133,7 @@ def export_ethogram(self) -> None:
133
133
  # modifiers
134
134
  if self.twBehaviors.item(r, cfg.behavioursFields[cfg.MODIFIERS]).text():
135
135
  # modifiers a string
136
- modifiers_dict = eval(self.twBehaviors.item(r, cfg.behavioursFields[cfg.MODIFIERS]).text())
136
+ modifiers_dict = json.loads(self.twBehaviors.item(r, cfg.behavioursFields[cfg.MODIFIERS]).text())
137
137
  modifiers_list = []
138
138
  for key in modifiers_dict:
139
139
  values = ",".join(modifiers_dict[key]["values"])
@@ -350,19 +350,22 @@ def import_ethogram_from_dict(self, project: dict):
350
350
  item.setBackground(QColor(230, 230, 230))
351
351
 
352
352
  else:
353
- if field == cfg.MODIFIERS and isinstance(project[cfg.ETHOGRAM][i][field], str):
354
- modif_set_dict = {}
355
- if project[cfg.ETHOGRAM][i][field]:
356
- modif_set_list = project[cfg.ETHOGRAM][i][field].split("|")
357
- for modif_set in modif_set_list:
358
- modif_set_dict[str(len(modif_set_dict))] = {
359
- "name": "",
360
- "type": cfg.SINGLE_SELECTION,
361
- "values": modif_set.split(","),
362
- }
363
- project[cfg.ETHOGRAM][i][field] = dict(modif_set_dict)
364
-
365
- item.setText(str(project[cfg.ETHOGRAM][i][field]))
353
+ if field == cfg.MODIFIERS:
354
+ if isinstance(project[cfg.ETHOGRAM][i][field], str):
355
+ modif_set_dict = {}
356
+ if project[cfg.ETHOGRAM][i][field]:
357
+ modif_set_list = project[cfg.ETHOGRAM][i][field].split("|")
358
+ for modif_set in modif_set_list:
359
+ modif_set_dict[str(len(modif_set_dict))] = {
360
+ "name": "",
361
+ "type": cfg.SINGLE_SELECTION,
362
+ "values": modif_set.split(","),
363
+ }
364
+ project[cfg.ETHOGRAM][i][field] = dict(modif_set_dict)
365
+ else:
366
+ item.setText(json.dumps(project[cfg.ETHOGRAM][i][field]))
367
+ else:
368
+ item.setText(project[cfg.ETHOGRAM][i][field])
366
369
 
367
370
  if field not in cfg.ETHOGRAM_EDITABLE_FIELDS:
368
371
  item.setFlags(Qt.ItemIsEnabled)
@@ -425,7 +428,10 @@ def load_dataframe_into_behaviors_tablewidget(self, df: pd.DataFrame) -> int:
425
428
  for _, row in df.iterrows():
426
429
  behavior = {"coding map": ""}
427
430
  for x in ethogram_header:
428
- behavior[x] = row[ethogram_header[x].upper()] if str(row[ethogram_header[x].upper()]) != "nan" else ""
431
+ if ethogram_header[x].upper() in row:
432
+ behavior[x] = row[ethogram_header[x].upper()] if str(row[ethogram_header[x].upper()]) != "nan" else ""
433
+ else:
434
+ behavior[x] = ""
429
435
 
430
436
  self.twBehaviors.setRowCount(self.twBehaviors.rowCount() + 1)
431
437
 
@@ -460,8 +466,11 @@ def load_dataframe_into_behaviors_tablewidget(self, df: pd.DataFrame) -> int:
460
466
 
461
467
 
462
468
  def import_behaviors_from_project(self):
469
+ """
470
+ import ethogram from a BORIS project file
471
+ """
463
472
  fn = QFileDialog().getOpenFileName(
464
- self, "Import behaviors from project file", "", ("Project files (*.boris *.boris.gz);;" "All files (*)")
473
+ self, "Import behaviors from BORIS project file", "", ("Project files (*.boris *.boris.gz);;" "All files (*)")
465
474
  )
466
475
  file_name = fn[0] if type(fn) is tuple else fn
467
476
 
@@ -474,7 +483,7 @@ def import_behaviors_from_project(self):
474
483
 
475
484
  def import_behaviors_from_text_file(self):
476
485
  """
477
- Import behaviors from text file (CSV or TSV)
486
+ Import ethogram from text file (CSV or TSV)
478
487
  """
479
488
 
480
489
  if self.twBehaviors.rowCount():
boris/version.py CHANGED
@@ -20,5 +20,5 @@ This file is part of BORIS.
20
20
 
21
21
  """
22
22
 
23
- __version__ = "8.27.2"
24
- __version_date__ = "2024-07-03"
23
+ __version__ = "8.27.4"
24
+ __version_date__ = "2024-08-20"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: boris-behav-obs
3
- Version: 8.27.2
3
+ Version: 8.27.4
4
4
  Summary: BORIS - Behavioral Observation Research Interactive Software
5
5
  Author-email: Olivier Friard <olivier.friard@unito.it>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -696,18 +696,18 @@ Classifier: Operating System :: OS Independent
696
696
  Requires-Python: >=3.8
697
697
  Description-Content-Type: text/x-rst
698
698
  License-File: LICENSE.TXT
699
- Requires-Dist: exifread >=3.0.0
700
- Requires-Dist: numpy >=1.26.4
701
- Requires-Dist: matplotlib >=3.3.3
702
- Requires-Dist: pandas >=2.2.2
703
- Requires-Dist: tablib[cli,html,ods,pandas,xls,xlsx] >=3
704
- Requires-Dist: pyqt5 >=5.15
699
+ Requires-Dist: exifread>=3.0.0
700
+ Requires-Dist: numpy>=1.26.4
701
+ Requires-Dist: matplotlib>=3.3.3
702
+ Requires-Dist: pandas>=2.2.2
703
+ Requires-Dist: tablib[cli,html,ods,pandas,xls,xlsx]>=3
704
+ Requires-Dist: pyqt5>=5.15
705
705
  Requires-Dist: pyreadr
706
706
  Provides-Extra: dev
707
- Requires-Dist: black ; extra == 'dev'
708
- Requires-Dist: ruff ; extra == 'dev'
709
- Requires-Dist: pytest ; extra == 'dev'
710
- Requires-Dist: pytest-cov ; extra == 'dev'
707
+ Requires-Dist: black; extra == "dev"
708
+ Requires-Dist: ruff; extra == "dev"
709
+ Requires-Dist: pytest; extra == "dev"
710
+ Requires-Dist: pytest-cov; extra == "dev"
711
711
 
712
712
  ===============================================================
713
713
  BORIS (Behavioral Observation Research Interactive Software)
@@ -29,7 +29,7 @@ boris/event_operations.py,sha256=JYIZC4ObShZ-SPxNQaQZwKs8xJn4Dj0lvIiNgzc28Jo,389
29
29
  boris/events_cursor.py,sha256=Jfu7yV1MG7HikNmMQmOVJ7ntmEZzDZn5HHp3va8llwM,1983
30
30
  boris/events_snapshots.py,sha256=BGfIba0_TxHW2UHaEOZF7hqM1jv5roI6KaGuWajfavg,27580
31
31
  boris/exclusion_matrix.py,sha256=xaEFLy2Zv5SWryMz1D0cEpywsAuZxZuBaaGYLaBGhng,5270
32
- boris/export_events.py,sha256=35tu9K9kEXlossdWjTNs74YuIs-ZQBSzw7MRnRIUK3Q,37826
32
+ boris/export_events.py,sha256=leFq9QXSF6cTwK5TBAOjbv2Tco1im5Rk-RfU8E_On80,38029
33
33
  boris/export_observation.py,sha256=TC_Mxyor5e0HZViG9xxAX_V18i61ihFnVmhioNOy_Dw,49821
34
34
  boris/external_processes.py,sha256=069iEVOfDI-7zUYPH7WlYBEnKqTR18mjj8dReBkUACE,11965
35
35
  boris/geometric_measurement.py,sha256=jd6HiWJNrjqRInG452a8Ke44Zj4QyNSYa9JKO8DZzOo,34609
@@ -59,10 +59,10 @@ boris/plot_events_rt.py,sha256=UfO1NKSqBR7j-vnfG8CKuOcdg5o8QQI_0eYdcz29Ufc,8358
59
59
  boris/plot_spectrogram_rt.py,sha256=yc8ifg9HCl-v_upMHkH_rmIZLhWBYkWBOhtKftvRvh0,8394
60
60
  boris/plot_waveform_rt.py,sha256=kNk6NVjM3wT3MpAw5zE9ktH94Pkd2AJ4ppv6uM6BVBc,7502
61
61
  boris/preferences.py,sha256=W_BHck8lxODvZ9NzIgfvhvXAwUI5A66aJVmdTRTxZMo,11494
62
- boris/preferences_ui.py,sha256=LQ46jW9kltJBQD85EHd5cCmlHG4c9N6v6YQLQvUisGM,21935
63
- boris/project.py,sha256=97dlXpLX0LNW7SfCXg3XGO-eDey0iBjy2dL63UGNPpk,83677
62
+ boris/preferences_ui.py,sha256=fz0jHW7Nqw2P68FLBqheaGrQsZATNz8d8J00TVMX_Ig,21981
63
+ boris/project.py,sha256=wMOcWsz7tA-efmHOrKe0_s5I4Vy-u1u_fUTWzxTVdp8,83465
64
64
  boris/project_functions.py,sha256=R3DS_faDuMGKTpMnV0OhqgZp9yO1ojoA5wUIXdtHNIE,70972
65
- boris/project_import_export.py,sha256=lCL4fOZuG5MaEf_wfDSHiE7-M2ZQsIbUR7KpHZjb1Uw,38097
65
+ boris/project_import_export.py,sha256=E2Jv4CQQpFxGspLZdAIxBcB-aCM7SlfobR5ZlC2QqHk,38463
66
66
  boris/project_ui.py,sha256=TRJlsqq4XbIl8k2f20BKr2PtKa0QNjFNr6UnMieZYqU,35915
67
67
  boris/qrc_boris.py,sha256=4U2cD_fIBTtsTPhirOl9I3kTArOhXWYvfuO_A0M9N0I,675001
68
68
  boris/qrc_boris5.py,sha256=6bwT8OVtIr84nVIYp2ldUL7XL6WJi9zgJow6kgRxuIQ,161601
@@ -76,7 +76,7 @@ boris/time_budget_functions.py,sha256=L-0PuPWYR33UMfqmxpcCVH-w4mLLrtZ8b8kBTmBwls
76
76
  boris/time_budget_widget.py,sha256=9WV-iKYSl1f3HBrGcL-eHDjUswrFQh6-WUcffTtce1Y,42852
77
77
  boris/transitions.py,sha256=2zucdoa2jTpWtM6nWHr8lOvjXkrQmo9j71fz_fMLALU,11998
78
78
  boris/utilities.py,sha256=07qXAQ6aGyiSC2h6RMJ031OlXYy05-KTLJtnQtXn6FU,48724
79
- boris/version.py,sha256=bNkeVv3Fjn9GoguaPyH60l06KqjwfwNCtaKjbCGDX6c,788
79
+ boris/version.py,sha256=fs3Hih6V9-QWHmasEF1Pyx9fUiAoLh6LqowVIuNvHwc,788
80
80
  boris/video_equalizer.py,sha256=QpVgmdqX_E4HnMa2f_Qo_fKJTl9nBoTQd_ykv9RWlIQ,5862
81
81
  boris/video_equalizer_ui.py,sha256=A2_Sz9AAVnJygTRUeK_YXxf-WWQpxSSlFw0MjkxiwSg,9762
82
82
  boris/video_operations.py,sha256=96jR-3snNn9VeEURRD6rCwvOL2sSHXoqlP_gYFwgO8A,9379
@@ -105,9 +105,9 @@ boris/qdarkstyle/utils/__init__.py,sha256=Nlma8-zbHoJc5n2NVT7OvwxPG5765JnsmMeGzr
105
105
  boris/qdarkstyle/utils/__main__.py,sha256=J1biUyDzfutKU1n9NdH9WnD0gFHaF-OJA4Q-n6Q2ehs,3309
106
106
  boris/qdarkstyle/utils/images.py,sha256=af-BJllzWgVoVz6QMvhFcKqvF3mo44AThaBjuAuHtNE,14444
107
107
  boris/qdarkstyle/utils/scss.py,sha256=n7WNo6pPRft8-dU7_gfjB_jA-JZAy50-S792RwR7Ri0,9366
108
- boris_behav_obs-8.27.2.dist-info/LICENSE.TXT,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
109
- boris_behav_obs-8.27.2.dist-info/METADATA,sha256=zBngfNrQRGj3JfyNdpAu5chxhZcqLMY2DisVnrZJKdY,45543
110
- boris_behav_obs-8.27.2.dist-info/WHEEL,sha256=0XQbNV6JE5ziJsWjIU8TRRv0N6SohNonLWgP86g5fiI,109
111
- boris_behav_obs-8.27.2.dist-info/entry_points.txt,sha256=fuO7JxKFLOm6xp6m3JHRA1UO_QW1dYU-F0IooA1NqQs,37
112
- boris_behav_obs-8.27.2.dist-info/top_level.txt,sha256=fJSgm62S7WesiwTorGbOO4nNN0yzgZ3klgfGi3Px4qI,6
113
- boris_behav_obs-8.27.2.dist-info/RECORD,,
108
+ boris_behav_obs-8.27.4.dist-info/LICENSE.TXT,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
109
+ boris_behav_obs-8.27.4.dist-info/METADATA,sha256=sJFqhkz8Uj1lgAcSntH461AuI4YUlExjdalt79XyxWw,45533
110
+ boris_behav_obs-8.27.4.dist-info/WHEEL,sha256=OWYSMTYHNOLxNw0Mxija-Qn3HdviNLu4kabRWA1yLB4,109
111
+ boris_behav_obs-8.27.4.dist-info/entry_points.txt,sha256=fuO7JxKFLOm6xp6m3JHRA1UO_QW1dYU-F0IooA1NqQs,37
112
+ boris_behav_obs-8.27.4.dist-info/top_level.txt,sha256=fJSgm62S7WesiwTorGbOO4nNN0yzgZ3klgfGi3Px4qI,6
113
+ boris_behav_obs-8.27.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (70.2.0)
2
+ Generator: setuptools (73.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py2-none-any
5
5
  Tag: py3-none-any