-
Notifications
You must be signed in to change notification settings - Fork 233
Add additional unsigned_to_signed doc
#4076
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
Conversation
| print(recording) | ||
| # use method on the Recording object | ||
| print(recording.get_dtype()) | ||
|
|
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.
Would be good to mention what you'd expect here. E.g. "If this returns a dtype starting with a u, such as uint16, the recording if using unsigned int. While if this returns ... "
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.
Do you think I should just write up a parsed-literal block or you think it is sufficient to just say uint16?
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.
Up to you. I think sufficient just to say: the possible things it can return are pretty simple.
|
Very clear and easy to understand - just some minor typos, and one request. Thanks @zm711 !! |
Co-authored-by: Chris Halcrow <[email protected]>
h-mayorquin
left a comment
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.
This looks good to me. If we can, I think it will be better to be specific about the formats that are affected by this. This will be useful for users so they can see if they are affected by this and/or can disregard this information otherwise.
|
|
||
| As of version 0.103.0 SpikeInterface has changed one of its defaults for interacting with | ||
| :code:`Recording` objects. We no longer autocast unsigned dtypes to signed implicitly. This | ||
| means that some users of SpikeInterface will need to add one additional line of code to their scripts |
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 mention the formats here that suffer from it?
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.
I think this is the perfect being the enemy of good. The only way I can think of doing this is:
- looking through the code in neo for each file format to see how it is stored
- testing this myself to see how each is stored
both of these are too time-intensive for me. Are you interested in making this list for us and then I'll add it in?
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.
No. I don't have time either.
We don't have the resources to be exhaustive but do we know at least or or two examples. Didn't this cause troubles for you and that's how you noticed?
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.
Yes it is in the example. I know Intan does this. But that's the only one I know for sure off the top of my head. (I could do a e.g. Intan) but I also didn't want to preference one system.
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.
I think it is fine to add only one to have at least is one example. We add more if we discover them to be more. I guess we can just do a search for uint16 in neo but for this PR at least let's have an example.
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.
Let me look for at least a second example if that exists.
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.
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.
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.
Thansk guys for looking this up. TO my knowledge, it's indeed Intan, Maxwell, and Biocam. Let's start adding these and add more if they pop up
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.
I can add the list in another PR if you want @zm711. You have already done a lot with this : )
doc/how_to/unsigned_to_signed.rst
Outdated
| ----------------- | ||
|
|
||
| For those that want a deeper understanding of dtypes `NumPy provides a great explanation <https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_. | ||
| For our purposes it is important to know that many pieces of recording equipment opt to store their electrophysiological data as unsigned integers, |
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.
"Many pieces" maybe being specific here would help if you know the formats that do this.
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.
"acquisition systems"? is that better? I don't necessarily want to go into depth here unless we do end up doing an exhaustive list. So I guess answering your statement above will determine what we do here.
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.
Yes, same as above. Let's give some examples.
doc/how_to/unsigned_to_signed.rst
Outdated
| solution required is to convernt unsigned integers into signed integers. Previously we did this under the hood, automatically for users that had | ||
| a :code:`Recording` object with an unsigned dtype. | ||
|
|
||
| We decided, however, that implicitly performing this action was not the best course of action. So from version 0.103.0, users will now explicitly |
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.
If we remember it here we can give the reasoning. Do we remember?
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.
I don't, other than implicit bad: explicit good. So you get a better provenance because previously we were doing a secret step that wasn't being recorded in provenance files necessarily (I think) haven't checked. Maybe worth discussion or @alejoe91 can add during his review.
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.
Yes, if that is our reasoning I think is good to just say that. "We decide however to stop doing implicit logic with side effects here ... " or something along those lines.
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.
Okay, maybe I can text Alessio tomorrow morning for a chat to see if he wants me to add. I could imagine explicit better, + better control of bit_depth (but I don't remember how the old function worked).
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.
Yes, it is just that it is even bad (even for us) if we say we decided and we don't add a rationale. Beats the purpose of documenting this. I rather remove the first sentence instead of giving a statement of what we did if we don't give a rationale.
doc/how_to/unsigned_to_signed.rst
Outdated
|
|
||
| For those that want a deeper understanding of dtypes `NumPy provides a great explanation <https://numpy.org/doc/stable/reference/arrays.dtypes.html>`_. | ||
| For our purposes it is important to know that many pieces of recording equipment opt to store their electrophysiological data as unsigned integers, | ||
| which provides the benefit of reducing the necessary file size. In order to convert to real units these file formats only need to store a :code:`gain` |
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.
I don't think this is true, since unit16 and int16 has the same size (16 bit). The difference is just in the range of values they represent
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.
That's basically what I was trying to get at. Because you can store a greater range of values you can use a smaller size unit but since we have to convert anyway to signed (or float) at some point this point is moot. I agree poorly written for what I was trying to get at and maybe not pertinent to the ephys case. We can rewrite!
I get that sometimes too. Usually if I just retry it works--I think it is actually a GitHub temp failure. I just double checked and the allow maintainers is definitely checked okay :) I'll check out the PR! |
Changes from Alessio
h-mayorquin
left a comment
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.
Ah you already added my requests, thanks! LGTM.
|
|
||
| As of version 0.103.0 SpikeInterface has changed one of its defaults for interacting with | ||
| :code:`Recording` objects. We no longer autocast unsigned dtypes to signed implicitly. This | ||
| means that some users of SpikeInterface will need to add one additional line of code to their scripts |
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.
I can add the list in another PR if you want @zm711. You have already done a lot with this : )
| solution required is to convernt unsigned integers into signed integers. Previously we did this under the hood, automatically for users that had | ||
| a :code:`Recording` object with an unsigned dtype. | ||
|
|
||
| We decided, however, that implicitly performing this action was not the best course of action, since: |
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.
Great. Thanks.
As discussed at our maintenance meeting here is the first draft of our unsigned_to_signed doc for people converting to 0.103.0 and running into the value error.
@chrishalcrow @h-mayorquin would love for your opinions on doc side.
@alejoe91, please just push directly to the PR with your fixes for bit depth.
Link to docs: https://spikeinterface--4076.org.readthedocs.build/en/4076/how_to/unsigned_to_signed.html