Refactor LockedAmplitude and ShapedAmplitude#110
Conversation
Both of these amplitudes could be made more flexible by getting rid of the type hierarchy that distinguished between, e.g., `ShapedContinousAmplitude` and `ShapedPulseAmplitude`. The shape and control can now be vectors or functions independently of each other. This enables substituting optimized pulses into existing amplitudes, among other benefits.
There was a problem hiding this comment.
Pull request overview
This PR refactors the amplitude layer to remove the old Locked* / Shaped* subtype split and instead represent amplitudes as parametric wrappers whose shape and control can independently be callables or discretized vectors. In the broader codebase, this sits at the control/amplitude boundary used by generator evaluation and propagation.
Changes:
- Replaces the previous
LockedAmplitudeandShapedAmplitudetype hierarchies with parametric structs and updatedevaluate/substitutemethods. - Adds support for mixed
ShapedAmplitudeforms where only the control or only the shape is vector-backed. - Expands amplitude tests to cover mixed shape/control combinations and substitution of a callable control with a discretized vector.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
src/amplitudes.jl |
Refactors amplitude representations, constructors, substitution, display, and evaluation dispatch. |
test/test_amplitudes.jl |
Adds regression coverage for mixed ShapedAmplitude modes and substitution behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #110 +/- ##
========================================
+ Coverage 90.4% 90.5% +0.2%
========================================
Files 37 37
Lines 2615 2661 +46
========================================
+ Hits 2362 2407 +45
- Misses 253 254 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Both of these amplitudes could be made more flexible by getting rid of the type hierarchy that distinguished between, e.g.,
ShapedContinousAmplitudeandShapedPulseAmplitude. The shape and control can now be vectors or functions independently of each other. This enables substituting optimized pulses into existing amplitudes, among other benefits.