Week+of+5-6+to+5-12

This week’s post will continue where last week’s post left off. The next function that shows up is the ‘BWet’ callback. The ‘BWet’ object is an edit text box titled “Bin Width.” The only thing this callback does aside from the obvious value change that occurs when the user enters a number in for the bin width is that it unchecks the autoscale checkbox called ‘ASbox’. The following function is the ‘BWet’ create function, which does the standard job of setting the background color to white. Then comes the ‘Hdraw’ callback. ‘Hdraw’ is the click button for drawing a histogram based on the current settings. It first uses the data set that is stored in the table and the field chosen in the popup menu ‘Hpop’ to isolate the column of data that will be graphed. Then, it checks the ‘Hopen’ object for whether it should be opened in a figure, the ‘NDbox’ object for whether it should be compared against a normal distribution, the ‘ASbox’ object for whether it should default to the Auto Scale, and finally the ‘BWet’ object if Auto Scale is turned off. The actual graphing is relatively simple, with ‘if’ statements inside each other denoting the various situations combining the different variables. These histograms are always plotted in ‘axes1’, assumedly for aesthetic purposes. Conveniently, MATLAB has a command called ‘NDf’ for plotting the normal distribution function, which makes that part nice and simple. I encountered a few bugs when attempting to test this section which I will likely address when I check out the code for these various buttons. After the ‘Hdraw’ callback follows an empty ‘Hpop’ callback and the standard create function for ‘Hpop which sets its background to white. ‘Hpop’ is the popup menu for which variable to choose to graph on the histogram. Next comes the ‘DSpop’ callback. ‘DSpop’ is the drop-down menu for which data set to use. The choice of data set from this menu determines which type of data can be chosen in the “Type” menu ‘Tpop’ object directly to the right of the ‘DSpop’ object. So, all the ‘DSpop’ callback does is based on the value chosen for ‘DSpop,’ it accordingly alters the options in ‘Tpop.’ ‘RFpop’ comes next and is another simpleton object with not function called in its callback and a standard create function. ‘RFpop’ is the drop-down menu for the reference frame the data should be shown from (parent or lab). ‘Tpop’ comes next and is yet another simpleton object just as ‘RFpop’ above. ‘Tpop’ is the aforementioned “Type” menu for which type of data from the set should be shown (usually GG vs. GF). ‘Cpop,’ the drop-down menu to choose which kind of charges (+/- or ++/--) the data should concern, follows ‘Tpop’ in the code, and is yet another unexciting pair of callback and create function. The next function is the callback function for ‘Fpush,’ the “Select” button for finalizing a cut of the data. This callback calls the ‘Fpushf’ script that actually cuts the data. It then writes a line into ‘Flist’, the box at the top right corner of the GUI which is meant to keep track of all the cuts that have been made. The programmer uses a few techniques here I did not learn in the course of working through the textbook. The first is the idea of a “Dynamic Search” which has come up a few times in this program and I will now finally discuss. It appears that one can isolate a column of a table if one has the name of the column in a character variable. All one needs to do is set a new variable equal to something in the form ‘table.name’. This will cut out everything in the table except for those values associated with that name. The next thing he does is use what is called a logical vector to cut the proper data out based on the user criteria. A logical vector is a vector full of Boolean quantities. The effort of the programmer here is to create a vector of Boolean quantities of whether or not a given value is greater than or less than (depending on user choice) the quantity chosen by the user. He does this by using the ‘find’ command to give “true” (or “1”) for those which meet the condition and “false” (or “0”) for those that do not. One side note here is that I feel it might be useful to also have options for cutting all values equal to a certain amount, or less than or equal, or greater than or equal. Anyway, the programmer then compares this Boolean vector to every single variable’s vector and cuts the values who do not meet the condition out by using a process with structures that I am not familiar with. He does this in an extra script called ‘filterf’. I also cannot find out what his lines involving ‘in.’ and ‘out.’ pertain to because Google searches confuse these with the words “in” and “out” in sentences. The odd thing about the programmer’s choice with the ‘Fpush’ callback is that he also has it unconditionally redraw the histogram as well as the scatterplot with the new data. The problem is this default situation could do things the user did not desire to happen, and should probably be fine-tuned a little bit with a script that will determine when and when not to redraw plots.