-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Registration decorator for parametric pulse shapes #3688
Comments
As an end-user looking at doing exactly this, I'd be interested in this functionality. If there is no registration decorator, where would we need to plug into/overwrite this functionality? |
Yes, I think you have the right idea. This would likely need to be modified into a registry, that registers standard pulses. |
Hacky and haven't fully tested it, but looks like the following also temporarily does the job (not as good as registering) import qiskit.qobj.converters.pulse_instruction as pulse_converter
class NewParamPulse(ParametricPulse):
pass
pulse_converter.ParametricPulseShapes.NewParamPulse = NewParamPulse |
This does seem like a good solution 👍. |
follow-up. The above ^^ method doesn't work b/c of the enum lookup in class NewParamPulseShapes(enum.Enum):
gaussian = ...
new_param_pulse = ...
import qiskit.assembler
qiskit.assembler.assemble_schedules.__globals__["ParametricPulseShapes"] = NewParamPulseShapes
# NOTE: tried this syntax, didn't work
# pulse_converter.ParametricPulseShapes = NewParamPulseshapes
# Verify
print(qiskit.assembler.assemble_schedules.__globals__["ParametricPulseShapes"])
qiskit.assemble(schedule_with_new_param_pulse) # errors if above global replacement doesn't succeed Hope this helps people in future! |
Found a better solution than above. Unfortunately it involves an extra python library, but it's a one-line solution, so... It uses https://pypi.org/project/aenum/ import aenum
import qiskit.qobj.converters.pulse_instruction as pulse_converter
aenum.extend_enum(pulse_converter.ParametricPulseShapes, "new_pulse_shape", NewParamPulse) |
Did this requirement get subsumed in Pulse Builder? |
@jwoehr, I don't think so. Pulse Builder still doesn't cover e.g. a linear ramp parametric pulse defined as e.g. |
Thank you, noting that, @drewrisinger |
I believe this to have been obsoleted by #7821 and follow-on work. @nkanazawa1989, could you check, and close this issue if so? |
What is the expected behavior?
From @eggerdj on PR #3463 which introduces Parametric Pulses:
The goal of this feature is to replace manually entering new parametric pulses into the mapper in assemble.
The text was updated successfully, but these errors were encountered: