Skip to content

Commit

Permalink
Merge pull request #13 from ryanharvey1/remove-warning-suppressors
Browse files Browse the repository at this point in the history
Remove warning suppressors in submodules
  • Loading branch information
ryanharvey1 authored Sep 17, 2024
2 parents 279cb75 + e8e4623 commit 40e9e94
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
6 changes: 0 additions & 6 deletions neuro_py/ensemble/explained_variance.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import warnings

import numpy as np

from nelpy.core._eventarray import SpikeTrainArray
Expand All @@ -8,10 +6,6 @@
from numba import jit


warnings.simplefilter(action="ignore", category=FutureWarning)
warnings.simplefilter(action="ignore", category=RuntimeWarning)


class ExplainedVariance(object):
"""Explained variance measure for assessing reactivation of neuronal activity using pairwise correlations.
Expand Down
3 changes: 0 additions & 3 deletions neuro_py/io/loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import warnings
from itertools import chain
from typing import List, Union
from warnings import simplefilter
from xml.dom import minidom

import nelpy as nel
Expand All @@ -20,8 +19,6 @@
from neuro_py.process.intervals import find_interval, in_intervals
from neuro_py.process.peri_event import get_participation

simplefilter(action="ignore", category=pd.errors.PerformanceWarning)


def loadXML(basepath: str):
"""
Expand Down
1 change: 1 addition & 0 deletions neuro_py/plotting/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

from neuro_py.stats.stats import confidence_intervals


def plot_events(events, labels, cmap="tab20", gridlines=True, alpha=0.75, ax=None):
"""
events: nested list of nelpy EpochArrays
Expand Down
1 change: 0 additions & 1 deletion neuro_py/spikes/spike_tools.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from typing import Union

import numpy as np
Expand Down
15 changes: 6 additions & 9 deletions neuro_py/tuning/maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
from neuro_py.stats.stats import get_significant_events
from neuro_py.tuning import fields

np.seterr(divide="ignore", invalid="ignore")


class SpatialMap(object):
"""
Expand Down Expand Up @@ -212,10 +210,8 @@ def compute_ratemap_1d(
),
bins=self.x_edges,
)
# divide by occupancy
ratemap = ratemap / occupancy

# if data to map is analog signal (continous)
# if data to map is analog signal (continuous)
elif isinstance(st_run, nel.core._analogsignalarray.AnalogSignalArray):
# get x location for every bin center
x = np.interp(
Expand All @@ -228,8 +224,9 @@ def compute_ratemap_1d(
ratemap[:, bidx - 1] += st_run.data[:, tt]
# divide by sampling rate
ratemap = ratemap * st_run.fs
# divide by occupancy
ratemap = ratemap / occupancy

# divide by occupancy
np.divide(ratemap, occupancy, where=occupancy != 0, out=ratemap)

# remove nans and infs
bad_idx = np.isnan(ratemap) | np.isinf(ratemap)
Expand Down Expand Up @@ -323,7 +320,6 @@ def compute_ratemap_2d(
np.interp(st_run.data[i], pos_run.abscissa_vals, pos_run.data[1, :]),
bins=(self.x_edges, self.y_edges),
)
ratemap = ratemap / occupancy

elif isinstance(st_run, nel.core._analogsignalarray.AnalogSignalArray):
x = np.interp(
Expand All @@ -337,7 +333,8 @@ def compute_ratemap_2d(
for tt, (bidxx, bidxy) in enumerate(zip(ext_bin_idx_x, ext_bin_idx_y)):
ratemap[:, bidxx - 1, bidxy - 1] += st_run.data[:, tt]
ratemap = ratemap * st_run.fs
ratemap = ratemap / occupancy

np.divide(ratemap, occupancy, where=occupancy != 0, out=ratemap)

bad_idx = np.isnan(ratemap) | np.isinf(ratemap)
ratemap[bad_idx] = 0
Expand Down

0 comments on commit 40e9e94

Please sign in to comment.