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.
Files changed (125) hide show
  1. boris/__init__.py +1 -1
  2. boris/__main__.py +1 -1
  3. boris/about.py +24 -40
  4. boris/add_modifier.py +88 -80
  5. boris/add_modifier_ui.py +235 -131
  6. boris/advanced_event_filtering.py +23 -29
  7. boris/analysis_plugins/__init__.py +0 -0
  8. boris/analysis_plugins/_latency.py +59 -0
  9. boris/analysis_plugins/irr_cohen_kappa.py +109 -0
  10. boris/analysis_plugins/irr_cohen_kappa_with_modifiers.py +112 -0
  11. boris/analysis_plugins/irr_weighted_cohen_kappa.py +157 -0
  12. boris/analysis_plugins/irr_weighted_cohen_kappa_with_modifiers.py +162 -0
  13. boris/analysis_plugins/list_of_dataframe_columns.py +22 -0
  14. boris/analysis_plugins/number_of_occurences.py +22 -0
  15. boris/analysis_plugins/number_of_occurences_by_independent_variable.py +54 -0
  16. boris/analysis_plugins/time_budget.py +61 -0
  17. boris/behav_coding_map_creator.py +228 -229
  18. boris/behavior_binary_table.py +33 -50
  19. boris/behaviors_coding_map.py +17 -18
  20. boris/boris_cli.py +6 -25
  21. boris/cmd_arguments.py +12 -1
  22. boris/coding_pad.py +16 -34
  23. boris/config.py +101 -49
  24. boris/config_file.py +55 -64
  25. boris/connections.py +105 -58
  26. boris/converters.py +13 -37
  27. boris/converters_ui.py +187 -110
  28. boris/cooccurence.py +250 -0
  29. boris/core.py +2108 -1275
  30. boris/core_qrc.py +15892 -10829
  31. boris/core_ui.py +941 -806
  32. boris/db_functions.py +17 -42
  33. boris/dev.py +134 -0
  34. boris/dialog.py +461 -242
  35. boris/duration_widget.py +9 -14
  36. boris/edit_event.py +61 -31
  37. boris/edit_event_ui.py +208 -97
  38. boris/event_operations.py +405 -281
  39. boris/events_cursor.py +25 -17
  40. boris/events_snapshots.py +36 -82
  41. boris/exclusion_matrix.py +4 -9
  42. boris/export_events.py +180 -203
  43. boris/export_observation.py +60 -73
  44. boris/external_processes.py +123 -98
  45. boris/geometric_measurement.py +427 -218
  46. boris/gui_utilities.py +91 -14
  47. boris/image_overlay.py +4 -4
  48. boris/import_observations.py +190 -98
  49. boris/ipc_mpv.py +304 -0
  50. boris/irr.py +20 -57
  51. boris/latency.py +31 -24
  52. boris/measurement_widget.py +14 -18
  53. boris/media_file.py +17 -19
  54. boris/menu_options.py +16 -6
  55. boris/modifier_coding_map_creator.py +1013 -0
  56. boris/modifiers_coding_map.py +7 -9
  57. boris/mpv2.py +127 -36
  58. boris/observation.py +493 -210
  59. boris/observation_operations.py +1010 -391
  60. boris/observation_ui.py +573 -363
  61. boris/observations_list.py +51 -58
  62. boris/otx_parser.py +74 -68
  63. boris/param_panel.py +45 -59
  64. boris/param_panel_ui.py +254 -138
  65. boris/player_dock_widget.py +91 -56
  66. boris/plot_data_module.py +18 -53
  67. boris/plot_events.py +56 -153
  68. boris/plot_events_rt.py +16 -30
  69. boris/plot_spectrogram_rt.py +80 -56
  70. boris/plot_waveform_rt.py +23 -48
  71. boris/plugins.py +431 -0
  72. boris/portion/__init__.py +18 -8
  73. boris/portion/const.py +35 -18
  74. boris/portion/dict.py +5 -5
  75. boris/portion/func.py +2 -2
  76. boris/portion/interval.py +21 -41
  77. boris/portion/io.py +41 -32
  78. boris/preferences.py +298 -123
  79. boris/preferences_ui.py +664 -225
  80. boris/project.py +293 -270
  81. boris/project_functions.py +610 -537
  82. boris/project_import_export.py +204 -213
  83. boris/project_ui.py +673 -441
  84. boris/qrc_boris.py +6 -3
  85. boris/qrc_boris5.py +6 -3
  86. boris/select_modifiers.py +62 -90
  87. boris/select_observations.py +19 -197
  88. boris/select_subj_behav.py +67 -39
  89. boris/state_events.py +51 -33
  90. boris/subjects_pad.py +6 -8
  91. boris/synthetic_time_budget.py +25 -17
  92. boris/time_budget_functions.py +169 -169
  93. boris/time_budget_widget.py +71 -86
  94. boris/transitions.py +41 -41
  95. boris/utilities.py +562 -222
  96. boris/version.py +3 -3
  97. boris/video_equalizer.py +16 -14
  98. boris/video_equalizer_ui.py +199 -130
  99. boris/video_operations.py +78 -28
  100. boris/view_df.py +104 -0
  101. boris/view_df_ui.py +75 -0
  102. boris/write_event.py +240 -136
  103. boris_behav_obs-9.7.1.dist-info/METADATA +140 -0
  104. boris_behav_obs-9.7.1.dist-info/RECORD +109 -0
  105. {boris_behav_obs-8.16.6.dist-info → boris_behav_obs-9.7.1.dist-info}/WHEEL +1 -1
  106. boris_behav_obs-9.7.1.dist-info/entry_points.txt +2 -0
  107. boris/README.TXT +0 -22
  108. boris/add_modifier.ui +0 -323
  109. boris/converters.ui +0 -289
  110. boris/core.qrc +0 -37
  111. boris/core.ui +0 -1571
  112. boris/edit_event.ui +0 -233
  113. boris/icons/logo_eye.ico +0 -0
  114. boris/map_creator.py +0 -982
  115. boris/observation.ui +0 -814
  116. boris/param_panel.ui +0 -379
  117. boris/preferences.ui +0 -537
  118. boris/project.ui +0 -1074
  119. boris/vlc_local.py +0 -90
  120. boris_behav_obs-8.16.6.dist-info/LICENSE.TXT +0 -674
  121. boris_behav_obs-8.16.6.dist-info/METADATA +0 -134
  122. boris_behav_obs-8.16.6.dist-info/RECORD +0 -106
  123. boris_behav_obs-8.16.6.dist-info/entry_points.txt +0 -2
  124. {boris → boris_behav_obs-9.7.1.dist-info/licenses}/LICENSE.TXT +0 -0
  125. {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('Atomic', ['left', 'lower', 'upper', 'right'])
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__ = ('_intervals',)
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('Parameters must be Interval instances')
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('Unsupported return type {} for {}'.format(type(value), value))
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('Unsupported type {} for {}'.format(type(other), other))
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
- item.lower == self.lower and
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('[{}]'.format(repr(interval.lower)))
571
+ intervals.append("[{}]".format(repr(interval.lower)))
592
572
  else:
593
573
  intervals.append(
594
- '{}{},{}{}'.format(
595
- '[' if interval.left == Bound.CLOSED else '(',
574
+ "{}{},{}{}".format(
575
+ "[" if interval.left == Bound.CLOSED else "(",
596
576
  repr(interval.lower),
597
577
  repr(interval.upper),
598
- ']' if interval.right == Bound.CLOSED else ')',
578
+ "]" if interval.right == Bound.CLOSED else ")",
599
579
  )
600
580
  )
601
- return ' | '.join(intervals)
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(string, conv, *, bound=r'.+?', disj=r' ?\| ?', sep=r', ?',
8
- left_open=r'\(', left_closed=r'\[', right_open=r'\)', right_closed=r'\]',
9
- pinf=r'\+inf', ninf=r'-inf'):
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'(?P<left>{}|{})'.format(left_open, left_closed)
29
- re_right_boundary = r'(?P<right>{}|{})'.format(right_open, right_closed)
30
- re_bounds = r'(?P<lower>{bound})({sep}(?P<upper>{bound}))?'.format(bound=bound, sep=sep)
31
- re_interval = r'{}(|{}){}'.format(re_left_boundary, re_bounds, re_right_boundary)
32
- re_intervals = r'{}(?P<disj>{})?'.format(re_interval, disj)
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 + '$', group['left']) else Bound.OPEN
53
- right = Bound.CLOSED if re.match(right_closed + '$', group['right']) else Bound.OPEN
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('lower', None)
56
- upper = group.get('upper', None)
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(interval, conv=repr, *, disj=' | ', sep=',', left_open='(',
67
- left_closed='[', right_open=')', right_closed=']', pinf='+inf', ninf='-inf'):
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 '{}{}'.format(left_open, right_open)
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('{}{}{}'.format(left, lower, right))
115
+ exported_intervals.append("{}{}{}".format(left, lower, right))
104
116
  else:
105
- exported_intervals.append('{}{}{}{}{}'.format(left, lower, sep, upper, right))
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('inf'), ninf=float('-inf')):
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(Interval.from_atomic(
134
- Bound(left),
135
- _convert(lower),
136
- _convert(upper),
137
- Bound(right),
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('inf'), ninf=float('-inf')):
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