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

Empty sequence adds an undesired block #203

Closed
beorostica opened this issue Oct 25, 2023 · 1 comment · Fixed by #321
Closed

Empty sequence adds an undesired block #203

beorostica opened this issue Oct 25, 2023 · 1 comment · Fixed by #321
Labels
3) low priority bug Something isn't working core

Comments

@beorostica
Copy link
Contributor

beorostica commented Oct 25, 2023

When an empty sequence is created, it adds an unnecessary 1-block. Here is a MWE where I additionaly remove the undesired block:

julia> using KomaMRI

julia> seq = Sequence()
Sequence[ τ = 0.0 ms | blocks: 1 | ADC: 0 | GR: 0 | RF: 0 | DEF: 0 ]

julia> seq += Sequence([Grad(1,1)])
Sequence[ τ = 1000.0 ms | blocks: 2 | ADC: 0 | GR: 1 | RF: 0 | DEF: 0 ]

julia> seq = seq[2:end]
Sequence[ τ = 1000.0 ms | blocks: 1 | ADC: 0 | GR: 1 | RF: 0 | DEF: 0 ]

This should't have implications in the simulations, however is not the behaviour we expect.

@cncastillo
Copy link
Member

This could fix it

Sequence() = Sequence(Matrix{Grad}(undef, 3, 0))

or defne

struct EmptySequence end
Sequence() = EmptySequence()
+(::EmptySequence, seq::Sequence) = ...
+(::EmptySequence, seq::RF) = ...
+(::EmptySequence, seq::Grad) = ...
+(::EmptySequence, seq::ADC) = ...

cncastillo added a commit that referenced this issue Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3) low priority bug Something isn't working core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants