This GitLab instance reached the end of its service life. It won't be possible to create new users or projects.

Please read the deprecation notice for more information concerning the deprecation timeline

Visit migration.git.tu-berlin.de (internal network only) to import your old projects to the new GitLab platform 📥

Commit 0df84c31 by Simon Weber

fixed examples

parent 31817e79
......@@ -41,12 +41,12 @@ print('PSI gridscore:', global_gridscore)
# The direction of psi give the local orientation of the grid around each spike
# See explanation above.
psi_angle = np.angle(psi, deg=True) / 6
psi_arg = np.angle(psi, deg=True) / 6
# The global grid orientation is the circular mean of the local orientations
# See explanation above.
global_orientation = circmean(psi_angle[np.isfinite(psi_angle)],
high=30, low=-30)
global_orientation = circmean(psi_arg[np.isfinite(psi_arg)],
high=30, low=-30)
print('Global grid orientation:', global_orientation)
###############################################
......@@ -68,7 +68,7 @@ plot.spikemap(shell_limits_choice='automatic_single', weights=weights,
plt.subplot(312)
plot.spikemap(shell_limits_choice='automatic_single',
compare_to_other_symmetries=False,
color_code='psi_angle', weights=weights,
color_code='psi_arg', weights=weights,
dotsize=dotsize, maximum_index=maximum_index)
# Histogram of distances between all locations with highlighted shell.
......
......@@ -3,6 +3,7 @@ from gridscore import spikes
from gridscore import plotting
from scipy.stats import circmean
import matplotlib.pyplot as plt
import hdf5storage
##########################################################################
####################### Spike data from grid cells #######################
......@@ -12,6 +13,8 @@ import matplotlib.pyplot as plt
# Precisely: recording 11016-31010502_T6C3 from Sargolini et al. 2006.
# Load spikepositions for this recording.
spikepositions = np.load('spikepositions.npy')
# Use hdf5storage.loadmat to load matlab files
# spikepositions = hdf5storage.loadmat('SpikePosHome3.mat')['SpikePosition']
# Spiketimes of the spikepositions.
# Irrelevant for the final grid score, but needed for plotting the
......@@ -25,7 +28,7 @@ spiketimes = None
arena_limits = np.array([[-50, 50], [-50, 50]])
# Initiating a Spikes class
spks = spikes.Spikes(positions=spikepositions, arena_limits=arena_limits,
times=spiketimes)
times=spiketimes)
# PSI: A complex number for each spike
psi = spks.psi()
......@@ -49,10 +52,10 @@ psi = spks.psi(compare_to_other_symmetries=False)
# NB: np.angle returns angles in the range -Pi to +Pi.
# So for n_symmetry = 6 the line below leads to
# angles between -30 and 30 degrees.
psi_angle = np.angle(psi, deg=True) / 6
psi_arg = np.angle(psi, deg=True) / 6
# The global grid orientation is the circular mean of the local orientations
global_orientation = circmean(psi_angle, high=30, low=-30)
global_orientation = circmean(psi_arg, high=30, low=-30)
print('Global grid orientation:', global_orientation)
###############################################
......@@ -72,8 +75,8 @@ plot.spikemap(shell_limits_choice='automatic_single', dotsize=dotsize)
# Local orientations
plt.subplot(312)
plot.spikemap(shell_limits_choice='automatic_single',
compare_to_other_symmetries=False,
color_code='psi_angle', dotsize=dotsize)
compare_to_other_symmetries=False,
color_code='psi_arg', dotsize=dotsize)
# plt.figure(figsize=(2, 2))
# Histogram of distances between all locations with highlighted shell.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment