Without it being immediately obvious that Pulse <: AbstractMatrix, array concatenation behavior can be a little confusing. Consider the following which could be used to generate a CPMG pulse sequence:
ndelay = 1
npi = 6
sequence = vcat(Xpi2, Idle*ndelay, Ypi, take(cycle([Idle*(2*ndelay), Ypi]), 2*(npi - 1))..., Idle*ndelay, Xpi2)
This gives:
Length-20 pulse sequence:
Xpi2
Idle
Ypi
Idle
Idle
Ypi
Idle
Idle
Ypi
Idle
Idle
Ypi
Idle
Idle
Ypi
Idle
Idle
Ypi
Idle
Xpi2
If you instead replace [Idle*(2*ndelay), Ypi] with vcat(Idle*(2*ndelay), Ypi):
Length-15 pulse sequence:
Xpi2
Idle
Ypi
Idle
Idle
Ypi
Idle
Idle
Ypi
Idle
Idle
Ypi
Idle
Idle
Xpi2
I suggest specifying the expected behavior of hcat, vcat, hvcat, and the various array concatenation shorthands ([a b], [a,b], [a b; c d]) in documentation and perhaps writing some simple tests in test/runtests.jl.
Without it being immediately obvious that
Pulse <: AbstractMatrix, array concatenation behavior can be a little confusing. Consider the following which could be used to generate a CPMG pulse sequence:This gives:
If you instead replace
[Idle*(2*ndelay), Ypi]withvcat(Idle*(2*ndelay), Ypi):I suggest specifying the expected behavior of
hcat,vcat,hvcat, and the various array concatenation shorthands ([a b],[a,b],[a b; c d]) in documentation and perhaps writing some simple tests intest/runtests.jl.