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

Updates to kilosort 4: version >= 4.0.16, bad_channels, clear_cache, use_binary_file #3339

Merged
merged 22 commits into from
Sep 6, 2024

Conversation

chrishalcrow
Copy link
Collaborator

As discussed in #3316, we decided to only support the latest version of kilosort. This PR checks the version and makes the arguments consistent with the kilosort arguments for version 4.0.16.

I added the version check by extending initialize_folder, which is where the installation check is. It's a little awkward because we should do the installation check before the version check, but this doesn't quite fit in the structure of the BaseSorter initialize_folder method. So we actually check that kilosort is installed twice.

@chrishalcrow chrishalcrow changed the title Add bad channels and do version check (again) Insist on version > 4.0.16 for kilosort 4 (again) Aug 26, 2024
@alejoe91 alejoe91 added the sorters Related to sorters module label Aug 27, 2024
@chrishalcrow chrishalcrow changed the title Insist on version > 4.0.16 for kilosort 4 (again) Insist on version >= 4.0.16 for kilosort 4 (again) Aug 27, 2024
@alejoe91
Copy link
Member

alejoe91 commented Aug 27, 2024

@chrishalcrow @JoeZiminski

I would suggest using this PR also to:

@alejoe91 alejoe91 added this to the 0.101.1 milestone Aug 27, 2024
@alejoe91 alejoe91 changed the title Insist on version >= 4.0.16 for kilosort 4 (again) Updates to kilosort 4: version >= 4.0.16 and use_binary_file Aug 27, 2024
@alejoe91
Copy link
Member

@chrishalcrow I'll push a change for the use_binary_file directly to this PR (updated title)


# this internally concatenates the recording
file_object = RecordingExtractorAsArray(recording_extractor=recording)
if params["use_binary_file"]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, if the recording is binary I would always do this path. It's faster.

@zm711 @samuelgarcia do you agree?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me. KS4 likes the binary so if that's an option I think feeding it that is better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done! the only caveat is that if one has a binary recording, but wants to force the RecordingExtractorAsArray mode, the only way is to modify the recording, e.g.: recording_non_bin = spre.scale(recording_bin)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alejoe91
Copy link
Member

alejoe91 commented Sep 2, 2024

@chrishalcrow @zm711 @JoeZiminski also updated the KS4 actions. Now only versions >= 4.0.16 are tested.

A test run on a tmp branch is running here: https://github.com/SpikeInterface/spikeinterface/actions/runs/10670770848/job/29575421194

Let me know what you think!

@alejoe91
Copy link
Member

alejoe91 commented Sep 3, 2024

@JoeZiminski I added a trigger for changes to the kilosort4 file and a general cleanup of the ks4 tests.

Let me know what you think!

@JoeZiminski
Copy link
Collaborator

Hey @alejoe91 sorry I never got around this in good time, thanks for taking care of it and the clean up! Looks great, also learnt some cool SI functions I did not know about it. Just one comment above. Cheers!

@JoeZiminski
Copy link
Collaborator

Great! @alejoe91 before merging this does it make sense to release SI patch 0.101.1?

@alejoe91
Copy link
Member

alejoe91 commented Sep 3, 2024

Great! @alejoe91 before merging this does it make sense to release SI patch 0.101.1?

I would actually include it in the release:) It's a great upgrade!

@JoeZiminski
Copy link
Collaborator

Oh yes that makes sense @alejoe91, I guess if there were no changes to the KS4 code that dealt with KS4 versions <=4.0.16 that have happened between 0.101.0 and this PR (I don't think there were?) then that is better! 0.101.0 is last version that supports KS4 <4.0.16 and >=0.101.1 supports KS4 4.0.16. sounds good!

@JoeZiminski
Copy link
Collaborator

JoeZiminski commented Sep 3, 2024

Sorry for the back and forth @alejoe91, unless I'm mistaken a lot of the commits for finalising KS4 versions <4.0.16 were added after 0.101.0 was released (e.g. #3085, #3276, I think #3265). So it would be cleaner to make a patch version before merging this PR for a clean break. However, it's not the end of the world if not, but the 'transition point' would be the commit before this is merged rather than a full version which might be confusing.

@alejoe91
Copy link
Member

alejoe91 commented Sep 3, 2024

Hey @JoeZiminski

#3265 is for KS<4. For the other changes, they are all to update the most recent KS4 version, including the CI changes. So I think it's ok to have the new release as a breaking point.

In addition, since we rely on many external tools, I think that in this case a patch release is also ok. We should encourage people to update KS4 anyways

@JoeZiminski
Copy link
Collaborator

JoeZiminski commented Sep 3, 2024

I think #3276 adds save_preprocesed_copy (old spelling) which is for KS <4.0.13 (the typo is fixed in 4.0.13). That CI PR is to test <4.0.13 (?) also I think and then is overwritten here, but the CI stuff doesn't matter so much. I think if you want the 'final final version' of spikeinterface that supports KS4 <4.0.13 including tests you would need to go to the commit prior to this one as 0.101.0 will be missing save_preprocessed_copy (and tests, that matters less). I think this is an extreme edge case though and so happy to squash it into 0.101.1, in practice I think it's unlikely anyone will need such a specific version!

Co-authored-by: Chris Halcrow <57948917+chrishalcrow@users.noreply.github.com>
@chrishalcrow
Copy link
Collaborator Author

chrishalcrow commented Sep 4, 2024

Looks good, and is working for me locally.

I don't think we need a release that supports in-between kilosort versions, since it was rapidly developing in its first months. I'd vote to have that if there had been a long-stable release, followed by a significant update.

EDIT: and I'd never been in the scripts folder before: cool!

@alejoe91 alejoe91 changed the title Updates to kilosort 4: version >= 4.0.16 and use_binary_file Updates to kilosort 4: version >= 4.0.16, bad_channels, clear_cache, use_binary_file Sep 5, 2024
@alejoe91
Copy link
Member

alejoe91 commented Sep 5, 2024

@zm711 @JoeZiminski @chrishalcrow

Waiting for tests to pass and merging this :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sorters Related to sorters module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants