Skip to content

Construct signals from AbstractArrays, and not only Arrays #85

@KronosTheLate

Description

@KronosTheLate

Current behaviour:

julia> using SampledSignals

julia> SampleBuf([1, 2, 3], 1)
3-frame, 1-channel SampleBuf{Int64, 1}
3.0s sampled at 1.0Hz
███

julia> SampleBuf(1:3, 1)
ERROR: MethodError: no method matching SampleBuf(::UnitRange{Int64}, ::Int64)
Closest candidates are:
  SampleBuf(::Type, ::Any, ::Quantity) at C:\Users\densb\.julia\packages\SampledSignals\WU1nF\src\SampleBuf.jl:37
  SampleBuf(::Type, ::Any, ::Quantity, ::Any) at C:\Users\densb\.julia\packages\SampledSignals\WU1nF\src\SampleBuf.jl:38
  SampleBuf(::Type, ::Any, ::Any...) at C:\Users\densb\.julia\packages\SampledSignals\WU1nF\src\SampleBuf.jl:35
  ...
Stacktrace:
 [1] top-level scope
   @ REPL[6]:1

This could be fixed by allowing AbstractVector instead of Vector in the constructor. Is there a reason why this has not been done, or should I make a PR?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions