-
Notifications
You must be signed in to change notification settings - Fork 216
Add session displacement generation #3231
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
Open
JoeZiminski
wants to merge
19
commits into
SpikeInterface:main
Choose a base branch
from
JoeZiminski:add_session_displacement_generation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,170
−24
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5a61b9f
drifting_generator.py - factor out get probe
JoeZiminski c5c1a0b
drifting_generator.py - factor out fixing of 'generate_templates_kwar…
JoeZiminski b010f8f
Factor out unit_factor calculation, fix wrong unit_locations dim in d…
JoeZiminski 3a6300c
generate.py - factor out setup InjectTemplatesRecording setup.
JoeZiminski 62d5755
generate.py - add extra outputs.
JoeZiminski 89ebe2b
Add a debugging script.
JoeZiminski 08c6ae3
Add session displacement generator.
JoeZiminski 1f9ed1a
Add tests for session displacement generator.
JoeZiminski f5c7e49
Remove debugging script.
JoeZiminski 7aeec39
Update docstring on 'calculate_displacement_unit_factor.
JoeZiminski 8bceeaa
Remove print.
JoeZiminski 2d0b93b
Add units to recording durations
JoeZiminski 040d1ca
Remove uncessary changes to generate.py
JoeZiminski 77f8c89
Merge branch 'add_session_displacement_generation' of github.com:JoeZ…
JoeZiminski 27a67bb
Additional removal on generate.py
JoeZiminski 6d36da1
typo fix (double ".")
JoeZiminski d66d636
Allow
JoeZiminski 050e22a
Merge branch 'add_session_displacement_generation' of github.com:JoeZ…
JoeZiminski 263f0d7
Make small adjustment to threshold for macOS.
JoeZiminski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this could be called something like "simulate_linear_gradient_drift"? i was a bit confused reading it, but it seems to be generating drift which is 0 at the top of the probe and something not zero at the bottom?
maybe someone can help explain what exactly
ends up producing... is it like there is some global drift plus per-unit linear drift?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @cwindolf thanks a lot for this review. This function is a refactoring of this code. I like
simulate_linear_gradient_drift
, for this PR I will keep the current naming for consistency with the old code. However I'll make an issue based on some of the points you raise in this PR (e.g. including some things in the within-session drift) and add a note on this there.I agree I got quite confused the first (few) times looking through the use of
non_rigid_gradient
. I think the easiest way to see it is with some example values. In the first part of the function, the dot-product of the displacement vector and the unit location (expressed as a vector from the probe origin, I am not sure where it is, maybe bottom-left). In the y-displacement only case, this is just the unit y position. These unit positions are scaled to[0, 1]
and calledfactors
.The
f
and expression you show ensure that the 'largest' unit location (e.g. near the top of the probe if the origin is bottom left) is scaled by 1 (no change). The scaling is linear across all unit positions, its kind of like alinspace
where the max value is 1 andf
sets the min value. e.g. looking at the smallest, largest and a middle location unit (i.e. factors 0, 1, and 0.5)non_rigid_gradient=0.8
0 * 0.2 + 0.8= 0.8
0.5 * 0.2 + 0.8 = 0.9
1 * 0.8 + 0.2 = 1
non_rigid_gradient=0.2
0 * 0.8 + 0.2 = 0.2
0.5 * 0.8 + 0.2 = 0.6
1 * 0.8 + 0.2 = 1
So in the first case, the scaling of the units is only in the range
[0.8, 1]
of the normalised position of the unit. But for the smallernon_rigid_gradient=0.2
, the scaling is between[0.2, 1]
.I re-wrote the docstring of the function, let me know if its any clearer, I think there is still room for improvement, I am also not sure how much depth to go into.