Browse Source

gin commit from nit-ope-de04

Modified files: 1
sprenger 3 years ago
parent
commit
e0d07cbfbd
1 changed files with 7 additions and 5 deletions
  1. 7 5
      code/example.py

+ 7 - 5
code/example.py

@@ -61,8 +61,8 @@ from neo_utils import load_segment
 
 # Specify the path to the recording session to load, eg,
 # '/home/user/l101210-001'
-# session_name = os.path.join('..', 'datasets', 'i140703-001')
-session_name = os.path.join('..', 'datasets', 'l101210-001')
+session_name = os.path.join('..', 'datasets', 'i140703-001')
+# session_name = os.path.join('..', 'datasets', 'l101210-001')
 odml_dir = os.path.join('..', 'datasets')
 
 # Open the session for reading
@@ -124,9 +124,11 @@ for anasig in data_segment.analogsignals:
 
 # Create LFP signal by filtering raw signal if not present already
 if filtered_anasig is None:
-    # Use the Elephant library to filter the signal
+    # Use the Elephant library to filter the signal, filter only target channel
+    target_channel_index = np.where(target_channel_id == raw_anasig.array_annotations['channel_ids'])[0]
+    raw_signal = raw_anasig[:, target_channel_index]
     f_anasig = butter(
-        raw_anasig,
+        raw_signal,
         highpass_freq=None,
         lowpass_freq=250 * pq.Hz,
         order=4)
@@ -223,7 +225,7 @@ nsx_colors = {2: 'k', 5: 'r', 6: 'b'}
 for i, anasig in enumerate(trial_segment.analogsignals):
     # only visualize neural data
     if anasig.annotations['neural_signal']:
-        nsx = anasig.array_annotations[nsx][0]
+        nsx = anasig.array_annotations['nsx'][0]
         target_channel_index = np.where(anasig.array_annotations['channel_ids'] == target_channel_id)[0]
         target_signal = anasig[:, target_channel_index]
         plt.plot(