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

Add prepend! for ImagineSignal traces, stimulus control example #91

Merged
merged 8 commits into from
Jun 4, 2024

Conversation

tmcgrath325
Copy link
Contributor

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.

Copy link
Member

@kdw503 kdw503 left a 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.

#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])
Copy link
Member

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)

seqi = findfirst(x->x==seqname, sequence_names(com))
prepend!(sequence_names(com), [seqname])
newseq = sequence_lookup(com)[seqname]
prepend!(sequences(com), [newseq])
Copy link
Member

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)
?

lseq = cumlength(com)[seqi] - cumlength(com)[seqi-1]
end
com.cumlength .+= lseq
prepend!(com.cumlength, lseq)
Copy link
Member

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)
?

Comment on lines 411 to 414
prepend!(sequences(com), [sequence])
prepend!(sequence_names(com), [seqname])
com.cumlength .+= full_length(sequence)
prepend!(com.cumlength, full_length(sequence))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use pushfirst! instead?

@timholy
Copy link
Member

timholy commented Jul 19, 2023

@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
@kdw503 kdw503 merged commit fb7f811 into master Jun 4, 2024
0 of 2 checks passed
@kdw503 kdw503 deleted the tmm/prepend branch June 4, 2024 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants