Skip to content

Report offending input in the simulation error messages - #1106

Open
jaewonyun1234 wants to merge 1 commit into
pasqal-io:developfrom
jaewonyun1234:simulation-module-error-messages
Open

Report offending input in the simulation error messages#1106
jaewonyun1234 wants to merge 1 commit into
pasqal-io:developfrom
jaewonyun1234:simulation-module-error-messages

Conversation

@jaewonyun1234

Copy link
Copy Markdown
Contributor

Hi @a-corni, @HGSilveri,

This covers pulser_simulation/simulation.py and pulser/_hamiltonian_data/hamiltonian_data.py together: 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 in simulation.py, 2 only in hamiltonian_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.

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.
@jaewonyun1234
jaewonyun1234 requested a review from a team as a code owner September 5, 2026 01:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant