Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: [3.8, 3.9]
python-version: [3.9, "3.10"]
os: [ubuntu-latest]

steps:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Rendering capabilities planned for future:
## Installation
**Install Requires:**

* Requires Python 3.7, 3.8, or 3.9
* Requires Python 3.9 or 3.10

* If ReaDDy trajectories will be converted, the ReaDDy python package must be installed:
(add conda forge channel if it's not already: `conda config --add channels conda-forge`)
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ name: anaconda-client-env
channels:
- conda-forge
dependencies:
- readdy==2.0.9
- readdy
- numpy>=1.20
5 changes: 4 additions & 1 deletion simulariumio/cytosim/cytosim_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ def _parse_objects(
overall_line: int,
total_lines: int,
scale_factor: float = None,
center_fibers: bool = False,
) -> Tuple[Dict[str, Any], List[int], int]:
"""
Parse a Cytosim output file containing objects
Expand Down Expand Up @@ -277,7 +278,8 @@ def _parse_objects(
result, scale_factor = TrajectoryConverter.scale_agent_data(
result, scale_factor
)
result = TrajectoryConverter.center_fiber_positions(result)
if center_fibers:
result = TrajectoryConverter.center_fiber_positions(result)
result.n_timesteps = time_index + 1
return (result, used_unique_IDs, overall_line, scale_factor)

Expand Down Expand Up @@ -319,6 +321,7 @@ def _read(self, input_data: CytosimData) -> TrajectoryData:
overall_line,
total_lines,
input_data.meta_data.scale_factor,
input_data.center_fibers,
)
except Exception as e:
raise InputDataError(f"Error reading input cytosim data: {e}")
Expand Down
6 changes: 6 additions & 0 deletions simulariumio/cytosim/cytosim_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ class CytosimData:
meta_data: MetaData
draw_fiber_points: bool
plots: List[Dict[str, Any]]
center_fibers: bool

def __init__(
self,
object_info: Dict[str, CytosimObjectInfo],
meta_data: MetaData = None,
draw_fiber_points: bool = False,
plots: List[Dict[str, Any]] = None,
center_fibers: bool = False,
):
"""
This object holds simulation trajectory outputs
Expand All @@ -50,8 +52,12 @@ def __init__(
plots : List[Dict[str, Any]] (optional)
An object containing plot data already
in Simularium format
center_fibers : bool
Set the position of each fiber as the center of its points?
Otherwise set it to zero.
"""
self.object_info = object_info
self.meta_data = meta_data if meta_data is not None else MetaData()
self.draw_fiber_points = draw_fiber_points
self.plots = plots if plots is not None else []
self.center_fibers = center_fibers
6 changes: 6 additions & 0 deletions simulariumio/tests/converters/test_cytosim_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
),
)
},
center_fibers=True,
)
converter = CytosimConverter(data)
results = JsonWriter.format_trajectory_data(converter._data)
Expand Down Expand Up @@ -93,6 +94,7 @@ def test_typeMapping_default(typeMapping, expected_typeMapping):
),
)
},
center_fibers=True,
)
converter_meta_data = CytosimConverter(data_with_metadata)
results_meta_data = JsonWriter.format_trajectory_data(converter_meta_data._data)
Expand Down Expand Up @@ -144,6 +146,7 @@ def test_box_size_provided(box_size, expected_box_size):
},
)
},
center_fibers=True,
)
converter_display_data = CytosimConverter(data_with_display_data)
results_display_data = JsonWriter.format_trajectory_data(converter_display_data._data)
Expand Down Expand Up @@ -328,6 +331,7 @@ def test_agent_ids():
),
),
},
center_fibers=True,
)
# load the data from Cytosim output .txt files
cytosim_data = {}
Expand Down Expand Up @@ -358,6 +362,7 @@ def test_input_file_error():
),
)
},
center_fibers=True,
)
with pytest.raises(InputDataError):
CytosimConverter(malformed_data)
Expand All @@ -374,6 +379,7 @@ def test_input_file_error():
),
)
},
center_fibers=True,
)
with pytest.raises(InputDataError):
CytosimConverter(wrong_file)
Expand Down