question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Validate input when setting the QuantumCircuit data attribute directly

See original GitHub issue

Similar to #2170 , but for QuantumCircuit. The possibility of arbitrary data in circuit.data makes modifying or replacing the internals of QuantumCircuit difficult and error prone (see discussion around circuit._append in #2824 ). We should:

  • Move circuit.data to circuit._data
  • Add a getter for circuit.data and document it as a ordered list of (Instruction, qargs, cargs). It’s an open question whether or not we should commit to preserving user-insertion order.
  • Add a setter for circuit.data with a DeprecationWarning, directing users to e.g. QuantumCircuit.append and the rest of the circuit API.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
quantumjimcommented, Sep 16, 2019

Thanks!

The relevant part of Ignis is in here: the _make_syndrome_graph() method of GraphDecoder. Any incompatible changes in .data() can be expected to cause this test to fail.

0reactions
kdkcommented, Sep 16, 2019

Hi @quantumjim , the title of this issue is somewhat outdated (see the two comments preceding yours, and the PR #2838 ). The current plan is for circuit.data() to remain in place with the same list-like interface, but with changes to circuit.data() being validated to make sure they are of the right Instruction, qargs, cargs format. Existing code should continue to work.

Can you link to the example in ignis that works with .data()? It would be handy to have as a test case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

qiskit.circuit.QuantumCircuit
This gets stored as free-form data in a dict in the metadata attribute. It will not be directly used in the circuit. Raises....
Read more >
How to pass a condition via Data Attribute to JS for validation
Although this obviously isn't the direct answer to your question, it is my suggestion for how to build form validation. – Steven Moseley....
Read more >
Validate your Data's Attributes with the AttributeValidator ...
FME has always been able to validate your data attributes using transformers such as the Tester, AttirbuteCreator (with conditional values), Joiner (to use ......
Read more >
AttributeError: 'QuantumCircuit' object has no attribute ...
Qiskit (to my knowledge) does not directly support feed-forward simulation, so I attempted a work-around. I call the simulator firstly:
Read more >
How to: Customize Data Field Validation in the Data Model ...
In the Name box, enter the name of the custom validation attribute class. You can use any name that is not already being...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found