Skip to content

Accessing non image data

Joe Futrelle edited this page May 10, 2017 · 9 revisions

Non-image data (a.k.a. ADC data) contains information about each target that includes fluorescence and scattering data as well as technical information such as image size and position. This information is organized into a tabular form. Column names are defined as constants on each sample bin, and can be accessed that way. For example, if a sample bin is stored in a variable called b, the ROI width column number is defined by the constant b.ROI_WIDTH.

ADC data for each sample bin is accessible in two ways:

  1. As a Pandas DataFrame, and
  2. Using a sample bin's dict-like interface

Pandas

For aggregate operations, the most efficient way to use ADC data is using the Pandas interface. This data is accessible as the adc property of each sample bin. This example computes the average "grab time" across all targets in a sample bin:

import numpy as np

adc = sample_bin.adc
cols = sample_bin.schema
np.mean(adc[cols.GRAB_TIME_END] - adc[cols.GRAB_TIME_START])

The ADC DataFrame is indexed by target number.

Excluding targets with no associated image

Not every target is associated with an image. If you want to access a DataFrame that only includes targets with associated images, you can use the images_adc property of a sample bin. This example computes the average image area for a given sample bin:

adc = sample_bin.images_adc
cols = sample_bin.schema
average_area = np.sum(adc[cols.ROI_WIDTH] * adc[cols.ROI_HEIGHT] / len(adc))

Dict-like interface

To access non-image data for a specific target, or to iterate over all targets, you can use a sample bin's dict-like interface. This example computes the area of target number 23 in a sample bin:

target = sample_bin[23]
cols = sample_bin.schema
area = target[cols.ROI_HEIGHT] * target[cols.ROI_WIDTH]

Empty bins

IFCB sometimes generates empty bins (bins with no targets or images). These are valid data. In this case the bin and its adc-related properties will be zero-length. In cases where this might cause unexpected behavior, it is the responsibility of the caller to check for an empty bin.