Original Code
          Consulting Original Code Consulting

OCC Home Page    Products  MICAS-X  LabVIEW related
              publications  LabVIEW Presentations
General LabVIEW Programs and VIs  File and DIrectory
              Utilities  LabVIEW Instrument Drivers  Scientific LabVIEW
            Programs for Download  LabVIEW Games for
              Download

Scientific LabVIEW Programs
MICAS-X  OCC Program Prep  Correlation Plot XControl  Gaussian Beam
              Calculator  Angle Between Two Lines  Nonlinear Fit  Mass SPectroscopy Peak Identifier  Mass Calculator

Below are some of the scientific LabVIEW program I have written.  All of these are free with the sole condition being that the attribution to their original author be left intact in the VI documentation.  Although it is not required, if you do download any of these programs, I would appreciate hearing from you.  Let me know (using the address at the bottom of this page) how well they work for you, and if you have any suggestions for improvements or observations of bugs that need fixing.


MICAS-X  MICAS-X is a new product by Original Code Consulting.It is a highly-customizable program for acquiring data from and controlling scientific instruments.  MICAS-X provides a broad range of software infrastructure - features many atmospheric and scientific instruments need, while providing a framework for integrating the customized software required for a specific application. MICAS-X



OCC Program
                    Prep  OCC Program Prep is a utility that assists in making autonomous data systems function correctly.  It can be configured to execute any number of steps.  Each step can perform one of the following actions:  Wait, Wait Until Daq Device is Ready, Launch a Program, Sync to NTP Server, or Sync to GPS.  Typical scenarios for OCC Program Prep are to wait until the operating system has fully initialized the NI DAQ Devices before launching the data acquisition program, and to synchronize the computer clock to a reliable external time source before launchint the data acquistion program.  For more information, see the OCC Program Prep page.
OCC Program Prep


Correlation Plot XControl  It is not easy to make a correlation plot in LabVIEW in which two quantities are graphed relative to each other, with each point color coded according to a third quantity.  With the advent of XControls in LabVIEW 8, it became possible to implement such a graph in a way that is easy for other programmers to use.  This Correlation Plot XControl (LV 8.2.1) (636 KB)includes an example program showing how to use the XControl as well as a short document describing the XControl and its properties.

Version 1.1.1 posted 10/22/07 contains minor cosmetic improvements.
Correlation Plot XControl


Gaussian Beam Calculator  The Gaussian Beam Calculator (LV 6.0) or Gaussian Beam Calculator (LV 8.2) is a program I wrote for calculating the propagation of a Gaussian (laser) beam through a series of simple lenses.  The user specifies the wavelength, the initial beam waist and position, and (optionally) M2.  The program then calculates the transformation of the beam as it encounters each lens (positive or negative focal length), yielding a new waist and position.  The results are presented in a table and graphically.  Configurations of lenses can be saved and reopened later, and results can be exported to ASCII (Excel-compatible) files.  There is no fixed limit to the number of lenses that can be analyzed.

This program is available either as LabVIEW VIs (LV 6.0.2) (307 KB), LabVIEW VIs (LV 8.2) (433 KB), an executable for LV 6.0.2 (685 KB) or as an executable for LV 8.2 (3.8 MB).  The LabVIEW 6.0.2 VIs require the Utitlity VIs available on the General LabVIEW page and also require that LabVIEW to be installed on the end-user's computer.  (Also note that in the LV version, it is possible for one of National Instruments' VI's to become unlinked, depending on where you install the VI's.  To launch the help file display, this program uses the Open URL in Browser.vi which is located under LabVIEW/help/_browser.llb  It may be necessary to relink this VI to get the program to run.)  The LabVIEW 8.2 souce code has the Utility VIs built into the same download.
The executable version does not require that LabVIEW be installed on the end-user's computer, but does require that the LabVIEW run-time engine be installed.  The LabVIEW run-time engine is free and can be downloaded from National Instruments, by navigating through Download Software/Drivers and Updates/All Software Versions/LabVIEW/platform/Run Time Engine, or by going through their ftp site at ftp.ni.com and navigating through Support/LabVIEW/Runtime/(platform).  (I cannot supply a direct link to their web download since their addresses are dynamic and it may be necessary to register in order to access the download.  Registration is not necessary if you go through their ftp site.)  Note that the correct version (6.0.2 or 8.2) of the Run Time Engine is required.  If you download a different version instead, the executable version of the Gaussian Beam Calculator will not operate.  If you already have one of the required versions of the LabVIEW Run Time Engine installed on your computer, then choose the appropriate version of the Gaussian Beam Calculator and you won't need to install the RTE again.

Version 1.2 of the Gaussian Beam Calculator, posted 20020128, fixes a small bug in the Units menu that manifested itself when previously-saved files were read into the program.
The help file describing the program (which is included in the downloads) can be viewed here.


 Angle
                    Between Two Lines  This VI (LV 8.2.1, 35KB)  is used to calculate the angel in radians between two lines in three dimensions that both pass through the origin.  In addition to the simple calculation sub-vi, an example program (shown to the right) is included to help visualize how it works.  Note that this example program uses the LabVIEW 3D Graph, and so cannot be used in the LabVIEW Base package.

This program was updated to version 1.1 in February, 2008, to correct a wiring error in the example VI.
Angle Between
                  Two Lines


Nonlinear Fit  NonLinear Fit (LV 6.0, 201 KB) is an example of how to use the Nonlinear Lev-Mar Fit sub-vi's that are part of National Instruments Advanced Analysis package to fit data to a Gaussian peak shape.  As inputs, the VI takes two arrays:  the X coordinates and the Y data.  The VI then fits these arrays to a Gaussian peak of the form  y=a0*exp(-2.772589*((x-a1)/a2)^2)+a3.   In order to have a good chance at having the fit converge, the VI makes estimates for the initial values of the coefficients a0 (Amplitude), a1 (Peak Position), and a2 (Full-Width-Half-Max).  a3 (DC Offset) is assumed to be close to 0 and is not estimated.  After the fit is calculated, the coefficients a0-a3 are returned, along with an array of calculated data based on the fit.  The original data and the fit are displayed in a graph for comparison.

Note that the factor of 2.772589 scales the peak so that the width is expressed in terms of FWHM.  If you wish other measures of the width, you can rescale the result or alter the VI as needed.  Depending on your data, you may also wish to alter the calculations of the initial guesses for the coefficients.  (E.g., you may need to calculated the DC Offset based on the first few and last few points of data, or you may want to smooth the data before calculating the intial guesses.)

Requirements:  Since it is based on the Advanced Analysis package, this VI cannot be run from the LabVIEW Base package or the Student Edition.  The Full Development System or a higher package is required in order to support the low-level routines used in this program.  Also note that this VI calls the Error Cluster Generator, which is part of the UtilityVIs.llb described on the Utilities page.

Version 2.0, posted 20020914, is significantly revised and improved.  In order to improve performance, the Target Function was rewritten so that it is called once for the entire array of data, rather than once for each point.  This and other improvements were suggested by Christian Altenbach and Don Wagner.  Christian and Don also assisted generously in testing these algorithms and made numerous helpful suggestions.  Version 2.0 is significantly cleaner and more powerful than the older versions previously posted here.  This version includes support for standard deviations for each data point, numerically calculated derivatives as well as analytical derivatives, and more than one target function definition.  (The original Exponential function in NI's example is included as well as the Gaussian fit.)  VI's written by Christian and Don use dynamically called target functions, which is a great way to support a large number of fitting functions.  This version uses a type-def enum control to select which target function to use.  It is fairly easy to edit the enum and the Target Function VI to add a small number of additional functions.  In addition, this direct call is slightly more efficient than the dynamic call.
Mass
            Spectroscopy Peak Identifier  The Mass Spectroscopy Peak Identifiier program (LV 6.1, 330 KB) is a tool I developed for helping to identify mass peaks in time-of-flight mass spectra.  This program assumes that the atomic masses are integers.  It uses a text file which defines which atoms to include in the calculations and then presents the user with an interactive screen which allows various parameters to be set.  The program then uses the atomic definitions file and the parameters to calculate all the atomic combinations that add up to a given mass.  Valences are accounted for, though combinations that do not have the appropriate valence are also shown.  Results for each mass that is calculated can be stored to a file.  One atomic definitions text file is included with the download.  This file is called Sea Salt.pks and includes the elements most commonly observed in mass spectra of sea salt particles. 
   The Mass Calculator described below is included as a pop-up window.  Ken Aiken of the NOAA Aeronomy Lab helped develop this program.

Mass Calculator  Mass Calculator (LV 6.1, 51 KB) is a simple program that adds up the integer masses of any atomic combination.  The screen is laid out similarly to a common arithmetical calculator, but instead of numeric keys, there are a set of keys similar to a periodic table which correspond to each of the elements.  The element symbols and masses are stored in text files that are included in the zip file download.  Also, note that the entire Mass Calculator program is included with the Peak Identifier download above. Mass Calculator
                  Program Front Panel

OCC Home Page  Top  MICAS-X  LabVIEW related
            publications  LabVIEW Presentations  BotLabs Web Page - home of the Saurobots!  Links
Please report any bad links, other problems, or comments to: 

Site Map and Downloads