-
Notifications
You must be signed in to change notification settings - Fork 5
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
initial work on supporting discontiguous data #78
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #78 +/- ##
===========================================
- Coverage 95.59% 84.68% -10.91%
===========================================
Files 4 5 +1
Lines 295 333 +38
===========================================
Hits 282 282
- Misses 13 51 +38
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Alternative, backwards-compatible-ish possibility: --- a/src/types.jl
+++ b/src/types.jl
@@ -48,20 +48,26 @@ struct SignalHeader
end
"""
- EDF.Signal{T}
+ EDF.Signal{T,V}
-Type representing a single EDF signal with sample type `T`.
+Type representing a single EDF signal with sample type `T`, stored in a collection
+of type `V`. For contiguous files (EDF+C), `V === Vector{T}`. For discontiguous files
+(EDF+D), this is `Vector{Vector{T}}`, where the inner vectors are the contiguous samples
+within each data record.
# Fields
* `header::SignalHeader`
-* `samples::Vector{T}`
+* `samples::V`
"""
-struct Signal{T}
+struct Signal{T,V<:Union{Vector{T},Vector{Vector{T}}}}
header::SignalHeader
- samples::Vector{T}
+ samples::V
end
+const ContiguousSignal{T} = Signal{T,Vector{T}}
+const DiscontiguousSignal{T} = Signal{T,Vector{Vector{T}}}
+
Signal{T}(header::SignalHeader) where {T} = Signal(header, T[])
Signal(header::SignalHeader) = Signal{EDF_SAMPLE_TYPE}(header) Advantages of this approach:
|
I would probably want both: there are a fair number of downstream tools that making a contiguous assumption in various ways. |
The idea is to provide a separate
read_discontiguous
to be as backward compatible as possible and to make very clear that something different is happening, namely the gaps are being filled with zeros.