Reading & Processing Digitizer Data Files
Format Specifications
Detailed specifications for the file formats supported by FemtoDAQ digitizer line are documented below. Each of these formats can be read into numpy arrays using skutils Loader objects.
Loading Digitizer Data Files
Loaders allows for quick and easy reading of FemtoDAQ digitizer data files. These Loaders are designed with the idea of fast, common interfaces for various file formats, to allow for easy and fast development no matter the file format used.
Loaders can return two data structures:
1. EventInfo
structures which aggregate data from multiple channels
within a pre-defined timestamp window.
2. ChannelData
which contains metadata and/or waveform data
from a single channel
Downloading Data from a FemtoDAQ Digitizer
Immediately following a data collection run, you can using skutils.FemtoDAQController.downloadLastRunDataFiles()
to download all data files that were generated during that run.
import skutils
digitizer = skutils.FemtoDAQController("url_or_ip_address")
last_run_data_files = digitizer.downloadLastRunDataFiles()
Loading Data from Files
Quick Loading
For most applications, skutils.quickLoad
provides the easiest way
to load data in for analysis. skutils.quickLoad
automatically uses the correct type of Loader
object for the
type of data file and return each EventInfo
as they were saved by your device.
event_count = 0
for event in skutils.quickLoad(last_run_files):
timestamp = event.timestamp
waveforms = event.wavedata()
print(f"Timestamp for this event is {timestamp}")
event_count += 1
Explicit Loading
In cases where you need to re-build Events or use advanced loading features, you
can instantiate a Loader
Object. skutils provides
tools to load each of the supported data types Data Formats.
The following block assumes you are working with EventCSV data files
for fname in last_run_data_files:
# create the loader for this file
loader = skutils.EventCSVLoader(fname)
for event in loader:
timestamp = event.min_timestamp
waves = event.wavedata()
pulse_heights = event.pulse_heights
# do processing...
Working with Event Data
The following examples assume you will have an EventInfo
instantiated using a tool such as skutils.quickLoad
Each EventInfo
object contains data from multiple channels.
Depending on the format, this allows you to access timestamps, pulse_heights and other DSP quantities
Iterating through channels in an Event
for ch_data in event.channel_data:
channel = ch_data.channel
Waveform Data
Waveform data for an event can be grabbed with wavedata()
. This
returns a numpy array where rows are waveform samples, and columns are the channels.
Attention
Some events may not contain waveforms - depending on your recording configuration.
In these cases has_waves
should be checked before you attempt to grab
waveforms that don’t exist.
channels = event.channels
if event.has_waves:
waveforms = event.wavedata()
print(f"This event contains waveform data for channels: {channels}. Each wave has {waveforms.shape[0]} samples")
Rebuilding Events
By default Events are build