boris-behav-obs 8.16.6__py3-none-any.whl → 9.7.1__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/__init__.py +1 -1
- boris/__main__.py +1 -1
- boris/about.py +24 -40
- boris/add_modifier.py +88 -80
- boris/add_modifier_ui.py +235 -131
- boris/advanced_event_filtering.py +23 -29
- 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 +228 -229
- boris/behavior_binary_table.py +33 -50
- boris/behaviors_coding_map.py +17 -18
- boris/boris_cli.py +6 -25
- boris/cmd_arguments.py +12 -1
- boris/coding_pad.py +16 -34
- boris/config.py +101 -49
- boris/config_file.py +55 -64
- boris/connections.py +105 -58
- boris/converters.py +13 -37
- boris/converters_ui.py +187 -110
- boris/cooccurence.py +250 -0
- boris/core.py +2108 -1275
- boris/core_qrc.py +15892 -10829
- boris/core_ui.py +941 -806
- boris/db_functions.py +17 -42
- boris/dev.py +134 -0
- boris/dialog.py +461 -242
- boris/duration_widget.py +9 -14
- boris/edit_event.py +61 -31
- boris/edit_event_ui.py +208 -97
- boris/event_operations.py +405 -281
- boris/events_cursor.py +25 -17
- boris/events_snapshots.py +36 -82
- boris/exclusion_matrix.py +4 -9
- boris/export_events.py +180 -203
- boris/export_observation.py +60 -73
- boris/external_processes.py +123 -98
- boris/geometric_measurement.py +427 -218
- boris/gui_utilities.py +91 -14
- boris/image_overlay.py +4 -4
- boris/import_observations.py +190 -98
- boris/ipc_mpv.py +304 -0
- boris/irr.py +20 -57
- boris/latency.py +31 -24
- boris/measurement_widget.py +14 -18
- boris/media_file.py +17 -19
- boris/menu_options.py +16 -6
- boris/modifier_coding_map_creator.py +1013 -0
- boris/modifiers_coding_map.py +7 -9
- boris/mpv2.py +127 -36
- boris/observation.py +493 -210
- boris/observation_operations.py +1010 -391
- boris/observation_ui.py +573 -363
- boris/observations_list.py +51 -58
- boris/otx_parser.py +74 -68
- boris/param_panel.py +45 -59
- boris/param_panel_ui.py +254 -138
- boris/player_dock_widget.py +91 -56
- boris/plot_data_module.py +18 -53
- boris/plot_events.py +56 -153
- boris/plot_events_rt.py +16 -30
- boris/plot_spectrogram_rt.py +80 -56
- boris/plot_waveform_rt.py +23 -48
- boris/plugins.py +431 -0
- boris/portion/__init__.py +18 -8
- boris/portion/const.py +35 -18
- boris/portion/dict.py +5 -5
- boris/portion/func.py +2 -2
- boris/portion/interval.py +21 -41
- boris/portion/io.py +41 -32
- boris/preferences.py +298 -123
- boris/preferences_ui.py +664 -225
- boris/project.py +293 -270
- boris/project_functions.py +610 -537
- boris/project_import_export.py +204 -213
- boris/project_ui.py +673 -441
- boris/qrc_boris.py +6 -3
- boris/qrc_boris5.py +6 -3
- boris/select_modifiers.py +62 -90
- boris/select_observations.py +19 -197
- boris/select_subj_behav.py +67 -39
- boris/state_events.py +51 -33
- boris/subjects_pad.py +6 -8
- boris/synthetic_time_budget.py +25 -17
- boris/time_budget_functions.py +169 -169
- boris/time_budget_widget.py +71 -86
- boris/transitions.py +41 -41
- boris/utilities.py +562 -222
- boris/version.py +3 -3
- boris/video_equalizer.py +16 -14
- boris/video_equalizer_ui.py +199 -130
- boris/video_operations.py +78 -28
- boris/view_df.py +104 -0
- boris/view_df_ui.py +75 -0
- boris/write_event.py +240 -136
- boris_behav_obs-9.7.1.dist-info/METADATA +140 -0
- boris_behav_obs-9.7.1.dist-info/RECORD +109 -0
- {boris_behav_obs-8.16.6.dist-info → boris_behav_obs-9.7.1.dist-info}/WHEEL +1 -1
- boris_behav_obs-9.7.1.dist-info/entry_points.txt +2 -0
- boris/README.TXT +0 -22
- boris/add_modifier.ui +0 -323
- boris/converters.ui +0 -289
- boris/core.qrc +0 -37
- boris/core.ui +0 -1571
- boris/edit_event.ui +0 -233
- boris/icons/logo_eye.ico +0 -0
- boris/map_creator.py +0 -982
- boris/observation.ui +0 -814
- boris/param_panel.ui +0 -379
- boris/preferences.ui +0 -537
- boris/project.ui +0 -1074
- boris/vlc_local.py +0 -90
- boris_behav_obs-8.16.6.dist-info/LICENSE.TXT +0 -674
- boris_behav_obs-8.16.6.dist-info/METADATA +0 -134
- boris_behav_obs-8.16.6.dist-info/RECORD +0 -106
- boris_behav_obs-8.16.6.dist-info/entry_points.txt +0 -2
- {boris → boris_behav_obs-9.7.1.dist-info/licenses}/LICENSE.TXT +0 -0
- {boris_behav_obs-8.16.6.dist-info → boris_behav_obs-9.7.1.dist-info}/top_level.txt +0 -0
boris/portion/interval.py
CHANGED
|
@@ -2,7 +2,7 @@ from collections import namedtuple
|
|
|
2
2
|
from .const import Bound, inf
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
Atomic = namedtuple(
|
|
5
|
+
Atomic = namedtuple("Atomic", ["left", "lower", "upper", "right"])
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
def mergeable(a, b):
|
|
@@ -96,7 +96,7 @@ class Interval:
|
|
|
96
96
|
one of the helpers provided in this module (open, closed, openclosed, etc.)
|
|
97
97
|
"""
|
|
98
98
|
|
|
99
|
-
__slots__ = (
|
|
99
|
+
__slots__ = ("_intervals",)
|
|
100
100
|
|
|
101
101
|
def __init__(self, *intervals):
|
|
102
102
|
"""
|
|
@@ -111,7 +111,7 @@ class Interval:
|
|
|
111
111
|
if not interval.empty:
|
|
112
112
|
self._intervals.extend(interval._intervals)
|
|
113
113
|
else:
|
|
114
|
-
raise TypeError(
|
|
114
|
+
raise TypeError("Parameters must be Interval instances")
|
|
115
115
|
|
|
116
116
|
if len(self._intervals) == 0:
|
|
117
117
|
# So we have at least one (empty) interval
|
|
@@ -181,10 +181,7 @@ class Interval:
|
|
|
181
181
|
"""
|
|
182
182
|
True if interval is empty, False otherwise.
|
|
183
183
|
"""
|
|
184
|
-
return (
|
|
185
|
-
self.lower > self.upper or
|
|
186
|
-
(self.lower == self.upper and (self.left == Bound.OPEN or self.right == Bound.OPEN))
|
|
187
|
-
)
|
|
184
|
+
return self.lower > self.upper or (self.lower == self.upper and (self.left == Bound.OPEN or self.right == Bound.OPEN))
|
|
188
185
|
|
|
189
186
|
@property
|
|
190
187
|
def atomic(self):
|
|
@@ -307,7 +304,7 @@ class Interval:
|
|
|
307
304
|
elif isinstance(value, tuple):
|
|
308
305
|
intervals.append(Interval.from_atomic(*value))
|
|
309
306
|
else:
|
|
310
|
-
raise TypeError(
|
|
307
|
+
raise TypeError("Unsupported return type {} for {}".format(type(value), value))
|
|
311
308
|
|
|
312
309
|
return Interval(*intervals)
|
|
313
310
|
|
|
@@ -350,7 +347,7 @@ class Interval:
|
|
|
350
347
|
return True
|
|
351
348
|
return False
|
|
352
349
|
else:
|
|
353
|
-
raise TypeError(
|
|
350
|
+
raise TypeError("Unsupported type {} for {}".format(type(other), other))
|
|
354
351
|
|
|
355
352
|
def intersection(self, other):
|
|
356
353
|
"""
|
|
@@ -468,14 +465,8 @@ class Interval:
|
|
|
468
465
|
if item.empty:
|
|
469
466
|
return True
|
|
470
467
|
elif self.atomic:
|
|
471
|
-
left = item.lower > self.lower or (
|
|
472
|
-
|
|
473
|
-
(item.left == self.left or self.left == Bound.CLOSED)
|
|
474
|
-
)
|
|
475
|
-
right = item.upper < self.upper or (
|
|
476
|
-
item.upper == self.upper and
|
|
477
|
-
(item.right == self.right or self.right == Bound.CLOSED)
|
|
478
|
-
)
|
|
468
|
+
left = item.lower > self.lower or (item.lower == self.lower and (item.left == self.left or self.left == Bound.CLOSED))
|
|
469
|
+
right = item.upper < self.upper or (item.upper == self.upper and (item.right == self.right or self.right == Bound.CLOSED))
|
|
479
470
|
return left and right
|
|
480
471
|
else:
|
|
481
472
|
selfiter = iter(self)
|
|
@@ -504,13 +495,11 @@ class Interval:
|
|
|
504
495
|
def __invert__(self):
|
|
505
496
|
complements = [
|
|
506
497
|
Interval.from_atomic(Bound.OPEN, -inf, self.lower, ~self.left),
|
|
507
|
-
Interval.from_atomic(~self.right, self.upper, inf, Bound.OPEN)
|
|
498
|
+
Interval.from_atomic(~self.right, self.upper, inf, Bound.OPEN),
|
|
508
499
|
]
|
|
509
500
|
|
|
510
501
|
for i, j in zip(self._intervals[:-1], self._intervals[1:]):
|
|
511
|
-
complements.append(
|
|
512
|
-
Interval.from_atomic(~i.right, i.upper, j.lower, ~j.left)
|
|
513
|
-
)
|
|
502
|
+
complements.append(Interval.from_atomic(~i.right, i.upper, j.lower, ~j.left))
|
|
514
503
|
|
|
515
504
|
return Interval(*complements)
|
|
516
505
|
|
|
@@ -526,12 +515,7 @@ class Interval:
|
|
|
526
515
|
return False
|
|
527
516
|
|
|
528
517
|
for a, b in zip(self._intervals, other._intervals):
|
|
529
|
-
eq =
|
|
530
|
-
a.left == b.left and
|
|
531
|
-
a.lower == b.lower and
|
|
532
|
-
a.upper == b.upper and
|
|
533
|
-
a.right == b.right
|
|
534
|
-
)
|
|
518
|
+
eq = a.left == b.left and a.lower == b.lower and a.upper == b.upper and a.right == b.right
|
|
535
519
|
if not eq:
|
|
536
520
|
return False
|
|
537
521
|
return True
|
|
@@ -543,8 +527,7 @@ class Interval:
|
|
|
543
527
|
if self.right == Bound.OPEN:
|
|
544
528
|
return self.upper <= other.lower
|
|
545
529
|
else:
|
|
546
|
-
return self.upper < other.lower or
|
|
547
|
-
(self.upper == other.lower and other.left == Bound.OPEN)
|
|
530
|
+
return self.upper < other.lower or (self.upper == other.lower and other.left == Bound.OPEN)
|
|
548
531
|
else:
|
|
549
532
|
return self.upper < other or (self.right == Bound.OPEN and self.upper == other)
|
|
550
533
|
|
|
@@ -553,8 +536,7 @@ class Interval:
|
|
|
553
536
|
if self.left == Bound.OPEN:
|
|
554
537
|
return self.lower >= other.upper
|
|
555
538
|
else:
|
|
556
|
-
return self.lower > other.upper or
|
|
557
|
-
(self.lower == other.upper and other.right == Bound.OPEN)
|
|
539
|
+
return self.lower > other.upper or (self.lower == other.upper and other.right == Bound.OPEN)
|
|
558
540
|
else:
|
|
559
541
|
return self.lower > other or (self.left == Bound.OPEN and self.lower == other)
|
|
560
542
|
|
|
@@ -563,8 +545,7 @@ class Interval:
|
|
|
563
545
|
if self.right == Bound.OPEN:
|
|
564
546
|
return self.upper <= other.upper
|
|
565
547
|
else:
|
|
566
|
-
return self.upper < other.upper or
|
|
567
|
-
(self.upper == other.upper and other.right == Bound.CLOSED)
|
|
548
|
+
return self.upper < other.upper or (self.upper == other.upper and other.right == Bound.CLOSED)
|
|
568
549
|
else:
|
|
569
550
|
return self.lower < other or (self.left == Bound.CLOSED and self.lower == other)
|
|
570
551
|
|
|
@@ -573,8 +554,7 @@ class Interval:
|
|
|
573
554
|
if self.left == Bound.OPEN:
|
|
574
555
|
return self.lower >= other.lower
|
|
575
556
|
else:
|
|
576
|
-
return self.lower > other.lower or
|
|
577
|
-
(self.lower == other.lower and other.left == Bound.CLOSED)
|
|
557
|
+
return self.lower > other.lower or (self.lower == other.lower and other.left == Bound.CLOSED)
|
|
578
558
|
else:
|
|
579
559
|
return self.upper > other or (self.right == Bound.CLOSED and self.upper == other)
|
|
580
560
|
|
|
@@ -586,16 +566,16 @@ class Interval:
|
|
|
586
566
|
|
|
587
567
|
for interval in self:
|
|
588
568
|
if interval.empty:
|
|
589
|
-
intervals.append(
|
|
569
|
+
intervals.append("()")
|
|
590
570
|
elif interval.lower == interval.upper:
|
|
591
|
-
intervals.append(
|
|
571
|
+
intervals.append("[{}]".format(repr(interval.lower)))
|
|
592
572
|
else:
|
|
593
573
|
intervals.append(
|
|
594
|
-
|
|
595
|
-
|
|
574
|
+
"{}{},{}{}".format(
|
|
575
|
+
"[" if interval.left == Bound.CLOSED else "(",
|
|
596
576
|
repr(interval.lower),
|
|
597
577
|
repr(interval.upper),
|
|
598
|
-
|
|
578
|
+
"]" if interval.right == Bound.CLOSED else ")",
|
|
599
579
|
)
|
|
600
580
|
)
|
|
601
|
-
return
|
|
581
|
+
return " | ".join(intervals)
|
boris/portion/io.py
CHANGED
|
@@ -4,9 +4,20 @@ from .const import Bound, inf
|
|
|
4
4
|
from .interval import Interval
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
def from_string(
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
def from_string(
|
|
8
|
+
string,
|
|
9
|
+
conv,
|
|
10
|
+
*,
|
|
11
|
+
bound=r".+?",
|
|
12
|
+
disj=r" ?\| ?",
|
|
13
|
+
sep=r", ?",
|
|
14
|
+
left_open=r"\(",
|
|
15
|
+
left_closed=r"\[",
|
|
16
|
+
right_open=r"\)",
|
|
17
|
+
right_closed=r"\]",
|
|
18
|
+
pinf=r"\+inf",
|
|
19
|
+
ninf=r"-inf",
|
|
20
|
+
):
|
|
10
21
|
"""
|
|
11
22
|
Parse given string and create an Interval instance.
|
|
12
23
|
A converter function has to be provided to convert a bound (as string) to a value.
|
|
@@ -25,11 +36,11 @@ def from_string(string, conv, *, bound=r'.+?', disj=r' ?\| ?', sep=r', ?',
|
|
|
25
36
|
:return: an Interval instance.
|
|
26
37
|
"""
|
|
27
38
|
|
|
28
|
-
re_left_boundary = r
|
|
29
|
-
re_right_boundary = r
|
|
30
|
-
re_bounds = r
|
|
31
|
-
re_interval = r
|
|
32
|
-
re_intervals = r
|
|
39
|
+
re_left_boundary = r"(?P<left>{}|{})".format(left_open, left_closed)
|
|
40
|
+
re_right_boundary = r"(?P<right>{}|{})".format(right_open, right_closed)
|
|
41
|
+
re_bounds = r"(?P<lower>{bound})({sep}(?P<upper>{bound}))?".format(bound=bound, sep=sep)
|
|
42
|
+
re_interval = r"{}(|{}){}".format(re_left_boundary, re_bounds, re_right_boundary)
|
|
43
|
+
re_intervals = r"{}(?P<disj>{})?".format(re_interval, disj)
|
|
33
44
|
|
|
34
45
|
intervals = []
|
|
35
46
|
has_more = True
|
|
@@ -49,22 +60,23 @@ def from_string(string, conv, *, bound=r'.+?', disj=r' ?\| ?', sep=r', ?',
|
|
|
49
60
|
else:
|
|
50
61
|
group = match.groupdict()
|
|
51
62
|
|
|
52
|
-
left = Bound.CLOSED if re.match(left_closed +
|
|
53
|
-
right = Bound.CLOSED if re.match(right_closed +
|
|
63
|
+
left = Bound.CLOSED if re.match(left_closed + "$", group["left"]) else Bound.OPEN
|
|
64
|
+
right = Bound.CLOSED if re.match(right_closed + "$", group["right"]) else Bound.OPEN
|
|
54
65
|
|
|
55
|
-
lower = group.get(
|
|
56
|
-
upper = group.get(
|
|
66
|
+
lower = group.get("lower", None)
|
|
67
|
+
upper = group.get("upper", None)
|
|
57
68
|
lower = _convert(lower) if lower is not None else inf
|
|
58
69
|
upper = _convert(upper) if upper is not None else lower
|
|
59
70
|
|
|
60
71
|
intervals.append(Interval.from_atomic(left, lower, upper, right))
|
|
61
|
-
string = string[match.end():]
|
|
72
|
+
string = string[match.end() :]
|
|
62
73
|
|
|
63
74
|
return Interval(*intervals)
|
|
64
75
|
|
|
65
76
|
|
|
66
|
-
def to_string(
|
|
67
|
-
|
|
77
|
+
def to_string(
|
|
78
|
+
interval, conv=repr, *, disj=" | ", sep=",", left_open="(", left_closed="[", right_open=")", right_closed="]", pinf="+inf", ninf="-inf"
|
|
79
|
+
):
|
|
68
80
|
"""
|
|
69
81
|
Export given interval to string.
|
|
70
82
|
|
|
@@ -81,7 +93,7 @@ def to_string(interval, conv=repr, *, disj=' | ', sep=',', left_open='(',
|
|
|
81
93
|
:return: a string representation for given interval.
|
|
82
94
|
"""
|
|
83
95
|
if interval.empty:
|
|
84
|
-
return
|
|
96
|
+
return "{}{}".format(left_open, right_open)
|
|
85
97
|
|
|
86
98
|
def _convert(bound):
|
|
87
99
|
if bound == inf:
|
|
@@ -100,14 +112,14 @@ def to_string(interval, conv=repr, *, disj=' | ', sep=',', left_open='(',
|
|
|
100
112
|
upper = _convert(item.upper)
|
|
101
113
|
|
|
102
114
|
if item.lower == item.upper:
|
|
103
|
-
exported_intervals.append(
|
|
115
|
+
exported_intervals.append("{}{}{}".format(left, lower, right))
|
|
104
116
|
else:
|
|
105
|
-
exported_intervals.append(
|
|
117
|
+
exported_intervals.append("{}{}{}{}{}".format(left, lower, sep, upper, right))
|
|
106
118
|
|
|
107
119
|
return disj.join(exported_intervals)
|
|
108
120
|
|
|
109
121
|
|
|
110
|
-
def from_data(data, conv=None, *, pinf=float(
|
|
122
|
+
def from_data(data, conv=None, *, pinf=float("inf"), ninf=float("-inf")):
|
|
111
123
|
"""
|
|
112
124
|
Import an interval from a piece of data.
|
|
113
125
|
|
|
@@ -130,16 +142,18 @@ def from_data(data, conv=None, *, pinf=float('inf'), ninf=float('-inf')):
|
|
|
130
142
|
|
|
131
143
|
for item in data:
|
|
132
144
|
left, lower, upper, right = item
|
|
133
|
-
intervals.append(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
intervals.append(
|
|
146
|
+
Interval.from_atomic(
|
|
147
|
+
Bound(left),
|
|
148
|
+
_convert(lower),
|
|
149
|
+
_convert(upper),
|
|
150
|
+
Bound(right),
|
|
151
|
+
)
|
|
152
|
+
)
|
|
139
153
|
return Interval(*intervals)
|
|
140
154
|
|
|
141
155
|
|
|
142
|
-
def to_data(interval, conv=None, *, pinf=float(
|
|
156
|
+
def to_data(interval, conv=None, *, pinf=float("inf"), ninf=float("-inf")):
|
|
143
157
|
"""
|
|
144
158
|
Export given interval to a list of 4-uples (left, lower,
|
|
145
159
|
upper, right).
|
|
@@ -163,10 +177,5 @@ def to_data(interval, conv=None, *, pinf=float('inf'), ninf=float('-inf')):
|
|
|
163
177
|
return conv(bound)
|
|
164
178
|
|
|
165
179
|
for item in interval:
|
|
166
|
-
data.append((
|
|
167
|
-
item.left.value,
|
|
168
|
-
_convert(item.lower),
|
|
169
|
-
_convert(item.upper),
|
|
170
|
-
item.right.value
|
|
171
|
-
))
|
|
180
|
+
data.append((item.left.value, _convert(item.lower), _convert(item.upper), item.right.value))
|
|
172
181
|
return data
|