diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 46ba1e8b..992ec90f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/README.md b/README.md index ed487fe5..41729d2f 100644 --- a/README.md +++ b/README.md @@ -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`) diff --git a/environment.yml b/environment.yml index 2cbb7f68..28cd9726 100644 --- a/environment.yml +++ b/environment.yml @@ -2,5 +2,5 @@ name: anaconda-client-env channels: - conda-forge dependencies: - - readdy==2.0.9 + - readdy - numpy>=1.20 diff --git a/simulariumio/cytosim/cytosim_converter.py b/simulariumio/cytosim/cytosim_converter.py index a0d43383..76c0414a 100644 --- a/simulariumio/cytosim/cytosim_converter.py +++ b/simulariumio/cytosim/cytosim_converter.py @@ -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 @@ -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) @@ -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}") diff --git a/simulariumio/cytosim/cytosim_data.py b/simulariumio/cytosim/cytosim_data.py index 5caff4d9..6a6e80a2 100644 --- a/simulariumio/cytosim/cytosim_data.py +++ b/simulariumio/cytosim/cytosim_data.py @@ -19,6 +19,7 @@ class CytosimData: meta_data: MetaData draw_fiber_points: bool plots: List[Dict[str, Any]] + center_fibers: bool def __init__( self, @@ -26,6 +27,7 @@ def __init__( 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 @@ -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 diff --git a/simulariumio/tests/converters/test_cytosim_converter.py b/simulariumio/tests/converters/test_cytosim_converter.py index fee4535b..134bed1a 100644 --- a/simulariumio/tests/converters/test_cytosim_converter.py +++ b/simulariumio/tests/converters/test_cytosim_converter.py @@ -30,6 +30,7 @@ ), ) }, + center_fibers=True, ) converter = CytosimConverter(data) results = JsonWriter.format_trajectory_data(converter._data) @@ -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) @@ -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) @@ -328,6 +331,7 @@ def test_agent_ids(): ), ), }, + center_fibers=True, ) # load the data from Cytosim output .txt files cytosim_data = {} @@ -358,6 +362,7 @@ def test_input_file_error(): ), ) }, + center_fibers=True, ) with pytest.raises(InputDataError): CytosimConverter(malformed_data) @@ -374,6 +379,7 @@ def test_input_file_error(): ), ) }, + center_fibers=True, ) with pytest.raises(InputDataError): CytosimConverter(wrong_file)