convert_model_units#
- convert_model_units(data: pd.DataFrame, ds: float | None, dt: float | None, regions: list[str] | str | None = None) None [source]#
Convert data from simulation units to true units.
Simulations use spatial unit of voxels and temporal unit of ticks. Spatial resolution (microns/voxel) and temporal resolution (hours/tick) are used to convert data to true units. If spatial or temporal resolution is not given, they will be estimated from the
KEY
column of the data.The following columns are added to the data:
Target column
Source column(s)
Conversion
time
TICK
dt * TICK
volume
NUM_VOXELS
ds * ds * ds * NUM_VOXELS
height
MAX_Z
MIN_Z
ds * (MAX_Z - MIN_Z + 1)
cx
CENTER_X
ds * CENTER_X
cy
CENTER_Y
ds * CENTER_Y
cz
CENTER_Z
ds * CENTER_Z
For each region (other than
DEFAULT
), the following columns are added to the data:Target column
Source column(s)
Conversion
volume.REGION
NUM_VOXELS.REGION
ds * ds * ds * NUM_VOXELS.REGION
height.REGION
MAX_Z.REGION
MIN_Z.REGION
ds * (MAX_Z.REGION - MIN_Z.REGION + 1)
The following property columns are rescaled:
Target column
Source column(s)
Conversion
area
area
ds * ds * area
perimeter
perimeter
ds * perimeter
axis_major_length
axis_major_length
ds * axis_major_length
axis_minor_length
axis_minor_length
ds * axis_minor_length
- Parameters:
data – Simulation data.
ds – Spatial resolution in microns/voxel, use None to estimate from keys.
dt – Temporal resolution in hours/tick, use None to estimate from keys.
regions – List of regions.
- convert_temporal_units(data: pd.DataFrame, dt: float) None [source]#
Convert temporal data from simulation units to true units.
Simulations use temporal unit of ticks. Temporal resolution (hours/tick) is used to convert data to true units.
The following temporal columns are converted:
Target column
Source column(s)
Conversion
time
TICK
dt * TICK
- Parameters:
data – Simulation data.
dt – Temporal resolution in hours/tick.
- convert_spatial_units(data: pd.DataFrame, ds: float, region: str | None = None) None [source]#
Convert spatial data from simulation units to true units.
Simulations use spatial unit of voxels. Spatial resolution (microns/voxel) is used to convert data to true units.
The following spatial columns are converted:
Target column
Source column(s)
Conversion
volume
NUM_VOXELS
ds * ds * ds * NUM_VOXELS
height
MAX_Z
MIN_Z
ds * (MAX_Z - MIN_Z + 1)
cx
CENTER_X
ds * CENTER_X
cy
CENTER_Y
ds * CENTER_Y
cz
CENTER_Z
ds * CENTER_Z
area
area
ds * ds * area
perimeter
perimeter
ds * perimeter
axis_major_length
axis_major_length
ds * axis_major_length
axis_minor_length
axis_minor_length
ds * axis_minor_length
Note that the centroid columns (
cx
,cy
, andcz
) are only converted for the entire cell (region == None
).- Parameters:
data – Simulation data.
ds – Spatial resolution in microns/voxel.
region – Name of region.
- estimate_temporal_resolution(key: str) float [source]#
Estimate temporal resolution based on condition key.
If the key contains
DT##
, where##
denotes the temporal resolution in minutes/tick, temporal resolution is estimated from##
. Otherwise, the default temporal resolution is 1 hours/tick.- Parameters:
key – Condition key.
- Returns:
Temporal resolution (hours/tick).
- estimate_spatial_resolution(key: str) float [source]#
Estimate spatial resolution based on condition key.
If the key contains
DS##
, where##
denotes the spatial resolution in micron/voxel, spatial resolution is estimated from##
. Otherwise, the default spatial resolution is 1 micron/voxel.- Parameters:
key – Condition key.
- Returns:
Spatial resolution (micron/voxel).