Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming convention (binsize -> bin_size, etc.) #316

Merged
merged 38 commits into from Aug 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c77654d
binsize -> bin_size
dizcza Apr 28, 2020
959c7d6
pep8
dizcza Apr 29, 2020
1473955
py2 case
dizcza Apr 29, 2020
c828763
Merge branch 'master' into naming-convention/bin_size
dizcza Jun 23, 2020
938254c
binned_st[s] -> binned_spiketrain
dizcza Jun 23, 2020
6988e95
pep8
dizcza Jun 23, 2020
d5ff3ce
fixed travis
dizcza Jun 23, 2020
e7d0ef4
asset tutorial binsize -> bin_size
dizcza Jun 23, 2020
9bd7c29
naming convention patched
dizcza Jun 23, 2020
e5ec217
pep8
dizcza Jun 23, 2020
5eb0bfb
renamed l to lag
dizcza Jun 23, 2020
048eb6f
binsize class property
dizcza Jun 23, 2020
476715d
reverted back homogeneous_gamma_process shape->a and rate->b to avoid…
dizcza Jun 24, 2020
c6f9082
reverted hilbert pad->N because N is passed in scipy.signal.hilbert
dizcza Jun 25, 2020
7da75a1
hilbert, cubic, cch
dizcza Jun 29, 2020
c235c29
env -> hilbert_envelop
dizcza Jun 29, 2020
74f1fa1
cell_assembly_detection, current_source_density, neo_tools, signal_pr…
dizcza Jul 2, 2020
781b59d
finished Cristiano's list
dizcza Jul 3, 2020
348411e
addressed comments on Mon
dizcza Jul 6, 2020
0408896
num_bins -> n_bins
dizcza Jul 6, 2020
cf8c0a2
welch_cohere
dizcza Jul 9, 2020
29f2cb1
minor doc refactorings
dizcza Jul 9, 2020
fbe395c
Merge branch 'master' into naming-convention/bin_size
dizcza Jul 9, 2020
77319bd
single_interaction_process n -> n_spiketrains
dizcza Jul 15, 2020
f76d6f2
_dist -> _distance
dizcza Jul 15, 2020
db5914c
refactored method names in protected _CrossCorrHist class
dizcza Jul 15, 2020
47f9562
fixed test
dizcza Jul 15, 2020
119e17a
tau_max -> max_tau
dizcza Aug 4, 2020
809dd64
freq -> frequency, fs -> sampling_frequency
dizcza Aug 4, 2020
710fb7e
corrcoef -> correlation_coefficient
dizcza Aug 4, 2020
179c1f8
A -> amplitude_distribution
dizcza Aug 4, 2020
f0bbe39
modified See also section
dizcza Aug 4, 2020
af7c4cc
same_config_cut -> same_configuration_pruning
dizcza Aug 4, 2020
f9c33b4
Merge branch 'master' into naming-convention/bin_size
dizcza Aug 4, 2020
1b5f6d4
Merge branch 'master' into naming-convention/bin_size
dizcza Aug 6, 2020
47281db
_i and _j suffixes convention for a pair of signals/spiketrains
dizcza Aug 6, 2020
fc7df75
pep8
dizcza Aug 7, 2020
4d19722
fixed a bug introduced by very smart autopep8
dizcza Aug 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions doc/style_guide.rst
Expand Up @@ -42,6 +42,10 @@ throughout Elephant.

.. code-block:: python

def pair_of_signals_example(spiketrain_i, spiketrain_j):
# Add '_i' and '_j' suffixes to a pair of signals, spiketrains or any
# other variables that come in pairs.

def perfect_naming_of_parameters(spiketrains, spiketrain, reference_spiketrain,
target_spiketrain, signal, signals, max_iterations,
min_threshold, n_bins, n_surrogates, bin_size, max_size,
Expand Down Expand Up @@ -119,9 +123,8 @@ throughout Elephant.
Therefore, do not use terms as `n` or `n_surr`, that are not
immediately understood.
bin_size : pq.Quantity or int
Separate the words by underscore. Do not use `binsize`. Old functions
which use `binsize` will be gradually refactored to conform to the new
convention.
Separate the words by underscore. Do not use `bin_size`. Old functions
which use `binsize` are deprecated.
max_size : float
Another example showing that words should be separated by underscores.
This intersects with the naming convention for a maximum value.
Expand Down
2 changes: 1 addition & 1 deletion doc/tutorials/asset.ipynb
Expand Up @@ -185,7 +185,7 @@
],
"source": [
"# 2.1.1) create ASSET analysis object\n",
"# hint: try different binsizes, e.g. binsize=2.5, 3.5, 4.0 ms\n",
"# hint: try different bin sizes, e.g. bin_size=2.5, 3.5, 4.0 ms\n",
"asset_obj = asset.ASSET(spiketrains, bin_size=3*pq.ms)\n",
"\n",
"# 2.1.2) compute the intersection matrix\n",
Expand Down
18 changes: 9 additions & 9 deletions doc/tutorials/parallel.ipynb
Expand Up @@ -256,7 +256,7 @@
"source": [
"### Example 2. Custom functions and positional argument\n",
"\n",
"Sometimes you might want to iterate over the second (or third, etc.) argument of a function. To do this, you need to create a custom function that passes its first input argument into the right position of the original function. Below is an example of how to compute time histograms of spiketrains with different `binsize` values (the second argument)."
"Sometimes you might want to iterate over the second (or third, etc.) argument of a function. To do this, you need to create a custom function that passes its first input argument into the right position of the original function. Below is an example of how to compute time histograms of spiketrains with different `bin_size` values (the second argument)."
]
},
{
Expand All @@ -269,9 +269,9 @@
"spiketrains = [homogeneous_poisson_process(rate, t_stop=10*pq.s) for _ in range(8)]\n",
"\n",
"# step 2: define your custom function\n",
"def my_custom_function(binsize):\n",
"def my_custom_function(bin_size):\n",
" # specify all custom key-word options here\n",
" return time_histogram(spiketrains, binsize, output='counts')"
" return time_histogram(spiketrains, bin_size, output='counts')"
]
},
{
Expand All @@ -282,9 +282,9 @@
},
"outputs": [],
"source": [
"binsize_list = np.linspace(0.1, 1, num=8) * pq.s\n",
"bin_size_list = np.linspace(0.1, 1, num=8) * pq.s\n",
"\n",
"time_hist = ProcessPoolExecutor().execute(my_custom_function, binsize_list)"
"time_hist = ProcessPoolExecutor().execute(my_custom_function, bin_size_list)"
]
},
{
Expand Down Expand Up @@ -334,7 +334,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"`time_hist` contains 8 AnalogSignals - one AnalogSignal per `binsize` from `binsize_list`.\n",
"`time_hist` contains 8 AnalogSignals - one AnalogSignal per `bin_size` from `bin_size_list`.\n",
"\n",
"### Benchmark\n",
"\n",
Expand All @@ -351,7 +351,7 @@
"warnings.filterwarnings(\"ignore\")\n",
"\n",
"# initialize the iteration list\n",
"binsize_list = np.linspace(0.1, 1, 100) * pq.s"
"bin_size_list = np.linspace(0.1, 1, 100) * pq.s"
]
},
{
Expand All @@ -369,7 +369,7 @@
],
"source": [
"# sequential processing\n",
"%timeit [time_histogram(spiketrains, binsize) for binsize in binsize_list]"
"%timeit [time_histogram(spiketrains, bin_size) for bin_size in bin_size_list]"
]
},
{
Expand All @@ -387,7 +387,7 @@
],
"source": [
"# with parallelization\n",
"%timeit ProcessPoolExecutor(max_workers=4).execute(my_custom_function, binsize_list)"
"%timeit ProcessPoolExecutor(max_workers=4).execute(my_custom_function, bin_size_list)"
]
}
],
Expand Down
12 changes: 6 additions & 6 deletions doc/tutorials/unitary_event_analysis.ipynb
Expand Up @@ -97,7 +97,7 @@
},
"outputs": [],
"source": [
"def plot_UE(data,Js_dict,Js_sig,binsize,winsize,winstep, pat,N,t_winpos,**kwargs):\n",
"def plot_UE(data,Js_dict,Js_sig,bin_size,winsize,winstep, pat,N,t_winpos,**kwargs):\n",
" \"\"\"\n",
" Examples:\n",
" ---------\n",
Expand Down Expand Up @@ -150,9 +150,9 @@
" if len(x)>0:\n",
" xx = []\n",
" for j in sig_idx_win:\n",
" xx =np.append(xx,x[np.where((x*binsize>=t_winpos[j]) &(x*binsize<t_winpos[j] + winsize))])\n",
" xx =np.append(xx,x[np.where((x*bin_size>=t_winpos[j]) &(x*bin_size<t_winpos[j] + winsize))])\n",
" plt.plot(\n",
" np.unique(xx)*binsize, np.ones_like(np.unique(xx))*tr + n*(num_tr + 1) + 1,\n",
" np.unique(xx)*bin_size, np.ones_like(np.unique(xx))*tr + n*(num_tr + 1) + 1,\n",
" ms=arg_dict['marker_size'], marker = 's', ls = '',mfc='none', mec='r')\n",
" plt.axhline((tr + 2)*(n+1) ,lw = 2, color = 'k')\n",
" y_ticks_pos = np.arange(num_tr/2 + 1,N*(num_tr+1), num_tr+1)\n",
Expand Down Expand Up @@ -181,7 +181,7 @@
" np.ones_like(data_tr[n].magnitude)*tr + n*(num_tr + 1) + 1,\n",
" '.', markersize=0.5, color = 'k')\n",
" plt.plot(\n",
" np.unique(Js_dict['indices']['trial'+str(tr)])*binsize,\n",
" np.unique(Js_dict['indices']['trial'+str(tr)])*bin_size,\n",
" np.ones_like(np.unique(Js_dict['indices']['trial'+str(tr)]))*tr + n*(num_tr + 1) + 1,\n",
" ls = '',ms=arg_dict['marker_size'], marker = 's', markerfacecolor='none', markeredgecolor='c')\n",
" plt.axhline((tr + 2)*(n+1) ,lw = 2, color = 'k')\n",
Expand Down Expand Up @@ -300,10 +300,10 @@
"outputs": [],
"source": [
"UE = ue.jointJ_window_analysis(\n",
" spiketrains, binsize=5*pq.ms, winsize=100*pq.ms, winstep=10*pq.ms, pattern_hash=[3])\n",
" spiketrains, bin_size=5*pq.ms, winsize=100*pq.ms, winstep=10*pq.ms, pattern_hash=[3])\n",
"\n",
"plot_UE(\n",
" spiketrains, UE, ue.jointJ(0.05),binsize=5*pq.ms,winsize=100*pq.ms,winstep=10*pq.ms,\n",
" spiketrains, UE, ue.jointJ(0.05),bin_size=5*pq.ms,winsize=100*pq.ms,winstep=10*pq.ms,\n",
" pat=ue.inverse_hash_from_pattern([3], N=2), N=2,\n",
" t_winpos=ue._winpos(0*pq.ms,spiketrains[0][0].t_stop,winsize=100*pq.ms,winstep=10*pq.ms))\n",
"plt.show()"
Expand Down