Report offending input in the simulation error messages - #1106
Open
jaewonyun1234 wants to merge 1 commit into
Open
Report offending input in the simulation error messages#1106jaewonyun1234 wants to merge 1 commit into
jaewonyun1234 wants to merge 1 commit into
Conversation
Error messages that only stated a rule now also report the value that broke it. Covers pulser_simulation/simulation.py and pulser/_hamiltonian_data/hamiltonian_data.py together: the two share eleven identical messages, so changing one without the other would leave the same error worded two ways depending on the entry point. 13 messages at 17 sites, 4 of them changed identically in both files. Bases are listed in channel declaration order. The two messages that report qubit ids missing from the register sort them: those ids come from sets and are by construction absent from the register, so there is no caller order to keep. Messages describing a state rather than a rejected input are left unchanged. Existing assertions that stopped before the reported value are extended to the end of the message.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi @a-corni, @HGSilveri,
This covers
pulser_simulation/simulation.pyandpulser/_hamiltonian_data/hamiltonian_data.pytogether: they share eleven byte-identical error messages, so doing one without the other would leave the same error worded two ways depending on the entry point. 13 messages at 17 sites — 4 changed identically in both files, 7 only insimulation.py, 2 only inhamiltonian_data.py.Three of them report qubit ids or bases that come from sets. The bases are listed in channel declaration order. The two qubit-id cases have no caller order to preserve — those ids are, by construction, the ones not in the register — so they are sorted, with a comment saying why.
Left unchanged: the ten that describe a state rather than a rejected input — empty samples, no declared channels, no instructions,
needs to be built, and the configuration clashes (noise_model+config, SLM + modulation, state preparation + initial state, depolarizing in all-basis, relaxation without ground-rydberg).Partially addresses #1057.