daqdb

Name

daqdb -- Record/playback event data from sqlite3 database files

Synopsis


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

                        

DESCRIPTION

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.

SUBCOMMANDS

daqdb open filename

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.

daqdb enable

Enables event recording. Note that event recording will actually start when the next begin run item is seen. At that time:

  1. A new save set will be created and the SpecTcl analysis configuration saved to it.

  2. 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.

  3. Subsequent scaler items will be saved to the run.

  4. Subsequent events will be saved to the run.

  5. 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.

daqdb disable

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.

daqdb close

Closes the database file. When the file is closed, the only legal operation is to open a database file.

daqdb autosave spectrum-name-list

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.

daqdb listruns

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

Number of the run.

config

Name of the save set containing the run.

title

The title of the run.

start_time

The date/time at which the run started. clock format will turn this numeric representation into a human readable string.

end_time (optional)

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

daqdb playrun-number

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.

daqdb stop

Stops an in progress playback immediately. It is possible to issue this command because the playback maintains event loop processing.