Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

408 check out contiguous channel property for discrete data #415

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FIX: Minor renaming
KatharineShapcott authored Jan 18, 2023
commit e6bfe1f09f8baf5504585f8c07352867aff5c47f
12 changes: 6 additions & 6 deletions syncopy/datatype/discrete_data.py
Original file line number Diff line number Diff line change
@@ -57,7 +57,7 @@ def data(self, inData):

if inData is not None:
# probably not the most elegant way..
if 'int' not in str(self.data.dtype):
if np.issubdtype(self.data.dtype, np.integer):
raise SPYTypeError(self.data.dtype, 'data', "integer like")

def __str__(self):
@@ -161,7 +161,7 @@ def trialid(self, trlid):

if self.data is None:
SPYError("SyNCoPy core - trialid: Cannot assign `trialid` without data. " +
"Please assing data first")
"Please assign data first")
return
scount = np.nanmax(self.data[:, self.dimord.index("sample")])
try:
@@ -334,7 +334,7 @@ class SpikeData(DiscreteData):
_stackingDimLabel = "sample"
_selectionKeyWords = DiscreteData._selectionKeyWords + ('channel', 'unit',)

def _compute_unique(self):
def _compute_unique_idx(self):
"""
Use `np.unique` on whole(!) dataset to compute globally
available channel and unit indices only once
@@ -379,7 +379,7 @@ def channel(self, chan):
# the constructor was called with data=None, hence
# we have to compute the unique indices here
if self.channel_idx is None:
self._compute_unique()
self._compute_unique_idx()

# we need as many labels as there are distinct channels
nChan = self.channel_idx.size
@@ -425,7 +425,7 @@ def unit(self, unit):
# the constructor was called with data=None, hence
# we have to compute this here
if self.unit_idx is None:
self._compute_unique()
self._compute_unique_idx()

if unit is None and self.data is not None:
raise SPYValueError("Cannot set `unit` to `None` with existing data.")
@@ -557,7 +557,7 @@ def __init__(self,
dimord=dimord)

# for fast lookup and labels
self._compute_unique()
self._compute_unique_idx()

# constructor gets `data=None` for
# empty inits, selections and loading from file