Skip to content

Commit

Permalink
feat: support underscores in erfsquare, padleft, and padright
Browse files Browse the repository at this point in the history
This is only relevant when computing durations
  • Loading branch information
antalsz committed Sep 20, 2024
1 parent 8aa4e46 commit 491ac48
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions quil-rs/src/program/scheduling/schedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,18 @@ impl<'p> ScheduledBasicBlock<'p> {
common_sample_rate
.map(|sample_rate| sample_count as f64 / sample_rate)
.map(Seconds)
} else if name == "erfsquare" {
} else if name == "erfsquare" || name == "erf_square" {
// It's not clear how demanding to be of the waveforms here. This is the simplest thing
// that could posibly work – compute the duration differently for "erfsquare", don't
// require constant values for any of the other fields, don't check which fields are
// present. However, we could do more stringent parsing and work with an `impl
// WaveformTemplate` instead. This would provide stronger guarantees, but less
// flexibility.
Some(parameter("duration")? + parameter("padleft")? + parameter("padright")?)
Some(
parameter("duration")?
+ parameter("padleft").or_else(|| parameter("pad_left"))?
+ parameter("padright").or_else(|| parameter("pad_right"))?,
)
} else {
parameter("duration")
}
Expand Down

0 comments on commit 491ac48

Please sign in to comment.