Repository navigation
Feature/schemes - #29
Merged
Merged
Conversation
scalcs.schemes draws a mechanism in the style of Colquhoun & Lape (2012),
Figs. 3, 7 and 8: states on a grid, each reversible step a close pair of
harpoon arrows with the barb of each on the outside of the pair, and a rate
constant, transition probability or equilibrium transition frequency written
against each direction.
schemes.draw(mec, values='probability', conc=10e-6, numbers=True)
The arrows are the rates of the mechanism. They are never inferred from
where the states are placed: joining neighbours on a grid is the obvious
shortcut, and it once drew the ten-state flip mechanism with thirteen
connections instead of eleven, joining open states that do not interconvert.
The placement comes from layout= if given, otherwise mec.layout - the drawing
stored with a .mec file - otherwise a ready-made layout matched on the state
names, which covers every mechanism in scalcs.samples.
Each arrow sits to its own left and carries its barb on its own left. The
two arrows of a pair run in opposite directions, so that puts both barbs on
the outside at any angle, with no notion of a forward direction needed.
Text and line widths shrink with the axes, relative to the scale of the
published Figs. 7 and 8, so a scheme in a small panel keeps the proportions
of the published figure instead of having its names overrun its arrows. They
are not enlarged in a bigger panel, where neighbouring numbers crowd.
Labels go where the published figures put them, beside each arrow near its
tail. On a diagonal they are anchored by the corner nearest the arrow, so
none of the text lies across the shaft.
A layout that leaves a state out, names one that does not exist, puts two
in one place, or runs a step's arrows over a third state - which would read
as two steps through it - is an error naming the states involved.
geometry() returns every position without drawing, so all but the rendering
is tested without matplotlib; the tests check the edges drawn against the
rates, the barbs against the pair, clearance round the state names, and the
values against qmatlib. Every sample mechanism is drawn.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
plot = ["matplotlib>=3.5"] for scalcs.schemes.draw and the one drawing
function in sccurves; the rest of the package
only returns arrays
gui now lists matplotlib, which the GUI imported
without declaring
CI installs the plot extra on every leg. Without it the scheme-drawing tests
importorskip and pass without drawing anything. The wheel check, which runs
in a clean environment with no matplotlib, now also imports scalcs.schemes,
so the lazy import cannot regress unnoticed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The guard was importorskip('matplotlib.backends.backend_qtagg'). Without a Qt
binding that module exists but raises a plain ImportError, not
ModuleNotFoundError, and from pytest 9.1 importorskip no longer counts that as
a reason to skip unless passed exc_type=ImportError. The import error then
interrupts collection, and pytest exits with code 2.
Latent on master: its Linux CI legs install no matplotlib, so the module was
skipped one line earlier, by importorskip('matplotlib'). Installing the plot
extra there exposed it, failing every Linux leg with pytest 9.2.0. It would
equally have hit anyone running the tests with matplotlib but no Qt.
Reproduced locally by blocking every Qt binding and making pytest's
deprecation warning an error, as 9.1 does: collection error and exit 2 before,
760 passed and this module skipped after.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged
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.
No description provided.