Frames, Masking, and Memory Limits¶
All examples assume coredaq is an open connection — see Quickstart.
What frames means¶
frames is the number of captured samples per active capture channel.
frames=1024with one active channel → 1024 samplesframes=1024with four active channels → 4 × 1024 samples (one set per channel)
Call max_capture_frames() before a large acquisition to avoid overflowing SDRAM.
Capture mask methods¶
| Method | Returns | Typical use |
|---|---|---|
capture_channel_mask() |
int |
Inspect the active capture mask |
set_capture_channel_mask(mask) |
int |
Set the mask directly |
capture_channels() |
tuple[int, ...] |
Inspect the channels enabled by the mask |
set_capture_channels(channels) |
tuple[int, ...] |
Set the mask from channel numbers |
max_capture_frames(channels=None) |
int |
Compute the largest safe capture length |
Setting the mask¶
set_capture_channel_mask() takes an integer. Bit 0 = channel 0, bit 1 = channel 1, and so on.
coredaq.set_capture_channel_mask(0x5) # channels 0 and 2 (0b0101)
coredaq.set_capture_channel_mask(0xF) # all four channels (0b1111)
print(coredaq.capture_channels()) # (0, 2)
To set the mask from a list of channel numbers instead:
coredaq.set_capture_channels([1, 3]) # channels 1 and 3
Temporary mask override in capture()¶
Pass channels=[...] to capture() to override the mask for that call only. The API restores the previous mask after the transfer.
with coreDAQ.connect(simulator=True) as coredaq:
result = coredaq.capture(frames=2048, channels=[0, 2], unit="mv")
print(result.enabled_channels) # (0, 2)
print(coredaq.capture_channels()) # restored to whatever it was before
Capture-only scope¶
The capture mask affects capture() and related acquisition methods only.
read_all()always reads all four channels regardless of the maskget_ranges()and range-setting methods always cover all four channels
Memory model¶
The coreDAQ has 32 MiB of SDRAM. Each frame is 2 bytes per active channel.
max_frames = 32 * 1024 * 1024 / (2 * active_channels)
| Active channels | Frame bytes | Maximum frames |
|---|---|---|
| 1 | 2 | 16,777,216 |
| 2 | 4 | 8,388,608 |
| 3 | 6 | 5,592,405 |
| 4 | 8 | 4,194,304 |
Programmatic check¶
with coreDAQ.connect(simulator=True) as coredaq:
print(coredaq.max_capture_frames()) # based on current mask
print(coredaq.max_capture_frames(channels=[0, 2])) # hypothetical two-channel capture
Related pages¶
- Capture Data —
capture()andCaptureResult - Units, Sample Rate, and Oversampling — sample rate and timing