diff --git a/kwave/options/simulation_execution_options.py b/kwave/options/simulation_execution_options.py index 7e46bc3c..07b4ab5b 100644 --- a/kwave/options/simulation_execution_options.py +++ b/kwave/options/simulation_execution_options.py @@ -156,7 +156,7 @@ def get_options_string(self, sensor: kSensor) -> str: if self.device_num is not None: options_list.append(f" -g {self.device_num}") - if self.num_threads is not None: + if self.num_threads is not None and PLATFORM != "windows": options_list.append(f" -t {self.num_threads}") if self.verbose_level > 0: diff --git a/tests/test_simulation_execution_options.py b/tests/test_simulation_execution_options.py index efaeda0b..1646bcce 100644 --- a/tests/test_simulation_execution_options.py +++ b/tests/test_simulation_execution_options.py @@ -86,7 +86,35 @@ def test_binary_name_extension_on_windows(self): options = SimulationExecutionOptions() self.assertTrue(options.binary_name.endswith(".exe")) - def test_get_options_string(self): + @patch("kwave.options.simulation_execution_options.PLATFORM", "darwin") + def test_get_options_string_darwin(self): + """Test the get_options_string method with a mock sensor.""" + options = self.default_options + options.device_num = 1 + options.num_threads = os.cpu_count() + options.verbose_level = 2 + + options_string = options.get_options_string(self.mock_sensor) + expected_substrings = [" -g 1", f" -t {os.cpu_count()}", " --verbose 2", " --p_raw", " --u_max", " -s 10"] + for substring in expected_substrings: + self.assertIn(substring, options_string) + + @patch("kwave.options.simulation_execution_options.PLATFORM", "windows") + def test_get_options_string_windows(self): + """Test the get_options_string method with a mock sensor.""" + options = self.default_options + options.device_num = 1 + options.num_threads = os.cpu_count() + options.verbose_level = 2 + + options_string = options.get_options_string(self.mock_sensor) + expected_substrings = [" -g 1", " --verbose 2", " --p_raw", " --u_max", " -s 10"] + for substring in expected_substrings: + self.assertIn(substring, options_string) + self.assertNotIn(f" -t {os.cpu_count()}", expected_substrings) + + @patch("kwave.options.simulation_execution_options.PLATFORM", "linux") + def test_get_options_string_linux(self): """Test the get_options_string method with a mock sensor.""" options = self.default_options options.device_num = 1