boris-behav-obs 9.5__py2.py3-none-any.whl → 9.5.2__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/analysis_plugins/list_of_dataframe_columns.py +22 -0
- boris/export_observation.py +2 -6
- boris/observation_operations.py +42 -37
- boris/version.py +2 -2
- {boris_behav_obs-9.5.dist-info → boris_behav_obs-9.5.2.dist-info}/METADATA +1 -1
- {boris_behav_obs-9.5.dist-info → boris_behav_obs-9.5.2.dist-info}/RECORD +10 -9
- {boris_behav_obs-9.5.dist-info → boris_behav_obs-9.5.2.dist-info}/WHEEL +0 -0
- {boris_behav_obs-9.5.dist-info → boris_behav_obs-9.5.2.dist-info}/entry_points.txt +0 -0
- {boris_behav_obs-9.5.dist-info → boris_behav_obs-9.5.2.dist-info}/licenses/LICENSE.TXT +0 -0
- {boris_behav_obs-9.5.dist-info → boris_behav_obs-9.5.2.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"""
|
|
2
|
+
BORIS plugin
|
|
3
|
+
|
|
4
|
+
number of occurences of behaviors
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import pandas as pd
|
|
8
|
+
|
|
9
|
+
__version__ = "0.0.1"
|
|
10
|
+
__version_date__ = "2025-06-13"
|
|
11
|
+
__plugin_name__ = "List of dataframe columns"
|
|
12
|
+
__author__ = "Olivier Friard - University of Torino - Italy"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def run(df: pd.DataFrame) -> pd.DataFrame:
|
|
16
|
+
"""
|
|
17
|
+
List the columns present in the dataframe
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
df_results = pd.DataFrame(df.columns, columns=["column name"])
|
|
21
|
+
|
|
22
|
+
return df_results
|
boris/export_observation.py
CHANGED
|
@@ -691,11 +691,6 @@ def export_aggregated_events(pj: dict, parameters: dict, obsId: str, force_numbe
|
|
|
691
691
|
# obs description
|
|
692
692
|
obs_description = util.eol2space(observation[cfg.DESCRIPTION])
|
|
693
693
|
|
|
694
|
-
"""
|
|
695
|
-
obs_length = observation_operations.observation_total_length(pj[cfg.OBSERVATIONS][obsId])
|
|
696
|
-
logging.debug(f"obs_length: {obs_length}")
|
|
697
|
-
"""
|
|
698
|
-
|
|
699
694
|
_, _, connector = db_functions.load_aggregated_events_in_db(
|
|
700
695
|
pj, parameters[cfg.SELECTED_SUBJECTS], [obsId], parameters[cfg.SELECTED_BEHAVIORS]
|
|
701
696
|
)
|
|
@@ -798,6 +793,7 @@ def export_aggregated_events(pj: dict, parameters: dict, obsId: str, force_numbe
|
|
|
798
793
|
if observation[cfg.TYPE] == cfg.MEDIA:
|
|
799
794
|
observation_type = "Media file"
|
|
800
795
|
|
|
796
|
+
# get the media file name of the start of event
|
|
801
797
|
media_file_name = observation_operations.event2media_file_name(observation, row["start"])
|
|
802
798
|
if media_file_name is None:
|
|
803
799
|
media_file_name = "Not found"
|
|
@@ -842,7 +838,7 @@ def export_aggregated_events(pj: dict, parameters: dict, obsId: str, force_numbe
|
|
|
842
838
|
observation["date"].replace("T", " "),
|
|
843
839
|
obs_description,
|
|
844
840
|
observation_type,
|
|
845
|
-
media_file_str,
|
|
841
|
+
media_file_str, # list of media used in observation
|
|
846
842
|
pj[cfg.OBSERVATIONS][obsId][cfg.TIME_OFFSET],
|
|
847
843
|
f"{coding_duration:.3f}" if not coding_duration.is_nan() else cfg.NA,
|
|
848
844
|
media_durations_str,
|
boris/observation_operations.py
CHANGED
|
@@ -1055,8 +1055,6 @@ def new_observation(self, mode: str = cfg.NEW, obsId: str = "") -> None:
|
|
|
1055
1055
|
}
|
|
1056
1056
|
|
|
1057
1057
|
if self.pj[cfg.OBSERVATIONS][new_obs_id][cfg.MEDIA_CREATION_DATE_AS_OFFSET]:
|
|
1058
|
-
print("\n", observationWindow.media_creation_time, "\n")
|
|
1059
|
-
|
|
1060
1058
|
self.pj[cfg.OBSERVATIONS][new_obs_id][cfg.MEDIA_INFO][cfg.MEDIA_CREATION_TIME] = observationWindow.media_creation_time
|
|
1061
1059
|
|
|
1062
1060
|
try:
|
|
@@ -2423,48 +2421,55 @@ def event2media_file_name(observation: dict, timestamp: dec) -> Optional[str]:
|
|
|
2423
2421
|
timestamp (dec): time stamp
|
|
2424
2422
|
|
|
2425
2423
|
Returns:
|
|
2426
|
-
str:
|
|
2424
|
+
str: path of media file containing the event
|
|
2427
2425
|
"""
|
|
2426
|
+
if observation.get(cfg.MEDIA_CREATION_DATE_AS_OFFSET, False):
|
|
2427
|
+
# media creation date/time was used for coding
|
|
2428
|
+
video_file_name = None
|
|
2429
|
+
for media_path in observation[cfg.MEDIA_INFO].get(cfg.MEDIA_CREATION_TIME, {}):
|
|
2430
|
+
start_media = observation[cfg.MEDIA_INFO][cfg.MEDIA_CREATION_TIME][media_path]
|
|
2431
|
+
duration = observation[cfg.MEDIA_INFO][cfg.LENGTH][media_path]
|
|
2432
|
+
if start_media <= timestamp <= start_media + duration:
|
|
2433
|
+
video_file_name = media_path
|
|
2434
|
+
break
|
|
2428
2435
|
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2436
|
+
else: # no media creation date
|
|
2437
|
+
cumul_media_durations: list = [dec(0)]
|
|
2438
|
+
for media_file in observation[cfg.FILE][cfg.PLAYER1]:
|
|
2439
|
+
try:
|
|
2440
|
+
media_duration = observation[cfg.MEDIA_INFO][cfg.LENGTH][media_file]
|
|
2441
|
+
# cut off media duration to 3 decimal places as that is how fine the player is
|
|
2442
|
+
media_duration = floor(media_duration * 10**3) / dec(10**3)
|
|
2443
|
+
cumul_media_durations.append(floor((cumul_media_durations[-1] + media_duration) * 10**3) / dec(10**3))
|
|
2444
|
+
except KeyError:
|
|
2445
|
+
return None
|
|
2438
2446
|
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2447
|
+
"""
|
|
2448
|
+
cumul_media_durations: list = [dec(0)]
|
|
2449
|
+
for media_file in observation[cfg.FILE][cfg.PLAYER1]:
|
|
2450
|
+
try:
|
|
2451
|
+
media_duration = dec(str(observation[cfg.MEDIA_INFO][cfg.LENGTH][media_file]))
|
|
2452
|
+
cumul_media_durations.append(round(cumul_media_durations[-1] + media_duration, 3))
|
|
2453
|
+
except KeyError:
|
|
2454
|
+
return None
|
|
2455
|
+
"""
|
|
2448
2456
|
|
|
2449
|
-
|
|
2457
|
+
cumul_media_durations.remove(dec(0))
|
|
2450
2458
|
|
|
2451
|
-
|
|
2459
|
+
logging.debug(f"{cumul_media_durations=}")
|
|
2452
2460
|
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2461
|
+
# test if timestamp is at end of last media
|
|
2462
|
+
if timestamp == cumul_media_durations[-1]:
|
|
2463
|
+
player_idx = len(observation[cfg.FILE][cfg.PLAYER1]) - 1
|
|
2464
|
+
else:
|
|
2465
|
+
player_idx = None
|
|
2466
|
+
for idx, value in enumerate(cumul_media_durations):
|
|
2467
|
+
start = 0 if idx == 0 else cumul_media_durations[idx - 1]
|
|
2468
|
+
if start <= timestamp < value:
|
|
2469
|
+
player_idx = idx
|
|
2470
|
+
break
|
|
2463
2471
|
|
|
2464
|
-
|
|
2465
|
-
video_file_name = observation[cfg.FILE][cfg.PLAYER1][player_idx]
|
|
2466
|
-
else:
|
|
2467
|
-
video_file_name = None
|
|
2472
|
+
video_file_name = observation[cfg.FILE][cfg.PLAYER1][player_idx] if player_idx is not None else None
|
|
2468
2473
|
|
|
2469
2474
|
return video_file_name
|
|
2470
2475
|
|
boris/version.py
CHANGED
|
@@ -30,7 +30,7 @@ boris/events_cursor.py,sha256=VPY_ygD0fxE5lp25mcd2l00XQXurCR6hprffF4tKRbU,2078
|
|
|
30
30
|
boris/events_snapshots.py,sha256=PjWzQvUGQtIcEc_7FDsRphf7fAhhTccQgYc2eQSA65g,27621
|
|
31
31
|
boris/exclusion_matrix.py,sha256=ff88xD6aqc8bpIuj9ZCz9ju_HeqqgibQwoaJrIOJ6RI,5272
|
|
32
32
|
boris/export_events.py,sha256=3B336WEA0g_8oW3VDo_kfq5D0ISu-e7z2f-_ROUvU9c,39756
|
|
33
|
-
boris/export_observation.py,sha256=
|
|
33
|
+
boris/export_observation.py,sha256=B8ASj6H70xfcTSUHrbcJa6YOYjih2WD4DSiUtXj5eAk,50764
|
|
34
34
|
boris/external_processes.py,sha256=PogE2eEiQLVZ2useMamQMOAeDmMUX_TlIpqPKLMm6Ak,13607
|
|
35
35
|
boris/geometric_measurement.py,sha256=4pI-AYpBSFlJBqS-f8dnkgLtj_Z2E5kwwAdh6WwZ4kk,35049
|
|
36
36
|
boris/gui_utilities.py,sha256=2HdWFxo2y0oxC29VJAA3R-TOMxVbOy3FuVwspjrTD6A,5519
|
|
@@ -47,7 +47,7 @@ boris/mpv-1.0.3.py,sha256=EXRtzQqFjOn4wMC6482Ilq3fNQ9N1GRP1VxwLzdeaBY,88077
|
|
|
47
47
|
boris/mpv.py,sha256=EfzIHjPbgewG4w3smEtqEUPZoVwYmMQkL4Q8ZyW-a58,76410
|
|
48
48
|
boris/mpv2.py,sha256=IUI4t4r9GYX7G5OXTjd3RhMMOkDdfal_15buBgksLsk,92152
|
|
49
49
|
boris/observation.py,sha256=10UkVyY8TDySntIX_-H-IsuFdiF6tEcmC6JQUzD6wYg,57139
|
|
50
|
-
boris/observation_operations.py,sha256
|
|
50
|
+
boris/observation_operations.py,sha256=xeMtD4K9wN_Hu0d_0G7Btv1Tezkhw_Qwfs1fF2xEg4o,107865
|
|
51
51
|
boris/observation_ui.py,sha256=DAnU94QBNvkLuHT6AxTwqSk_D_n6VUhSl8PexZv_dUk,33309
|
|
52
52
|
boris/observations_list.py,sha256=NqwECGHtHYmKhSe-qCfqPmJ24SSfzlXvIXS2i3op_zE,10591
|
|
53
53
|
boris/otx_parser.py,sha256=70QvilzFHXbjAHR88YH0aEXJ3xxheLS5fZGgHFHGpNE,16367
|
|
@@ -78,7 +78,7 @@ boris/time_budget_functions.py,sha256=y5He8crz0xsTxVfz0jATwFFQVnPAIrNHja_0sF6NtR
|
|
|
78
78
|
boris/time_budget_widget.py,sha256=z-tyITBtIz-KH1H2OdMB5a8x9QQLK7Wu96-zkC6NVDA,43213
|
|
79
79
|
boris/transitions.py,sha256=_aZJfJWv3EBrtmQ7qsdTCayQo6uWU7BXqtQQgflEhr4,12250
|
|
80
80
|
boris/utilities.py,sha256=dD5HpojqlAGLVkr3YnOsaqfbCMHFYroe040ZchB5WnM,56662
|
|
81
|
-
boris/version.py,sha256=
|
|
81
|
+
boris/version.py,sha256=r_jFSfQ3dIc0y2gmc77YPeX3ALHmwPPtr0mCN4VgrtY,787
|
|
82
82
|
boris/video_equalizer.py,sha256=FartoGghFK-T53zklP70rPKYqTuzL8qdvfGlsOF2wwc,5854
|
|
83
83
|
boris/video_equalizer_ui.py,sha256=1CG3s79eM4JAbaCx3i1ILZXLceb41_gGXlOLNfpBgnw,10142
|
|
84
84
|
boris/video_operations.py,sha256=mh3iR__Sm2KnV44L_sW2pOo3AgLwlM7wiTnnqQiAVs4,9381
|
|
@@ -87,6 +87,7 @@ boris/view_df_ui.py,sha256=CaMeRH_vQ00CTDDFQn73ZZaS-r8BSTWpL-dMCFqzJ_Q,2775
|
|
|
87
87
|
boris/write_event.py,sha256=RN_cFQZNE2jWbM_BiodL4tsyKT0JPREvUy7xgZnrfaM,24041
|
|
88
88
|
boris/analysis_plugins/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
89
89
|
boris/analysis_plugins/_latency.py,sha256=9kCdFDtb5Zdao1xFpioi_exm_IxyGm6RlY3Opn6GUFo,2030
|
|
90
|
+
boris/analysis_plugins/list_of_dataframe_columns.py,sha256=VEiVhxADtyaIKN4JrfFV02TuTAfWhQ60bf1mHVQp27I,437
|
|
90
91
|
boris/analysis_plugins/number_of_occurences.py,sha256=IDyDrdezqvSKT3BlD8QWpSYk8X9nnBBLI80OUnFJ3bY,509
|
|
91
92
|
boris/analysis_plugins/number_of_occurences_by_independent_variable.py,sha256=t39bmmmZIDCSbcDvVeiKAhKNNP2SdpHp417JczHEnP4,793
|
|
92
93
|
boris/analysis_plugins/time_budget.py,sha256=C1wNYwd5Jugr8h5z2aXRUBY8dF8pD4n953dPwNHY5VY,2244
|
|
@@ -96,9 +97,9 @@ boris/portion/dict.py,sha256=SyHxc7PfDw2ufNLFQycwJtzmRfL48rDp4UrM2KN7IWc,11282
|
|
|
96
97
|
boris/portion/func.py,sha256=3TkQtFKLfsqntwd27HSGHceFhnXHmT-EbNMqktElC5Q,2174
|
|
97
98
|
boris/portion/interval.py,sha256=bAdUiJjGeUAPgsBAImwNeviiwfQq5odfhFZccAWzOTA,20299
|
|
98
99
|
boris/portion/io.py,sha256=ppNeRpiLNrocF1yzGeuEUIhYMf2LfsR-cji3d0nmvUs,6371
|
|
99
|
-
boris_behav_obs-9.5.dist-info/licenses/LICENSE.TXT,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
|
|
100
|
-
boris_behav_obs-9.5.dist-info/METADATA,sha256=
|
|
101
|
-
boris_behav_obs-9.5.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
102
|
-
boris_behav_obs-9.5.dist-info/entry_points.txt,sha256=k__8XvFi4vaA4QFvQehCZjYkKmZH34HSAJI2iYCWrMs,52
|
|
103
|
-
boris_behav_obs-9.5.dist-info/top_level.txt,sha256=fJSgm62S7WesiwTorGbOO4nNN0yzgZ3klgfGi3Px4qI,6
|
|
104
|
-
boris_behav_obs-9.5.dist-info/RECORD,,
|
|
100
|
+
boris_behav_obs-9.5.2.dist-info/licenses/LICENSE.TXT,sha256=WJ7YI-moTFb-uVrFjnzzhGJrnL9P2iqQe8NuED3hutI,35141
|
|
101
|
+
boris_behav_obs-9.5.2.dist-info/METADATA,sha256=pIRDrmyWcnAK10pxpqzXD2dC9t7wDEALlBy99fblRLk,4602
|
|
102
|
+
boris_behav_obs-9.5.2.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
|
|
103
|
+
boris_behav_obs-9.5.2.dist-info/entry_points.txt,sha256=k__8XvFi4vaA4QFvQehCZjYkKmZH34HSAJI2iYCWrMs,52
|
|
104
|
+
boris_behav_obs-9.5.2.dist-info/top_level.txt,sha256=fJSgm62S7WesiwTorGbOO4nNN0yzgZ3klgfGi3Px4qI,6
|
|
105
|
+
boris_behav_obs-9.5.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|