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

Allow creating Edf containing only annotations #7

Merged
merged 1 commit into from
Nov 28, 2023
Merged

Conversation

hofaflo
Copy link
Contributor

@hofaflo hofaflo commented Nov 27, 2023

As described in section 2.1.2 of the EDF+ specs, an EDF+ may contain only an annotation signal and no ordinary signals, e.g. to store a hypnogram.

@hofaflo hofaflo self-assigned this Nov 27, 2023
Base automatically changed from refuse-empty-subfields to main November 28, 2023 08:01
Copy link
Contributor

@marcoross marcoross left a comment

Choose a reason for hiding this comment

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

Approved, however we should discuss the behavior of the signals property in the context of annotations.

Comment on lines +1018 to +1021
def test_signals_cannot_be_set_to_empty_sequence_for_edf_without_annotations():
edf = Edf([EdfSignal(np.arange(2), 1)])
with pytest.raises(ValueError, match="signals must not be empty"):
edf.signals = []
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried adding the positive test case, where I'd try to set the signals to an empty sequence for an Edf object that does have annotations. However, this failed too, which made me think about the behavior of the signals property in the context of an annotations signal being present:

The current behavior is that the annotations signal is generated when adding annotations and the signals property returns a tuple including that annotations channel. Now, what happens if we set the signals property with a non-empty sequence of signals that does not contain the already existing annotations signal? Will the annotations be deleted? I think the behavior is okay for now, but we should discuss it.

@marcoross marcoross merged commit add2af9 into main Nov 28, 2023
4 checks passed
@marcoross marcoross deleted the only-annotations branch November 28, 2023 10:09
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

Successfully merging this pull request may close these issues.

2 participants