Skip to content

Commit a5d329c

Browse files
author
arch
committed
updates for windof
1 parent 0f4fe93 commit a5d329c

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

funscript_editor/algorithms/signalprocessing.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import numpy as np
44
import logging
5+
import platform
56
from funscript_editor.utils.config import HYPERPARAMETER, SETTINGS
67

78
def scale_signal(signal :list, lower: float = 0, upper: float = 99) -> list:
@@ -148,7 +149,10 @@ def get_local_max_and_min_idx(score :list, fps: int, shift_min :int = 0, shift_m
148149
Returns:
149150
dict: dict with 2 lists with all local max and min indexes ({'min':[], 'max':[]})
150151
"""
151-
logger = logging.getLogger("changepoints")
152+
if platform.system() != 'Windows':
153+
# TODO logging here on windows cause open background process
154+
logger = logging.getLogger("changepoints")
155+
152156
avg = moving_average(score, w=round(fps * HYPERPARAMETER['avg_sec_for_local_min_max_extraction']))
153157
changepoints = {'min': [], 'max': []}
154158
tmp_min_idx, tmp_max_idx = -1, -1
@@ -191,7 +195,9 @@ def get_local_max_and_min_idx(score :list, fps: int, shift_min :int = 0, shift_m
191195

192196

193197
if SETTINGS['additional_changepoints']:
194-
logger.info("Add additional change points")
198+
if platform.system() != 'Windows':
199+
# TODO logging here on windows cause open background process
200+
logger.info("Add additional change points")
195201
merge_threshold = max(1, round(fps * float(HYPERPARAMETER['additional_changepoints_merge_threshold_in_ms']) / 1000.0))
196202
additional_changepoints = get_changepoints(score, fps, float(HYPERPARAMETER['changepoint_detection_threshold']))
197203
for cp_idx in additional_changepoints:
@@ -202,14 +208,14 @@ def get_local_max_and_min_idx(score :list, fps: int, shift_min :int = 0, shift_m
202208
continue
203209

204210
if score[cp_idx] < avg[cp_idx]:
205-
logger.debug("add additional min changepoint at idx %d", cp_idx)
206211
changepoints['min'].append(cp_idx)
207212
else:
208-
logger.debug("add additional max changepoint at idx %d", cp_idx)
209213
changepoints['max'].append(cp_idx)
210214

211215

212-
logger.info("apply manual shift")
216+
if platform.system() != 'Windows':
217+
# TODO logging here on windows cause open background process
218+
logger.info("Apply manual shift")
213219
if shift_min != 0:
214220
for k, idx in enumerate(changepoints['min']):
215221
changepoints['min'][k] = max((0, min((len(score)-1, idx+shift_min)) ))

0 commit comments

Comments
 (0)