[18-JUN-25] When it starts up, LWDAQ installs hundreds of commands for instruments and tools to use. The LWDAQ (upper-case LWDAQ) commands are those installed by TclTk scripts that LWDAQ runs at start-up. The lwdaq (lower-case lwdaq) commands are those installed by the lwdaq library that LWDAQ loads at start-up. We compile this library from Pascal source code. The LWDAQ commands all begin with LWDAQ_. The lwdaq commands all begin with lwdaq_. This Command Reference describes all LWDAQ and lwdaq commands.
The LWDAQ distribution's Packages directory contains a number of TclTk libraries, which in Tcl nomenclature are called "packages". Some of these packages are loaded by LWDAQ at startup. The TTY package, for example, manages the console interface when we launch LWDAQ from a terminal, and the EDF package manages the writing of European Data Format files. This manual does not describe the packages in the Packages directory, but you can load them into LWDAQ with the Tcl "package require" command. There is no LWDAQ package. The LWDAQ libraries are distributed among two dozen LWDAQ scripts in the LWDAQ directory structure. We do not load the LWDAQ commands with "package require LWDAQ", we load them during the LWDAQ initialization. If you include a "package require LWDAQ" command in your script, you will generate an error.
The Tcl scripts that define the LWDAQ commands are in the LWDAQ/LWDAQ.app/Contents/LWDAQ directory. Each LWDAQ command has its own entry in this manual, with its Tcl declaration and its in the Tcl comments above the declaration. The Pascal units that define the lwdaq commands are in the LWDAQ/Sources directory. Each operating system has its own version of the shared library we compile from the Pascal units, but all versions define the same commands. Each lwdaq command takes some mandatory parameters, and a list of optional parameters. You specify the mandatory parameters by passing their values directly to the command, in the correct order. You specify optional parameters with a list of option names in the form "?option value?". You can specify any number of these options, and in any order. Here is an example library command call from the Rasnik instrument script.
set result [lwdaq_rasnik $image_name \ -show_fitting $config(analysis_show_fitting) \ -show_timing $config(analysis_show_timing) \ -reference_code $config(analysis_reference_code) \ -orientation_code $config(analysis_orientation_code) \ -pixel_size_um $info(analysis_pixel_size_um) \ -reference_x_um $info(analysis_reference_x_um) \ -reference_y_um $info(analysis_reference_y_um) \ -square_size_um $config(analysis_square_size_um) ]
The lwdaq.pas file acts as an interface between our Pascal library and the Tcl interpreter that manages the entire LWDAQ process. The lwdaq.pas initialization routine, init_Lwdaq, loads the lwdaq shared library and declares all the lwdaq commands for the interpreter's use. We compile the shared libraries for Windows, Linux, MacOS, and Raspbian with the Free Pascal Compiler (FPC).
The lwdaq command grants access to a selection of mathematical routines declared in our Pascal library. We call these the lwdaq routines to distinguish them from the lwdaq commands, of which lwdaq is an exmaple. The following command calls our linear interpolator on a set of x-y data pairs to estimate the value of a curve at x=2.
lwdaq linear_interpolate 2 "0 0 3 3 6 6"
You will find a list of the routines available through the lwdaq command in a table below, as well as descriptions of each of them.
The image parameters taken by many of the library commands are the names of images in the LWDAQ image list. This list of images is maintained in memory by the library commands. Each image contains its pixel intensities and an overlay in which the library routines can draw lines. You draw an image in a Tk photo widget with lwdaq_draw. First lwdaq_draw renders the pixel intensity in the photo, and then it renders the overlay. The same image can be rendered in multiple Tk photos. When an instrument captures consecutive images from a data acquisition system, it is deleting previous images (now redundant) from the LWDAQ image list, creating a new image, filling it with the acquired pixel intensities, and rendering the image in the same Tk photo in the instrument window.
proc LWDAQ_about {}
LWDAQ_about creates a message box that pops up and tells us about the program.
proc LWDAQ_acquire {instrument}
LWDAQ_acquire acquires data for the instrument called $instrument from either a file, or an existing image in memory, or directly from the daq. After acquiring, it applies analysis if enabled and returns a result string.
proc LWDAQ_acquire_button {name}
LWDAQ_acquire_button is for use with instrument acquire buttons.
proc LWDAQ_activity_Receiver {}
LWDAQ_activity_Receiver opens a new panel that shows a table of telemetry channels and the number of samples received per second from each in the most recent acquisition.
proc LWDAQ_analysis_BCAM {{image_name ""}}
LWDAQ_analysis_BCAM applies BCAM analysis to an image in the lwdaq image list. By default, the routine uses the image $config(memory_name).
proc LWDAQ_analysis_Camera {{image_name ""}}
LWDAQ_analysis_Camera applies Camera analysis to an image in the lwdaq image list. By default, the routine uses the image $config(memory_name).
proc LWDAQ_analysis_Diagnostic {{image_name ""}}
LWDAQ_analysis_Diagnostic displays the power supply measurements carried by the $image_name and displays them in the diagnostic instrument window. It calculates average values for the power supply voltages and current consumption and returns these parameters, as well as other information about the driver. By default, the routine uses the image $config(memory_name).
proc LWDAQ_analysis_Dosimeter {{image_name ""}}
LWDAQ_analysis_Dosimeter applies Dosimeter analysis to an image in the lwdaq image list. By default, the routine uses the image named $config(memory_name). It calculates the vertical slope of intensity in cnt/row first. The analysis working with the original image when analyis_enable=1, but switches to using the image after subtraction of background gradient when analysis_enable>=2. With analysis_enable=2 the image in memory remains the same, and analysis operates on a copy of the original. With analysis_enable=3, the analysis replaces the original image with the gradient-subtracted image. The analysis calculates charge density in cnt/px next. The charge density is combined intensity of bright hits divided by the number of pixels in the analysis bounds of the image. A hit is a spot that satisfies the analysis_threshold string. The threshold string specifies a minumum intensity for pixels in a hit. The string "20 & 2 <" specifies a minimum intensity twenty counts above background, and indicates that the background should be the average intensity of the image. The same string sets a limit of two pixels in any valid hit. Following the charge density is the standard deviation of intensity, the value of the threshold intensity, and the number of hits found in the image. Each hit is represented by its total brightness above background, and if analysis_include_ij=1, the row and column number of the pixel closest to the optical center of the hit. Following these values, the analysis will list one or more bright hits in order of descending brightness. With analysis_num_hits="*", all hits found will be listed. With analysis_num_hits="10", ten hits will be listed. If only three hits exist, the remaining seven hits will be represented by brightness "-1" and position "0 0".
proc LWDAQ_analysis_Flowmeter {{image_name ""}}
LWDAQ_analysis_Flowmeter takes the flowmeter RTD sensor resistance measurements in $image_name and plots a graph of sensor temperature versus time in the Flowmeter window. It returns a string containing the inverse time-constant of the cool-down phase. By default, the routine uses image $config(memory_name).
proc LWDAQ_analysis_Gauge {{image_name ""}}
LWDAQ_analysis_Gauge takes the RTD resistance measurements contained in $image_name and plots a graph of temperature versus time for each sensor whose resistance is recorded in the image. It calculates the average value of each temperature and returns the averages as a string. By default, the routine uses image $config(memory_name).
proc LWDAQ_analysis_Inclinometer {{image_name ""}}
LWDAQ_analysis_Inclinometer converts the ADC measurements contained in $image_name into voltages, and plots them in the Inclinometer window. It calculates the average value of the voltage, the slope, and the standard deviation, and returns these in a string. By default, the routine uses image $config(memory_name).
proc LWDAQ_analysis_Rasnik {{image_name ""}}
LWDAQ_analysis_Rasnik applies rasnik analysis to an image in the lwdaq image list. By default, the routine uses image $config(memory_name).
proc LWDAQ_analysis_Receiver {{image_name ""}}
LWDAQ_analysis_Receiver applies receiver analysis to an image in the lwdaq image list. By default, the routine uses the image $config(memory_name).
proc LWDAQ_analysis_RFPM {{image_name ""}}
LWDAQ_analysis_RFPM converts the ADC measurements contained in $image_name into voltages, and plots them in the RFPM window. By default, the routine uses image $config(memory_name). If analysis_enable is set to 1, the analysis returns the peak-to-peak value of the signal on all four RFPM signal paths in units of ADC counts. If analysis_enanalysis is 2, the analysis returns the rms values of the signals.
proc LWDAQ_analysis_SCAM {{image_name ""}}
LWDAQ_analysis_SCAM applies SCAM analysis to an image in the lwdaq image list. By default, the routine uses the image $config(memory_name).
proc LWDAQ_analysis_Terminal {{image_name ""}}
LWDAQ_analysis_Terminal scans an image received from a Terminal data acquisition, and turns it into a string of numbers.
proc LWDAQ_analysis_Thermometer {{image_name ""}}
LWDAQ_analysis_Thermometer takes the RTD resistance measurements contained in $image_name and plots a graph of temperature versus time for each sensor whose resistance is recorded in the image. It calculates the average value of each temperature and returns the averages as a string. By default, the routine uses image $config(memory_name).
proc LWDAQ_analysis_Viewer {{image_name ""}}
LWDAQ_analysis_Viewer calls the analysis of another instrument to analyze an image in the Viewer panel. If report is set, the routine draws the image in the Viewer panel and writes the results of analysis to the text window.
proc LWDAQ_analysis_Voltmeter {{image_name ""}}
LWDAQ_analysis_Voltmeter converts the ADC measurements contained in $image_name into voltages, and plots them in the Voltmeter window. It calculates the average value of the voltage, the slope, and the standard deviation, and returns these in a string. By default, the routine uses image $config(memory_name).
proc LWDAQ_analysis_WPS {{image_name ""}}
LWDAQ_analysis_WPS applies WPS analysis to an image in the lwdaq image list. By default, the routine uses the image $config(memory_name).
proc LWDAQ_bind_command_key {window letter command}
LWDAQ_bind_command_key binds the specified command letter to the specified command on all platforms. We use the "command" key on MacOS and the "control" key on Windows and Linux. If the window is an empty string, we bing the key to the root window.
proc LWDAQ_button_confirm {s}
LWDAQ_button_confirm opens a toplevel window called "Confirm" and prints message $s in the window. The procedure returns after the user presses a button.
proc LWDAQ_button_wait {{s ""}}
LWDAQ_button_wait opens a toplevel window with a continue button and waits until the user presses the button before closing the window and continuing. An optional message, s, may be printed in the window along with the continue instruction.
proc LWDAQ_button_warning {s}
LWDAQ_button_warning opens a toplevel window called "Warning" and prints message, s, in the window. The procedure returns after the user presses a button.
proc LWDAQ_byte_poll {sock addr value}
LWDAQ_byte_poll tells the relay at the other end of TCPIP socket $sock to wait until the byte it reads from address $addr has value $value. The value we pass to the routine is a string of characters that represent a decimal number. The routine converts this string into a binary byte. The strings "-1" and "255" both get converted into the same binary value, 255, which is -1 in 2's compliment.
proc LWDAQ_byte_read {sock addr}
LWDAQ_byte_read reads a byte from the controller address space on a driver. The read takes place through a socket open with the driver called $sock, and reads a byte from controller address $addr. The routine returns the byte as a decimal number. The addr parameter is a string of characters representing a decimal number. The routine translates the parameter into a four-byte integer before transmitting it to the driver. The routine returns a string of characters that represents a decimal number.
proc LWDAQ_byte_write {sock addr value}
LWDAQ_byte_write writes byte $value through TCPIP socket $sock to controller address $addr. The addr and value parameters are strings of characters that represent decimal numbers. The routine translates these into a four-byte integer and a single-byte value before transmitting them to the driver.
proc LWDAQ_clock_widget {{wf ""}}
LWDAQ_clock_widget creates a text widget that displays second-by-second current time. If you specify a window name, the clock widget will appear in the window, packed towards the top. Otherwise the routine creates a new toplevel window for the clock.
proc LWDAQ_close {name}
LWDAQ_close closes the window of the named instrument.
proc LWDAQ_close_all_sockets {}
LWDAQ_close_all_sockets closes all open sockets and returns an empty string.
proc LWDAQ_cmd_Voltmeter {cmd}
LWDAQ_cmd_Voltmeter takes the top three nibbles of a sixteen bit command word and adds the correct nibble at the end to set the logic outputs.
proc LWDAQ_command_reference { {file_name ""} }
LWDAQ_command_reference generates the LWDAQ software command reference manual automatically, using the files ./Sources/lwdaq.pas for Pascal library routine entries and the template file ./LWDAQ.app/Contents/LWDAQ/CRT.html, as well as our LWDAQ command listing and help extraction routines. By default, the routine creates the command reference in the current LWDAQ working directory, and names it Commands.html. But we can pass is a specific file name if we like.
proc LWDAQ_config_read {sock}
LWDAQ_config_read reads the configuration parameters from the LWDAQ relay at the other end of an open TCPIP socket $sock, and returns them if they are valid. If the contents are not valid, the routine reports an error. The parameters the routine reads are those in the relay's RAM. These are the the ones in effect on the relay. They are not the ones written in the relay's EEPROM configuration file. There is no way to read the EEPROM configuration directly. The EEPROM parameters are loaded into ram after a hardware reset, which can be performed by pressing a button on the driver, or with LWDAQ_relay_reboot.
proc LWDAQ_config_write {sock config}
LWDAQ_config_write writes $config to the configuration EEPROM on the relay. The new configuration parameters will not take effect until you reboot the driver. Until then, the existing parameters in the driver's RAM will remain in effect.
proc LWDAQ_controller_reset {sock}
LWDAQ_controller_reset writes the value 1 to the software reset byte on a controller at the other end of socket $sock, thus resetting all its state machines and registers. The relay remains unaffected.
proc LWDAQ_controls_Camera {}
LWDAQ_controls_Camera creates buttons that configure the Camera for various image sensors.
proc LWDAQ_controls_Diagnostic {}
LWDAQ_controls_Diagnostic creates secial controls for the Diagnostic instrument.
proc LWDAQ_controls_Flowmeter {}
LWDAQ_controls_Flowmeter creates secial controls for the Flowmeter instrument.
proc LWDAQ_controls_Gauge {}
LWDAQ_controls_Gauge creates secial controls for the Gauge instrument.
proc LWDAQ_controls_Inclinometer {}
LWDAQ_controls_Inclinometer creates secial controls for the Inclinometer instrument.
proc LWDAQ_controls_Receiver {}
LWDAQ_controls_Receiver creates secial controls for the Receiver instrument.
proc LWDAQ_controls_RFPM {}
LWDAQ_controls_RFPM creates secial controls for the RFPM instrument.
proc LWDAQ_controls_Thermometer {}
LWDAQ_controls_Thermometer creates secial controls for the Thermometer instrument.
proc LWDAQ_controls_Viewer {}
LWDAQ_controls_Viewer creates secial controls for the Viewer instrument.
proc LWDAQ_controls_Voltmeter {}
LWDAQ_controls_Voltmeter creates special controls for the Voltmeter instrument.
proc LWDAQ_crop_Viewer {}
LWDAQ_crop_Viewer crops the Viewer's image to its analysis bounds and draws it in the Viewer panel.
proc LWDAQ_daq_BCAM {}
LWDAQ_daq_BCAM captures an image from the LWDAQ electronics and places the image in the lwdaq image list. It provides background subtraction by taking a second image while flashing non-existent lasers. It provides automatic exposure adjustment by calling itself until the maximum image intensity lies within peak_min and peak_max. For detailed comments upon the readout of the image sensors, see the LWDAQ_daq_Camera routine.
proc LWDAQ_daq_Camera {}
LWDAQ_daq_Camera captures an image from the LWDAQ electronics and places the image in the lwdaq image list.
proc LWDAQ_daq_Diagnostic {}
LWDAQ_daq_Diagnostic reads configuration paramters from the LWDAQ hardware, and records them in a result string, which it returns.
proc LWDAQ_daq_Dosimeter {}
LWDAQ_daq_Dosimeter captures an image from the LWDAQ electronics and places the image in the lwdaq image list.
proc LWDAQ_daq_Flowmeter {}
LWDAQ_daq_Flowmeter reads configuration parameters from the LWDAQ hardware, and records them in a result string, which it returns.
proc LWDAQ_daq_Gauge {}
LWDAQ_daq_Gauge reads configuration paramters from the LWDAQ hardware, and records them in a result string, which it returns.
proc LWDAQ_daq_Inclinometer {}
LWDAQ_daq_Inclinometer reads samples out of an input channel.
proc LWDAQ_daq_Rasnik {}
LWDAQ_daq_Rasnik captures an image from the LWDAQ electronics and places the image in the lwdaq image list. It provides background subtraction by taking a second image while flashing non-existent LEDs. It provides automatic exposure adjustment by calling itself until the maximum image intensity lies withint peak_min and peak_max.
proc LWDAQ_daq_Receiver {}
LWDAQ_daq_Receiver reads data from a data device. It fetches the data in blocks, and opens and closes a socket to the driver for each block. Although opening and closing sockets introduces a delay into the data acquisition, it allows another LWDAQ process to use the same LWDAQ driver in parallel. Some receivers provide a register that gives the number of messages available for download in its memory. In the absence of such a register, there is no way to determine the number of messages available for download, so this routine estimates the number of messages available using aquire_end_ms, which it updates after every block download to be equal to or greater than the millisecond absolute time of the last clock message in the block. By subtracting the end time from the current time, the routine obtains an estimate of the length of time spanned by the messages available in the data receiver. The routine also maintains an estimate of the number of messages per clock message in the recording. It multiplies this ratio by the available time and the clock frequency to get its estimate of the number of messages avaialable in the data receiver. The routine reports errors with the key word "corrupted" to indicate an error that merits resetting the data receiver. but the routine does not reset the data receiver itself.
proc LWDAQ_daq_RFPM {}
LWDAQ_daq_RFPM reads samples out of an input channel.
proc LWDAQ_daq_SCAM {}
LWDAQ_daq_SCAM captures an image from the LWDAQ electronics and places the image in the lwdaq image list. It provides background subtraction by taking a second image while flashing non-existent lasers. It provides automatic exposure adjustment by calling itself until the maximum image intensity lies within peak_min and peak_max. For detailed comments upon the readout of the image sensors, see the LWDAQ_daq_Camera routine.
proc LWDAQ_daq_Terminal {}
LWDAQ_daq_Terminal reads a string of characters or a block of data froma data device.
proc LWDAQ_daq_Thermometer {}
LWDAQ_daq_Thermometer reads configuration paramters from the LWDAQ hardware, and records them in a result string, which it returns.
proc LWDAQ_DAQ_to_GIF_Viewer {}
LWDAQ_DAQ_to_GIF_Viewer opens a browser in which you select multiple DAQ image files, and converts them to GIF files, writing them into the same directory with suffix ".gif".
proc LWDAQ_daq_Viewer {}
LWDAQ_daq_Viewer is a dummy procedure for the standard aquire button.
proc LWDAQ_daq_Voltmeter {}
LWDAQ_daq_Voltmeter reads samples out of an input channel.
proc LWDAQ_daq_WPS {}
LWDAQ_daq_WPS captures an image from the LWDAQ electronics and places the image in the lwdaq image list. It provides background subtraction by taking a second image while flashing non-existent lasers. It provides automatic exposure adjustment by calling itself until the maximum image intensity lies within peak_min and peak_max.
proc LWDAQ_debug_log {s}
LWDAQ_debug_log opens a file named by the debug_log value, in the program directory, and appends a string to the end of it, then closes the file.
proc LWDAQ_decimal_to_binary {decimal {length 32}}
LWDAQ_decimal_to_binary takes a decimal integer, $decimal, and returns the least significant $length digits of its binary representation as a string of ones and zeros. By default, $length is 32, which is also the maximum value of $length supported by the routine. We include comment in the code to explain our use of binary format and binary scan. It turns out that we have to use both these routines to achieve our end. First we format the integer as a binary object, then we scan this binary object for its bits.
proc LWDAQ_delay_seconds {sock value {flagname ""}}
LWDAQ_delay_seconds tells a driver at the other end of $sock to pause for $value seconds. If the delay is less than max_delay_seconds, the routine sends the delay commands to the driver and exits. The driver will be left executing the delay. But if the delay is greater than max_delay_seconds, the routine sends a sequence of delay job commands to the driver and waits for each one to complete before sending the next. In this way, the socket is kept open and no timeout will occur.
proc LWDAQ_driver_init {}
LWDAQ_driver_init initializes the global variable LWDAQ_Driver that describes the LWDAQ Relay and LWDAQ Controller sections of the LWDAQ Driver.
proc LWDAQ_echo {sock s}
LWDAQ_echo takes a string and sends it to a driver in an echo message. It waits for a data return message containing a string, which should match the string it sent.
proc LWDAQ_edit_script {{cmd "Open"} {src ""}}
LWDAQ_edit_script creates and controls a text editor window. It returns the name of the window. The window provides New, Open, Save, and SaveAs buttons. The routine takes a command "cmd" and a text source "src" as input parameters. The "Open" command creates a new, empty, editing window. It treats the source parameter as a file name. If the named file is an empty string, edit_script opens a file browser so the user can select a file, and it reads that file into the editing window. Otherwise, if the named file exists, edit_script reads the contents of the named file into the editing window. It sets the window title equal to the file name. Note that the Open command does not create a new file. The "Save" command takes an editor window name as its source, and saves the contents of that editor window to the file named in the editor window's title. The "SaveAs" command also takes a window as its source but opens a browser for the user to choose a destination file. The "New" command opens a new editor window with a default file name. It ignores the source parameter. In the text editor window, we use command-z to undo, command-s to save the text to the title file. The New button in the text editor opens a file called Untitled.txt, which we assume does not exist.
proc LWDAQ_enable_text_undo {t}
LWDAQ_enable_text_undo turns on a text widget's undo stack. This stack will consume memory as it gets larger, so you should leave the stack off when you are repeatedly and automatically updating the text window contents, as we do in the System Monitor or the Acquisifier windows.
proc LWDAQ_exec_Diagnostic {operation}
LWDAQ_exec_Diagnostic opens a socket to a driver and calls the specified operation routine.
proc LWDAQ_execute_job {sock job}
LWDAQ_execute_job tells a driver to execute job with job identifier $job through socket $sock. The driver will be busy thereafter for however long it takes to execute the job, but the routine will return as soon as the TCPIP messages required to instruct the driver have been transmitted. Note that if you have lazy_flush set to 1, the job won't execute until you flush the socket, close it, or read from it. The job parameter is a string of characters representing a decimal number.
proc LWDAQ_extended_BCAM {}
LWDAQ_extended_BCAM tries to assign optimal values to peak_max and peak_min, and adjust the analysis boundaries to enclose the spots within a number of pixels of their centers. You direct the configuration calculations with the extended_parameters string, which contains parameters as a list. The string "0.6 0.9 20 1" sets peak_min to 60% of saturation, peak_max to 90% of saturation, shrinks the image bounds to 20 pixels around the spot center, and adjusts individual source exposure times. If you don't want a border, specify bounds to be 0 (instead of 20). If you don't want to adjust multiple sources individually, specify 0 for individual_sources.
proc LWDAQ_extended_Rasnik {}
LWDAQ_extended_Rasnik tries to assign optimal values to peak_max and peak_min. You direct the configuration with info(extended_parameters), which contains min_frac and max_frac. With the string "0.6 0.9", the configuration sets peak_min to 60% of saturation, peak_max to 90% of saturation.
proc LWDAQ_extended_SCAM {}
LWDAQ_extended_SCAM tries to assign optimal values to peak_max and peak_min, and adjust the analysis boundaries to enclose the spots within a number of pixels of their centers. You direct the configuration calculations with the extended_parameters string, which contains parameters as a list. The string "0.6 0.9 20 1" sets peak_min to 60% of saturation, peak_max to 90% of saturation, shrinks the image bounds to 20 pixels around the spot center, and adjusts individual source exposure times. If you don't want a border, specify bounds to be 0 (instead of 20). If you don't want to adjust multiple sources individually, specify 0 for individual_sources.
proc LWDAQ_find_files {directory pattern}
LWDAQ_find_files takes a directory and a glob matching pattern to produce a list of all matching files in the directory and its sub-directories. The match is case-insensitive, but the complete file name, including its extension, must match the patter. Thus AFileName.txt will not be matched with FileName.txt, although it will match with *Name.txt and ?FileName.*. The routine assembles its match list by calling itself recursively. The fact that the routine must support recursive calls dictates that the final list is not sorted. If we were to sort the list, we would be sorting in every recursive call to the routine, which makes the routine inefficient. Follow your call to this routine with a list sort to obtain an ordered list.
proc LWDAQ_firmware_version {sock}
LWDAQ_firmware_version reads the controller's firmware version number through open socket $sock, and returns the version.
proc LWDAQ_flash_seconds {sock value}
LWDAQ_flash_seconds is like LWDAQ_delay_seconds, except it flashes a source for an arbitrarily long period, rather than just waiting. When the total flash time is greater than the maximum single-flash time supported by the driver, the routine creates a total flash time by adding together smaller flashes. Ten seconds of flash time will take more than ten seconds to implement because of the delays in communication between computer and driver.
proc LWDAQ_get_dir_name { {initialdir ""} }
LWDAQ_get_dir_name opens a file browser and allows you to select a directory. We can specify an initial directory for the file search. By default the search begins in the LWDAQ working directory.
proc LWDAQ_get_file_name { {multiple 0} {initialdir ""} }
LWDAQ_get_file_name opens a file browser window and allows the user to select one or more files in the file system. The user can select multiple files when multiple is one (1). By default, multiple is zero (0). The routine starts in the LWDAQ working directory, and when the user selects a file, it sets the working directory to the directory containing the file. If the user selects no file, or presses the cancel button in the pop-up window, the routine does nothing. We can specify an initial directory for the file search. By default the search begins in the LWDAQ working directory.
proc LWDAQ_get_lwdaq_config {option}
LWDAQ_get_lwdaq_config takes a lwdaq_config option name and returns its value. We can get all the values of all options with "lwdaq_config", but this routine extracts one particular option value for the convenience of the calling routine. When we specify the option, we must not include the dash suffix.
proc LWDAQ_GIF_to_DAQ_Viewer {}
LWDAQ_GIF_to_DAQ_Viewer opens a browser in which you select multiple GIF image files, and converts them to DAQ files, writing them into the same directory with suffix ".daq".
proc LWDAQ_global_var_name {}
LWDAQ_global_var_name will return a unique name for a global variable.
proc LWDAQ_hardware_id {sock}
LWDAQ_hardware_id reads the controller identifier number from the LWDAQ driver at the other end of TCPIP socket $sock, and returns the identifier.
proc LWDAQ_hardware_version {sock}
LWDAQ_hardware_version reads the controller's hardware version number through open socket $sock, and returns it.
proc LWDAQ_html_contents { {cell_spacing 4} {num_columns 4} {file_name ""} }
LWDAQ_html_contents creates a table of contents for an HTML document. Each h2 and h3 level heading must have a unique name in the document, because this routine uses the heading text as the identifier for each heading line. The table of contents will be placed underneath an h2 heading with text "Contents". Any pre-existing table of contents between this h2 heading and the next h2 heading will be removed from the document. The routine takes three optional parameters. The first two are cell_spacing and num_columns for the h3 heading tables beneath each h2 heading. The third parameter is the name of the HTML file to be processed.
proc LWDAQ_html_split {{file_name ""}}
LWDAQ_html_split takes a long file with h2-level chapters and splits it into chapter files. It puts the chapter files in a new directory. If the original file is called A.html, the directory is A, and the chapters are named A_1.html to A_n.html, where n is the number of chapters. There will be another file called index.html, which is the table of contents. Each chapter provides a link to the table of contents, to the previous chapter, and to the next chapter. Each preserves the header and stylsheets used in the original file. All local html links get displaced downwards by one level in order to account for the chapters being buried in a new directory. Internal links in the document are broken, so you will have to go in and fix them by hand. Any h2-level heading called "Contents" will be removed from the list of chapter, because we assume it's a table of contents generated by the routine LWDAQ_html_contents.
proc LWDAQ_html_tables { {file_name ""} }
LWDAQ_html_tables extracts all the tables from an HTML document and writes them to a new HTML document with Tables_ added to the beginning of the original document's file root. The routine takes one optional parameter: the name of the HTML document.
proc LWDAQ_image_pixels {image_name {left -1} {top -1} {right -1} {bottom -1}}
LWDAQ_image_pixels returns a string containing the intensities of all pixels in a rectangular area in the image. By default, the routine uses the analysis boundaries, but we can also specify our own left, top, right, and bottom boundaries in that order. The pixels form an array by use of spaces and line breaks. There is a line break at the end of each row of pixels and a space between each column. You can paste the output from this routine directly into a spreadsheet and obtain a two-dimensional intensity array.
proc LWDAQ_image_sensor_clear {sock type}
LWDAQ_image_sensor_clear clears charge from an image sensor so it will be ready to expose. We pass the routine a socket to the driver and a device type number that identifies the image sensor.
proc LWDAQ_image_sensor_transfer {sock type}
LWDAQ_image_sensor_transfer moves the image from the exposure array into the storage or transfer array, is such an array exists in the image sensor. We pass the routine a socket to the driver and a device type number that identifies the image sensor.
proc LWDAQ_info_button {name}
LWDAQ_info_button makes a new toplevel window with a button that lets you see the instrument script. Below the button are the elements of the instrument's info array. You can change the elements by typing in the entry boxes.
proc LWDAQ_infobuttons_BCAM {f}
LWDAQ_infobuttons_BCAM creates buttons that allow us to configure the BCAM for any of the available image sensors. The general-purpose instrument routines will call this procedure when they create the info panel.
proc LWDAQ_infobuttons_Dosimeter {f}
LWDAQ_infobuttons_Dosimeter creates buttons that allow us to configure the Dosimeter for any of the available image sensors.
proc LWDAQ_infobuttons_Rasnik {f}
No description available.
proc LWDAQ_infobuttons_SCAM {f}
LWDAQ_infobuttons_SCAM creates buttons that allow us to configure the SCAM for any of the available image sensors. The general-purpose instrument routines will call this procedure when they create the info panel.
proc LWDAQ_init_BCAM {}
LWDAQ_init_BCAM creates all elements of the BCAM instrument's config and info arrays.
proc LWDAQ_init_Camera {}
LWDAQ_init_Camera creates all elements of the Camera instrument's config and info arrays.
proc LWDAQ_init_Diagnostic {}
LWDAQ_init_Diagnostic creates all elements of the Diagnostic instrument's config and info arrays.
proc LWDAQ_init_Dosimeter {}
LWDAQ_init_Dosimeter creates all elements of the Dosimeter instrument's config and info arrays.
proc LWDAQ_init_Flowmeter {}
LWDAQ_init_Flowmeter creates all elements of the Flowmeter instrument's config and info arrays.
proc LWDAQ_init_Gauge {}
LWDAQ_init_Gauge creates all elements of the Gauge instrument's config and info arrays.
proc LWDAQ_init_Inclinometer {}
LWDAQ_init_Inclinometer creates all elements of the Inclinometer instrument's config and info arrays.
proc LWDAQ_init_main_window {}
LWDAQ_init_main_window initialize the main window and defines the menubar.
proc LWDAQ_init_Rasnik {}
LWDAQ_init_Rasnik creates all elements of the Rasnik instrument's config and info arrays.
proc LWDAQ_init_Receiver {}
LWDAQ_init_Receiver creates all elements of the Receiver Instrument's config and info arrays.
proc LWDAQ_init_RFPM {}
LWDAQ_init_RFPM creates all elements of the RFPM instrument's config and info arrays.
proc LWDAQ_init_SCAM {}
LWDAQ_init_SCAM creates all elements of the SCAM instrument's config and info arrays.
proc LWDAQ_init_Terminal {}
LWDAQ_init_Terminal creates all elements of the Terminal instrument's config and info arrays.
proc LWDAQ_init_Thermometer {}
LWDAQ_init_Thermometer creates all elements of the Thermometer instrument's config and info arrays.
proc LWDAQ_init_Viewer {}
LWDAQ_init_Viewer creates all elements of the Viewer instrument's config and info arrays.
proc LWDAQ_init_Voltmeter {}
LWDAQ_init_Voltmeter creates all elements of the Voltmeter instrument's config and info arrays.
proc LWDAQ_init_WPS {}
LWDAQ_init_WPS creates all elements of the WPS instrument's config and info arrays.
proc LWDAQ_inside_widget {w x y}
LWDAQ_inside_widget takes a widget name and widget-local x and y coordinate and returns true iff the point (x,y) is inside the widget. There may be an existing TclTk routine for this, but we can't find it.
proc LWDAQ_instrument_analyze {instrument {id ""}}
LWDAQ_instrument_analyze calls an instrument's analysis routine after checking its analysis_enable flag, and catches errors from the analysis routine. It assumes that the image it is to analyze is the image named in the instrument's memory_name parameter. The routine places an identifier in the result, as provided by the id parameter. By default, id becomes the memory name. The routine also prints the result to the panel text window.
proc LWDAQ_instrument_closeup {x y name}
LWDAQ_instrument_closeup deduces column, row, and intensity of the pixel at the tip of our mouse pointer when we double-click on an image in any of the LWDAQ instruments. It prints the column, row, and intensity to the instrument's text window, which we assume exists or else the inspector routine would not have been called. This routine is bound to the double-press button event within the instrument image displays. If the Viewer instrument is open, a region around the pixel will be displayed and zoomed so we can see detail. The routine calls Viewer routines to accomplish the crop and zoom.
proc LWDAQ_instrument_print {instrument print_str {color black}}
LWDAQ_instrument_print prints the result of analysis to an instrument text window using LWDAQ_print. If the verbose_result is set in the instrument's config array, then the routine uses the verbose_description list in the info array to describe each element of the result on on separate lines. We intend for this routine to be used only for printing instrument results in the instrument window. If you want to print anything else in the instrument window, use LWDAQ_print with the text window name $info(text). The info(text) element is set even if the instrument window is not open, and LWDAQ_print checks to see if the text window exists before it prints.
proc LWDAQ_instrument_save {name}
LWDAQ_instrument_save saves instrument settings to a settings file in the LWDAQ configuration directory, so they will be loaded automatically when LWDAQ is next launched, or when a new LWDAQ is spawned. There is one parameter we don't want to save or read back: the name of the data image, which is something that cannot persist from one launch of LWDAQ to the next. It returns the name of the settings file.
proc LWDAQ_instrument_unsave {name}
LWDAQ_instrument_unsave deletes a perviously-saved instrument settings file, if one exists. It returns the name of the settings file that was deleted, or an empty string if no file was found.
proc LWDAQ_instruments_init {}
LWDAQ_instruments_init initializes the instruments routines.
proc LWDAQ_integer_write {sock addr value}
LWDAQ_integer_write writes a four-byte integer $value through open TCPIP socket $sock to controller address $addr. The addr and value parameters are strings of characters that represent decimal numbers.
proc LWDAQ_interface_init {}
LWDAQ_interface_init initializes the interface routines, installs operating system dependent event handlers, and configures the default fonts for the graphical user interface.
proc LWDAQ_ip_addr_match {addr_1 addr_2}
LWDAQ_ip_addr_match takes two IP address strings and compares them to see if they point to the same driver socket. If the addresses match, the routine returns a 1. If they don't match, it returns a 0. A * in either parameter is a wild card, and will match.
proc LWDAQ_is_error_result {s}
LWDAQ_is_error_result returns 1 if and only if the first string begins with "ERROR: " (case sensitive).
proc LWDAQ_job_done {sock}
LWDAQ_job_done returns 1 if the driver's job register reads back zero, and 1 otherwise.
proc LWDAQ_library_settings {}
LWDAQ_library_settings allows us to edit the settings used by the analysis libraries. These are accessible through the lwdaq_config command. We make an array of options and values which the user can edit and then apply.
proc LWDAQ_list_commands { {pattern *} }
LWDAQ_list_commands lists LWDAQ commands in the console and returns an empty string.
proc LWDAQ_login {sock password {error_on_fail 1}}
LWDAQ_login attempts to log into a LWDAQ relay with a login message and password $password. The routine recognises "no_password" as a key phrase to skip the login attempt and return the value 0. Otherwise, the routine sends the password and waits for an answer from the relay. An answer of 1 is success and 0 is failure. On success, the routine returns 1. On failure, the routine will generate an error by default, or return -1 if you pass the value 0 for error_on_fail.
proc LWDAQ_loop_button {name}
LWDAQ_loop_button is for use with instrument loop buttons.
proc LWDAQ_loop_time {sock}
LWDAQ_loop_time reads the contents of a LWDAQ Driver's loop timer register and returns it. The driver is at the other end of an open TCPIP socket named $sock.
proc LWDAQ_loop_time_Diagnostic {sock}
LWDAQ_loop_time_Diagnostic executes a LWDAQ loop job on the Diagnostic instrument's target device, reads out the LWDAQ Driver's loop timer, and prints the loop time in the Diagnostic text window.
proc LWDAQ_mac_read {sock}
LWDAQ_mac_read reads the mac address of the Ethernet chip on the LWDAQ relay at the other end of open TCPIP socket $sock, and returns the address as a string of hexadecimal characters.
proc LWDAQ_MacOS_Open_File {theAppleEvent theReplyAE}
No description available.
proc LWDAQ_make_instrument_menu {}
LWDAQ_make_instrument_menu destroys the current instrument menu and makes a new one that matches the current list of instruments.
proc LWDAQ_make_tool_menu {}
LWDAQ_make_tool_menu destroys the current tool menu and makes a new one that matches the current selection of tools in the Tools, More, and Spawn directories.
proc LWDAQ_monitor_open {}
LWDAQ_monitor_open opens the system monitor window.
proc LWDAQ_monitor_refresh {}
LWDAQ_monitor_refresh updates the system monitor window, if it exists, and posts itself for re-execution in the TCL event loop.
proc LWDAQ_most_recent_byte {sock}
LWDAQ_most_recent_byte reads the contents of a LWDAQ Driver's mrb register and returns it. The driver is at the other end of an open TCPIP socket named $sock. The mrb register contains the most recent byte to be written to the Driver's ram, either by the relay or by the controller.
proc LWDAQ_ndf_create {file_name meta_data_size}
LWDAQ_ndf_create creates a new Neuroscience Data Format file, which is the format used by LWDAQ to store archives of continuous time-series data. The NDF format begins with a four-byte format identifier, which is the string " ndf" (note the space at the beginning of the identifier string. Next come three four-byte numbers in big-endian format (most significant byte first). These are the byte offset to meta-data space, byte offset to data space, and the length of meta-data string when last written. If the length is zero, routines that read the meta-data string should check the length for themselves. The header may contain additional binary information particular to the application. The meta-data space follows the header and contains only a null-terminated character string. The data space comes next, and occupies the remainder of the file. This routine creates a new file with an empty string and no data.
proc LWDAQ_ndf_data_append {file_name data}
LWDAQ_ndf_data_append appends new data to an NDF file.
proc LWDAQ_ndf_data_check {file_name}
LWDAQ_ndf_data_check returns the byte location of the file's data block and the length of the data block. If the file is not NDF, the routine returns an error.
proc LWDAQ_ndf_data_read {file_name start_addr num_bytes}
LWDAQ_ndf_data_read reads num_bytes of data out of an NDF file data block, starting at byte start_addr. The first byte in the data block is byte zero. If you specify * for num_bytes, the routine reads all available data bytes from the file. If the file does not contain the bytes requested, the routine returns all the bytes that can be read.
proc LWDAQ_ndf_string_append {file_name meta_data}
LWDAQ_ndf_string_append appends a meta-data string to the one that