Skip to content

Commit

Permalink
Fix epoch latency offset (1-indexing to 0-indexing). Bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
jackz314 committed Aug 15, 2022
1 parent 37009fc commit cb158d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion eeglabio/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""The version number."""

__version__ = '0.0.2-1'
__version__ = '0.0.2-2'
4 changes: 2 additions & 2 deletions eeglabio/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def export_set(fname, data, sfreq, events, tmin, tmax, ch_names, event_id=None,

# EEGLAB latency, in units of data sample points
# ensure same int type (int64) as duration
ev_lat = events[:, 0].astype(np.int64)
ev_lat = events[:, 0].astype(np.int64) + 1 # +1 for eeglab indexing

# event durations should all be 0 except boundaries which we don't have
ev_dur = np.zeros_like(ev_lat, dtype=np.int64)
Expand Down Expand Up @@ -114,7 +114,7 @@ def export_set(fname, data, sfreq, events, tmin, tmax, ch_names, event_id=None,
annot_types = np.array(annotations[0])[valid_lat_mask]
annot_dur = np.array(annotations[2])[valid_lat_mask] * sfreq
# epoch number = sample / epoch len + 1
annot_epoch = annot_lat // epoch_len + 1
annot_epoch = (annot_lat - 1) // epoch_len + 1 # -1 switch back

all_types = np.append(ev_types, annot_types)
all_lat = np.append(ev_lat, annot_lat)
Expand Down

0 comments on commit cb158d5

Please sign in to comment.