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

CmdDef arguments fail if not provided as keyword arguments #2741

Closed
taalexander opened this issue Jul 4, 2019 · 0 comments · Fixed by #2743
Closed

CmdDef arguments fail if not provided as keyword arguments #2741

taalexander opened this issue Jul 4, 2019 · 0 comments · Fixed by #2743
Labels
bug Something isn't working good first issue Good for newcomers mod: pulse Related to the Pulse module
Milestone

Comments

@taalexander
Copy link
Contributor

Information

  • Qiskit Terra version:
  • Python version:
  • Operating system:

What is the current behavior?

cmd_def.get('u3', control, np.pi, 0, np.pi)

Raises error

---------------------------------------------------------------------------
PulseError                                Traceback (most recent call last)
<ipython-input-16-5eef41f492e0> in <module>
----> 1 control_xgate = cmd_def.get('u3', control, np.pi, 0, np.pi)

~/anaconda3/envs/qiskit/lib/python3.7/site-packages/qiskit/pulse/cmd_def.py in get(self, cmd_name, qubits, *params, **kwparams)
    134 
    135             if isinstance(schedule, ParameterizedSchedule):
--> 136                 return schedule.bind_parameters(*params, **kwparams)
    137 
    138             return schedule.flatten()

~/anaconda3/envs/qiskit/lib/python3.7/site-packages/qiskit/pulse/schedule.py in bind_parameters(self, *args, **kwargs)
    414                 predefined = self.parameters
    415             sub_params = {k: v for k, v in named_parameters.items() if k in predefined}
--> 416             schedules.append(param_sched(**sub_params))
    417 
    418         # construct evaluated schedules

~/anaconda3/envs/qiskit/lib/python3.7/site-packages/qiskit/pulse/schedule.py in __call__(self, *args, **kwargs)
    424     def __call__(self, *args: List[Union[float, complex]],
    425                  **kwargs: Dict[str, Union[float, complex]]) -> Schedule:
--> 426         return self.bind_parameters(*args, **kwargs)

~/anaconda3/envs/qiskit/lib/python3.7/site-packages/qiskit/pulse/schedule.py in bind_parameters(self, *args, **kwargs)
    414                 predefined = self.parameters
    415             sub_params = {k: v for k, v in named_parameters.items() if k in predefined}
--> 416             schedules.append(param_sched(**sub_params))
    417 
    418         # construct evaluated schedules

~/anaconda3/envs/qiskit/lib/python3.7/site-packages/qiskit/qobj/converters/pulse_instruction.py in gen_fc_sched(*args, **kwargs)
    346 
    347             def gen_fc_sched(*args, **kwargs):
--> 348                 phase = abs(phase_expr(*args, **kwargs))
    349                 return commands.FrameChange(phase)(channel) << t0
    350 

~/anaconda3/envs/qiskit/lib/python3.7/site-packages/qiskit/pulse/parser.py in __call__(self, *args, **kwargs)
    134                 return PulseExpression(expr, self._partial_binding)
    135             else:
--> 136                 raise PulseError('Parameters %s are not all bound.' % self.params)
    137         return expr.body.n
    138 

PulseError: "Parameters ['P2'] are not all bound."

Steps to reproduce the problem

What is the expected behavior?

Suggested solutions

I believe this may have something to do with qiskit assuming a specific format for the order/names of commands, these should instead be ordered alphabetically. As they will typically be P{n}.

@taalexander taalexander added this to the 0.9 milestone Jul 4, 2019
@taalexander taalexander added bug Something isn't working good first issue Good for newcomers labels Jul 4, 2019
@1ucian0 1ucian0 added the mod: pulse Related to the Pulse module label Jan 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers mod: pulse Related to the Pulse module
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants