convert_to_simularium#
- CAMERA_POSITIONS: dict[str, tuple[float, float, float]] = {'patch': (0.0, -0.5, 900), 'potts': (10.0, 0.0, 200.0)}#
Default camera positions for different simulation types.
- CAMERA_LOOK_AT: dict[str, tuple[float, float, float]] = {'patch': (0.0, -0.2, 0.0), 'potts': (10.0, 0.0, 0.0)}#
Default camera look at positions for different simulation types.
- convert_to_simularium(series_key: str, simulation_type: str, data: pd.DataFrame, length: float, width: float, height: float, ds: tuple[float, float, float], dt: float, colors: dict[str, str], url: str = '', jitter: float = 1.0) str [source]#
Convert data to Simularium trajectory.
- Parameters:
series_key – Simulation series key.
simulation_type – Simulation type.
data – Simulation trajectory data.
length – Bounding box length.
width – Bounding box width.
height – Bounding box height.
ds – Spatial scaling in um/voxel.
dt – Temporal scaling in hours/tick.
colors – Color mapping.
url – Url prefix for meshes.
jitter – Jitter applied to colors.
- Returns:
Simularium trajectory.
- get_meta_data(series_key: str, simulation_type: str, length: float, width: float, height: float, dx: float, dy: float, dz: float) MetaData [source]#
Create MetaData object.
If the simulation type has defined camera settings, those will be used. Otherwise, the global camera defaults will be used.
- Parameters:
series_key – Simulation series key.
simulation_type – Simulation type.
length – Bounding box length.
width – Bounding box width.
height – Bounding box height.
dx – Spatial scaling in the X direction in um/voxel.
dy – Spatial scaling in the Y direction in um/voxel.
dz – Spatial scaling in the Z direction in um/voxel.
- Returns:
MetaData object.
- get_agent_data(data: pd.DataFrame) AgentData [source]#
Create empty AgentData object.
Method uses the “frame”, “name”, and “points” columns in data to generate the AgentData object.
The number of unique entries in the “frame” column determines the total number of frames dimension. The maximum number of entries in the “name” column (for a given frame) determines the maximum number of agents dimension. The maximum number of subpoints is determined by the length of the longest list in the “points” column (which may be zero).
- Parameters:
data – Simulation trajectory data.
- Returns:
AgentData object.
- get_display_data(data: pd.DataFrame, colors: dict[str, str], url: str = '', jitter: float = 1.0) DisplayData [source]#
Create map of DisplayData objects.
Method uses the “name” and “display” columns in data to generate the DisplayData objects.
The “name” column should be a string in one of the following forms:
(index)#(color_key)
(group)#(color_key)#(index)
(group)#(color_key)#(index)#(frame)
where
(index)
becomes DisplayData object name and(color_key)
is passed to the color mapping to select the DisplayData color (optional color jitter may be applied).The “display” column should be a valid
DISPLAY_TYPE
. For theDISPLAY_TYPE.OBJ
type, a URL prefix must be used and names should be in the form(group)#(color_key)#(index)#(frame)
, which is used to generate the full URL formatted as:(url)/(frame)_(group)_(index).MESH.obj
. Note that(frame)
is zero-padded to six digits and(index)
is zero-padded to three digits.- Parameters:
data – Simulation trajectory data.
colors – Color mapping.
url – Url prefix for meshes.
jitter – Jitter applied to colors.
- Returns:
Map of DisplayData objects.
- shade_color(color: str, alpha: float) str [source]#
Shade color by specified alpha.
Positive values of alpha will blend the given color with white (alpha = 1.0 returns pure white), while negative values of alpha will blend the given color with black (alpha = -1.0 returns pure black). An alpha = 0.0 will leave the color unchanged.
- Parameters:
color – Original color as hex string.
alpha – Shading value between -1 and +1.
- Returns:
Shaded color as hex string.