Skip to content

[DOC] Improve trial_shifting parameter documentation - #704

Open
CozySocksAlways wants to merge 2 commits into
NeuralEnsemble:masterfrom
INM-6:fix/trial_shift_doc
Open

CozySocksAlways wants to merge 2 commits into
NeuralEnsemble:masterfrom
INM-6:fix/trial_shift_doc

Conversation

@CozySocksAlways

@CozySocksAlways CozySocksAlways commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

  • Clarifies how the dither parameter of trial_shifting works and makes the code match the documented behaviour.
  • Old docstring for dither fails to mention:
    • If the shift is applied to the whole trial, i.e that each spike is moved by same amount
    • If the shift can go in either direction up to dither
    • What distribution the shift is drawn from (uniform)

Changes

  • Docs (trial_shifting, _trial_shifting_of_concatenated_spiketrain): the dither entry now says that all spikes in a trial are shifted by the same random amount, drawn uniformly from the closed interval [-dither, +dither].
  • Implementation (_trial_shifting): the shift is now drawn with random.uniform(-dither, dither) instead of dither * (2 * random.random() - 1). This also matches the intent mentioned in the documentation and also reads better in code. The behavior is unchanged, so the distribution is same.

@CozySocksAlways CozySocksAlways added this to the v1.3.0 milestone Jun 17, 2026
@CozySocksAlways CozySocksAlways added the documentation Indicates a need for improvements or additions to documentation label Jun 17, 2026
@CozySocksAlways
CozySocksAlways marked this pull request as ready for review June 17, 2026 14:08
@CozySocksAlways
CozySocksAlways requested a review from kohlerca June 17, 2026 14:08
@coveralls

coveralls commented Jun 17, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Status

coverage: 88.242% (-0.4%) from 88.605% — INM-6:fix/trial_shift_doc into NeuralEnsemble:master

Comment thread elephant/spike_train_surrogates.py Outdated
@CozySocksAlways CozySocksAlways self-assigned this Oct 22, 2026
Comment thread elephant/spike_train_surrogates.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Indicates a need for improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants