Skip to content

The redsun command

Installing redsun installs a command of the same name. python -m redsun runs it too, for an environment whose scripts are not on the path.

redsun [--version] [--example [STYLE]]
Option What it does
--version prints the installed version
--example opens the example session in your platform's look
--example STYLE opens the example session in the style named: napari or qlementine
none prints the help

The example session

The example is a QtSession holding every component redsun ships: the acquisition, positioner, lights and log views, with their presenters. A stage with two axes, a focus axis, a laser and an LED stand in for hardware, so nothing outside the process moves. One plan, walk, sends the focus to a few positions in turn with a pause after each, and holds it locked while it runs. The log view is a tab in the centre of the window, and the other views are docked around it. The session class and the function making its configuration are in redsun.examples.

The example needs a Qt binding, which the pyqt and pyside extras install. Without one the command says which extra to install and exits with 1. It exits with 1 as well when the session cannot be built, and prints the reason.

It is a session like any other, named redsun-example, so it writes its log files where every session does.

ExampleApp

ExampleApp(
    config: Source | Sequence[Source] | None = None,
    *,
    log_level: int | str | None = None,
    profile: ProfileKind | None = None,
    profile_dir: str | Path | None = None,
)

Bases: QtSession

Every built-in component in one window, over simulated devices.

A stage with two axes, a focus axis, a laser and an LED stand in for hardware, so nothing outside the process moves. One plan sends the focus to a few positions in turn, and holds it locked while it runs.

window_layout

window_layout() -> WindowLayout

Return the layout the example starts with: the logs as a tab of the centre, the other views docked around it.

wire

wire() -> Iterator[Link]

Link each view to its presenter, and the devices a plan holds to the views that lock them.

example_config

example_config(style: str | None) -> dict[str, Any]

Return the configuration showing the example in style, or in the platform's look for None.

style is the short name of a style redsun ships, as a session file writes it.

Exit codes

Code When
0 the help or the version was printed, or the example's window was closed
1 the example could not start
2 an option or a style the command does not know