Пример #1
0
    def convert_persistent_value(self, instruction):
        """Return converted `PersistentValueInstruction`.

        Args:
            instruction (PulseQobjInstruction): persistent value qobj
        Returns:
            Schedule: Converted and scheduled Instruction
        """
        t0 = instruction.t0
        channel = self.get_channel(instruction.ch)
        val = instruction.val

        # This is parameterized
        if isinstance(val, str):
            val_expr = parse_string_expr(val, partial_binding=False)

            def gen_pv_sched(*args, **kwargs):
                val = complex(val_expr(*args, **kwargs))
                return commands.PersistentValue(val)(channel) << t0

            return ParameterizedSchedule(gen_pv_sched, parameters=val_expr.params)

        return commands.PersistentValue(val)(channel) << t0
Пример #2
0
 def gen_pv_sched(*args, **kwargs):
     val = complex(val_expr(*args, **kwargs))
     return commands.PersistentValue(val)(channel) << t0