Skip to content

Commit de36516

Browse files
author
Dammy Desktop
committed
chore: remove skvideo directory and transition to imageio
1 parent dec311a commit de36516

127 files changed

Lines changed: 4760 additions & 7478 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
-571 Bytes
Binary file not shown.

PupilProcessing/pupilpipeline.py

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,19 @@
1-
import logging
2-
import math
3-
import os.path
4-
51
import joblib
62
import pandas as pd
73

84
from .psychophysicsUtils import *
95
from . import utils
106
from xdetectioncore.behaviour import load_aggregate_td_df, add_datetimecol
11-
from datetime import datetime, time, timedelta,timezone
12-
from matplotlib import pyplot as plt
7+
from datetime import datetime, timedelta,timezone
138
import numpy as np
14-
from scipy import signal
15-
import time
169
from copy import deepcopy as copy
17-
import glob
1810
import pathlib
1911
from pathlib import Path
20-
import yaml
2112
from loguru import logger
22-
from rich.logging import RichHandler
2313
from pyinspect import install_traceback
24-
import psutil
25-
import argparse
2614
import multiprocessing
27-
import platform
2815
from tqdm import tqdm
2916
import sys
30-
import pytz
3117

3218

3319
# script for building trial data and pupil data dict
@@ -54,18 +40,6 @@ def remove_missed_ttls(ts: np.ndarray) -> np.ndarray:
5440
return ts[good_idx]
5541

5642

57-
def has_handle(fpath):
58-
for proc in psutil.process_iter():
59-
try:
60-
for item in proc.open_files():
61-
if fpath == item.path:
62-
return True
63-
except Exception:
64-
pass
65-
66-
return False
67-
68-
6943
def get_dlc_est_path(recdir, filt_flag, non_plabs_str,name):
7044
dlc_estimates_files = []
7145
if filt_flag:

PupilSense/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
from . inference_pupil_sense import Inference, get_center_and_radius
2-
from . import skvideo
2+
from . extract_pupil_pupil_sense import main
271 Bytes
Binary file not shown.
4.15 KB
Binary file not shown.
4.93 KB
Binary file not shown.
-51 Bytes
Binary file not shown.
Binary file not shown.

PupilSense/extract_pupil_pupil_sense.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55

66
import pandas as pd
7-
from . import skvideo
7+
import imageio.v3 as iio
88
import time
99
import signal # <-- added for signal handling
1010
import sys # <-- for sys.exit
@@ -43,7 +43,12 @@ def main(eye_video_paths,invert_gray_im, **kwargs):
4343
# load video using skvideo.io.vread
4444
num_frames_to_load = kwargs.get('num_frames',0)
4545

46-
eye_video = skvideo.io.vread(str(eye_video_path), num_frames=num_frames_to_load, outputdict={'-pix_fmt': 'gray'})
46+
# eye_video = skvideo.io.vread(str(eye_video_path), num_frames=num_frames_to_load, outputdict={'-pix_fmt': 'gray'})
47+
eye_video = iio.imread(str(eye_video_path),
48+
index=slice(0, num_frames_to_load) if num_frames_to_load > 0 else None,
49+
plugin="pyav", # Or "ffmpeg"
50+
format="gray"
51+
)
4752
load_end = time.time()
4853
print(f'load time: {round((load_end-load_start)/60,2)} mins')
4954
# eye_video = eye_video.dtype(np.uint8)

0 commit comments

Comments
 (0)