-
Notifications
You must be signed in to change notification settings - Fork 261
Add the possilibity of opening intan files even if corrupted. #1470
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
Add the possilibity of opening intan files even if corrupted. #1470
Conversation
@h-mayorquin, two comments. (One a suggestion and then one a more philosophical discussion point). I think I would raise the warning even if someone set My only worry is that if we think of the case of a block of data (in the Intan sense not in the I'm really torn on this. But I'm willing to be convinced (I've had one corrupted file due to another user of our shared computer) and I thought about trying to salvage it, but decided I didn't want to expend the effort. |
I did it like this at the beginning and then I changed. If they switch the default to
Yes, we told them there is a problem and stopped them at their tracks, gave them a big bool so they can go on to the forbidden land on their own will with no guarantees in our part. Why play the police? As I don't want to play the police I think that the improvements would be on making it more clear that they are going to dangerous place. Maybe the variable should be |
Maybe then instead we could add an attribute or a header element that provides a record that this file is a corrupted or uncorrupted file. Someone might just globally take on the risk, but I think we should still give them a way to know that this particular dataset is corrupt. So header element is probably easiest and most visibile.
I think this is a good point. The name |
This makes sense to me so people can use that in loops if so they desire by checking against that attribute. |
@zm711 I added your suggestions. I am not satisfied yet with the docstring writing and the variable name but this will give an idea of the structure and we can improve from there. |
I think the structure looks good to me now, but I agree the naming probably needs to be thought about a bit more. It's more a |
What do you think of the name of the attribute that keeps the state of the check? |
Changed here to |
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.
Just noticed a typo to fix. Otherwise I think this is fine for me. Unless @alejoe91 or @samuelgarcia are against this? But this works for me if it helps you.
neo/rawio/intanrawio.py
Outdated
BaseRawIO.__init__(self) | ||
self.filename = filename | ||
self.load_data_unsafely = load_data_unsafely | ||
self.unsafe_timestamps = False |
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 works for me.
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 just noticed the default for load_data_unsafely
is wrong.
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.
Corrected in the last commit.
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.
Actually just thinking about this maybe rather than unsafe_timestamps
we be more explicit and say something like noncontinuous_timestamps
?
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. Agree. Changing.
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.
Done.
What do you think of |
I think that might be a better name. Although technically we are only doing one check so it would be Looks like CI safe for some reason since both RTD and testing didn't work. Probably just need a fresh push. |
I am leaving open the possibility that we might have more than one check in the future. Thinking that we might also want to have something similar in other extractors (consistent API) and they might have different integrity checks. So, integrity checks as a generic name and then a bunch of flags for every type of checks (here being the discontinous timestamps) |
40e6b6e
to
8fc1955
Compare
neo/rawio/intanrawio.py
Outdated
ignore_integrity_checks: bool, default: False | ||
If True, data that violates integrity assumptions will be loaded. At the moment the only integrity | ||
check we perform is that timestamps are continuous. Setting this to True will ignore this check and set | ||
the attribute `discontinous_timestamps` to True if the timestamps are not continous. This attribute can be checked |
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.
the attribute `discontinous_timestamps` to True if the timestamps are not continous. This attribute can be checked | |
the attribute `discontinuous_timestamps` to True if the timestamps are not continuous. This attribute can be checked |
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.
Thank you!
Hi,
Currently, we have a check to determine if the timestamps associated with the data exhibit discontinuities. If they do, we throw an assertion and prevent the file from being read. I believe this is beneficial as it serves as a strong signal that the user should take a closer look at the file. This assertion is warranted.
But I also believe that once we infrormed the users that there is an error we should still allow the users to open the file if so they desired. This is good for two reasons:
This PR allows this to happen by introducing another boolean at instantiation that overpass this error and open the file anway. That is, it just allows the desired behavior with a boolean and keeps the default as it is for backwards compatbility.