plesty.pol_pl.__main__

Entry point for running the polarization-dependent PL experiment as a standalone process.

Device addresses and the shared disk are deployment facts and come from the environment (HWP_ADDRESS, SPEC_ADDRESS, PLESTY_DATA). The bench running the experiment serves each instrument on the bench setup.yaml names for it and gives the run its address; ExperimentCLI sets PLESTY_DATA at start-up from setup.yaml and the values its variables hold in .env; one set by hand still wins. Measurement tuning lives in a YAML configuration file.

ExperimentCLI owns everything that is the same for every experiment — --config, --resume, --run-root, --dry-run and --manifest, the preflight, the event loop, and the graceful stop. This module declares only what differs: SCHEMA, what the run reads from the environment, and how the rig and the experiment are built.

MANIFEST is the contract. python -m plesty.pol_pl --manifest prints it, and a console builds this experiment’s settings form from it without being taught anything about this module. It and config/default.yaml must declare the same keys — gate e3 checks that they do.

Attributes

RIG

SCHEMA

MANIFEST

cli

Functions

with_prominence(→ dict[str, Any])

Return config with the line-finding threshold set, or unchanged for None.

configure(→ dict[str, Any])

Apply the command line's overrides to the loaded configuration.

check(→ None)

Refuse an incomplete configuration before anything connects.

build_devices(→ plesty.pol_pl.rig.PolPlRig)

Build the rig, leaving out the sub-devices named in skip.

build_experiment(→ plesty.lib.experiment.Experiment)

Build the experiment on the rig.

Module Contents

plesty.pol_pl.__main__.RIG: dict[str, list[str]]
plesty.pol_pl.__main__.SCHEMA: dict[str, list[plesty.lib.device.params.ConfigParameter]]
plesty.pol_pl.__main__.MANIFEST
plesty.pol_pl.__main__.cli
plesty.pol_pl.__main__.with_prominence(config: dict[str, Any], prominence: float | None) → dict[str, Any]

Return config with the line-finding threshold set, or unchanged for None.

The threshold is analysis.fit_options.prominence: a line must stand at least that many counts above its surroundings to be found. The run saves the configuration it used, so the value set here is on record.

Parameters:
  • config (dict[str, Any]) – The loaded measurement configuration.

  • prominence (Optional[float]) – The threshold in counts, or None to leave it alone.

Returns:

The configuration to freeze into the plan.

Raises:

ValueError – If prominence is not a positive number of counts.

Return type:

dict[str, Any]

plesty.pol_pl.__main__.configure(args: Any, config: dict[str, Any]) → dict[str, Any]

Apply the command line’s overrides to the loaded configuration.

Parameters:
  • args (Any) – The parsed command line.

  • config (dict[str, Any]) – The configuration as read from the YAML file.

Returns:

The configuration the run freezes into its plan.

Return type:

dict[str, Any]

plesty.pol_pl.__main__.check(args: Any, config: dict[str, Any]) → None

Refuse an incomplete configuration before anything connects.

What only a hardware run needs — the shared data disk — is checked here rather than in the experiment, so --dry-run works without it and a missing disk costs nothing measured.

Parameters:
  • args (Any) – The parsed command line.

  • config (dict[str, Any]) – The configuration this run would use.

Return type:

None

plesty.pol_pl.__main__.build_devices(args: Any, config: dict[str, Any], skip: frozenset[str]) → plesty.pol_pl.rig.PolPlRig

Build the rig, leaving out the sub-devices named in skip.

Each sub-device’s address is read from its own <NAME>_ADDRESS environment variable. Called again on every start-up retry, so an edited .env or a server started in the meantime is picked up.

Parameters:
  • args (Any) – The parsed command line.

  • config (dict[str, Any]) – The measurement configuration.

  • skip (frozenset[str]) – Optional sub-devices to build the rig without.

Return type:

plesty.pol_pl.rig.PolPlRig

plesty.pol_pl.__main__.build_experiment(args: Any, config: dict[str, Any], run_root: str | None, devices: Any) → plesty.lib.experiment.Experiment

Build the experiment on the rig.

Parameters:
  • args (Any) – The parsed command line.

  • config (dict[str, Any]) – The measurement configuration, frozen into the run’s plan.

  • run_root (Optional[str]) – Where this run’s checkpoint directory goes.

  • devices (Any) – The connected rig, or None for --dry-run.

Return type:

plesty.lib.experiment.Experiment