Skip to content

stephtr/experiment-framework

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Experiment Framework

This framework is specifically made for apps controlling physical experiments.

Its purpose is to manage external components and provide a layer of abstraction which makes switching between different implementations (devices surving a specific purpose, for example different lasers) easy.

Implementations exist for Lasers (TOPTICA), Cameras (Andor, Baumer, FLIR Grasshopper, Photonfocus) and Stages (MadCityLabs, SmarAct), although the source code can't be put under Open Source.

Example usage

For a working example (including the UI components), see the TestApp.

var Components = ExperimentContainer.Singleton;

Add component classes:

Components.AddComponentClass<LaserComponent>();
Components.AddComponentClass<StageComponent>();

Add all available implementations:

Components.AddComponent<FakeLaser>();
Components.AddComponent<OtherLaser>();
Components.AddComponent<LaserOfChoice>();
Components.AddComponent<FakeStage>();

Make the component settings persistent:

Components.UseWinUISettingsStore();
Components.LoadFromSettings();

Initialize a component (if not anyway being done by LoadFromSettings or by the ExperimentSettings component):

Components.ActivateComponentAsync(typeof(LaserComponent), null, typeof(FakeLaser).Name, new FakeLaserSettings());

Get & use a component:

var laser = Components.GetActiveComponent<LaserComponent>();
laser.IsOn = true;

Get notified on component changes:

// either (for a specific component):
Components.AddComponentChangeHandler<LaserComponent>((newLaser) => { ... });
// or (for all component changes):
Components.ComponentChanged += (componentClass, id, newComponent) => { ... };

WinUI 3 components

The framework comes with a few WinUI components:

ExperimentSettings

Displays controls to change between different component class implementations and change their respective settings:

Screenshot of the ExperimentSettings

ExperimentStatusBar

Shows a statusbar which displays all loaded components and their state (double click to reload a component):

Screenshot of the ExperimentStatusBar

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages