diff --git a/examples/plot_rat_hippocampus_foraging.py b/examples/plot_rat_hippocampus_foraging.py index 432c2f7..b718431 100644 --- a/examples/plot_rat_hippocampus_foraging.py +++ b/examples/plot_rat_hippocampus_foraging.py @@ -1,9 +1,9 @@ #!/usr/bin/env python """ -Decode location from CA1 activity +Dataset: CA1 activity during foraging ============================== -This is an example of how to decode location in a free field from CA1 activity +This is an example of how to access data recorded from CA1 during open field foraging """ @@ -15,37 +15,20 @@ # Let's plot the path in the free field import matplotlib.pyplot as plt -plt.plot(dataset.location['x'], dataset.location['y'], alpha=0.5) +plt.plot(dataset.location['x'], dataset.location['y']) plt.axis('equal') plt.show() ######################################### -# Create a feature vector for each time point in the location data +# Create a feature vector, binning spikes for each time point from neuroglia.spike import Binner binner = Binner(sample_times=dataset.location['time']) response = binner.fit_transform(dataset.spikes) -print(response.head()) ######################################### -# create feature +# Plot CA1 activity - -from sklearn.linear_model import LinearRegression -lm = LinearRegression() - -split = int(len(response)/2) - -X_train = response.values[:split] -y_train = dataset.location['x'].values[:split] - -lm.fit(X_train,y_train) - - -X_test = response.values[split:] -y_test = dataset.location['x'].values[split:-1] -y_pred = lm.predict(X_test) -plt.plot(y_test[:100]) -plt.plot(y_pred[:100]) +response.plot() plt.show()