-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add prepend! for ImagineSignal traces, stimulus control example #91
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank Tom for implementing this method.
Overall looks great!
But I left some minor comments.
And it would be better if you make some test codes for the method near the append
method test code in the test
directory.
src/imaginesignal.jl
Outdated
#TODO: run safety checks here | ||
#find the length of this sequence and append to cumlength vector | ||
seqi = findfirst(x->x==seqname, sequence_names(com)) | ||
prepend!(sequence_names(com), [seqname]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compare to ImagineInterface.append! method, below would be better?
pushfirst!(sequence_names(com), seqname)
src/imaginesignal.jl
Outdated
seqi = findfirst(x->x==seqname, sequence_names(com)) | ||
prepend!(sequence_names(com), [seqname]) | ||
newseq = sequence_lookup(com)[seqname] | ||
prepend!(sequences(com), [newseq]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also
pushfirst!(sequences(com), newseq)
?
src/imaginesignal.jl
Outdated
lseq = cumlength(com)[seqi] - cumlength(com)[seqi-1] | ||
end | ||
com.cumlength .+= lseq | ||
prepend!(com.cumlength, lseq) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also
pushfirst!(com.cumlength, lseq)
?
src/imaginesignal.jl
Outdated
prepend!(sequences(com), [sequence]) | ||
prepend!(sequence_names(com), [seqname]) | ||
com.cumlength .+= full_length(sequence) | ||
prepend!(com.cumlength, full_length(sequence)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use pushfirst! instead?
@tmcgrath325, want to respond to these suggestions and then I can give you the next round of review? |
The tests are similar to the planned usage for prepend!, adding a constant value before an experiment
Using
prepend!
is intended to be a convenient way to allow for padding the beginnings of traces, rather than requiring traces be constructed from beginning to end.I've also added a modified example workflow script that shows how a stimulus signal can be set up for control of the autosampler.