package require SpecTclDB daqdb open filename daqdb enable daqdb disable daqdb close daqdb autosave spectrum-name-list daqdb listruns daqdb play run-number daqdb stop
This command ensemble is used by SpecTcl to manage event recording and playback to/from SQLite3 databases. This package is very SpecTcl dependent. subcommands will start event processors, and event sinks, as well as drive event sinks.
Opens the database filename
.
If a database event processor
has not yet been created, one will
be. The event processor's database
writer will be set to one
attached to filename
.
The event processor will also create an
event sink.
Event writing, when it happens is a collaboration
between an event processor and
an event sink. All non-event
data (begin run, end run, scalers),
must be written by the event processor,
as it knows about those items.
Event data, on the other hand,
is done by an event sink because
by the time the event sinks are
called, the event processing pipeline
has fully built the
CEvent
that corresponds to the unpacked
parameters in the event.
Enables event recording. Note that event recording will actually start when the next begin run item is seen. At that time:
A new save set will be created and the SpecTcl analysis configuration saved to it.
A run will be created within the save set and filled in with the run number, the title, and the time at which the run started.
Subsequent scaler items will be saved to the run.
Subsequent events will be saved to the run.
On the first corresponding end run, the end time will be saved to the run and the contents of all spectra on the autosave list will be written to the saveset.
Event recording is immediately stopped. While it is legal to do this while analysis is in progress, this is not recommended.
If event recording is stopped while it is in progress, the run record will not have an end of run and the run will not be entirely recorded to the save set. Furthermore, the contents of spectra on the auto-saved list will not be saved.
Closes the database file. When the file is closed, the only legal operation is to open a database file.
spectrum-name-list
is a Tcl list of spectrum names.
The spectra on this list become the new
autosave spectrum list. At the
end of recording a run, the contents
of these spectra are written into the
same saveset as the run.
Returns a Tcl list describing all of the runs in the database file. Each element of the list is a dict that describes one run. These dicts contain the following key/value pairs:
Number of the run.
Name of the save set containing the run.
The title of the run.
The date/time at which the run started. clock format will turn this numeric representation into a human readable string.
The time at which the run ended. This will not be present if recording was prematurely disabled before the entire run was recorded or if the run was improperly ended when it was acquired.
Once more, this integer value can be converted into a human readable time using clock seconds
Begins playing back data from the run
run-number
.
Data are read from the database for that
run and directly submitted to SpecTcl's
event sink pipeline.
Periodically, the playback will drain event from the Tcl event queue allowing the SpecTcl user interface to remain alive during playback.
Since the user event processing pipeline is bypassed, runs should play back noticeably faster than from raw data.
Event recording while performing event playback is not supported. This is because recording relies on getting begin and end run information from the event processing pipeline which is completely bypassed during playback. Furthermore, it's likely that recording's use of transactions will deadlock SpecTcl during playback.
Stops an in progress playback immediately. It is possible to issue this command because the playback maintains event loop processing.