Hi, I am trying to create a .edf file using the EDF.jl
package , but i run into issues during File creation; I get a Method Error in calling EDF.File
ERROR: MethodError: no method matching EDF.File(::IOStream, ::EDF.FileHeade
r, ::Vector{EDF.Signal{Int16}})
Closest candidates are:
EDF.File(::I, ::EDF.FileHeader, ::Array{Union{EDF
Signal{T}}, 1}) where {T<:Union{Int16, EDF.Int24},
I tried to be as type cautious as possible by initializing explicitly an Array , but to no avail
the File method insists i pass the wrong type.
Minimum Reproducible Examle:
using EDF
using Dates
# some random example data
data_matrix = round.(rand(0.0:400.0,15,9000))
## Header Creation
header = EDF.FileHeader(
"0.0", # EDF version (0.0 for EDF+)
"Simulation01", # Patient ID
"Recording001", # Recording ID
now(), # t0
true, #contiguous
1, # num of records
9000.0 # Duration
)
## Signals
signal_labels = string.(collect('A':'Z')[1:15])
signals = Array{EDF.Signal{Int16},1}(undef,15)
for (i,label) in enumerate(signal_labels)
signal_header = EDF.SignalHeader(
label,
"EEG",
"V",
Float32(-100.0f0),
Float32(100.0f0),
Float32(-32768.0f0),
Float32(32767.0f0),
"No filter",
Int32(9000)
)
signal = EDF.Signal{Int16}(signal_header,data_matrix[i,:] )
push!(signals,signal)
end
print(typeof(signals)) # should be fine?!
Vector{EDF.Signal{Int16}} # (alias for Array{EDF.Signal{Int16}, 1})
output_file = "example_data.edf"
io = open(output_file, "w")
edf_file = EDF.File(io, header, signals)
## Method error!!
EDF.write(io, edf_file)
close(io)