Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	simba/data_processors/cuda/convex_hull.py
  • Loading branch information
sronilsson committed Aug 28, 2024
2 parents 6b035d0 + b5e8122 commit 1a75e0c
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 37 deletions.
6 changes: 4 additions & 2 deletions simba/data_processors/cuda/angle_3pt.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

from numba import cuda
import math

import numpy as np
from numba import cuda

from simba.utils.read_write import read_df
import math

THREADS_PER_BLOCK = 256
@cuda.jit
Expand Down
2 changes: 1 addition & 1 deletion simba/data_processors/cuda/count_values_in_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
__email__ = "[email protected]"


from numba import cuda
import numpy as np
from numba import cuda

THREADS_PER_BLOCK = 256

Expand Down
17 changes: 12 additions & 5 deletions simba/data_processors/cuda/create_average_cupy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,24 @@
__email__ = "[email protected]"


from typing import Union, Optional
import os
from typing import Optional, Union

import cupy as cp
import cv2
import numpy as np
import cupy as cp

from simba.utils.errors import InvalidInputError, FFMPEGCodecGPUError
from simba.utils.checks import check_file_exist_and_readable, check_int, check_if_string_value_is_valid_video_timestamp, check_that_hhmmss_start_is_before_end,check_if_dir_exists, check_nvidea_gpu_available
from simba.utils.read_write import get_video_meta_data, check_if_hhmmss_timestamp_is_valid_part_of_video, get_fn_ext, read_img_batch_from_video_gpu
from simba.utils.checks import (check_file_exist_and_readable,
check_if_dir_exists,
check_if_string_value_is_valid_video_timestamp,
check_int, check_nvidea_gpu_available,
check_that_hhmmss_start_is_before_end)
from simba.utils.data import find_frame_numbers_from_time_stamp
from simba.utils.errors import FFMPEGCodecGPUError, InvalidInputError
from simba.utils.printing import stdout_success
from simba.utils.read_write import (
check_if_hhmmss_timestamp_is_valid_part_of_video, get_fn_ext,
get_video_meta_data, read_img_batch_from_video_gpu)


def create_average_frm(video_path: Union[str, os.PathLike],
Expand Down
23 changes: 15 additions & 8 deletions simba/data_processors/cuda/create_average_frame_cuda.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

from typing import Union, Optional
import os
from typing import Optional, Union

import cupy as cp
import cv2
import numpy as np
import cupy as cp
from numba import cuda

from simba.utils.errors import InvalidInputError, FFMPEGCodecGPUError
from simba.utils.checks import check_file_exist_and_readable, check_int, check_if_string_value_is_valid_video_timestamp, \
check_that_hhmmss_start_is_before_end, check_if_dir_exists, check_nvidea_gpu_available, check_instance, check_if_valid_img
from simba.utils.read_write import get_video_meta_data, check_if_hhmmss_timestamp_is_valid_part_of_video, get_fn_ext, \
read_img_batch_from_video_gpu
from simba.utils.checks import (check_file_exist_and_readable,
check_if_dir_exists,
check_if_string_value_is_valid_video_timestamp,
check_if_valid_img, check_instance, check_int,
check_nvidea_gpu_available,
check_that_hhmmss_start_is_before_end)
from simba.utils.data import find_frame_numbers_from_time_stamp
from simba.utils.errors import FFMPEGCodecGPUError, InvalidInputError
from simba.utils.printing import stdout_success
from numba import cuda
from simba.utils.read_write import (
check_if_hhmmss_timestamp_is_valid_part_of_video, get_fn_ext,
get_video_meta_data, read_img_batch_from_video_gpu)


def average_3d_stack_cupy(image_stack: np.ndarray) -> np.ndarray:
num_frames, height, width, _ = image_stack.shape
Expand Down
3 changes: 2 additions & 1 deletion simba/data_processors/cuda/direction_two_bps.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

import math

import numpy as np
from numba import cuda
import math

THREADS_PER_BLOCK = 1024

Expand Down
8 changes: 5 additions & 3 deletions simba/data_processors/cuda/euclidan_distance.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

from numba import cuda
import math

import numpy as np
from simba.utils.read_write import read_df
from numba import cuda

from simba.mixins.feature_extraction_mixin import FeatureExtractionMixin
import math
from simba.utils.read_write import read_df

THREADS_PER_BLOCK = 128

Expand Down
3 changes: 2 additions & 1 deletion simba/data_processors/cuda/is_inside_circle.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

import math

import numpy as np
from numba import cuda
import math

THREADS_PER_BLOCK = 1024
@cuda.jit
Expand Down
6 changes: 4 additions & 2 deletions simba/data_processors/cuda/sliding_circular_mean.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

import numpy as np
import cupy
from typing import Optional

import cupy
import numpy as np


def sliding_circular_mean(x: np.ndarray,
time_window: float,
sample_rate: int,
Expand Down
6 changes: 4 additions & 2 deletions simba/data_processors/cuda/sliding_resultant_vector_length.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

import numpy as np
import cupy
from typing import Optional

import cupy
import numpy as np


def sliding_resultant_vector_length(x: np.ndarray,
time_window: float,
sample_rate: int,
Expand Down
5 changes: 3 additions & 2 deletions simba/data_processors/cuda/sliding_spearmans_rank.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

import numpy as np
import cupy as cp
from typing import Optional

import cupy as cp
import numpy as np


def sliding_spearmans_rank(x: np.ndarray,
y: np.ndarray,
Expand Down
29 changes: 19 additions & 10 deletions simba/plotting/blob_plotter.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,34 @@
__author__ = "Simon Nilsson"
__email__ = "[email protected]"

from typing import List, Tuple
import os
from typing import Union, Optional
from typing import List, Optional, Tuple, Union

import numpy as np

try:
from typing import Literal
except:
from typing_extensions import Literal
from simba.utils.read_write import find_all_videos_in_directory, get_fn_ext, remove_files, get_video_meta_data, find_core_cnt, concatenate_videos_in_folder
from simba.utils.checks import check_if_dir_exists, check_valid_boolean, check_int, check_nvidea_gpu_available, check_str, check_if_valid_rgb_tuple
from simba.utils.enums import Options, TextOptions, Defaults
from simba.utils.printing import stdout_success, SimbaTimer
from simba.utils.errors import InvalidInputError, FFMPEGCodecGPUError
from simba.data_processors.blob_location_computer import BlobLocationComputer
from simba.mixins.plotting_mixin import PlottingMixin
import multiprocessing

import functools
import multiprocessing

from numba import jit

from simba.data_processors.blob_location_computer import BlobLocationComputer
from simba.mixins.plotting_mixin import PlottingMixin
from simba.utils.checks import (check_if_dir_exists, check_if_valid_rgb_tuple,
check_int, check_nvidea_gpu_available,
check_str, check_valid_boolean)
from simba.utils.enums import Defaults, Options, TextOptions
from simba.utils.errors import FFMPEGCodecGPUError, InvalidInputError
from simba.utils.printing import SimbaTimer, stdout_success
from simba.utils.read_write import (concatenate_videos_in_folder,
find_all_videos_in_directory,
find_core_cnt, get_fn_ext,
get_video_meta_data, remove_files)


class BlobPlotter(PlottingMixin):
"""
Expand Down

0 comments on commit 1a75e0c

Please sign in to comment.