Notes over Readings

Notes over Underneath the Bragg Peaks by T. Egami and S.J.L Billinge

Structural Strudy of ZrAlNi Amorphous Alloys recieve may 8 1992 by E. Matsubara


Independent Study Final Project 2

Gytis Blinstrubas

6/11/17

 

Independent Study

 

Over this last spring term my independent study consisted of me learning how to code with a program called labview. This program is a vital aspect of the research I am continuing from last term. We need to use this program because when we get data from our samples we get it in two forms. When the data is taken at the Advanced Photon Source at Argonne national lab our data is in the form in an image. Currently the labview program is built to take this data and convert it to the proper graphs we need. However, we also use our in-house X-Ray Diffractometer. The data from the XRD and the APS will give us the same result except that the XRD gives us the data in the form of the image. To be able to process our data we use a program called pdfgetx2. This program is less user friendly and much older, than labview. We want to rebuild the labview program so that we can process our data faster and the same way as we do the data from the APS. The program that is used for the APS is very large and has many components. To be able to work on the program I will first need to learn the basics of labview. My first task was to learn how to install the program onto my drive so that I can work on it remotely from any computer. To complete this task, I copied the build code from a hard drive and then put the program into my F drive. I also had to make sure to include a lot of sub programs because when this large program runs it is dependent on a lot of smaller programs. After installing this program on my drive, it was also important to learn how to use the program and make sure that it works. I then had to learn how to input my data and manipulate the program so that I can do corrections and build programs myself.  The first program that I built was a simple program. This program allows the user to input two numbers and then choose for the program to either add, subtract, multiply, or divide those two numbers. The program works by adding specific icons to a block diagram and then connecting the icons to create the final code which function properly. On the front diagram three boxes are displayed, where two of the boxes are for inputting the numbers and the third box shows your final answer. After creating this simple program and learning the basic skills to be able to create VI’s, I then started to learn specific code that would help me in recreating the program we use for Argonne. The first code I built was a VI that could input excel files and create a graph from those files. My first step in creating this code was inserting two read delimited icons on the block diagram. Two icons are needed since one will read the data for the X axis while one will read it for the Y. The reason why I need these icons specifically is that they are able to read 2d arrays of scalar numbers. When importing my files, they will need to be converted to comma delimited files in order for labview to read this data. Off of the read delimited file a constant needs to be added, our constant in this case is the comma since we are importing the comma delimited files. The next step I took is to insert an express VI called “Build XY Graph”. This is used since an express VI has many applications and is more user friendly than a normal VI. For our case we need this express VI because it converts our raw data into graph form. The last step is to add a xy graph icon so that our graph can be seen on the front diagram. This icon will be connected to the express VI. An example of the code can be seen below.

The icons and the constant can be seen to the left, where the constants are the pink boxes with a comma. With the yellow wire, each icon is either attached to the x or y input. Lastly the xy graph icon is attached to the build xy graph icon in order for the program to display the data in a graph form.. An intensity versus theta graph of an empty 2mm capillary can be seen below.

After creating a program to be able to insert text files, my next task was to create a program that could display images. The process of inserting a picture into labview is not overly complicated. The first icon that is needed is a read JPEG file. The purpose of this is that it takes the image and converts it into data that labview can read. Then connected to this icon is another icon called Draw Flattened Pixel map. This is used to create the picture. Finally, a picture icon is added. This icon takes our picture from before and displays it on the front diagram. After inserting the image, my final task was to take my image and display it on an intensity graph. With my research partner Sven Marnauzs we built a code that could accomplish this task. The first icon that was put in was a file path, this is done so that we can insert our saved image. Then the read JPEG file and the Draw Flattened Pixel map icons are inserted. After that, a picture to pix map icon is inserted and a constant is added to the icon to tell how many bits the picture is. The next icon added is an unflattened pixmap. This icon unflattens the data from the Draw Flattened Pixel map icon. The last icon added is the intensity graph, so that our image can be seen on the front panel. An example of the code can be seen below.

 

The top codes task is to insert an image, while the bottom code is used to insert an image to an intensity graph.

Over this last term my independent study consisted of me starting to learn labview so that over the summer I can rework the APS program to read data taken from our in house XRD. Currently, I am building a program that will allow me to insert history files into labview and be able to extract certain parameters from that file. My work from the independent study conducted during winter and fall term will continue over the summer.


Editing the Load History File VI

After creating the load history file VI I then inserted a history file made from the LabView program. I ran the program and could view the parameters of that history file. My next task was to modify this program to accept pdfgetx2 data and to change the front diagram to show the information I want from the pdfgetx2 history file. The first thing that I had to learn was how to edit the front panel. This panel is made up of all clusters, and the way that he current VI is built there are two of the same clusters that need to each match each other.
The clusters itself are made up of smaller clusters. To be able to edit certain parameters within the cluster, I need to find that cluster saved within the X Ray Batch folder. Then I can edit those clusters and copy them to my load history file VI. When I delete the old cluster and replace it with the new edited one I need to make sure that both main clusters have the same elements. If I do not do this then this VI will not run and load my history file. To run the Pdfgetx2 history file the block diagram will not have to be changed at all, what will need to be reworked is the front panel and potentially the format of the file. Also all new clusters will have to be made so that the history file from the pdfgetx2 program can work.


Learning the “Load History File” Sub VI

The current VI I made is like one I found already built. The reason why I did this was so to learn how to build a Vi that can import history files, learn how this specific VI works, and find certain parameters. The pre built VI that I found was in the folder
-Research
-LabView Program
-Everything
-BESL LabView Analysis 2014
-X-Ray Analysis
-Xray Batch SubVIs
-SaveLoad VIs

The first step in building this VI is to add a case structure. The case structure will execute the program built inside of it. There are two options true or false. To be able to run the true or false program a switch needs to be added. In this case the switch is used to either load a history file from a drive or the other option is to save the history file to a specific location. Then a file path is added so that a history file can be loaded. The first icon that is attached to the path is an open/create/replace file icon this either opens, creates or replaces the file that we insert into our program. I then insert two Write To Text icons. These icons takes strings and writes them as lines so that they can be converted to the file. Attached to one of the icons is a Close File icon which closes an opened file. Also attached is a cluster to string VI, This VI takes a cluster and then a string will be outputted. Attached to the other icon is a Concentrait sting icon, this icon takes many strings and creates it into one singe string. Attached to that is a constant and a end of the line constant. This end of the line constant consist of a constant string that has an end of the line value. The last icon that I inserted into the case structure is the property node icon. This reads our data and then sets the previous data. This node deals with our specific values that we want. Attached to that icon is a close reference which closes our RefNum and then an input which displays our values on the front panel. For the false case everything outside of the structure is the same. Inside the structure there are two property nodes which both connect to the variant to data icon. This icon converts the variant data to a data type that labview can read. The other icon that is included within the structure is the file to cluster VI takes a file path and creates a cluster and Off of that Icon there is a constant. Overall this program is much more complex than most of the others I have worked with so far. A picture of the VI is seen below.

The above picture is the false case while the below picture is the true case.


Creating a Program to Switch Data Types

The first step in creating a program to switch between two different data types is to create two case structures. Inside these structures there are sub diagrams. The purpose of the case structure is to determine which diagram will
execute when the program is ran. Then I added a switch to tell which program to execute. The two programs I added were to insert an image and to insert an excel file which gives me a graph. The displays for the VI’s need to be outside of the case structure. For my case it is the xy graph icon and the picture icon. It is also important to note that I want the structure to only run when the switch is in the true position. To accomplish this I can only create a VI when the case structure says true, and since I do not have a VI when the case structure says false I need to use the default if not wired between the display icon and the case structure. Also note these VI’s were built before this program was built. A picture of the program can be seen below.

The top program is to insert an image on the front panel. On the left the switch can be seen. While the VI is inside of the case diagram. The bottom program is to insert an excel file and display a graph on the front panel.


Creating a VI that Inserts Data

http://digital.ni.com/public.nsf/allkb/02971A30F5D8FC6986256A0A004F11A0

This is a helpful link

To be able to insert a simple picture into labview only three functions need to be put in the block diagram.
The first is a read JPEG file icon. The purpose of this icon is that it converts the image files to data so that
it can be read by labview. The next icon that needs to be added is the Draw Flatten Pixel map. This takes the data
and actually creates it into a picture. The final item that is added is the picture icon. This is what actually
displays the picture onto the front panel.

Then With Sven I built a program that can take an image file and import so that it is shown on an intensity screen.
The first icon needed was a file path. While again a read JPEG file icon and a Draw Flatten Pixel map is also
needed. Then the picture to pix map is included. This takes the picture and converts it into data so that many applications can be used with the picture. A constant needs to be added, this constant tells how many bit the pixel map will be. After this icon an unflatten pixmap icon is added. This is needed because the draw flatten pixel map flattens the data and this icon unflattens it. The last icon that is added is the intensity graph so that the image can be seen on the front panel.

 

In the picture top program is to insert just an image, while the bottom program is to insert an image into an intensity graph.


Schedule for Summer Research

The following dates over the summer I will need off.

June 21-25

July 1-4

Thank you


Creating a VI to Input Excel Files

To input an excel file a VI program needs to be created in LabView. The First thing that had to be created is two read delimited icons. One icon inputs x axis data while one will input y axis data on the graph. The purpose of these icons are that they are able to read  2d arrays of scalar numbers, which is essentially an excel file. The files that will be imported need to be convert to a comma delimited file. This is done so that the LabView program can read the data. After the icons are put in a constant of a comma needs to be attached so that the files can compatible with this build. The other portion of the program is an express VI which is called “Build XY graph”. We used an express VI since this type of VI has many applications for graphing different data and they are much more user friendly than regular VI’s. We use this VI since it takes our raw data from the icons and coverts it into a graph form. Finally an xy graph icon needs to be added so that the actual graph can be seen on the front diagram. An example of the graph can be seen below.

 

graph for program to insert files

This is a graph intensity versus theta of an empty 2mm capillary.

To be able to change the properties of the graph, right click on the screen and then click properties. This window can change the axis titles, re-scale the graph, or it can change the appearance of the graph.

Program to insert excel files

This is the image of the block diagram for the program. The two icons can be seen on the left. The constant is the pink box with the comma, while the icons are the boxes with the glasses and the array image inside. Using wire we connect each to either the x input or the y input. And finally it can be seen that the xy graph icon is attached to the express VI.

 

 


Notes Starting Program and Imputing Data

 

Word pad over Start up procedure.

Start Up-Input Data


Observations of How Background Multiplier affects S(q)

Notes Over S(q) being changed by background Multiplier

——————————————————-

1. When the program is first started the background multiplier value is

Background = .304

Peak 1 intensity= 1.55
Peak 2 intensity= 1.8
Peak 3 intensity= 5.225
Peak 4 intensity= 3.14

Then we change the background values to see how the graph of s(q) changes.

Background 2= .1

Peak 1 intensity= 1.45
Peak 2 intensity= 1.7
Peak 3 intensity= 4.7575
Peak 4 intensity= 2.887

Background 3= .5

Peak 1 intensity= 1.625
Peak 2 intensity= 1.9375
Peak 3 intensity= 5.7625
Peak 4 intensity= 3.44
Background 4= .7

Peak 1 intensity= 1.75
Peak 2 intensity= 2.1075
Peak 3 intensity= 6.465
Peak 4 intensity= 3.825
Background 5= 1.5

Peak 1 intensity= 2.816
Peak 2 intensity= 3.621
Peak 3 intensity= 12.875
Peak 4 intensity= 7.325
Background 6= .9

Peak 1 intensity= 1.905
Peak 2 intensity= 2.327
Peak 3 intensity= 7.38
Peak 4 intensity= 4.327
Background 7= 1.1

Peak 1 intensity= 2.115
Peak 2 intensity= 2.62
Peak 3 intensity= 8.61
Peak 4 intensity= 5

Observations:

At a first glance it can be seen that when the background mult. is increased the intensity of the peaks will also increase.However after plotting the the data on the excel graph attached below we can also see that as the background mult. increases the relative peak separation in the y direction will also increase. After further analysis we noticed that there is a parabolic relation between peak heights when the multiplier is changed. We also found that there are constraints to the multiplier in which we can increase the multiplier until 2.123, but at that point the graph will become a line and any value
larger will make the graph be inverted. We observed for background mult. values of 0-2 the peaks will increase in intensity. While the Values between 2 and 2.123 will make the intensity values decrease until it is a line.
After taking and analyzing data I did not see any shift of the graph in the x direction. These values stayed constant no matter what the multiplier value was.
peak1= .867 q(1/A)
peak2= .909 q(1/A)
peak3= 1.229 q(1/A)
peak4= 1.474 q(1/A)
The Background mult. is a multiplier on the intensity of the dark empty chamber before it is subtracted from the detector image.The background needs to be subtracted so that when we do our final analysis our data will not include the Dark images or the container. This is considered to be a correction to our data.

 

Excel Graph of Data

Background Data

 

 

Back Ground Multiplier edit

Above is a picture of the graph of S(q) The background mult. is labeled and so are peaks 1-4.