Statistics

Statistics analysis is currently being worked on!

class ih.statistics.Stats(db)[source]
anova(intable, outtable, grouping, overwrite=False)[source]
Parameters:
  • intable (str) – The input table to load information from
  • outtable (str) – The output table to write information to.
  • grouping (list) – The list of image types to group by.

Computes the analysis of variation of all numeric information based on 3 factors, treatment, date, and the interaction between the two. Analysis of variation is different than the rest of the stats functions, in that a lot of information is lost after running it. The results themselves correspond to columns (pixels, rmed, binx...) instead of actual images.

correlation(intable, outtable, dataFile, dataHeaders, overwrite=False)[source]
Parameters:
  • intable (str) – The input table to load information from
  • outtable (str) – The output table to write information to.
  • dataFile (str) – The csv data file to load
  • dataHeaders (str) – Column names for relevant table headers.

This function correlates all numeric values with values in the given file. The input data file is assumed to be in csv format. In dataHeaders, you must specify four keys, ‘id’, ‘date’, ‘dateFormat’, and ‘metric’. Each of these should be column names. Id corresponds to the lemnaTec style identifier ex: ‘023535-S’. All dates are converted into Y-m-d form, you must provide a valid format in ‘dateFormat’, that way the dates can be converted correctly. The ‘metric’ column is the actual value you want to correlate to.

export(table, processed=True, group=None, fname=None)[source]
Parameters:
  • table (str) – The table to write to csv
  • processed (bool) – Whether or not to extract processed data
  • group (list) – Which image types to extract from the database.
  • fname (str) – The file name to write to.

This function simply extracts data from a database and writes it to csv format. Default functionality is to extract only data that has been processed. This is checked by finding if an outputPath has been set. Additionally, you can specify a list of image types to extract, if not, the default list contains all rgb and fluo images. Finally, if no file name is specified, the name of the table is used as the filename.

logErrors(logfile, table='images')[source]
Parameters:
  • logfile (str) – The logfile to write errors to
  • table (str) – The table to load errors from

This function writes all errors from a given table to a log file, usually used at the end of image processing to write all images that did not process correctly.

normalize(intable, outtable, column='pixels', overwrite=False)[source]
Parameters:
  • intable (str) – The input table to load information from
  • outtable (str) – The output table to write information to.
  • column (str) – The column to normalize information to

Normalizes all numerical information to the specific column. This function is usually used with ‘pixels’ as the specified column, which expresses all numeric information as a percentage of the total pixels in the image.

shootArea(intable, outtable, grouping, overwrite=False)[source]
Parameters:
  • intable (str) – The input table to load information from
  • outtable (str) – The output table to write information to.
  • grouping (list) – Which imtypes to group

This function adds the numeric values of multiple image types together. In general, it is used to combine side view + top view images of the same spectrum. If you plan on correlating your data to lemnaTec’s data, lemnaTec uses SV1 + SV2 + TV, so you should aggregate your data likewise.

tTest(intable, outtable, comp='imtype', overwrite=False)[source]
Parameters:
  • intable (str) – The input table to perform the T test on.
  • outtable (str) – The output table to write the results to.
  • comp (str) – Whether to compare image types or image names.
  • overwrite (bool) – Whether or not to overwrite the output database

This function computes a ttest of the input table for all numeric headers. The comparison is either done based on image types or image names. Default functionality is a comparison between image types, specify comp = ‘imgname’ to compare image names.

threshold(intable, outtable, thresh=0.01, overwrite=False)[source]
Parameters:
  • intable (str) – The input table to load information from
  • outtable (str) – The output table to write information to.
  • thresh (float) – The threshold value.

This function thresholds the table based on the given value. All values that fall below the threhsold are ‘updated’ in place with ‘null’. Normalize is often called before thresholding.

treatmentComp(intable, outtable, type='ratio', direction='Control', comp='imtype', overwrite=False)[source]
Parameters:
  • intable (str) – The input table to load information from
  • outtable (str) – The output table to write information to.
  • type (str) – The type of calculation to do between treatments. Should be ratio or difference.
  • direction (str) – Whether to compute C ~ S, or S ~ C, default is Control first.
  • comp (str) – Whether to compare by imtype or imgname

This function compares information between treatments – It finds plants that are identical except for treatment, and computes either a ratio or difference between them. Direction is specified as the column you want first, so direction = “Control” will compute C ~ S, and direction = “Stress” will compute S ~ C. If you have already normalized your table, difference will provide better information than ratio.