Pre-Lab - Purdue University

advertisement
Model Adaptation Activity
Nano Roughness – Project Part A
Successful completion of this project will enable you to:
 Gain more experience using MATLAB with the focus being on:
o The use of control and conditional structures
o The creation of an executive program and user-defined functions
 Continue to create plots of technical presentation quality
 Practice applying statistical analysis concepts
 Apply MATLAB skills to a problem based on a real-world situation
 Continue to develop effective teaming skills
PROJECT DESCRIPTION
Liguore Labs has analyzed your team's work thus far in determining roughness from nanoscale
images. Kerry Prior has asked your team to develop a program in MATLAB that allows a user to
calculate roughness of a nanoscale sample by several methods available. You have read how an
AFM works, and Liguore Labs wants a method to visually display AFM datasets and calculate
roughness using methods that are accepted within the industry. To satisfy the company's needs,
your team must design a program that is functional and easy to use. In addition to developing the
software tool, your team will document your procedures and demonstrate how your software tool
can be used on a series of AFM data files. Your document must be written in complete sentences
and should clarify the program completely, yet briefly, for your client. Your software tool will be
viewed and evaluated by the managers at Liguore Labs. You may assume that the managers have
some knowledge of science and math but are NOT engineers.
BACKGROUND INFORMATION
In Homework 11, you learned to use AFM data to make a digitized, grayscale image as in Figure
1. Note that this is not a picture of the surface, and you should not use "photograph" or "picture"
in your report. These are digital "images" in which the brightness value of each pixel represents
height. Figure 1 can be stored in MATLAB as a variable that contains an array of numbers, with
each number referring to the gray scale value for each pixel of the image. A sub-sample of the
complete Figure 1 file is shown in Table 1; this sub-sample shows the gray scale values for the
square superimposed on Figure 1 and magnified by itself in Figure 2. Gray-scale values can
range from 0 for black to 255 for white (as they do in Figure 1). You will place a line over this
table of data, by choosing two random points to define the endpoints. This line can be horizontal,
vertical, or at an angle. An example of a possible line is shown on the table as the underlined
values (though it is not shown on the actual figure, to avoid obscuring the pixels that are used).
You will determine gray values so you can make an image that acts like a "topographic map" of
your AFM data, that will provide a visual representation of "depth".
Copyright © 2004 Purdue University
1
Figure 1. Image made from AFM height data, with
pixel color representing height at each location.
(Remember that this is not a photograph.)
Figure 2. Close-up of area
outlined in Figure 1, to show
pixels and brightness.
Table 1. Digital file for sub-sample from AFM image shown in Figure 2, with possible angled
line shown by underlined numbers. Note the dark "hole" in the middle of values < 100.
196
193
195
195
206
205
208
207
203
196
192
183
184
180
176
168
155
161
155
205
220
213
209
202
205
210
213
216
216
211
193
192
189
189
203
203
205
203
201
193
186
181
180
178
172
156
144
155
140
197
220
215
209
205
207
210
208
214
215
214
187
188
188
189
200
195
195
195
196
191
179
176
173
169
163
148
130
146
125
192
219
216
212
208
207
210
207
211
215
216
180
183
183
185
190
185
185
189
191
189
176
173
170
164
158
146
133
136
120
179
215
217
213
208
207
208
207
208
214
216
173
177
175
180
184
183
182
184
183
182
172
165
167
161
157
137
132
132
120
165
209
217
214
209
209
209
208
209
214
218
165
166
169
178
180
180
175
174
171
166
157
146
155
148
143
128
124
122
120
162
201
217
215
211
207
208
208
208
213
220
153
155
162
171
173
173
169
168
161
149
143
131
138
130
126
125
125
122
120
152
192
215
217
214
207
209
208
208
211
219
149
151
151
157
164
170
169
166
158
145
138
132
128
119
119
123
125
124
121
138
182
210
217
214
209
210
209
210
213
217
Copyright © 2004 Purdue University
145
147
146
152
157
163
162
158
149
141
127
126
118
112
113
120
124
123
125
138
174
205
217
214
211
209
210
213
214
216
138
142
145
152
149
149
149
146
141
137
124
121
109
102
107
116
122
124
129
140
165
203
217
215
211
209
211
214
213
216
133
137
140
144
143
141
144
142
138
135
132
125
112
98
102
112
119
125
131
136
154
198
215
216
211
208
212
214
211
214
131
135
136
141
142
140
143
139
135
132
133
123
109
98
99
110
117
125
132
137
146
191
215
217
212
210
210
213
210
210
129
131
134
139
138
139
140
134
132
128
126
114
102
99
100
105
113
125
133
141
145
186
215
217
214
210
208
212
209
209
128
129
132
134
132
137
139
134
130
126
123
108
102
101
102
102
110
119
131
137
145
181
208
216
214
210
208
211
209
210
129
130
130
129
130
135
137
134
128
127
123
107
103
102
102
104
110
114
127
130
141
176
204
214
213
211
208
209
209
209
131
130
129
128
129
134
134
131
124
125
120
107
105
102
103
105
111
114
121
127
137
172
200
210
213
211
206
207
209
208
134
130
130
129
129
129
128
128
124
124
118
109
107
104
103
105
111
113
117
122
134
165
190
204
211
211
205
206
208
207
135
131
131
127
129
128
128
127
125
123
120
110
107
104
103
105
110
112
115
118
131
155
179
198
210
209
206
205
207
206
137
134
131
128
129
128
127
126
122
121
118
111
105
105
103
105
108
110
112
115
126
145
174
191
206
207
205
203
204
206
136
137
131
130
128
127
126
125
120
118
116
112
103
103
102
103
105
108
110
113
123
140
164
183
202
206
204
201
203
206
2
MATLAB Code
Executive Function
Your code will consist of a MATLAB executive program and a series of supporting MATLAB
user-defined functions. An executive user-defined function is the main function that controls the
overall order of computations and operations. This function has no input or output arguments.
Your team will construct one executive user-defined function called nanorough.m which will
control the order of the computations and calls to user-defined functions. For the duration of
Project II, your team will add and modify sections of this function as you complete the
supporting user-defined functions. This function is to execute when nanorough is entered at the
MATLAB prompt. It will make calls to the supporting user-defined functions that your team
creates. You will begin building the executive function in Lab 12, though you will have
developed some of the supporting user-defined functions in Lab 11. In Part A, you will be
writing introductory code that finds the height values needed to perform the roughness
calculation. In Part B, you will be given information about the different formulas used to
calculate roughness and will implement these calculations.
Supporting User-Defined Functions
Your team will construct user-defined functions that will perform the computations for the
project. The executive function should route appropriate information to and from user-defined
functions but perform minimal computations itself. All major computations (such as defining the
endpoints of the line) and repetitive computations (such as converting height values to color
values or finding the values of brightness along the line) must be handled by user-defined
functions. A good rule-of-thumb is to create a user-defined function for any task or computation
that takes more than 8 lines of code. Clearly indicate the author(s) of each function. There should
be clear evidence that each member is contributing to the development of project code.
Required Functionality of Code
When the user of your code types nanorough at the MATLAB prompt, the user should be kept
in the program until the user wishes to quit. This means that the user can continuously run AFM
datasets without being forced to restart the program. Your team will work on this in Lab 12.
Your code must be able to load an ASCII AFM dataset. Your code must also be general enough
to handle any AFM dataset with X, Y, and height data in three columns. Your team will
construct this piece of the project in Homework 11. During demonstrations of your code, your
team will be asked to develop an image of a dataset your team has never seen before (though it
will be of the same style as those you have used while developing your project).
Sample Images and Determination of Pixel Color Value
Three AFM datasets are provided for use by your team. The digitized files are called gold24.txt,
afm2.txt, and afm3.txt and located in the engr106/FALL2003/PROJECTS subdirectory. Each
dataset will be loaded and converted to an array of numbers. This will be covered in Homework
11. Each number in the array represents the height at the particular point. You will normalize this
data to find a gray scale value for each pixel. These values range from 0 for black to 255 for
white. Each of these 256 colors will represent a small range of heights.
Copyright © 2004 Purdue University
3
Thus, you will have two data arrays. The first, the Height Data Array, contains the height values
for each point that will be used in all your calculations (most of which will be performed in Part
B). The second array, the Pixel Color Array, will have the same number of rows and columns as
the Height Data Array, but will have been "proportioned" or "normalized" to contain integer
values between 0 and 255 and will be used as a visual representation to help the user "see" the
roughness of the surface. This image will be Plot 1.
Random Lines
Each line is defined by a starting point and an ending point. The points must be randomly placed
on the image. Your team will begin work on random generation of points in Lab 11, and will
continue this in Labs 12 and 13 and Homework 12.
Average Height
Each pixel along the line will have a height value. You will calculate the average height of these
points. You will plot the height at each point along the line as well as the average height. Refer
to Question 7 of Homework 10. Your Plot 2 will look like the "Cross Section" plots.
Required Output Results
Your code should generate results that are easy to interpret. Graphical results are to include plots:
 Plot 1 is a figure showing the image made from the AFM data with all lines (though you are
only required to have one for Part A) used to determine the roughness overlaid on the image.
 Plot 2 is a figure showing the height of each pixel along the line. It must be properly labeled
and should display a line showing the average height (which is not shown on the plots in
Homework 10, but is needed for calculations required for Part B).
Additionally, a series of text-based key results must be displayed on the screen. These include:
 All user inputs (e.g., dataset name).
 All internally-measured values (e.g., size of dataset array, maximum and minimum height
values).
 All internally-calculated values (e.g., "height resolution" of image – the height difference
between two pixels that differ by 1 out of the 256 shades of gray, the average height).
REPORTS
Your team will demonstrate the team's nanorough initial code in lab. Your code should be able
to provide initial results (described below) for an AFM dataset never seen before. Your TA will
select one team member to display the code, which is why every member should have access to
the code and understand it. This demonstration will form part of the grade for Part A.
Further, your team will submit an interim project report that includes the following items.
Executive Summary. Write a one-page (1.5 spacing) executive summary to the managers of the
Liguore Labs. The summary must include a description of your methodology for finding color
values based on the AFM dataset and for finding the "addresses" of points (or pixels) that fall
along the random line. The description should include enough detail for the manager of Liguor
Copyright © 2004 Purdue University
4
Labs to understand how the images are generated, what these images show, how the line is used,
and what the "average" height represents Many of the calculations for Part B will be based on
deviations from this "average" line. Also discuss the capabilities of MATLAB that make it useful
for this type of analysis, as well as any shortcomings of MATLAB for this application that you
may have identified. This should be written in the form of a memorandum as follows:
MEMORANDUM
To:
Kerry Prior, Vice President of Research, Liguore Labs
From: Team #: List all members of your team
Re:
AFM Roughness MATLAB Tool - Interim Report
Date:
Flow Chart(s). Draw one or more flowcharts to track the calculation of the pixel colors from the
AFM height dataset, calculate the average height, and other tasks as necessary. These should be
easy for the TA to follow. They may be neatly handwritten or electronic – PowerPoint provides
flowcharting capability, though you are allowed to do these by hand, which might be faster.
Code and Documentation.
 Provide a typed list of all the functions that your team has written for Part A of the Project.
For each function on the list, include the name of the function, the author(s), and a brief
description of what the function does. Provide a description of the inputs and outputs. Note
that most of this information is to be included in the help comments of each function.
 Submit a hard copy of each function written for Part A. Be sure the correct file name appears
on each page. Adequately comment your code so your TA can easily follow your code.
Initial Results.
At the end of Part A, your code should do the following (and you will test that your code can
develop these results on two of the three AFM datasets provided and submit your results):
 Convert a raw AFM height dataset into an image
 Generate one random line on the image
 Calculate the average height for the chosen line
 Display Plot 1 and Plot 2 to the screen in a single figure window using the subplot command
 Display to the screen the name of the AFM dataset being analyzed. Display all user inputs,
assumed values, and key results that were required as part of the calculation.
Your team will also submit a copy of the output printed to the screen by creating two diaries:
one for each of two (out of the three) sample AFM datasets (use the diary command in
MATLAB). Please suppress printing of all computation lines before running your simulation so
that the diary will not be too long. Otherwise, trim extraneous lines in the diary text file before
printing the hard copy. Your output should clearly indicate which dataset is being analyzed.
Copyright © 2004 Purdue University
5
Engineering Contexts and Concepts for Developing and
Promoting Students' Higher Level Learning (NSF BEE 0342028)
Model Adaptation Activity
Nano Roughness – Project Part B
Successful completion of this project will enable you to:
 Gain more experience using MATLAB with the focus being on:
o The use of control and conditional structures
o The creation of an executive program and user-defined functions
 Continue to create plots of technical presentation quality
 Practice applying statistical analysis concepts
 Apply MATLAB skills to a problem based on a real-world situation
 Continue to develop effective teaming skills
PROJECT DESCRIPTION
Liguore Labs is ready for your finished MATLAB code to calculate roughness of a nanoscale
sample by several methods available. You have read how an AFM works, and Liguore Labs
wants a method to visually display AFM datasets and calculate roughness using methods that are
accepted within the industry. To satisfy the company's needs, your team must design a program
that is functional and easy to use. In addition to developing the software tool, your team will
document your procedures and demonstrate how your software tool can be used on a series of
AFM data files. Your document must be written in complete sentences and should clarify the
program completely, yet briefly, for your client. Your software tool will be evaluated by the
managers at Liguore Labs, who have knowledge of science and math but are not engineers.
Roughness Calculations: (based on www.veeco.com/appnotes/AN505.pdf)
Copyright © 2004 Purdue University
6
The following methods of measuring roughness are generally accepted in the industry:
Term Definition
Calculation
Use
n
Mean of height values of all
This is a starting point for
1
Z
Z   Zi
heights along profile (where
many of the other
n i 1
"profile" is the line you draw)
calculations
n
Roughness
Average
of
the
This simple method is often
Ra
1
R

Z

Z

a
i
profile is the difference
used to describe the
n i 1
between each point and the
roughness of machined
average height
surfaces.
2
Root Means Square Average of
This more complicated
Rq
1 n
the profile is similar in concept Rq 
method is ~1.11*Ra for many
 Zi  Z
n i 1
to linear regression
surfaces, but not always
Measure of highest and
R p , Rv Maximum profile peak height, Measured
Maximum profile valley depth
lowest points
Maximum Height of profile is
Range of highest and lowest
Rt  R p  Rv
Rt
difference between peak and
points
valley
5
Average Profile is the average
Rz
 See picture and discussion
1  5
R

P

V
found from the five greatest
 i  j  below to define a maximum
z
10  i 1
j 1
 peak and valley
peaks and five greatest valleys.
3
Skewness measures the
Used with a histogram (Plot
Rsk
1 n
R

Z

Z
assymetry of the profile about
3) to show if heights are

sk
i
nRq3 i 1
the mean line.
normally distributed
Positive skew indicates a predominance of peaks, while negative skew indicates a
predominance of valleys.




Note that a peak, such as P1, prevents any other points on that "mountain" from being a peak
until the height has gone below Z in both directions. Note this is also true of valleys (see V2,
with a "local" valley just to the left of V2 that is not used). The label Rz has been used for other
roughness measures, so you might find other equations if you search the Internet; use this one.
The following image is provided only to help you see what skewness and the Rsk value indicate.
Note that the ADF (Amplitude Distribution Function) is a histogram of all the heights. Again,
you do not need to develop a figure like the one shown here. However, you will develop a
histogram similar to the ADF curve (rotated 90º) as Plot 3 (discussed in “Required Output
Results”). To make this curve reasonably smooth, you will likely have 30 or more bins.
Copyright © 2004 Purdue University
7
MATLAB Code
Executive Function
Your code will consist of a MATLAB executive function and a series of supporting user-defined
functions. The executive function, called nanorough.m, will control the order of computations
and calls to user-defined functions. This function is to execute when nanorough is entered at the
MATLAB prompt. The executive function should route appropriate information to and from
user-defined functions but perform minimal computations itself.
Supporting User-Defined Functions
Your team will construct user-defined functions that will perform the computations for the
project. In the "Roughness Calculations" section above, you have been given information about
the different formulas used to calculate roughness and will implement these calculations. For
additional information, visit www.htskorea.com/tech/spm/profile.pdf (particularly pages 6-7, 1113, 33-37, and 41-42). Much of this site is based on www.predev.com/smg/parameters.htm). All
major computations (such as defining the endpoints of the line or solving the roughness
equations) and repetitive computations (such as converting height values to color values or
finding the five peaks and valleys) must be handled by user-defined functions. A good rule-ofthumb is to create a user-defined function for any task or computation that takes more than 8
lines of code. Clearly indicate the author(s) of each function. There should be clear evidence that
each member is contributing to the development of project code.
Required Functionality of Code
When the user of your code types nanorough at the MATLAB prompt, the user should be kept
in the program until the user wishes to quit. This means that the user is to be allowed to run one
AFM dataset after another, after another without being forced to restart the program.
Copyright © 2004 Purdue University
8
Your code must be general enough to load any AFM dataset with X, Y, and height data in three
columns. During the final demonstration of your code, your team will be asked to calculate
roughness of a dataset your team has never seen before (though it will be of the same style as
those you have used while developing your project).
Random Lines
Each line is defined by a starting point and an ending point that allows at least 200 data points to
be found between them. The starting and ending points must be randomly placed on the image.
User Choice of Parameter
The user should be given a choice of which roughness value will be found. The user should also
be given the choice to find all measurements at once, if desired, rather than having to choose all
of them one by one. Once the user makes a selection, the MATLAB code should calculate that
value and display it to the screen. As soon as the user enters a name of an AFM dataset, Plot 1
should appear. When the user chooses any of the measurements, Plots 1 and 2 should appear in a
single figure using the subplot command. If the user chooses to find the skewness, Plots 1 and 3
should appear in a single figure. If the user chooses to see all calculations, then Plots 1, 2, and 3
should appear in a single figure. (Plots are discussed in “Required Output Results” below.)
Consistency and Reliability
"Consistency" is the sameness of parts of the whole. Some AFM datasets are "consistent", in that
if you are calculating Rz, and you place seven random lines on your data, you get similar values
for each of the seven lines. The roughness measure is similar over each measured part. Other
datasets will be highly variable, in that a line placed in one location will result in a very different
roughness value from another line, and could be called "inconsistent". It is up to your team to
define “similar”. You should discuss the concept of consistency of the datasets in your summary.
"Reliability" is defined as an ability to collect the same results on repeated trials. The roughness
calculation made for a single line may not be a good representation of the dataset since there may
be a high degree of variability depending on where the line is superimposed on the dataset. To
get high reliability, several lines with different starting and end points should be used on the
dataset. Your team will decide how many lines are needed to attain "reasonable reliability" of the
roughness for a given dataset. To do this, your team will need to come to a consensus on what
constitutes "reasonable reliability".
If you take readings on seven lines, it may not make sense to average those seven readings. You
might choose to use the mode roughness value (which is difficult with continuous values; how
many decimal places are appropriate for your roughness value?), a trimmed mean where you
drop the highest and lowest values (or three highest and three lowest values), or some method
other than simple arithmetic average. Develop a procedure for determining roughness values
that ensures that your measurements on a dataset meet your team's definition of "reasonable
reliability." Implement your procedure in your project code - your team will need to decide what
results need to be presented to the user. Discuss your analysis of reliability in your report.
Consistency and reliability are related topics, so there may be an amount of overlap in your
discussion of each topic.
Copyright © 2004 Purdue University
9
Required Output Results
Your code should generate results that are easy to interpret. Graphical results are to include plots:
 Plot 1 is a figure showing the image made from the AFM data with all lines used to
determine the roughness overlaid on the image.
 Plot 2 is a figure showing the height of each pixel along the line. In Part A, the x-axis showed
pixels along the line; for Part B, the x-axis should show the actual distance in nanometers
along the line. Use proper labels and display a line showing the average height.
 Plot 3 is a histogram of the height values found for one of the lines used, with approximately
30 bins and with bin edges defined to help illustrate the skew of the roughness value.
Additionally, a series of text-based key results must be displayed on the screen. These include:
 All user inputs (e.g., dataset name).
 All internally-measured values (e.g., size of dataset, maximum and minimum height values,
reliability related measured values).
 All internally-calculated values (e.g., "height resolution" of image – the height difference
between two pixels that differ by 1 out of the 256 shades of gray, the average height, the
computed roughness value(s) desired by the user, reliability related calculated values).
REPORTS
Your team will demonstrate the team's nanorough code in lab. Your code should be able to
provide full results (described below) for an AFM dataset never seen before. Your TA will select
one team member to display the code, which is why every member should have access to the
code and understand it. This demonstration will form part of the grade for Part B.
Further, your team will submit a final project report that includes the following items.
Executive Summary. Write maximum three-page (1.5 spacing) executive summary to the
managers of the Liguore Labs. The executive summary should include:
 A brief description of the problem your team is solving and an explanation of why methods
for measuring nanoscale roughness are important/useful.
 Your team must include a paragraph that discusses why there are so many roughness
measures, i.e., why a single roughness measure will not work for all datasets. You may wish
to refer to the datasets you were provided.
 A discussion of consistency and/or reliability in general terms. You may certainly refer to the
three datasets provided, but do not discuss consistency and reliability in terms of those three
images only; your discussion should be general so it would be useful for the managers as
they look at other datasets.
 A brief response to any problems that were noted on Part A of the project (e.g. clarify
missing or unclear material).
 A 1-2 paragraph description of the functionality and use of the program you have developed.
The description should include enough detail for the manager of Liguor Labs to understand
what a "roughness" value indicates about the surface, as well as what "skewness" represents
and how to read your histogram. Your description should note how your team had chosen to
define consistency and a procedure for how it is achieved in the determination of roughness
measures.
Copyright © 2004 Purdue University
10

A comparison of two of the provided datasets; results should be presented in table format.
(The table will not count towards your three page limit).
Write the summary in the form of a memorandum as follows:
MEMORANDUM
To:
Kerry Prior, Vice President of Research, Liguore Labs
From: Team #: List all members of your team
Re:
AFM Roughness MATLAB Tool - Final Report
Date:
Flow Chart(s). Draw one or more flowcharts to track allowing the user to choose the desired
calculation, finding the five peaks and valleys, or other important code functionality.
Code and Documentation.
 Provide a typed list of all the functions that your team has written for the Project. For each
function on the list, include the name of the function, the author(s), and a brief description of
what the function does. Provide a description of the inputs and outputs. Note that most of this
information is to be included in the help comments of each function.
 Submit a hard copy of each function written for Part B. Be sure the correct file name appears
on each page. Adequately comment your code so your TA can easily follow your code.
Final Results.
At the end of Part B, your code should do the following (and you will test that your code can
develop these results on two of the three AFM datasets provided and submit your results):
 Convert a raw AFM height dataset into an image
 Generate one random line on the image that allows at least 200 data points along its length
 Calculate the Mean and the Average Roughness for the chosen line
 Print all required plots to the screen in a single figure window (the histogram is not required
to have "nice" bin edges, but it must have at least 30 bins to make a "smooth" curve)
 Print all user inputs, assumed values, and key results that required as part of the calculation.
 Display Plots 1, 2, and 3 (as appropriate based on the user input) to the screen in a single
figure window using the subplot command
 Display to the screen the name of the AFM dataset being analyzed. Display all user inputs,
assumed values, and key results that were required as part of the calculation.
Your team will also submit a copy of the output printed to the screen by creating two diaries:
one for each of two (out of the three) sample AFM datasets (use the diary command in
MATLAB). Please suppress printing of all computation lines before running your simulation so
that the diary will not be too long. Otherwise, trim extraneous lines in the diary text file before
printing the hard copy. Your output should clearly indicate which dataset is being analyzed.
Copyright © 2004 Purdue University
11
Download