analysis.tomography_data.tomography_data

Methods for analyzing tomography data.

Module Attributes

TOMOGRAPHY_SAMPLE_COLUMNS

Columns names used when sampling tomography data.

Functions

get_branched_tomography_data(bucket, name, ...)

Load or create merged branched actin tomography data for given datasets.

get_tomography_data(bucket, name, ...[, ...])

Load or create merged tomography data for given datasets.

get_unbranched_tomography_data(bucket, name, ...)

Load or create merged unbranched actin tomography data for given datasets.

plot_tomography_data_by_dataset(data[, ...])

Plot tomography data for each dataset.

read_tomography_data(file[, label])

Read tomography data from file as dataframe.

rescale_tomography_data(data[, scale_factor])

Rescale tomography data from pixels to um.

sample_tomography_data(data, save_location, ...)

Sample selected columns from tomography data at given resolution.

test_consecutive_segment_angles(polymer_trace)

Test if all angles between consecutive segments of a polymer trace are less than 90 degrees.

TOMOGRAPHY_SAMPLE_COLUMNS: list[str] = ['xpos', 'ypos', 'zpos']

Columns names used when sampling tomography data.

test_consecutive_segment_angles(polymer_trace: ndarray) bool[source]

Test if all angles between consecutive segments of a polymer trace are less than 90 degrees.

Parameters:

polymer_trace – A 2D array where each row is a point in 3D space.

Returns:

True if all consecutive angles are less than 90 degrees, False otherwise.

read_tomography_data(file: str, label: str = 'fil') DataFrame[source]

Read tomography data from file as dataframe.

Parameters:
  • file – Path to tomography data.

  • label – Label for the filament id column.

Returns:

Dataframe of tomography data.

rescale_tomography_data(data: DataFrame, scale_factor: float = 1.0) None[source]

Rescale tomography data from pixels to um.

Parameters:
  • data – Unscaled tomography data.

  • scale_factor – Data scaling factor (pixels to um).

get_branched_tomography_data(bucket: str, name: str, repository: str, datasets: list[tuple[str, str]], scale_factor: float = 1.0) DataFrame[source]

Load or create merged branched actin tomography data for given datasets.

Parameters:
  • bucket – Name of S3 bucket for input and output files.

  • name – Name of dataset.

  • repository – Data repository for downloading tomography data.

  • datasets – Folders and names of branched actin datasets.

  • scale_factor – Data scaling factor (pixels to um).

Returns:

Merged branched tomography data.

get_unbranched_tomography_data(bucket: str, name: str, repository: str, datasets: list[tuple[str, str]], scale_factor: float = 1.0) DataFrame[source]

Load or create merged unbranched actin tomography data for given datasets.

Parameters:
  • bucket – Name of S3 bucket for input and output files.

  • name – Name of dataset.

  • repository – Data repository for downloading tomography data.

  • datasets – Folders and names of branched actin datasets.

  • scale_factor – Data scaling factor (pixels to um).

Returns:

Merged unbranched tomography data.

get_tomography_data(bucket: str, name: str, repository: str, datasets: list[tuple[str, str]], group: str, scale_factor: float = 1.0) DataFrame[source]

Load or create merged tomography data for given datasets.

Parameters:
  • bucket – Name of S3 bucket for input and output files.

  • name – Name of dataset.

  • repository – Data repository for downloading tomography data.

  • datasets – Folders and names of branched actin datasets.

  • group – Actin filament group (“branched” or “unbranched”).

  • scale_factor – Data scaling factor (pixels to um).

Returns:

Merged tomography data.

sample_tomography_data(data: DataFrame, save_location: str, save_key: str, n_monomer_points: int, minimum_points: int, sampled_columns: list[str] = ['xpos', 'ypos', 'zpos'], recalculate: bool = False) DataFrame[source]

Sample selected columns from tomography data at given resolution.

Parameters:
  • data – Tomography data to sample.

  • save_location – Location to save sampled data.

  • save_key – File key for sampled data.

  • n_monomer_points – Number of equally spaced monomer points to sample.

  • minimum_points – Minimum number of points for valid fiber.

  • sampled_columns – List of column names to sample.

  • recalculate – True to recalculate the sampled tomography data, False otherwise.

Returns:

Sampled tomography data.

plot_tomography_data_by_dataset(data: DataFrame, save_location: str | None = None, save_key_template: str = 'tomography_data_%s.png') None[source]

Plot tomography data for each dataset.

Parameters:
  • data – Tomography data.

  • save_location – Location for output file (local path or S3 bucket).

  • save_key_template – Name key template for output file.