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

Mcsh5 offsets and proper scaling in uV for return_scaled #2988

Merged
merged 9 commits into from
Jul 5, 2024

Conversation

yger
Copy link
Collaborator

@yger yger commented Jun 6, 2024

Adding the offsets from the mcs5h header in order to have a recording with offset_to_UV and gain_to_UV. In addition, the gain was entered in V, and thus the scaling was not really making sense. As far as I understand, we want to have return_scaled returning values in uV, am I right? If yes, this is doing the job here, given the documentation that can be found online

https://www.multichannelsystems.com/sites/multichannelsystems.com/files/documents/manuals/HDF5%20MCS%20Raw%20Data%20Definition.pdf

@yger yger added enhancement New feature or request extractors Related to extractors module labels Jun 6, 2024
Copy link
Collaborator

@h-mayorquin h-mayorquin left a comment

Choose a reason for hiding this comment

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

This makes sense to me save the question about the offset. Could we add a link to the specification in the docstring now that we are a it?

The link that you shared could work I think.

[Edit, wrong link]

@@ -121,7 +124,8 @@ def openMCSH5File(filename, stream_id):
Tick = info["Tick"][0] / 1e6
exponent = info["Exponent"][0]
convFact = info["ConversionFactor"][0]
gain = convFact.astype(float) * (10.0**exponent)
gain_uV = 1e6 * (convFact.astype(float) * (10.0**exponent))
offset_uV = 1e6 * (info["ADZero"].astype(float) * (10.0**exponent))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Given this from the specification:
image

Shouldn't the offset be negative?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, you are right, this should be negative....

Copy link
Collaborator

Choose a reason for hiding this comment

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

Great.

Copy link
Member

Choose a reason for hiding this comment

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

In our implementation the offset is after the gain.
So the offset should be divided by gain I think. Can you check ?

@samuelgarcia samuelgarcia added this to the 0.101.0 milestone Jun 12, 2024
@samuelgarcia
Copy link
Member

Does the dtype is always a uint ? why is there this offset ?

@samuelgarcia samuelgarcia merged commit 0422cfb into SpikeInterface:main Jul 5, 2024
15 checks passed
@yger yger deleted the mcsh5_offsets branch July 5, 2024 12:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request extractors Related to extractors module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants