|
@@ -51,6 +51,7 @@ from reachgraspio import reachgraspio
|
|
|
import odml.tools
|
|
|
|
|
|
from neo import utils as neo_utils
|
|
|
+from neo_utils import load_segment
|
|
|
import odml_utils
|
|
|
|
|
|
|
|
@@ -127,8 +128,8 @@ def get_arraygrid(signals, chosen_el):
|
|
|
# Load data and metadata for a monkey
|
|
|
# =============================================================================
|
|
|
# CHANGE this parameter to load data of the different monkeys
|
|
|
-# monkey = 'Nikos2'
|
|
|
-monkey = 'Lilou'
|
|
|
+monkey = 'Nikos2'
|
|
|
+# monkey = 'Lilou'
|
|
|
|
|
|
chosen_el = {'Lilou': 71, 'Nikos2': 63}
|
|
|
chosen_units = {'Lilou': range(1, 5), 'Nikos2': range(1, 5)}
|
|
@@ -223,9 +224,33 @@ segment.spiketrains = segment.filter(targdict={'channel_id': chosen_el[monkey]},
|
|
|
segment.spiketrains = [st for st in segment.spiketrains if st.annotations['unit_id'] in range(1, 5)]
|
|
|
# replacing the segment with a new segment containing all data
|
|
|
# to speed up cutting of segments
|
|
|
-from neo_utils import load_segment
|
|
|
segment = load_segment(segment, load_wavefroms=True, channel_indexes=[chosen_el[monkey]])
|
|
|
|
|
|
+# use most raw neuronal data if multiple versions are present
|
|
|
+max_sampling_rate = max([a.sampling_rate for a in segment.analogsignals])
|
|
|
+idx = 0
|
|
|
+while idx < len(segment.analogsignals):
|
|
|
+ signal = segment.analogsignals[idx]
|
|
|
+ if signal.annotations['neural_signal'] and signal.sampling_rate < max_sampling_rate:
|
|
|
+ segment.analogsignals.pop(idx)
|
|
|
+ else:
|
|
|
+ idx += 1
|
|
|
+
|
|
|
+# neural_signals = []
|
|
|
+# behav_signals = []
|
|
|
+# for sig in segment.analogsignals:
|
|
|
+# if sig.annotations['neural_signal']:
|
|
|
+# neural_signals.append(sig)
|
|
|
+# else:
|
|
|
+# behav_signals.append(sig)
|
|
|
+#
|
|
|
+# chosen_raw = neural_signals[0]
|
|
|
+# for sig in neural_signals:
|
|
|
+# if sig.sampling_rate > chosen_raw.sampling_rate:
|
|
|
+# chosen_raw = sig
|
|
|
+#
|
|
|
+# segment.analogsignals = behav_signals + [chosen_raw]
|
|
|
+
|
|
|
# cut segments according to inserted 'complete_trials' epochs and reset trial times
|
|
|
cut_segments = neo_utils.cut_segment_by_epoch(segment, epochs[0], reset_time=True)
|
|
|
|
|
@@ -569,8 +594,7 @@ ax4.text(timebar_xmin + 0.25 * pq.s, timebar_ypos + timebar_labeloffset,
|
|
|
# PLOT BEHAVIORAL SIGNALS of chosen trial
|
|
|
# =============================================================================
|
|
|
# get behavioral signals
|
|
|
-ainp_signals = [nsig for nsig in trial_segment.analogsignals if
|
|
|
- not nsig.annotations['neural_signal']][0]
|
|
|
+ainp_signals = [nsig for nsig in trial_segment.analogsignals if not nsig.annotations['neural_signal']][0]
|
|
|
|
|
|
force_channel_idx = np.where(ainp_signals.array_annotations['channel_ids'] == 141)[0][0]
|
|
|
ainp_trialz_signals = [a for a in trialz_seg.analogsignals if not a.annotations['neural_signal']]
|