camacq.helper package

Helper functions for camacq.

camacq.helper.ensure_dict(value: dict[str, Any] | None) dict[str, Any][source]

Convert None to empty dict.

camacq.helper.get_module(package: str, module_name: str) ModuleType[source]

Return a module from a package.

Parameters:
  • package (str) – The path to the package.

  • module_name (str) – The name of the module.

camacq.helper.has_at_least_one_key(*keys: str) Callable[[dict[str, Any]], dict[str, Any]][source]

Validate that at least one key exists.

camacq.helper.register_signals(center: Center) None[source]

Register signal handlers.

async camacq.helper.setup_one_module(center: Center, config: dict[str, Any], module: ModuleType) None[source]

Set up one module or package.

Returns:

Return a task to set up the module or None.

Return type:

asyncio.Task

Submodules

camacq.helper.template module

Handle templates.

camacq.helper.template.get_env(center: Center) ImmutableSandboxedEnvironment[source]

Get the template environment.

camacq.helper.template.make_template(center: Center, data: Any) Any[source]

Make templated data.

camacq.helper.template.render_template(data: Any, variables: dict[str, Any]) Any[source]

Render templated data.

camacq.helper.template.template_next_well_x(sample: LeicaSample, plate_name: str, x_wells: int = 12, y_wells: int = 8) int | None[source]

Return the next well x coordinate for the plate x, y format.

camacq.helper.template.template_next_well_xy(sample: Sample, plate_name: str, x_wells: int = 12, y_wells: int = 8) tuple[int | None, int | None][source]

Return the next not done well for the given plate x, y format.

camacq.helper.template.template_next_well_y(sample: LeicaSample, plate_name: str, x_wells: int = 12, y_wells: int = 8) int | None[source]

Return the next well x coordinate for the plate x, y format.