boris-behav-obs 9.7.7__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.
Potentially problematic release.
This version of boris-behav-obs might be problematic. Click here for more details.
- boris/__init__.py +26 -0
- boris/__main__.py +25 -0
- boris/about.py +143 -0
- boris/add_modifier.py +635 -0
- boris/add_modifier_ui.py +303 -0
- boris/advanced_event_filtering.py +455 -0
- boris/analysis_plugins/__init__.py +0 -0
- boris/analysis_plugins/_latency.py +59 -0
- boris/analysis_plugins/irr_cohen_kappa.py +109 -0
- boris/analysis_plugins/irr_cohen_kappa_with_modifiers.py +112 -0
- boris/analysis_plugins/irr_weighted_cohen_kappa.py +157 -0
- boris/analysis_plugins/irr_weighted_cohen_kappa_with_modifiers.py +162 -0
- boris/analysis_plugins/list_of_dataframe_columns.py +22 -0
- boris/analysis_plugins/number_of_occurences.py +22 -0
- boris/analysis_plugins/number_of_occurences_by_independent_variable.py +54 -0
- boris/analysis_plugins/time_budget.py +61 -0
- boris/behav_coding_map_creator.py +1110 -0
- boris/behavior_binary_table.py +305 -0
- boris/behaviors_coding_map.py +239 -0
- boris/boris_cli.py +340 -0
- boris/cmd_arguments.py +49 -0
- boris/coding_pad.py +280 -0
- boris/config.py +785 -0
- boris/config_file.py +356 -0
- boris/connections.py +409 -0
- boris/converters.py +333 -0
- boris/converters_ui.py +225 -0
- boris/cooccurence.py +250 -0
- boris/core.py +5901 -0
- boris/core_qrc.py +15958 -0
- boris/core_ui.py +1107 -0
- boris/db_functions.py +324 -0
- boris/dev.py +134 -0
- boris/dialog.py +1108 -0
- boris/duration_widget.py +238 -0
- boris/edit_event.py +245 -0
- boris/edit_event_ui.py +233 -0
- boris/event_operations.py +1040 -0
- boris/events_cursor.py +61 -0
- boris/events_snapshots.py +596 -0
- boris/exclusion_matrix.py +141 -0
- boris/export_events.py +1006 -0
- boris/export_observation.py +1203 -0
- boris/external_processes.py +332 -0
- boris/geometric_measurement.py +941 -0
- boris/gui_utilities.py +135 -0
- boris/image_overlay.py +72 -0
- boris/import_observations.py +242 -0
- boris/ipc_mpv.py +325 -0
- boris/irr.py +634 -0
- boris/latency.py +244 -0
- boris/measurement_widget.py +161 -0
- boris/media_file.py +115 -0
- boris/menu_options.py +213 -0
- boris/modifier_coding_map_creator.py +1013 -0
- boris/modifiers_coding_map.py +157 -0
- boris/mpv.py +2016 -0
- boris/mpv2.py +2193 -0
- boris/observation.py +1453 -0
- boris/observation_operations.py +2538 -0
- boris/observation_ui.py +679 -0
- boris/observations_list.py +337 -0
- boris/otx_parser.py +442 -0
- boris/param_panel.py +201 -0
- boris/param_panel_ui.py +305 -0
- boris/player_dock_widget.py +198 -0
- boris/plot_data_module.py +536 -0
- boris/plot_events.py +634 -0
- boris/plot_events_rt.py +237 -0
- boris/plot_spectrogram_rt.py +316 -0
- boris/plot_waveform_rt.py +230 -0
- boris/plugins.py +431 -0
- boris/portion/__init__.py +31 -0
- boris/portion/const.py +95 -0
- boris/portion/dict.py +365 -0
- boris/portion/func.py +52 -0
- boris/portion/interval.py +581 -0
- boris/portion/io.py +181 -0
- boris/preferences.py +510 -0
- boris/preferences_ui.py +770 -0
- boris/project.py +2007 -0
- boris/project_functions.py +2041 -0
- boris/project_import_export.py +1096 -0
- boris/project_ui.py +794 -0
- boris/qrc_boris.py +10389 -0
- boris/qrc_boris5.py +2579 -0
- boris/select_modifiers.py +312 -0
- boris/select_observations.py +210 -0
- boris/select_subj_behav.py +286 -0
- boris/state_events.py +197 -0
- boris/subjects_pad.py +106 -0
- boris/synthetic_time_budget.py +290 -0
- boris/time_budget_functions.py +1136 -0
- boris/time_budget_widget.py +1039 -0
- boris/transitions.py +365 -0
- boris/utilities.py +1810 -0
- boris/version.py +24 -0
- boris/video_equalizer.py +159 -0
- boris/video_equalizer_ui.py +248 -0
- boris/video_operations.py +310 -0
- boris/view_df.py +104 -0
- boris/view_df_ui.py +75 -0
- boris/write_event.py +538 -0
- boris_behav_obs-9.7.7.dist-info/METADATA +139 -0
- boris_behav_obs-9.7.7.dist-info/RECORD +109 -0
- boris_behav_obs-9.7.7.dist-info/WHEEL +5 -0
- boris_behav_obs-9.7.7.dist-info/entry_points.txt +2 -0
- boris_behav_obs-9.7.7.dist-info/licenses/LICENSE.TXT +674 -0
- boris_behav_obs-9.7.7.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""
|
|
2
|
+
BORIS
|
|
3
|
+
Behavioral Observation Research Interactive Software
|
|
4
|
+
Copyright 2012-2025 Olivier Friard
|
|
5
|
+
|
|
6
|
+
This file is part of BORIS.
|
|
7
|
+
|
|
8
|
+
BORIS is free software; you can redistribute it and/or modify
|
|
9
|
+
it under the terms of the GNU General Public License as published by
|
|
10
|
+
the Free Software Foundation; either version 3 of the License, or
|
|
11
|
+
any later version.
|
|
12
|
+
|
|
13
|
+
BORIS is distributed in the hope that it will be useful,
|
|
14
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
15
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
16
|
+
GNU General Public License for more details.
|
|
17
|
+
|
|
18
|
+
You should have received a copy of the GNU General Public License
|
|
19
|
+
along with this program; if not see <http://www.gnu.org/licenses/>.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
import binascii
|
|
24
|
+
|
|
25
|
+
from PySide6.QtCore import Signal, QPoint, Qt
|
|
26
|
+
from PySide6.QtGui import QPen, QPixmap, QBrush, QMouseEvent, QPolygonF, QColor
|
|
27
|
+
from PySide6.QtWidgets import (
|
|
28
|
+
QDialog,
|
|
29
|
+
QGraphicsView,
|
|
30
|
+
QGraphicsScene,
|
|
31
|
+
QLineEdit,
|
|
32
|
+
QVBoxLayout,
|
|
33
|
+
QHBoxLayout,
|
|
34
|
+
QSpacerItem,
|
|
35
|
+
QSizePolicy,
|
|
36
|
+
QPushButton,
|
|
37
|
+
QGraphicsPixmapItem,
|
|
38
|
+
QGraphicsPolygonItem,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class ModifiersCodingMapWindow(QDialog):
|
|
43
|
+
class View(QGraphicsView):
|
|
44
|
+
mousePress = Signal(QMouseEvent)
|
|
45
|
+
|
|
46
|
+
def mousePressEvent(self, event):
|
|
47
|
+
self.mousePress.emit(event)
|
|
48
|
+
|
|
49
|
+
start = 0
|
|
50
|
+
elList = []
|
|
51
|
+
points = []
|
|
52
|
+
|
|
53
|
+
def __init__(self, parent):
|
|
54
|
+
QGraphicsView.__init__(self, parent)
|
|
55
|
+
self.setScene(QGraphicsScene(self))
|
|
56
|
+
self.scene().update()
|
|
57
|
+
|
|
58
|
+
def __init__(self, modifiers_coding_map):
|
|
59
|
+
super(ModifiersCodingMapWindow, self).__init__()
|
|
60
|
+
|
|
61
|
+
self.areasList = {}
|
|
62
|
+
self.polygonsList2 = {}
|
|
63
|
+
self.codeSeparator = ","
|
|
64
|
+
|
|
65
|
+
self.codingMap = modifiers_coding_map
|
|
66
|
+
self.setWindowTitle(f"Modifiers coding map: {self.codingMap['name']}")
|
|
67
|
+
Vlayout = QVBoxLayout(self)
|
|
68
|
+
|
|
69
|
+
self.view = self.View(self)
|
|
70
|
+
self.view.mousePress.connect(self.viewMousePressEvent)
|
|
71
|
+
|
|
72
|
+
self.leareaCode = QLineEdit(self)
|
|
73
|
+
self.leareaCode.setVisible(True)
|
|
74
|
+
|
|
75
|
+
Vlayout.addWidget(self.view)
|
|
76
|
+
Vlayout.addWidget(self.leareaCode)
|
|
77
|
+
|
|
78
|
+
hBoxLayout = QHBoxLayout(self)
|
|
79
|
+
|
|
80
|
+
spacerItem = QSpacerItem(241, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
81
|
+
hBoxLayout.addItem(spacerItem)
|
|
82
|
+
|
|
83
|
+
self.pbCancel = QPushButton("Cancel", clicked=self.reject)
|
|
84
|
+
hBoxLayout.addWidget(self.pbCancel)
|
|
85
|
+
|
|
86
|
+
self.btDone = QPushButton("Done", self, clicked=self.accept)
|
|
87
|
+
self.btDone.setVisible(True)
|
|
88
|
+
|
|
89
|
+
hBoxLayout.addWidget(self.btDone)
|
|
90
|
+
|
|
91
|
+
Vlayout.addLayout(hBoxLayout)
|
|
92
|
+
|
|
93
|
+
self.setLayout(Vlayout)
|
|
94
|
+
|
|
95
|
+
self.loadMap()
|
|
96
|
+
|
|
97
|
+
def viewMousePressEvent(self, event):
|
|
98
|
+
"""
|
|
99
|
+
insert clicked areas codes
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
test = self.view.mapToScene(event.pos()).toPoint()
|
|
103
|
+
|
|
104
|
+
for code in self.polygonsList2:
|
|
105
|
+
if self.polygonsList2[code].contains(test):
|
|
106
|
+
codes = self.leareaCode.text().split(self.codeSeparator)
|
|
107
|
+
if "" in codes:
|
|
108
|
+
codes.remove("")
|
|
109
|
+
|
|
110
|
+
# check if code already in codes list
|
|
111
|
+
if code in codes:
|
|
112
|
+
codes.remove(code)
|
|
113
|
+
else:
|
|
114
|
+
codes.append(code)
|
|
115
|
+
|
|
116
|
+
self.leareaCode.setText(self.codeSeparator.join(sorted(codes)))
|
|
117
|
+
|
|
118
|
+
def getCodes(self):
|
|
119
|
+
return self.leareaCode.text()
|
|
120
|
+
|
|
121
|
+
def loadMap(self):
|
|
122
|
+
"""
|
|
123
|
+
load bitmap from data
|
|
124
|
+
show it in view scene
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
self.areasList = self.codingMap
|
|
128
|
+
|
|
129
|
+
bitmapContent = binascii.a2b_base64(self.areasList["bitmap"])
|
|
130
|
+
|
|
131
|
+
pixmap = QPixmap()
|
|
132
|
+
pixmap.loadFromData(bitmapContent)
|
|
133
|
+
|
|
134
|
+
self.view.setSceneRect(0, 0, pixmap.size().width(), pixmap.size().height())
|
|
135
|
+
pixItem = QGraphicsPixmapItem(pixmap)
|
|
136
|
+
pixItem.setPos(0, 0)
|
|
137
|
+
self.view.scene().addItem(pixItem)
|
|
138
|
+
|
|
139
|
+
for area in self.areasList["areas"]:
|
|
140
|
+
points = self.areasList["areas"][area]["geometry"]
|
|
141
|
+
|
|
142
|
+
newPolygon = QPolygonF()
|
|
143
|
+
for p in points:
|
|
144
|
+
newPolygon.append(QPoint(p[0], p[1]))
|
|
145
|
+
|
|
146
|
+
clr = QColor()
|
|
147
|
+
clr.setRgba(self.areasList["areas"][area]["color"])
|
|
148
|
+
|
|
149
|
+
# draw polygon
|
|
150
|
+
polygon = QGraphicsPolygonItem(newPolygon)
|
|
151
|
+
|
|
152
|
+
polygon.setPen(QPen(clr, 0, Qt.NoPen, Qt.RoundCap, Qt.RoundJoin))
|
|
153
|
+
|
|
154
|
+
polygon.setBrush(QBrush(clr, Qt.SolidPattern))
|
|
155
|
+
|
|
156
|
+
self.view.scene().addItem(polygon)
|
|
157
|
+
self.polygonsList2[area] = polygon
|