Python utils

class python_utils.SpikeSim(path, sim_fname, neglect_t, neglect_t_end=- 1, config_fname='')[source]

Class loading and parsing files given by a simulation. The main attributes are the simulation parameters and results:

  • end_t: end time of simulation

  • dt: time resolution of the simulation

  • input_mode: external input mode:

    • 0 (base mode): each neuron receives an indipendent poisson signal with mean frequency = SubNetwork::ext_in_rate

    • 2 (paper mode): the input to the striatal population is correlated (ask for details)

  • rho_corr_paper (only with input_mode 2)

  • data: dictionary with spike times corresponding to each population; data[‘pop’] is a list of np.arrays each containing the activity of a neuron

  • subnets: a list of the SubNetworks in the simulation

MeanActivity()[source]

Method computing the mean spiking activity of the subnets

activityDistribution(pop='', save_img='')[source]

Method computing the distribution of the number of spike of each neuron in the subnetworks

static crossCorr(x, y, L, rescale=True)[source]

Method computing the cross correlation between two vectors mediated over subvectors of len L Notes: * L must be even and less than len(x)/2 * the two vector must be of the same lenght * if rescale is True (default) each subvector is zscored before calculating the cross correlation; otherways only the mean is subtracted to the data

getParameterValues()[source]

Method initializing the simulation parameters

histogram(pop='', res=1.0, save_img='')[source]

Method showing or saving the spiking activity of a given subnet

Parameters
  • pop (float) – desidered population; if ‘all’ is passed all population are showed.

  • res – time width of each bin in the histogram

  • save_img (string) – path and name of the file to be saved

info()[source]

Method printing the simulation parameters

loadData()[source]

Method loading spike times for each SubNetwork

necglectTime()[source]

Method removing the spikes occurring before t_start and after t_end (if > 0)

periodogram(pop='', res=1.0, N_parseg=500, save_img='')[source]

Method computing the periodogram resulting from the (z-scored) spiking activity of the passed subnetwork

welch_spectogram(pop='', nparseg=1000, show=True, res=1.0, save_img='', Ns={})[source]

Method computing the spectrogram resulting from the spiking activity of the passed subnetwork using the Welch method

python_utils.load_pkl(path)[source]

Function loading an object from a pickle file.

Parameters

path (string) – path to the object to be loaded

python_utils.readSpikes(file)[source]

Function reading spike times in the format produced by the simulation

Parameters

file (string) – path to the file with spike times

python_utils.save_pkl(obj, path)[source]

Function saving an object as a pickle file.

Parameters
  • obj (generic) – python object (list, dictionary…) to be saved

  • path (string) – path to the object to be saved