Using multi_d_acquistion_events
multi_d_acquisition_events
is a powerful tool that allows you to specify the acquisition events in a similar manner to using the μmanager gui.
You should also read the Features page for this function.
[1]:
import numpy as np
from pycromanager import multi_d_acquisition_events
Specifying xy positions
To specify the xy positions you need to pass a 2D array with shape (N, 2). However, you may have two separate arrays for x
and y
. In the next cells are several different ways to construct an approriate 2D array.
[2]:
x = np.arange(0, 5)
y = np.arange(0, -5, -1)
xy = np.hstack([x[:, None], y[:, None]])
xy
[2]:
array([[ 0, 0],
[ 1, -1],
[ 2, -2],
[ 3, -3],
[ 4, -4]])
[3]:
multi_d_acquisition_events(xy_positions=xy)
[3]:
[{'axes': {'position': 0}, 'x': 0, 'y': 0},
{'axes': {'position': 1}, 'x': 1, 'y': -1},
{'axes': {'position': 2}, 'x': 2, 'y': -2},
{'axes': {'position': 3}, 'x': 3, 'y': -3},
{'axes': {'position': 4}, 'x': 4, 'y': -4}]
Adding z positions
Single absolute z position
To specify a single z value for each position use the xyz_positions
argument
[4]:
z = np.arange(0, 5)
xyz = np.hstack([x[:, None], y[:, None], z[:, None]])
multi_d_acquisition_events(xyz_positions=xyz)
[4]:
[{'axes': {'position': 0, 'z': 0}, 'x': 0, 'y': 0, 'z': 0},
{'axes': {'position': 1, 'z': 0}, 'x': 1, 'y': -1, 'z': 1},
{'axes': {'position': 2, 'z': 0}, 'x': 2, 'y': -2, 'z': 2},
{'axes': {'position': 3, 'z': 0}, 'x': 3, 'y': -3, 'z': 3},
{'axes': {'position': 4, 'z': 0}, 'x': 4, 'y': -4, 'z': 4}]
Relative z positions
Relative to each point
[6]:
multi_d_acquisition_events(xyz_positions=xyz, z_start=-1, z_end=1, z_step=1)
[6]:
[{'axes': {'position': 0, 'z': 0}, 'x': 0, 'y': 0, 'z': -1},
{'axes': {'position': 0, 'z': 1}, 'x': 0, 'y': 0, 'z': 0},
{'axes': {'position': 0, 'z': 2}, 'x': 0, 'y': 0, 'z': 1},
{'axes': {'position': 1, 'z': 0}, 'x': 1, 'y': -1, 'z': 0},
{'axes': {'position': 1, 'z': 1}, 'x': 1, 'y': -1, 'z': 1},
{'axes': {'position': 1, 'z': 2}, 'x': 1, 'y': -1, 'z': 2},
{'axes': {'position': 2, 'z': 0}, 'x': 2, 'y': -2, 'z': 1},
{'axes': {'position': 2, 'z': 1}, 'x': 2, 'y': -2, 'z': 2},
{'axes': {'position': 2, 'z': 2}, 'x': 2, 'y': -2, 'z': 3},
{'axes': {'position': 3, 'z': 0}, 'x': 3, 'y': -3, 'z': 2},
{'axes': {'position': 3, 'z': 1}, 'x': 3, 'y': -3, 'z': 3},
{'axes': {'position': 3, 'z': 2}, 'x': 3, 'y': -3, 'z': 4},
{'axes': {'position': 4, 'z': 0}, 'x': 4, 'y': -4, 'z': 3},
{'axes': {'position': 4, 'z': 1}, 'x': 4, 'y': -4, 'z': 4},
{'axes': {'position': 4, 'z': 2}, 'x': 4, 'y': -4, 'z': 5}]
Time points
You can specify the number of time points and the delay between them. The min_start_time
in the events makes it so that there is a garunteed delay between subsequent acquisition events.
[8]:
multi_d_acquisition_events(num_time_points=5, time_interval_s=10)
[8]:
[{'axes': {'time': 0}, 'min_start_time': 0},
{'axes': {'time': 1}, 'min_start_time': 10},
{'axes': {'time': 2}, 'min_start_time': 20},
{'axes': {'time': 3}, 'min_start_time': 30},
{'axes': {'time': 4}, 'min_start_time': 40}]
When combining a time series with a position series we can specify the order using teh order
argument which has a default order of:
time
position
channel
z
[9]:
xy_small = xy[:2, :]
multi_d_acquisition_events(
num_time_points=2,
time_interval_s=10,
xy_positions=xy_small,
order="ptz",
z_start=-1,
z_end=0,
z_step=1,
)
[9]:
[{'axes': {'position': 0, 'time': 0, 'z': 0},
'x': 0,
'y': 0,
'min_start_time': 0,
'z': -1},
{'axes': {'position': 0, 'time': 0, 'z': 1},
'x': 0,
'y': 0,
'min_start_time': 0,
'z': 0},
{'axes': {'position': 0, 'time': 1, 'z': 0},
'x': 0,
'y': 0,
'min_start_time': 10,
'z': -1},
{'axes': {'position': 0, 'time': 1, 'z': 1},
'x': 0,
'y': 0,
'min_start_time': 10,
'z': 0},
{'axes': {'position': 1, 'time': 0, 'z': 0},
'x': 1,
'y': -1,
'min_start_time': 0,
'z': -1},
{'axes': {'position': 1, 'time': 0, 'z': 1},
'x': 1,
'y': -1,
'min_start_time': 0,
'z': 0},
{'axes': {'position': 1, 'time': 1, 'z': 0},
'x': 1,
'y': -1,
'min_start_time': 10,
'z': -1},
{'axes': {'position': 1, 'time': 1, 'z': 1},
'x': 1,
'y': -1,
'min_start_time': 10,
'z': 0}]
Channels
The channel_group
, channels
and channel_exposure_ms
arguments can be used to control what channels are collected.
[10]:
channel_group = "your-channel-group"
channels = ["BF", "GFP"]
channel_exposures_ms = [15.5, 200]
multi_d_acquisition_events(
xy_positions=xy,
channels=channels,
channel_group=channel_group,
channel_exposures_ms=channel_exposures_ms,
)
[10]:
[{'axes': {'position': 0},
'x': 0,
'y': 0,
'channel': {'group': 'your-channel-group', 'config': 'BF'},
'exposure': 0},
{'axes': {'position': 0},
'x': 0,
'y': 0,
'channel': {'group': 'your-channel-group', 'config': 'GFP'},
'exposure': 1},
{'axes': {'position': 1},
'x': 1,
'y': -1,
'channel': {'group': 'your-channel-group', 'config': 'BF'},
'exposure': 0},
{'axes': {'position': 1},
'x': 1,
'y': -1,
'channel': {'group': 'your-channel-group', 'config': 'GFP'},
'exposure': 1},
{'axes': {'position': 2},
'x': 2,
'y': -2,
'channel': {'group': 'your-channel-group', 'config': 'BF'},
'exposure': 0},
{'axes': {'position': 2},
'x': 2,
'y': -2,
'channel': {'group': 'your-channel-group', 'config': 'GFP'},
'exposure': 1},
{'axes': {'position': 3},
'x': 3,
'y': -3,
'channel': {'group': 'your-channel-group', 'config': 'BF'},
'exposure': 0},
{'axes': {'position': 3},
'x': 3,
'y': -3,
'channel': {'group': 'your-channel-group', 'config': 'GFP'},
'exposure': 1},
{'axes': {'position': 4},
'x': 4,
'y': -4,
'channel': {'group': 'your-channel-group', 'config': 'BF'},
'exposure': 0},
{'axes': {'position': 4},
'x': 4,
'y': -4,
'channel': {'group': 'your-channel-group', 'config': 'GFP'},
'exposure': 1}]
[ ]: