You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The class variable limit_amplitude in Pulse base class controls validation of max pulse amplitude. According to how test is written, likely this is designed as a global variable.
However, the every pulse subclass constructor takes limit_amplitude, and this may confuse users because it looks like limit_amplitude is an instance variable.
If something like this is supported, limit_amplitude should be really instance variable, i.e. here the parameter validation happens only in the constructor, so setting limit_amplitude for the first pulse only affects the first pulse, if this variable is specified by every class instantiation.
I think limit_amplitude should be removed at least from all pulse subclass constructor. It would be great Qiskit offers some mechanism to manage preference of users, rather than directly attaching such preference to class.
The text was updated successfully, but these errors were encountered:
I don't have opinions on this, but I remember being confused about it too when I came across it. That said, I think it is both a class variable and and instance variable; if limit_amplitude is passed to a constructor then it's set as an instance attribute, which overrides the class-level attribute on lookup, but doesn't actually change the value:
Ah, that's good point. I changed the constructor in #7821 so that it always interact with class variable (otherwise serialization logic becomes terrible). But I think this is still not enough. I'll add deprecation warning in this release.
What should we add?
The class variable
limit_amplitude
inPulse
base class controls validation of max pulse amplitude. According to how test is written, likely this is designed as a global variable.https://github.com/Qiskit/qiskit-terra/blob/a735680f69f7a2e2757dddbedf09f6d7c6a5e692/test/python/pulse/test_pulse_lib.py#L85-L93
However, the every pulse subclass constructor takes
limit_amplitude
, and this may confuse users because it looks likelimit_amplitude
is an instance variable.https://github.com/Qiskit/qiskit-terra/blob/a735680f69f7a2e2757dddbedf09f6d7c6a5e692/qiskit/pulse/library/parametric_pulses.py#L103-L125
If something like this is supported,
limit_amplitude
should be really instance variable, i.e. here the parameter validation happens only in the constructor, so settinglimit_amplitude
for the first pulse only affects the first pulse, if this variable is specified by every class instantiation.I think
limit_amplitude
should be removed at least from all pulse subclass constructor. It would be great Qiskit offers some mechanism to manage preference of users, rather than directly attaching such preference to class.The text was updated successfully, but these errors were encountered: