logger
_routine_registry
Value: getLogger(...)
Value: None
Context object passed to routine functions containing resources and results.
Initialize context with resource and results registries.
Decorator to register a function as a routine.
The decorated function receives:
Usage: @routine def my_sweep(ctx, gate, voltages, measure_contact): device = ctx.resources.device return device.sweep_1d(gate, voltages, measure_contact)
@routine(name=“custom_name”) def analyze_sweep(ctx, **params):
sweep_data = ctx.results.get(“my_sweep”) if sweep_data: voltages, currents = sweep_data
return analysis_result
Get all registered routines.
Clear all registred routines
Simple runner that executes decorated routine functions with resources and configs.
Resources can be provided in two ways:
resources parameterconfigs parameter (runner instantiates resources)When using the configs parameter, a DataLogger is automatically created and registered
with name=“logger” for convenient logging within routines.
Examples:
device = Device(name=“device”, …) logger = DataLogger(name=“logger”, …) runner = RoutineRunner(resources=[device, logger])
device_config = DeviceConfig(…) runner = RoutineRunner(configs=[device_config])
Now ctx.resources.device and ctx.resources.logger are available
Initialize runner with resources or configs.
Parameters:
Parameters:
Raises:
ValueError: If neither resources nor configs provided, or if both provided
Instantiate resources from configuration objects.
Parameters:
List of configuration objects (e.g., DeviceConfig)
Returns:
List of instantiated resource objects
Extract routine parameters from configuration objects (recursive).
Parameters:
List of configuration objects (e.g., DeviceConfig)
Returns:
Dictionary mapping routine names to their parameters
Recursively extract parameters from routine config and its nested routines.
Parameters:
The routine configuration to extract from
Dictionary to store extracted parameters
Get the full path for a routine including parent hierarhcy.
Parameters:
Name of the routine
Returns:
Full path like “health_check/noise_floor_measurement” or just “routine_name” if no parent
Get merged parameters from all parent routines in the hierarchy.
Parameters:
Name of the routine
Returns:
Dictionary of merged parent parameters
Execute a registered routine.
Parameters:
Name of the routine to run
Returns:
Result of the routine
Resolve logger base directory in priority order.
Priority:
base_dir ctor arg)Synchronize the logger base directory if we own it.
We only mutate the logger path when:
_manages_logger_base_dir is True), orbase_dir override.This prevents clobbering user-provided loggers while still keeping runner-created loggers aligned with session overrides.
Execute all routines from config in order.
Parameters:
Optional parent routine name(s). If provided, only run
Returns:
Dictionary mapping routine names to their results
Recursively run a routine and its nested routines.
Parameters:
The routine configuration to execute
Dictionary to store results
Parameters from parent routine to inherit
Get stored result from a routine.
List all registered routines.
List all stored results.