From e0ccb053369ddfe410373941f58a1ed58b0d027e Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Thu, 14 Apr 2022 19:09:10 +0200 Subject: [PATCH 01/20] fix headings for release notes, elephant versions > 0.10.0 --- doc/release_notes.rst | 47 ++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/doc/release_notes.rst b/doc/release_notes.rst index eba563f83..d54361527 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -6,7 +6,7 @@ Elephant 0.11.1 release notes ============================= Bug fixes -------------- +--------- * Fix installation on macOS (#472) Documentation @@ -23,19 +23,19 @@ Other changes * Fixed failing unit test asset on macOS (#474) Selected dependency changes -------------- +--------------------------- * scipy >=1.5.4 (#473) Elephant 0.11.0 release notes ============================= Breaking changes -------------- +---------------- * For current source density measures electrode coordinates can no longer be supplied via a `RecordingChannelGroup` object as it is no longer supported in Neo v0.10.0 (#447) New functionality and features -------------- +------------------------------ * Redesigned `elephant.spike_train_generation` module using classes (old API is retained for compatibility) (#416) * Added function to calculate the multitaper power spectral density estimate in `elephant.spectral` (#417) @@ -44,7 +44,7 @@ New functionality and features * Support for the new `SpikeTrainList` object of Neo (#447) Bug fixes -------------- +--------- * Issue with unit scaling in `BinnedSpikeTrain` (#425) * Changed `BinnedSpikeTrain` to support quantities<0.12.4 (#418) @@ -79,7 +79,7 @@ Other changes Selected dependency changes -------------- +--------------------------- * nixio >= 1.5.0 * neo >= 0.10.0 * python >= 3.7 @@ -123,8 +123,7 @@ Bug fixes Elephant 0.9.0 release notes -**************************** - +============================ This release is titled to accompany the [2nd Elephant User Workshop](https://www.humanbrainproject.eu/en/education/participatecollaborate/infrastructure-events-trainings/2nd-elephant-user-workshop/) Viziphant @@ -189,10 +188,8 @@ Bug fixes - surrogates get arbitrary sampling_rate (https://github.com/NeuralEnsemble/elephant/pull/353), which relates to the provenance tracking issue; - Elephant 0.8.0 release notes -**************************** - +============================ New features ------------ * The `parallel` module is a new experimental module (https://github.com/NeuralEnsemble/elephant/pull/307) to run python functions concurrently. Supports native (pythonic) ProcessPollExecutor and MPI. Not limited to Elephant functional. @@ -218,7 +215,7 @@ Breaking changes * Naming convention changes (`binsize` -> `bin_size`, etc.) in almost all Elephant functions (https://github.com/NeuralEnsemble/elephant/pull/316). Elephant 0.7.0 release notes -**************************** +============================ Breaking changes ---------------- @@ -264,7 +261,7 @@ Performance Elephant 0.6.4 release notes -**************************** +============================ This release has been made for the "1st Elephant User Workshop" (https://www.humanbrainproject.eu/en/education/participatecollaborate/infrastructure-events-trainings/1st-elephant-user-workshop-accelerate-structured-and-reproducibl). @@ -296,7 +293,7 @@ Improvements Elephant 0.6.3 release notes -**************************** +============================ July 22nd 2019 The release v0.6.3 is mostly about improving maintenance. @@ -319,7 +316,7 @@ Other changes * Single VERSION file (https://github.com/NeuralEnsemble/elephant/pull/231) Elephant 0.6.2 release notes -**************************** +============================ April 23rd 2019 New functions @@ -334,7 +331,7 @@ Other changes Elephant 0.6.1 release notes -**************************** +============================ April 1st 2019 New functions @@ -352,7 +349,7 @@ Other changes Elephant 0.6.0 release notes -**************************** +============================ October 12th 2018 New functions @@ -370,7 +367,7 @@ Other changes Elephant 0.5.0 release notes -**************************** +============================ April 4nd 2018 New functions @@ -390,7 +387,7 @@ Other changes Elephant 0.4.3 release notes -**************************** +============================ March 2nd 2018 Other changes @@ -400,7 +397,7 @@ Other changes Elephant 0.4.2 release notes -**************************** +============================ March 1st 2018 New functions @@ -426,7 +423,7 @@ Other changes Elephant 0.4.1 release notes -**************************** +============================ March 23rd 2017 Other changes @@ -435,7 +432,7 @@ Other changes Elephant 0.4.0 release notes -**************************** +============================ March 22nd 2017 New functions @@ -461,7 +458,7 @@ Other changes Elephant 0.3.0 release notes -**************************** +============================ April 12st 2016 New functions @@ -490,7 +487,7 @@ Other changes Elephant 0.2.1 release notes -**************************** +============================ February 18th 2016 Other changes @@ -499,7 +496,7 @@ Minor bug fixes. Elephant 0.2.0 release notes -**************************** +============================ September 22nd 2015 New functions From 1f62bf5b31bc9c5bdf6657bdac92da887398a653 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Thu, 14 Apr 2022 19:46:32 +0200 Subject: [PATCH 02/20] fixed warnings on build html for asset docstring --- elephant/asset/asset.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/elephant/asset/asset.py b/elephant/asset/asset.py index 7a28089b5..b61f0d1cc 100644 --- a/elephant/asset/asset.py +++ b/elephant/asset/asset.py @@ -1874,6 +1874,7 @@ def intersection_matrix(self, normalization=None): * 'intersection': `len(intersection(s_i, s_j))` * 'mean': `sqrt(len(s_1) * len(s_2))` * 'union': `len(union(s_i, s_j))` + Default: None Returns @@ -1928,9 +1929,9 @@ def probability_matrix_montecarlo(self, n_surrogates, imat=None, If None, the output of :func:`ASSET.intersection_matrix` is used. Default: None surrogate_method : {'dither_spike_train', 'dither_spikes', - 'jitter_spikes', - 'randomise_spikes', 'shuffle_isis', - 'joint_isi_dithering'}, optional + 'jitter_spikes', 'randomise_spikes', 'shuffle_isis', + 'joint_isi_dithering'}, optional + The method to generate surrogate spike trains. Refer to the :func:`spike_train_surrogates.surrogates` documentation for more information about each surrogate method. Note that some of these @@ -2204,9 +2205,10 @@ def joint_probability_matrix(self, pmat, filter_shape, n_largest, precision : {'float', 'double'}, optional Single or double floating-point precision for the resulting `jmat` matrix. - * `'float'`: 32 bits; the tolerance error is ``≲1e-3``. + * `'float'`: 32 bits; the tolerance error is ``≲1e-3``. * `'double'`: 64 bits; the tolerance error is ``<1e-5``. + Double floating-point precision is typically x4 times slower than the single floating-point equivalent. Default: 'float' From 0d60d9aa45cbf23a3af181fbfc246bcaece519d1 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Thu, 14 Apr 2022 20:00:07 +0200 Subject: [PATCH 03/20] fixed warnings on build html for causality.granger docstring --- elephant/causality/granger.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/elephant/causality/granger.py b/elephant/causality/granger.py index 5c6311200..1eba6279e 100644 --- a/elephant/causality/granger.py +++ b/elephant/causality/granger.py @@ -370,8 +370,10 @@ def pairwise_granger(signals, max_order, information_criterion='aic'): Maximal order of autoregressive model. information_criterion : {'aic', 'bic'}, optional A function to compute the information criterion: - `bic` for Bayesian information_criterion, - `aic` for Akaike information criterion, + + * `bic` for Bayesian information_criterion, + * `aic` for Akaike information criterion, + Default: 'aic' Returns @@ -543,8 +545,10 @@ def conditional_granger(signals, max_order, information_criterion='aic'): Maximal order of autoregressive model. information_criterion : {'aic', 'bic'}, optional A function to compute the information criterion: - `bic` for Bayesian information_criterion, - `aic` for Akaike information criterion, + + * `bic` for Bayesian information_criterion, + * `aic` for Akaike information criterion, + Default: 'aic' Returns From 2b9f49cb92b9425d8104930bd3db45a4c01b782a Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Thu, 14 Apr 2022 20:30:20 +0200 Subject: [PATCH 04/20] fixed warnings on build html for cell_assembly_detection docstring --- elephant/cell_assembly_detection.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/elephant/cell_assembly_detection.py b/elephant/cell_assembly_detection.py index d225d7296..064845281 100644 --- a/elephant/cell_assembly_detection.py +++ b/elephant/cell_assembly_detection.py @@ -157,10 +157,11 @@ def cell_assembly_detection(binned_spiketrain, max_lag, reference_lag=2, if they appear in the very same configuration. Default: False bool_times_format : bool, optional - .. deprecated:: 0.10.0 - Has no effect, the returning 'times' are always a quantity array - specifying the pattern spike times. - Default: None + .. deprecated:: 0.10.0 + Has no effect, the returning 'times' are always a quantity array + specifying the pattern spike times. + Default: None + verbose : bool, optional Regulates the number of prints given by the method. If true all prints are given, otherwise the method does give any prints. From e9b633a8f3db8cceabe6c02d89f1141cbd80c286 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 15 Apr 2022 00:07:23 +0200 Subject: [PATCH 05/20] more fixes --- doc/conf.py | 1 - elephant/cell_assembly_detection.py | 2 ++ elephant/conversion.py | 14 +++++++------- elephant/current_source_density.py | 8 ++++---- elephant/gpfa/gpfa.py | 7 ------- elephant/signal_processing.py | 13 ++++--------- elephant/spade.py | 2 +- elephant/spike_train_correlation.py | 20 +++++++++++--------- elephant/spike_train_surrogates.py | 4 ++-- 9 files changed, 31 insertions(+), 40 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index d77f26acd..e9ce4dd41 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -21,7 +21,6 @@ sys.path.insert(0, '..') # -- General configuration ----------------------------------------------- - # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' diff --git a/elephant/cell_assembly_detection.py b/elephant/cell_assembly_detection.py index 064845281..e611c2087 100644 --- a/elephant/cell_assembly_detection.py +++ b/elephant/cell_assembly_detection.py @@ -157,7 +157,9 @@ def cell_assembly_detection(binned_spiketrain, max_lag, reference_lag=2, if they appear in the very same configuration. Default: False bool_times_format : bool, optional + .. deprecated:: 0.10.0 + Has no effect, the returning 'times' are always a quantity array specifying the pattern spike times. Default: None diff --git a/elephant/conversion.py b/elephant/conversion.py index ecf4b06eb..6ec64a5be 100644 --- a/elephant/conversion.py +++ b/elephant/conversion.py @@ -317,6 +317,7 @@ class BinnedSpikeTrain(object): ----- There are four minimal configurations of the optional parameters which have to be provided, otherwise a `ValueError` will be raised: + * t_start, n_bins, bin_size * t_start, n_bins, t_stop * t_start, bin_size, t_stop @@ -325,7 +326,7 @@ class BinnedSpikeTrain(object): If `spiketrains` is a `neo.SpikeTrain` or a list thereof, it is enough to explicitly provide only one parameter: `n_bins` or `bin_size`. The `t_start` and `t_stop` will be calculated from given `spiketrains` (max - `t_start` and min `t_stop` of `neo.SpikeTrain`s). + `t_start` and min `t_stop` of `neo.SpikeTrain`s`). Missing parameter will be calculated automatically. All parameters will be checked for consistency. A corresponding error will be raised, if one of the four parameters does not match the consistency @@ -831,7 +832,7 @@ def to_spike_trains(self, spikes="random", as_array=False, .. code-block:: python - BinnedSpikeTrain(binned_st.to_spike_trains()) == binned_st + BinnedSpikeTrain(binned_st.to_spike_trains()) == binned_st The object bin size is stored in resulting ``spiketrain.annotations['bin_size']``. @@ -842,13 +843,12 @@ def to_spike_trains(self, spikes="random", as_array=False, Specifies how to generate spikes inside bins. * "left": align spikes from left to right to have equal inter- - spike interval; - + spike interval; * "center": align spikes around center to have equal inter-spike - interval; - + interval; * "random": generate spikes from a homogenous Poisson process; - it's the fastest mode. + it's the fastest mode. + Default: "random" as_array : bool, optional If True, numpy arrays are returned; otherwise, wrap the arrays in diff --git a/elephant/current_source_density.py b/elephant/current_source_density.py index 6638d9e8e..f542e1cc4 100644 --- a/elephant/current_source_density.py +++ b/elephant/current_source_density.py @@ -12,9 +12,9 @@ CSD is also called as Source Localization or Source Imaging in the EEG circles. Here are CSD methods for different types of electrode configurations. -- 1D - laminar probe like electrodes. -- 2D - Microelectrode Array like -- 3D - UtahArray or multiple laminar probes. +- 1D -laminar probe like electrodes. +- 2D -Microelectrode Array like +- 3D -UtahArray or multiple laminar probes. The following methods have been implemented so far @@ -85,7 +85,7 @@ def estimate_csd(lfp, coordinates='coordinates', method=None, method : string Pick a method corresponding to the setup, in this implementation For Laminar probe style (1D), use 'KCSD1D' or 'StandardCSD', - or 'DeltaiCSD' or 'StepiCSD' or 'SplineiCSD' + or 'DeltaiCSD' or 'StepiCSD' or 'SplineiCSD' For MEA probe style (2D), use 'KCSD2D', or 'MoIKCSD' For array of laminar probes (3D), use 'KCSD3D' Defaults to None diff --git a/elephant/gpfa/gpfa.py b/elephant/gpfa/gpfa.py index 85681172d..86d20c06f 100644 --- a/elephant/gpfa/gpfa.py +++ b/elephant/gpfa/gpfa.py @@ -191,13 +191,6 @@ class GPFA(sklearn.base.BaseEstimator): mapping between the neuronal data space and the orthonormal latent variable space - Methods - ------- - fit - transform - fit_transform - score - Raises ------ ValueError diff --git a/elephant/signal_processing.py b/elephant/signal_processing.py index dbcfb7293..2a830b711 100644 --- a/elephant/signal_processing.py +++ b/elephant/signal_processing.py @@ -413,13 +413,10 @@ def butter(signal, highpass_frequency=None, lowpass_frequency=None, order=4, `lowpass_frequency` and `highpass_frequency`: * `highpass_frequency` only (`lowpass_frequency` is None): - highpass filter - + highpass filter * `lowpass_frequency` only (`highpass_frequency` is None): - lowpass filter - + lowpass filter * `highpass_frequency` < `lowpass_frequency`: bandpass filter - * `highpass_frequency` > `lowpass_frequency`: bandstop filter Default: None @@ -430,9 +427,7 @@ def butter(signal, highpass_frequency=None, lowpass_frequency=None, order=4, Filtering function to be used. Available filters: * 'filtfilt': `scipy.signal.filtfilt`; - * 'lfilter': `scipy.signal.lfilter`; - * 'sosfiltfilt': `scipy.signal.sosfiltfilt`. In most applications 'filtfilt' should be used, because it doesn't @@ -884,8 +879,8 @@ def rauc(signal, baseline=None, bin_duration=None, t_start=None, t_stop=None): If None, ends at the last time of `signal`. The signal is cropped using `signal.time_slice(t_start, t_stop)` after baseline removal. Useful if you want the RAUC for a short section of - the signal but want the mean or median calculation (`baseline`='mean' - or `baseline`='median') to use the entire signal for better baseline + the signal but want the mean or median calculation (`baseline` ='mean' + or `baseline` ='median') to use the entire signal for better baseline estimation. Default: None diff --git a/elephant/spade.py b/elephant/spade.py index 8ad93d190..d5297cc37 100644 --- a/elephant/spade.py +++ b/elephant/spade.py @@ -179,7 +179,7 @@ def spade(spiketrains, bin_size, winlen, min_spikes=2, min_occ=2, pattern. If None, no maximal number of occurrences is considered. Default: None min_neu : int, optional - Minimum number of neurons in a sequence to considered a pattern. + Minimum number of neurons in a sequence to consider a pattern. Default: 1 approx_stab_pars : dict or None, optional Parameter values for approximate stability computation. diff --git a/elephant/spike_train_correlation.py b/elephant/spike_train_correlation.py index a70c0a074..0d8324f36 100644 --- a/elephant/spike_train_correlation.py +++ b/elephant/spike_train_correlation.py @@ -329,7 +329,7 @@ def covariance(binned_spiketrain, binary=False, fast=True): When using `fast=True` and `binned_spiketrain` shape is large. Warns - -------- + ----- UserWarning If at least one row in `binned_spiketrain` is empty (has no spikes). @@ -435,7 +435,7 @@ def correlation_coefficient(binned_spiketrain, binary=False, fast=True): When using `fast=True` and `binned_spiketrain` shape is large. Warns - -------- + ----- UserWarning If at least one row in `binned_spiketrain` is empty (has no spikes). @@ -568,18 +568,18 @@ def cross_correlation_histogram( spike trains can have any `t_start` and `t_stop`. window : {'valid', 'full'} or list of int, optional ‘full’: This returns the cross-correlation at each point of overlap, - with an output shape of (N+M-1,). At the end-points of the - cross-correlogram, the signals do not overlap completely, and - boundary effects may be seen. + with an output shape of (N+M-1,). At the end-points of the + cross-correlogram, the signals do not overlap completely, and + boundary effects may be seen. ‘valid’: Mode valid returns output of length max(M, N) - min(M, N) + 1. - The cross-correlation product is only given for points where - the signals overlap completely. - Values outside the signal boundary have no effect. + The cross-correlation product is only given for points where + the signals overlap completely. + Values outside the signal boundary have no effect. List of integers (min_lag, max_lag): The entries of window are two integers representing the left and right extremes (expressed as number of bins) where the cross-correlation is computed. - Default: 'full' + Default: 'full' border_correction : bool, optional whether to correct for the border effect. If True, the value of the CCH at bin :math:`b` (for :math:`b=-H,-H+1, ...,H`, where :math:`H` is @@ -600,10 +600,12 @@ def cross_correlation_histogram( smoothing window. The smoothing window cannot be larger than the maximum lag of the CCH. The kernel is normalized to unit area before being applied to the resulting CCH. Popular choices for the kernel are + * normalized boxcar kernel: `numpy.ones(N)` * hamming: `numpy.hamming(N)` * hanning: `numpy.hanning(N)` * bartlett: `numpy.bartlett(N)` + If None, the CCH is not smoothed. Default: None method : {'speed', 'memory'}, optional diff --git a/elephant/spike_train_surrogates.py b/elephant/spike_train_surrogates.py index 6a1acbec5..b9f6fec7a 100644 --- a/elephant/spike_train_surrogates.py +++ b/elephant/spike_train_surrogates.py @@ -768,7 +768,7 @@ class JointISI(object): Default: False method : {'fast', 'window'}, optional * 'fast': the spike can move in the whole range between the - previous and subsequent spikes (computationally efficient). + previous and subsequent spikes (computationally efficient). * 'window': the spike movement is limited to the parameter `dither`. Default: 'window' @@ -1029,7 +1029,7 @@ def dithering(self, n_surrogates=1): Default: 1 Returns - ---------- + ------- dithered_sts : list of neo.SpikeTrain Spike trains, that are dithered versions of the given :attr:`spiketrain`. From f3b321643cd408b9122e21059e8e0ec5ad17152c Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 15 Apr 2022 01:32:13 +0200 Subject: [PATCH 06/20] fixed indentation errors --- elephant/spade.py | 18 +++++++++++------- elephant/spike_train_generation.py | 7 ++++++- elephant/spike_train_synchrony.py | 13 +++++++++---- elephant/unitary_event_analysis.py | 4 ++-- 4 files changed, 28 insertions(+), 14 deletions(-) diff --git a/elephant/spade.py b/elephant/spade.py index d5297cc37..8c048c342 100644 --- a/elephant/spade.py +++ b/elephant/spade.py @@ -25,13 +25,15 @@ Notes ----- -This modules relies on the C++ implementation of the fp-growth algorithm developed by -Forian Porrmann (available at https://github.com/fporrmann/FPG). The module replaces -a more generic implementation of the algorithm by Christian Borgelt -(http://www.borgelt.net/pyfim.html) that was used in previous versions of Elephant. -If the module (fim.so) is not available in a precompiled format (currently Linux/Windows) or cannot -be compiled on a given system during install, SPADE will make use of a pure Python implementation -of the fast fca algorithm contained in `elephant/spade_src/fast_fca.py`, which is +This modules relies on the C++ implementation of the fp-growth +algorithm developed by Forian Porrmann (available at +https://github.com/fporrmann/FPG). The module replaces a more generic +implementation of the algorithm by Christian Borgelt ( +http://www.borgelt.net/pyfim.html) that was used in previous versions of +Elephant. If the module (fim.so) is not available in a precompiled format ( +currently Linux/Windows) or cannot be compiled on a given system during +install, SPADE will make use of a pure Python implementation of the fast fca +algorithm contained in `elephant/spade_src/fast_fca.py`, which is significantly slower. @@ -268,12 +270,14 @@ def spade(spiketrains, bin_size, winlen, min_spikes=2, min_occ=2, If `output_format` is 'concepts', then `output['patterns']` is a tuple of patterns which in turn are tuples of + 1. spikes in the pattern 2. occurrences of the pattern For details see :func:`concepts_mining`. if stability is calculated, there are also: + 3. intensional stability 4. extensional stability diff --git a/elephant/spike_train_generation.py b/elephant/spike_train_generation.py index 47b300f6e..ca049e380 100644 --- a/elephant/spike_train_generation.py +++ b/elephant/spike_train_generation.py @@ -270,7 +270,9 @@ def peak_detection(signal, threshold=0.0 * pq.mV, sign='above', of a (default) `neo.SpikeTrain` object. Default: False format : {None, 'raw'}, optional + .. deprecated:: 0.8.0 + Whether to return as SpikeTrain (None) or as a plain array of times ('raw'). Deprecated. Use `as_array=False` for None format and `as_array=True` @@ -1347,11 +1349,13 @@ def single_interaction_process( Overall mean rate of the time series to be generated (coincidence rate `coincidence_rate` is subtracted to determine the background rate). Can be: + * a float, representing the overall mean rate of each process. If so, it must be higher than `coincidence_rate`. * an iterable of floats (one float per process), each float representing the overall mean rate of a process. If so, all the entries must be larger than `coincidence_rate`. + coincidence_rate : pq.Quantity Coincidence rate (rate of coincidences for the n-dimensional SIP). The SIP spike trains will have coincident events with rate @@ -1373,9 +1377,10 @@ def single_interaction_process( istic (i.e. rate_coincidence is the actual rate with which coincidences are generated) or stochastic (i.e. rate_coincidence is the mean rate of coincidences): - * 'deterministic': deterministic rate + * 'deterministic': deterministic rate * 'stochastic': stochastic rate + Default: 'deterministic' t_start : pq.Quantity, optional Starting time of the series. If specified, it must be lower than diff --git a/elephant/spike_train_synchrony.py b/elephant/spike_train_synchrony.py index f8e438527..a59cbfc3e 100644 --- a/elephant/spike_train_synchrony.py +++ b/elephant/spike_train_synchrony.py @@ -87,7 +87,7 @@ def spike_contrast(spiketrains, t_start=None, t_stop=None, A list of input spike trains to calculate the synchrony from. t_start : pq.Quantity, optional The beginning of the spike train. If None, it's taken as the minimum - value of `t_start`s of the input spike trains. + value of `t_start's` of the input spike trains. Default: None t_stop : pq.Quantity, optional The end of the spike train. If None, it's taken as the maximum value @@ -284,22 +284,26 @@ def delete_synchrofacts(self, threshold, in_place=False, mode='delete'): threshold : int Threshold value for the deletion of spikes engaged in synchronous activity. + * `deletion_threshold >= 2` leads to all spikes with a larger or - equal complexity value to be deleted/extracted. + equal complexity value to be deleted/extracted. * `deletion_threshold <= 1` leads to a ValueError, since this - would delete/extract all spikes and there are definitely more - efficient ways of doing so. + would delete/extract all spikes and there are definitely more + efficient ways of doing so. + in_place : bool, optional Determines whether the modification are made in place on ``self.input_spiketrains``. Default: False mode : {'delete', 'extract'}, optional Inversion of the mask for deletion of synchronous events. + * ``'delete'`` leads to the deletion of all spikes with complexity >= `threshold`, i.e. deletes synchronous spikes. * ``'extract'`` leads to the deletion of all spikes with complexity < `threshold`, i.e. extracts synchronous spikes. + Default: 'delete' Raises @@ -314,6 +318,7 @@ def delete_synchrofacts(self, threshold, in_place=False, mode='delete'): list of neo.SpikeTrain List of spiketrains where the spikes with ``complexity >= threshold`` have been deleted/extracted. + * If ``in_place`` is True, the returned list is the same as ``self.input_spiketrains``. * If ``in_place`` is False, the returned list is a deepcopy of diff --git a/elephant/unitary_event_analysis.py b/elephant/unitary_event_analysis.py index a91a57759..424ec9efe 100644 --- a/elephant/unitary_event_analysis.py +++ b/elephant/unitary_event_analysis.py @@ -726,15 +726,15 @@ def jointJ_window_analysis(spiketrains, bin_size=5 * pq.ms, Default: None method : str, optional The method with which to compute the unitary events: + * 'analytic_TrialByTrial': calculate the analytical expectancy on each trial, then sum over all trials; - * 'analytic_TrialAverage': calculate the expectancy by averaging over trials (cf. Gruen et al. 2003); - * 'surrogate_TrialByTrial': calculate the distribution of expected coincidences by spike time randomization in each trial and sum over trials. + Default: 'analytic_trialByTrial' t_start, t_stop : float or pq.Quantity, optional The start and stop times to use for the time points. From 4c84759d3a40c47e4561091b0cfc8bffbe2384bc Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 15 Apr 2022 12:03:51 +0200 Subject: [PATCH 07/20] fixed import errors --- .../spike_train_generation_class.rst | 30 ++++++ doc/conf.py | 102 +++++++++--------- elephant/spike_train_correlation.py | 1 + elephant/spike_train_generation.py | 5 +- 4 files changed, 87 insertions(+), 51 deletions(-) create mode 100644 doc/_templates/autosummary/spike_train_generation_class.rst diff --git a/doc/_templates/autosummary/spike_train_generation_class.rst b/doc/_templates/autosummary/spike_train_generation_class.rst new file mode 100644 index 000000000..7dfdd91f2 --- /dev/null +++ b/doc/_templates/autosummary/spike_train_generation_class.rst @@ -0,0 +1,30 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + + {% block methods %} + + {% if methods %} + .. rubric:: {{ _('Methods') }} + + .. autosummary:: + {% for item in methods %} + ~{{ name }}.{{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Attributes') }} + + .. autosummary:: + {% for item in attributes %} + {%- if item not in ["process_operational_time","isi_generator"] %} + ~{{ name }}.{{ item }} + {%- endif %} + {%- endfor %} + {% endif %} + {% endblock %} diff --git a/doc/conf.py b/doc/conf.py index e9ce4dd41..9afec5037 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -3,7 +3,8 @@ # Elephant documentation build configuration file, created by # sphinx-quickstart on Wed Feb 5 17:11:26 2014. # -# This file is execfile()d with the current directory set to its containing dir. +# This file is execfile()d with the current directory set to its containing +# dir. # # Note that not all possible configuration values are present in this # autogenerated file. @@ -22,9 +23,10 @@ # -- General configuration ----------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' -# Add any Sphinx extension module names here, as strings. They can be extensions +# Add any Sphinx extension module names here, as strings. They can be +# extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', @@ -43,13 +45,13 @@ ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ['_templates/autosummary'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' @@ -75,13 +77,13 @@ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -90,25 +92,26 @@ '**.ipynb_checkpoints', ] -# The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# The reST default role (used for this markup: `text`) to use for all +# documents. +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # Only execute Jupyter notebooks that have no evaluated cells nbsphinx_execute = 'auto' @@ -138,17 +141,17 @@ # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -166,30 +169,30 @@ # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. html_show_sphinx = False @@ -200,10 +203,10 @@ # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'elephantdoc' @@ -217,7 +220,6 @@ # https://github.com/sphinx-doc/sphinx/issues/6705#issuecomment-536197438 html4_writer = True - # -- Options for LaTeX output -------------------------------------------- latex_elements = { @@ -232,7 +234,8 @@ } # Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). +# (source start file, target name, title, author, documentclass +# [howto/manual]). latex_documents = [ ('index', 'elephant.tex', u'Elephant Documentation', authors, 'manual'), @@ -240,23 +243,23 @@ # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------- @@ -269,7 +272,7 @@ ] # If true, show URL addresses after external links. -#man_show_urls = False +# man_show_urls = False # -- Options for Texinfo output ------------------------------------------ @@ -288,13 +291,13 @@ ] # Documents to append as an appendix to all manuals. -#texinfo_appendices = [] +# texinfo_appendices = [] # If false, no module index is generated. -#texinfo_domain_indices = True +# texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. -#texinfo_show_urls = 'footnote' +# texinfo_show_urls = 'footnote' # -- Options for Epub output --------------------------------------------- @@ -307,37 +310,37 @@ # The language of the text. It defaults to the language option # or en if the language is not set. -#epub_language = '' +# epub_language = '' # The scheme of the identifier. Typical schemes are ISBN or URL. -#epub_scheme = '' +# epub_scheme = '' # The unique identifier of the text. This can be a ISBN number # or the project homepage. -#epub_identifier = '' +# epub_identifier = '' # A unique identification for the text. -#epub_uid = '' +# epub_uid = '' # A tuple containing the cover image and cover page html template filenames. -#epub_cover = () +# epub_cover = () # HTML files that should be inserted before the pages created by sphinx. # The format is a list of tuples containing the path and title. -#epub_pre_files = [] +# epub_pre_files = [] # HTML files shat should be inserted after the pages created by sphinx. # The format is a list of tuples containing the path and title. -#epub_post_files = [] +# epub_post_files = [] # A list of files that should not be packed into the epub file. -#epub_exclude_files = [] +# epub_exclude_files = [] # The depth of the table of contents in toc.ncx. -#epub_tocdepth = 3 +# epub_tocdepth = 3 # Allow duplicate toc entries. -#epub_tocdup = True +# epub_tocdup = True # configuration for intersphinx: refer to Viziphant @@ -347,7 +350,8 @@ } # Use more reliable mathjax source -mathjax_path = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' +mathjax_path = 'https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' # noqa + # Remove the copyright notice from docstrings: diff --git a/elephant/spike_train_correlation.py b/elephant/spike_train_correlation.py index 0d8324f36..f2b92d677 100644 --- a/elephant/spike_train_correlation.py +++ b/elephant/spike_train_correlation.py @@ -556,6 +556,7 @@ def cross_correlation_histogram( """ Computes the cross-correlation histogram (CCH) between two binned spike trains `binned_spiketrain_i` and `binned_spiketrain_j`. + :cite:`correlation-Eggermont2010_77` Visualization of this function is covered in Viziphant: :func:`viziphant.spike_train_correlation.plot_cross_correlation_histogram`. diff --git a/elephant/spike_train_generation.py b/elephant/spike_train_generation.py index ca049e380..7a7dd2931 100644 --- a/elephant/spike_train_generation.py +++ b/elephant/spike_train_generation.py @@ -17,6 +17,7 @@ **************************** .. autosummary:: :toctree: _toctree/spike_train_generation + :template: spike_train_generation_class.rst StationaryPoissonProcess StationaryGammaProcess @@ -580,8 +581,8 @@ class StationaryPoissonProcess(RenewalProcess): """ Generates spike trains whose spikes are realizations of a stationary Poisson process with the given rate, starting at time `t_start` and - stopping at time `t_stop`. Optionally, a absolute refractory period / - dead time can be specified. + stopping at time `t_stop` :cite:`generation-Deger12_443`. Optionally, + a absolute refractory period / dead time can be specified. Parameters ---------- From 815d618349e97b486c6bf0c69a5677c271a09fa7 Mon Sep 17 00:00:00 2001 From: Moritz Kern <92092328+Moritz-Alexander-Kern@users.noreply.github.com> Date: Fri, 22 Apr 2022 19:43:20 +0200 Subject: [PATCH 08/20] Apply suggestions from code review Co-authored-by: Michael Denker --- elephant/spike_train_generation.py | 2 +- elephant/spike_train_synchrony.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/elephant/spike_train_generation.py b/elephant/spike_train_generation.py index 7a7dd2931..aaeed9197 100644 --- a/elephant/spike_train_generation.py +++ b/elephant/spike_train_generation.py @@ -582,7 +582,7 @@ class StationaryPoissonProcess(RenewalProcess): Generates spike trains whose spikes are realizations of a stationary Poisson process with the given rate, starting at time `t_start` and stopping at time `t_stop` :cite:`generation-Deger12_443`. Optionally, - a absolute refractory period / dead time can be specified. + an absolute refractory period / dead time can be specified. Parameters ---------- diff --git a/elephant/spike_train_synchrony.py b/elephant/spike_train_synchrony.py index a59cbfc3e..b7247731e 100644 --- a/elephant/spike_train_synchrony.py +++ b/elephant/spike_train_synchrony.py @@ -87,7 +87,7 @@ def spike_contrast(spiketrains, t_start=None, t_stop=None, A list of input spike trains to calculate the synchrony from. t_start : pq.Quantity, optional The beginning of the spike train. If None, it's taken as the minimum - value of `t_start's` of the input spike trains. + value of `t_start` values of the input spike trains. Default: None t_stop : pq.Quantity, optional The end of the spike train. If None, it's taken as the maximum value From 980720c749d8fc2403214484890845bfbb56b335 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Tue, 10 May 2022 16:23:43 +0200 Subject: [PATCH 09/20] removed 'binsize', deprecated, use 'bin_size' --- elephant/gpfa/gpfa.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/elephant/gpfa/gpfa.py b/elephant/gpfa/gpfa.py index 86d20c06f..4cfc3c6ee 100644 --- a/elephant/gpfa/gpfa.py +++ b/elephant/gpfa/gpfa.py @@ -259,11 +259,6 @@ def __init__(self, bin_size=20 * pq.ms, x_dim=3, min_var_frac=0.01, self.fit_info = dict() self.transform_info = dict() - @property - def binsize(self): - warnings.warn("'binsize' is deprecated; use 'bin_size'") - return self.bin_size - def fit(self, spiketrains): """ Fit the model with the given training data. From 86ee496fc980ec0d7a5ab102bcae07807c647752 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Tue, 10 May 2022 16:57:30 +0200 Subject: [PATCH 10/20] removed deprecation for __init__ --- elephant/gpfa/gpfa.py | 1 - 1 file changed, 1 deletion(-) diff --git a/elephant/gpfa/gpfa.py b/elephant/gpfa/gpfa.py index 4cfc3c6ee..8f30ae095 100644 --- a/elephant/gpfa/gpfa.py +++ b/elephant/gpfa/gpfa.py @@ -229,7 +229,6 @@ class GPFA(sklearn.base.BaseEstimator): ... 'latent_variable']) """ - @deprecated_alias(binsize='bin_size') def __init__(self, bin_size=20 * pq.ms, x_dim=3, min_var_frac=0.01, tau_init=100.0 * pq.ms, eps_init=1.0E-3, em_tol=1.0E-8, em_max_iters=500, freq_ll=5, verbose=False): From 9137982e3b1dfface277cbffdfd6f6bb7f8c7235 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Thu, 11 Aug 2022 14:19:07 +0200 Subject: [PATCH 11/20] added template for gpfa --- doc/_templates/autosummary/gpfa_class.rst | 7 +++++++ elephant/gpfa/gpfa.py | 9 +++++++++ 2 files changed, 16 insertions(+) create mode 100644 doc/_templates/autosummary/gpfa_class.rst diff --git a/doc/_templates/autosummary/gpfa_class.rst b/doc/_templates/autosummary/gpfa_class.rst new file mode 100644 index 000000000..0c146b266 --- /dev/null +++ b/doc/_templates/autosummary/gpfa_class.rst @@ -0,0 +1,7 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :special-members: __contains__,__getitem__,__iter__,__len__,__add__,__sub__,__mul__,__div__,__neg__ + :members: diff --git a/elephant/gpfa/gpfa.py b/elephant/gpfa/gpfa.py index 8f30ae095..c7f1b59ab 100644 --- a/elephant/gpfa/gpfa.py +++ b/elephant/gpfa/gpfa.py @@ -36,6 +36,7 @@ .. autosummary:: :toctree: _toctree/gpfa + :template: gpfa_class.rst GPFA @@ -229,9 +230,12 @@ class GPFA(sklearn.base.BaseEstimator): ... 'latent_variable']) """ + @deprecated_alias(binsize='bin_size') def __init__(self, bin_size=20 * pq.ms, x_dim=3, min_var_frac=0.01, tau_init=100.0 * pq.ms, eps_init=1.0E-3, em_tol=1.0E-8, em_max_iters=500, freq_ll=5, verbose=False): + """Initialize object + """ self.bin_size = bin_size self.x_dim = x_dim self.min_var_frac = min_var_frac @@ -258,6 +262,11 @@ def __init__(self, bin_size=20 * pq.ms, x_dim=3, min_var_frac=0.01, self.fit_info = dict() self.transform_info = dict() + @property + def binsize(self): + warnings.warn("'binsize' is deprecated; use 'bin_size'") + return self.bin_size + def fit(self, spiketrains): """ Fit the model with the given training data. From 70bb744ebe2d809e2780c62972f6210798327f56 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Mon, 7 Nov 2022 16:54:51 +0100 Subject: [PATCH 12/20] overline for heading in install.rst --- doc/install.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/install.rst b/doc/install.rst index bac0e9979..5a9dbc36f 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -209,9 +209,10 @@ You can have one, both, or none installed in your system. unresponsive until the compute program terminates. .. _no-compile-spade: -*********** + +**************************** Resolving compilation issues -*********** +**************************** Some modules in Elephant make use of C extensions to speed up computation. However, those extensions need to be compiled before use. In some cases, this From 04be5eab8a4b105010f339889f43441ec629a56b Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Wed, 16 Nov 2022 10:01:52 +0100 Subject: [PATCH 13/20] remove template for gpfa --- doc/_templates/autosummary/gpfa_class.rst | 7 ------- elephant/gpfa/gpfa.py | 1 - 2 files changed, 8 deletions(-) delete mode 100644 doc/_templates/autosummary/gpfa_class.rst diff --git a/doc/_templates/autosummary/gpfa_class.rst b/doc/_templates/autosummary/gpfa_class.rst deleted file mode 100644 index 0c146b266..000000000 --- a/doc/_templates/autosummary/gpfa_class.rst +++ /dev/null @@ -1,7 +0,0 @@ -{{ fullname | escape | underline}} - -.. currentmodule:: {{ module }} - -.. autoclass:: {{ objname }} - :special-members: __contains__,__getitem__,__iter__,__len__,__add__,__sub__,__mul__,__div__,__neg__ - :members: diff --git a/elephant/gpfa/gpfa.py b/elephant/gpfa/gpfa.py index 456880d4f..607f65b3a 100644 --- a/elephant/gpfa/gpfa.py +++ b/elephant/gpfa/gpfa.py @@ -36,7 +36,6 @@ .. autosummary:: :toctree: _toctree/gpfa - :template: gpfa_class.rst GPFA From e94cd343d69b360e345200fa16880015e67034a9 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 25 Nov 2022 15:09:29 +0100 Subject: [PATCH 14/20] increase timeout for urlopen --- elephant/datasets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elephant/datasets.py b/elephant/datasets.py index efedb9b25..9345a128c 100644 --- a/elephant/datasets.py +++ b/elephant/datasets.py @@ -144,7 +144,7 @@ def download_datasets(repo_path, filepath=None, checksum=None, if 'ELEPHANT_DATA_URL' not in environ: # user did not set URL # is 'version-URL' available? (not for elephant development version) try: - urlopen(default_url+'/README.md') + urlopen(default_url+'/README.md', timeout=10) except HTTPError as error: # if corresponding elephant-data version is not found, @@ -161,7 +161,7 @@ def download_datasets(repo_path, filepath=None, checksum=None, # if verification of SSL certificate fails, do not verify cert try: # try again without certificate verification urlopen(default_url + '/README.md', - context=ssl._create_unverified_context()) + context=ssl._create_unverified_context(), timeout=10) except HTTPError as http_error: # e.g. 404: default_url = url_to_root + f"raw/master" From 13fce35eeb9bbe986c26cc2426cf24574ccfdac9 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 25 Nov 2022 15:14:42 +0100 Subject: [PATCH 15/20] remove unused variable --- elephant/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elephant/datasets.py b/elephant/datasets.py index 9345a128c..40f95b242 100644 --- a/elephant/datasets.py +++ b/elephant/datasets.py @@ -162,7 +162,7 @@ def download_datasets(repo_path, filepath=None, checksum=None, try: # try again without certificate verification urlopen(default_url + '/README.md', context=ssl._create_unverified_context(), timeout=10) - except HTTPError as http_error: # e.g. 404: + except HTTPError: # e.g. 404: default_url = url_to_root + f"raw/master" warnings.warn(f"Data URL:{default_url}, error: {error}." From d9b9955d940f4054343599a21639af166b37cd79 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 25 Nov 2022 15:29:46 +0100 Subject: [PATCH 16/20] change context for urlopen --- elephant/datasets.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/elephant/datasets.py b/elephant/datasets.py index 40f95b242..a45cf6a2d 100644 --- a/elephant/datasets.py +++ b/elephant/datasets.py @@ -65,9 +65,9 @@ def download(url, filepath=None, checksum=None, verbose=True): try: urlretrieve(url, filename=filepath, reporthook=t.update_to) except URLError: - urlretrieve(url, filename=filepath, reporthook=t.update_to, - data=ssl._create_unverified_context()) - + # do not authenticate SSL certificate + ssl._create_default_https_context = ssl._create_unverified_context + urlretrieve(url, filename=filepath, reporthook=t.update_to) return filepath @@ -160,8 +160,9 @@ def download_datasets(repo_path, filepath=None, checksum=None, except URLError as error: # if verification of SSL certificate fails, do not verify cert try: # try again without certificate verification - urlopen(default_url + '/README.md', - context=ssl._create_unverified_context(), timeout=10) + ctx = ssl._create_unverified_context() + ctx.check_hostname = True + urlopen(default_url + '/README.md', timeout=10) except HTTPError: # e.g. 404: default_url = url_to_root + f"raw/master" From d45095110837dd7d3caed12c8d46bbf437ede0ea Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 25 Nov 2022 15:45:42 +0100 Subject: [PATCH 17/20] remove timeout --- elephant/datasets.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elephant/datasets.py b/elephant/datasets.py index a45cf6a2d..67aacfd69 100644 --- a/elephant/datasets.py +++ b/elephant/datasets.py @@ -144,7 +144,7 @@ def download_datasets(repo_path, filepath=None, checksum=None, if 'ELEPHANT_DATA_URL' not in environ: # user did not set URL # is 'version-URL' available? (not for elephant development version) try: - urlopen(default_url+'/README.md', timeout=10) + urlopen(default_url+'/README.md') except HTTPError as error: # if corresponding elephant-data version is not found, @@ -162,7 +162,7 @@ def download_datasets(repo_path, filepath=None, checksum=None, try: # try again without certificate verification ctx = ssl._create_unverified_context() ctx.check_hostname = True - urlopen(default_url + '/README.md', timeout=10) + urlopen(default_url + '/README.md') except HTTPError: # e.g. 404: default_url = url_to_root + f"raw/master" From 5d1afc24530e28ba13bf5571bbebf8364b1233cf Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 25 Nov 2022 15:54:59 +0100 Subject: [PATCH 18/20] fix typo --- elephant/datasets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/elephant/datasets.py b/elephant/datasets.py index 67aacfd69..c6786a085 100644 --- a/elephant/datasets.py +++ b/elephant/datasets.py @@ -163,7 +163,7 @@ def download_datasets(repo_path, filepath=None, checksum=None, ctx = ssl._create_unverified_context() ctx.check_hostname = True urlopen(default_url + '/README.md') - except HTTPError: # e.g. 404: + except HTTPError: # e.g. 404 default_url = url_to_root + f"raw/master" warnings.warn(f"Data URL:{default_url}, error: {error}." From afd4d0a90e116abff9b6564e1ac51e34ccf669ff Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 25 Nov 2022 17:27:07 +0100 Subject: [PATCH 19/20] add template for GPFA class --- doc/_templates/autosummary/gpfa_class.rst | 7 +++++++ elephant/gpfa/gpfa.py | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 doc/_templates/autosummary/gpfa_class.rst diff --git a/doc/_templates/autosummary/gpfa_class.rst b/doc/_templates/autosummary/gpfa_class.rst new file mode 100644 index 000000000..0c146b266 --- /dev/null +++ b/doc/_templates/autosummary/gpfa_class.rst @@ -0,0 +1,7 @@ +{{ fullname | escape | underline}} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :special-members: __contains__,__getitem__,__iter__,__len__,__add__,__sub__,__mul__,__div__,__neg__ + :members: diff --git a/elephant/gpfa/gpfa.py b/elephant/gpfa/gpfa.py index 607f65b3a..a156a78f5 100644 --- a/elephant/gpfa/gpfa.py +++ b/elephant/gpfa/gpfa.py @@ -36,6 +36,7 @@ .. autosummary:: :toctree: _toctree/gpfa + :template: gpfa_class.rst GPFA @@ -54,7 +55,7 @@ Run tutorial interactively: .. image:: https://mybinder.org/badge.svg - :target: https://mybinder.org/v2/gh/NeuralEnsemble/elephant/master + :target: https://mybinder.org/v2/gh/NeuralEnsemble/elephant/master ?filepath=doc/tutorials/gpfa.ipynb @@ -235,8 +236,7 @@ class GPFA(sklearn.base.BaseEstimator): def __init__(self, bin_size=20 * pq.ms, x_dim=3, min_var_frac=0.01, tau_init=100.0 * pq.ms, eps_init=1.0E-3, em_tol=1.0E-8, em_max_iters=500, freq_ll=5, verbose=False): - """Initialize object - """ + # Initialize object self.bin_size = bin_size self.x_dim = x_dim self.min_var_frac = min_var_frac From 3ef76a8bd103ba2d4e33a43f356cf4586b8c7704 Mon Sep 17 00:00:00 2001 From: Moritz-Alexander-Kern Date: Fri, 25 Nov 2022 17:38:47 +0100 Subject: [PATCH 20/20] fix math expression --- elephant/gpfa/gpfa.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/elephant/gpfa/gpfa.py b/elephant/gpfa/gpfa.py index a156a78f5..79b4f7515 100644 --- a/elephant/gpfa/gpfa.py +++ b/elephant/gpfa/gpfa.py @@ -87,7 +87,7 @@ class GPFA(sklearn.base.BaseEstimator): - """ + r""" Apply Gaussian process factor analysis (GPFA) to spike train data There are two principle scenarios of using the GPFA analysis, both of which @@ -162,7 +162,7 @@ class GPFA(sklearn.base.BaseEstimator): Currently, only 'rbf' is supported. gamma : (1, #latent_vars) np.ndarray related to GP timescales of latent variables before - orthonormalization by :math:`bin_size / sqrt(gamma)` + orthonormalization by :math:`\frac{bin\_size}{\sqrt{gamma}}` eps : (1, #latent_vars) np.ndarray GP noise variances d : (#units, 1) np.ndarray