Hybrid Computing
Hybrid computing fuses the available classical digital algorithms with the new possibilities introduced by analog computing!
Common Hybrid Computing Tasks
- class pybrid.base.hybrid.programs.recl.RunEvaluateReconfigureLoop(*args, **kwargs)
Bases:
BaseProgram
Run-Evaluate-Reconfigure-Loop Abstraction
This class implements the typical process flow of a run-evaluate-reconfigure-loop. Users should inherit this class and overwrite the following function to inject their specific code.
set_user_variables()
for one-time initialization codeinitial_configuration()
for configuring the first runnext_configuration()
for configuring the next run (except the first)run_done()
for evaluating a completed runloop_done()
for final evaluation or cleanup code
- create_run()
- ignore_run_errors: ClassVar[bool] = False
Whether to ignore errors during a run by default
- initial_configuration(run: BaseRun, computer: AnalogComputer)
User-supplied function called before the first run.
Use this function to set the configurations for the first run. Run configuration parameters (e.g. OP time or DAQ config) will be kept to future runs.
- Parameters:
run – First run that is about to be started
computer – A representation of the specific analog computer
- Returns:
None
- loop_done(runs: List[BaseRun])
User-supplied function called after the loop exits.
Use this to close any open resources (like files) and to do evaluation across multiple runs.
- Parameters:
runs – List of all executed runs.
- Returns:
None
- next_configuration(run: BaseRun, computer: AnalogComputer, previous_runs: List[BaseRun])
User-supplied function called before each run except the first.
Use this function to set the configurations for the upcoming run. You can either modify the passed modules or access modules you ‘remembered’ in init_loop.
- Parameters:
run – Run that is about to be started
computer – A representation of the specific analog computer
previous_runs – List of previous runs
- Returns:
None
- run_done(run: BaseRun) bool
User-supplied function called after a run is completed.
Use this function to evaluate the results of the latest run. If the loop should be stopped after this run, return True.
- Parameters:
run – The just completed run
- Returns:
False if loop should be stopped, True to continue
- run_error(run: BaseRun, error: Exception)
Error handling function.
Is called on any exception raised during a computation.
- runs: List[BaseRun]
- set_user_variables(computer: AnalogComputer)
User-supplied function called before the loop is started.
Use this function to set user variables and constant computer configuration values. Acquire any necessary resources (like opening files).
- Parameters:
computer – A representation of the specific analog computer
- Returns:
None
- async start()
Entrypoint for starting the Run-Evaluate-Reconfigure-Loop
This function is called automatically by the pybrid command line tool. You should not need to call it unless you manually start a loop.
- Returns:
None