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

incorrect unit amplitude and location after spre.astype(recording, np.int16) #3625

Open
a-zmz opened this issue Jan 16, 2025 · 7 comments
Open

Comments

@a-zmz
Copy link

a-zmz commented Jan 16, 2025

Hi,

after preprocessing with dredge motion correction, the recording data type became float32. i want to change dtype back to int16 to save some space, so i did:
int_rec = spre.astype(recording=recording, dtype=np.int16)

however, after kilosort 4 and export_report:

  • in unit list.csv, all units have max_on_channel_id being imec0.ap#AP174
  • amplitudes are centred at 4000
  • unit location are off

Image

unit list.csv

Image

but before changing dtype, they look like this:

Image
unit list.csv
Image

could someone please help? thanks!

@samuelgarcia
Copy link
Member

Hi.
I think you need to propagate 2 properties from the original recording after going back to int16
"gain_to_uV" and "offset_to_uV".

They must have been lost in the correct motion preprocessing step or somwhere.

The amplitude alsod epend on theses 2 factor if they are present in the recording properties

@a-zmz
Copy link
Author

a-zmz commented Jan 17, 2025

hi,

the preprocessed recording does have these two properties from the raw recording, and so does the int16 converted one.

@alejoe91
Copy link
Member

Could this be an overflow issue? Can you try to convert to int32 instead and see how the locations look?

@zm711
Copy link
Collaborator

zm711 commented Jan 24, 2025

@a-zmz were you able to check it with int32 to see if it is an overflow. That is important for us to know if we need to explore this more or not :)

@a-zmz
Copy link
Author

a-zmz commented Jan 24, 2025

Hi @zm711, I was gonna do it tmr, will post the results!

@zm711
Copy link
Collaborator

zm711 commented Jan 24, 2025

Perfect! Thanks.

@a-zmz
Copy link
Author

a-zmz commented Jan 26, 2025

hello, i can confirm that when converting to int32, amplitude and unit locations look correct. i also tried to convert again to int16 after dtype being int32, the problem did not appear. i wonder why...

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

No branches or pull requests

4 participants