camacq.plugins.sample package

Handle sample state.

class camacq.plugins.sample.Image(path, values=None, **kwargs)

Bases: ImageContainer

An image with path and position info.

property change_event

Return an event class to fire on container change.

Type:

Event

property images

Return a dict with all images for the container.

Type:

dict

property name

Return an identifying name for the container.

Type:

str

property path

Return the path of the image.

Type:

str

property values

Return a dict with the values set for the container.

Type:

dict

class camacq.plugins.sample.ImageContainer

Bases: ABC

A container for images.

abstract property change_event

Return an event class to fire on container change.

Type:

Event

abstract property images

Return a dict with all images for the container.

Type:

dict

abstract property name

Return an identifying name for the container.

Type:

str

abstract property values

Return a dict with the values set for the container.

Type:

dict

class camacq.plugins.sample.Sample

Bases: ImageContainer, ABC

Representation of the state of the sample.

center = None
abstract property change_event

Return an event class to fire on container change.

Type:

Event

data = None
get_sample(name, **kwargs)

Get an image container of the sample.

Parameters:
  • name (str) – The name of the container type.

  • **kwargs – Arbitrary keyword arguments. These will be used to create the id string of the container.

Returns:

Return the found ImageContainer instance.

Return type:

ImageContainer instance

abstract property image_event_type

Return the image event type to listen to for the sample.

Type:

str

abstract property images

Return a dict with all images for the container.

Type:

dict

abstract property name

Return the name of the sample.

Type:

str

abstract async on_image(center, event)

Handle image event for this sample.

async set_sample(name, values=None, **kwargs)

Set an image container of the sample.

Parameters:
  • name (str) – The name of the container type.

  • values (dict) – The optional values to set on the container.

  • **kwargs – Arbitrary keyword arguments. These will be used to create the id string of the container.

Returns:

Return the ImageContainer instance that was updated.

Return type:

ImageContainer instance

abstract property set_sample_schema

Return the validation schema of the set_sample method.

abstract property values

Return a dict with the values set for the container.

Type:

dict

class camacq.plugins.sample.SampleEvent(data=None)

Bases: Event

An event produced by a sample change event.

property container

Return the container instance of the event.

Type:

ImageContainer instance

property container_name

Return the container name of the event.

Type:

str

data
event_type = 'sample_event'
property images

Return the container images of the event.

Type:

dict

property values

Return the container values of the event.

Type:

dict

class camacq.plugins.sample.SampleImageSetEvent(data=None)

Bases: SampleEvent

An event produced by a new image on the sample.

property container

Return the container instance of the event.

Type:

ImageContainer instance

property container_name

Return the container name of the event.

Type:

str

data
event_type = 'sample_image_set_event'
property images

Return the container images of the event.

Type:

dict

property values

Return the container values of the event.

Type:

dict

class camacq.plugins.sample.Samples

Bases: dotdict

Hold all samples.

clear() None.  Remove all items from D.
copy() a shallow copy of D
fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.

If E is present and has a .keys() method, then does: for k in E: D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values() an object providing a view on D's values
camacq.plugins.sample.get_matched_samples(sample, name, attrs=None, values=None)

Return the sample items that match.

camacq.plugins.sample.register_sample(center, sample)

Register sample.

async camacq.plugins.sample.setup_module(center, config)

Set up sample module.

Parameters:
  • center (Center instance) – The Center instance.

  • config (dict) – The config dict.

Submodules

camacq.plugins.sample.helper module