Skip to content

Commit

Permalink
Add docstrings to convert to projection task
Browse files Browse the repository at this point in the history
  • Loading branch information
jessicasyu committed Sep 18, 2024
1 parent 95f9d85 commit 835790e
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 6 deletions.
68 changes: 68 additions & 0 deletions src/arcade_collection/convert/convert_to_projection.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,36 @@ def convert_to_projection(
scale: int,
colors: dict[str, str],
) -> mpl.figure.Figure:
"""
Convert data to projection figure.
Parameters
----------
series_key
Simulation series key.
locations_tar
Archive of location data.
frame
Frame number.
regions
List of regions.
box
Size of bounding box.
ds
Spatial scaling in um/voxel.
dt
Temporal scaling in hours/tick.
scale
Size of scale bar (in um).
colors
Map of region to colors.
Returns
-------
:
Projection figure.
"""

fig = plt.figure(figsize=(10, 10), constrained_layout=True)
length, width, height = box

Expand Down Expand Up @@ -73,6 +103,25 @@ def convert_to_projection(
def add_frame_timestamp(
ax: mpl.axes.Axes, length: int, width: int, dt: float, frame: int, color: str
) -> None:
"""
Add a frame timestamp to figure axes.
Parameters
----------
ax
Axes object.
length
Length of bounding box.
width
Width of bounding box.
dt
Temporal scaling in hours/tick.
frame
Frame number.
color
Timestamp color.
"""

hours, minutes = divmod(round(frame * dt, 2), 1)
timestamp = f"{int(hours):02d}H:{round(minutes*60):02d}M"

Expand All @@ -90,6 +139,25 @@ def add_frame_timestamp(
def add_frame_scalebar(
ax: mpl.axes.Axes, length: int, width: int, ds: float, scale: int, color: str
) -> None:
"""
Add a frame scalebar to figure axes.
Parameters
----------
ax
Axes object.
length
Length of bounding box.
width
Width of bounding box.
ds
Spatial scaling in um/voxel.
scale
Size of scale bar (in um).
color
Scalebar color.
"""

scalebar = scale / ds

ax.add_patch(
Expand Down
8 changes: 4 additions & 4 deletions src/arcade_collection/convert/convert_to_simularium.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def convert_to_simularium(
height
Bounding box height.
ds
Spatial scaling in units/um.
Spatial scaling in um/voxel.
dt
Temporal scaling in hours/tick.
colors
Expand Down Expand Up @@ -150,11 +150,11 @@ def get_meta_data(
height
Bounding box height.
dx
Spatial scaling in the X direction in units/um.
Spatial scaling in the X direction in um/voxel.
dy
Spatial scaling in the Y direction in units/um.
Spatial scaling in the Y direction in um/voxel.
dz
Spatial scaling in the Z direction in units/um.
Spatial scaling in the Z direction in um/voxel.
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def convert_to_simularium_objects(
box
Size of bounding box.
ds
Spatial scaling in units/um.
Spatial scaling in um/voxel.
dt
Temporal scaling in hours/tick.
colors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def convert_to_simularium_shapes(
box
Size of bounding box.
ds
Spatial scaling in units/um.
Spatial scaling in um/voxel.
dt
Temporal scaling in hours/tick.
colors
Expand Down

0 comments on commit 835790e

Please sign in to comment.