3. BasicProcessing Functions¶
-
class
BasicProcessing.
UnispecProcessing
(config_file)[source]¶ Initializes the class. Reads input/output parameters from configuration file.
Parameters: config_file (String) – Text file containing input/output configuration -
AvgWPs
(data)[source]¶ Averages values for each channel and file in data.
Parameters: data – Array of interpolated data (as returned from Interp()
)Returns: Array of averaged values for each file Return type: Array of Floats indexed as [ int_WL
/int_CH_B
/int_CH_A
]
-
CheckSaturation
(data)[source]¶ Returns a list with a count of saturated values per channel for each file.
Parameters: data (Nested list of Strings) – List of full run data (as returned from ReadFiles()
)Returns: List of Arrays [file index, Ch B, Ch A] Return type: [Integer, Integer, Integer]
-
CheckSaturation_WL
(data)[source]¶ Returns a list of wavelengths with saturated values.
Parameters: data (Nested list of Strings) – List of full run data (as returned from ReadFiles()
)Returns: List wavelengths indexed as [file index][Ch B(0) / Ch A(1)] Return type: Nested list of Floats
-
GetDateTime
(file)[source]¶ Gets the time and date from a specified file.
Parameters: file (Nested list of data) – List of data from file (from full run data with file index specified) Returns: Array containing date and time indexed as [ date
/time
]Return type: [Date/Time] String
-
GetFileLists
()[source]¶ Reads input directory specified in config file and populates class arrays
WPs
andStops
with file paths/names that are to be processed.File sets are split based on where white plates are identified date/time (assuming they are included in the filename) and .
Returns: # of runs, # of white plates, # of stops Return type: Integer, Integer, Integer
-
Interp
(data)[source]¶ Interpolates data to 1 nm.
Only includes wavelengths where data is present for both channels.
Parameters: data (Nested list of Strings) – List of run data (as returned from ReadFiles()
)Returns: Array of interpolated data indexed as [file #, int_WL
/int_CH_B
/int_CH_A
]Return type: [file, WL/Ch B/Ch A] Array of Floats
-
ReadFiles
(flist, headerlen)[source]¶ Reads Unispec output files into a list, separating header and spectrum data for each file.
Parameters: - flist (Nested list of Strings) – List of files to read (as returned from
GetFileLists()
) - headerlen (Integer) – Constant defining how many lines the header consists of
Returns: List of data indexed as [file index][
header
/data
][row index][CH_B_WL
/CH_B
/CH_A_WL
/CH_A
]Return type: Nested list of Strings
- flist (Nested list of Strings) – List of files to read (as returned from
-
Refl
(Stop_data, WP_data)[source]¶ Calculates reflectance for an array of data.
Parameters: Returns: Array of reflectance values for each file
Return type: [File, WL] Float
-
RemoveSaturated
(orig_data, sat_data)[source]¶ Removes data from files indexed in sat_data from orig_data.
Parameters: - orig_data (Nested list of Strings) – List of full run data (as returned from
ReadFiles()
) - sat_data – List of Arrays [file index, Ch B, Ch A]
Returns: List of reduced run data (maintains list format)
Return type: Nested list of Strings
- orig_data (Nested list of Strings) – List of full run data (as returned from
-
Stops
= [[]]¶ Array of stop files indexed as [Run #][Stop #]
-
WPs
= [[]]¶ Array of white plate files indexed as [Run #][WP #]
-
WriteOutput
(data, path, filename)[source]¶ Creates a CSV file of the reflectance data in data.
A file should be generated for each set of stops. Each row then represents a stop and each column corresponds with a wavelength.
Parameters: Returns: 0
Return type: Integer
-
plot_Averaging
(orig_data, avg_data)[source]¶ Creates a plot comparing a collection of data with its average.
Useful for checking white plate averaging.
Parameters: Returns: 0
Return type: Integer
-
-
class
BasicProcessing.
consts
[source]¶ Class of constants to make understanding various lists/arrays simpler.
-
CH_A
= 3¶
-
CH_A_WL
= 2¶
-
CH_A_WL_End
= 3¶
-
CH_A_WL_Start
= 2¶
-
CH_B
= 1¶
-
CH_B_WL
= 0¶
-
CH_B_WL_End
= 1¶
-
CH_B_WL_Start
= 0¶
-
WL_Lims
= 2¶
-
data
= 1¶
-
date
= 0¶
-
datetime
= 1¶
-
header
= 0¶
-
int_CH_A
= 2¶
-
int_CH_B
= 1¶
-
int_WL
= 0¶
-
time
= 1¶
-