Switching Between APS data and In-House Data

The VI discussed in this post is a work in progress which will be able to switch between using the X-Ray batch VI and an In-House XRD VI. We will call this the Main VI.

The two images above display the block diagram. If the condition is true, then the X-Ray Batch VI will execute. If the condition is false then the In-House XRD VI will execute.

The upper left image shows how the various files are entered by the user in the Main VI. The upper right image is the resulting graph of the In-House XRD VI.

The image above shows the block diagram for the In-House XRD VI. The raw data is taken from an Excel csv file. However, the csv file contains other information besides the raw data. So we must start at the desired index in the csv file. The code in enclosed by the red circle creates sub-arrays for the angle axis and intensity axis.

Switching Between Data Types and Calling Sub VI’s

Switching data types VI

There is a structure called “case structure” that will execute if the condition is true or false.
By using the case structure, it is possible for the user to switch between data types.

In the example above, the user can tell the program to complete an action for either an image, a excel spreadsheet, or both.

LabVIEW also allows the programmer to call sub-VI’s. In the example below, the program will call the Switching Data Types VI, as shown above. This sub-VI requires two inputs and will produce two outputs, replicating the VI shown above.

The picture below shows how one can “map out” the sub-VI in the front panel. Notice the similarities with the picture below and the picture above.

Reading and Writing Intensity Values of a Image

Below is the block diagram using the same method to read image intensity values as before (see Converting an Image File to an Intensity Graph in LabVIEW), but it has been modified to write those values into a 1-D array in Excel.

First, the size of the array must be known. To do this, we create an array using the Array Size VI. This creates an array with two values, the number of rows and the number of columns. Next, we index this created array to read the number of columns and rows. We then multiply the number of columns by the number of rows to get the size of the data set, which we can then use to set the size of the 2-D to 1-D array. The 1-D array is then sorted and written into an Excel spreadsheet.

Converting an Image File to an Intensity Graph in LabVIEW

Below is the simple block diagram.

The image path is connected to a JPEG reader, since the file used is a JPEG.

Next the image is flattened into a single string format, and then converted into a 8 bit (1 byte) Pixmap (a cluster of image data), which is then unflattened back into an array.

The array can then be displayed as an intensity graph. Darker colors in the original JPEG have a higher amplitude in intensity graph below.

Reading Data from Excel to Produce a Graph in labVIEW

Shown below is the block diagram










The Path block is just a constant file path defined by the user in the front end. In this case, the file is in comma-delimited format produced by excel.

Following the “wire”, we come upon the “Read Delimited Spreadsheet” VI, which can read delimited spreadsheets and create a 2D array out of them.

Next, the 2D array gets converted into a “columns are channels, rows are rows” format. This is needed so the “Build XY Graph” VI can read each array.

The converted array is put into either the x input or y input.

The output of this process is show below.



Asymmetric Solvation

Asymmetric Solvation

This is a power point for our discussion on 4/20/2017 on solvation.  The application is NaCl and water.