fishdist.wing_analysis_utils

add_to_db_sql(sql_file, table_name, headers, data_rows)

Adds data to a SQL database table.

Parameters:
  • sql_file (str) –

    The path to the SQL file.

  • table_name (str) –

    The name of the table.

  • headers (list) –

    The headers of the table.

  • data_rows (list) –

    The data rows to be added.

Returns:
  • dict

    The formatted table containing the data.

append_to_file(sql_file, table_name, finally_formatted_table)

Appends a formatted table to a SQL database.

Parameters:
  • sql_file (str) –

    The path to the SQL file.

  • table_name (str) –

    The name of the table.

  • finally_formatted_table (dict) –

    The formatted table data to be appended.

compute_iqr(x)

Computes the interquartile range (third quartile - first quartile), a distribution measure not sensitive to outliers.

Parameters:
  • x (ndarray) –

    The data.

Returns:
  • float

    The interquartile range.

compute_weighted_centroid(coords, intensity_image)

Computes the weighted centroid of the given coordinates in an intensity image.

Parameters:
  • coords (ndarray) –

    The coordinates.

  • intensity_image (ndarray) –

    The intensity image.

Returns:
  • numpy.ndarray: The weighted centroid.

get_q1_q3(x)

Computes the 1st and 3rd quartiles of the given data.

Parameters:
  • x (ndarray) –

    The data.

Returns:
  • numpy.ndarray: The 1st and 3rd quartiles.