These Matlab scripts to post process ASD FieldSpec Pro ...



Guidelines for Post Processing and plotting ASD Fieldspec Pro White Reference data files in Matlab including scripts for Savitzky-Golay smoothing and computing 1st and 2nd derivatives.

Version 01.01 (2009)

Created by: A Mac Arthur, January 2009

These Matlab scripts to post process ASD FieldSpec Pro data were written by A Mac Arthur, alasdair.macarthur@ed.ac.uk, University of Edinburgh PhD student No. S0455489 on 30/01/09 and are distributed free via the NERC FSF web site.

Note however these scripts are generic. Users must specify the appropriate ‘path’ and ‘filename’ to load and save their data and to point any subsequent script at the appropriate data. In addition, users must verify that the appropriate parameters for their data, i.e. Savitzky-Golay smoothing polynomial order and filter size, are used. The polynomial order and filter size use in the generic scripts is not being recommended

By providing these resources to the user community the Field Spectroscopy Facility takes no responsibility for the use of this script. While all reasonable steps have been taken by FSF to ensure that these resources perform the task described, the FSF cannot be held responsible for any problems experienced during their use.

A test data set and a populated structure ‘ASDFilesStructureWithDataFromTestDataSet.mat’ generated from this data set has been include for reference.

Each script has been annotated to enable the stages to be followed.

Reading the ASD data into a structure

1) Copy the Matlab scripts into the same folder as the ASD Field Spec Pro data.

2) Set Matlab ‘Current Directory’ to the folder with the data and scripts.

3) ‘Open’ ‘ReadASDFieldSpecProData.m’ in the Matlab ‘Editor’ window.

4) Use either ‘Run’ or ‘Evaluate entire file’ to run the script and load the ASD file data, wavelength scale and headers into a Matlab structure. The file will be save into the ‘Current Directory’.

5) ‘FileNames’ holds a sequential list if the imported file names in a cell array within the structure; ‘FileData’ hold each of the files complete with its header data in separate structures within the main structure; ‘RelWRefReflecatanceFiles’ holds a copy of all the relative white reference reflectance files in one array and ‘AbsWRefReflectFiles’ RelWRefReflecatanceFiles’ holds a copy of all the absolute (that is after applying the panel calibration) white reference reflectance files in one array. The individual files in the arrays correspond sequentially to the files in ‘FileNames’. In addition, for ease of access, a wavelength scale is stored in ‘WvlScale’.

6) Note that after running the script the structure and all variables will be deleted from the Matlab workspace and only the structure will be saved.

7) If needed the structure can be loaded into the workspace by using >>load(‘filename’) or clicking on the folder icon on the ‘Workspace’ tool bar and locating the file.

Plotting files in the structure

1) ‘Open’ the script ‘PlotASDFiles.m’ in the Matlab ‘Editor’ window.

2) Use either ‘Run’ or ‘Evaluate entire file’ to run the script and plot the ‘AbsWRefReflectFiles’ files held in the structure save in Section 1. Note it will be necessary to chance the file name being loaded if it was changed before running ‘ReadASDFieldSpecProData.m’.

3) The script will load in the named in load(‘filename’) and plot the array declared in the ‘plot’ parameters

4) Note that the plot properties can be changed either by editing the script or by using the ‘Property Editor’ dialogue in the plot diagram

5) The Plot figure will not be saved automatically.

Smoothing data and computing the 1st and 2nd derivatives

1) N.B. The structure need not be in the ‘Workspace’ while this script is being run as it will be loaded automatically by the script.

2) ‘Open’ the script ‘SGSmoothASDFiles.m’ in the Matlab ‘Editor’ window.

3) Use either ‘Run’ or ‘Evaluate entire file’ to run the script. This will load the previously saved structure, create an array of smoothed data, compute the 1st and 2nd derivatives of the data and append these to the structure each in an array as in Fig. 2

4) The structure will be saved to the ‘Current Directory’ and deleted from the ‘Workspace’.

5) The smoothed data or the derivatives can be plotted by amending the ‘PlotASDFiles.m’ script to point to the arrays required.

Removing water absorption bands

1) N.B. The structure need not be in the ‘Workspace’ while this script is being run as it will be loaded automatically by the script.

2) ‘Open’ the script ‘RemoveWaterAbsorption BandFromASDFiles.m’ in the Matlab ‘Editor’ window.

3) Use either ‘Run’ or ‘Evaluate entire file’ to run the script. This will load the previously saved structure, remove the water absorption band and append an array to the structure (as in Fig.3), save it to the ‘Current Directory and clear the ‘Workspace’.

4) The data with the water absorption bands removed can be plotted by amending the ‘PlotASDFiles.m’ script to point to the arrays required.

-----------------------

[pic]

Figure 1

[pic]

Figure 2

[pic]

Figure 3

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download