Skip to content

Commit 89d605d

Browse files
committed
Bunch of CI-demanded fixes.
1 parent 6acf3b4 commit 89d605d

5 files changed

Lines changed: 340 additions & 320 deletions

File tree

examples/jaxfluids/test_jaxfluids_env.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
are part of the observation
4747
- is_scale_observations: Optional. Boolean indicating whether observations are scaled to [0, 1].
4848
- target_fn: Optional. Target thrust vector function. Choose either 'sine' or 'step'.
49-
49+
5050
The Nozzle3D environment has the following additional arguments:
5151
- num_actuators: Required. Integer number of actuators. Must be between 4 and 12.
5252
- secondary_pressure_ratio: Optional. Float, must be between 0.7 and 0.9.
@@ -57,7 +57,7 @@
5757
are part of the observation
5858
- is_scale_observations: Optional. Boolean indicating whether observations are scaled to [0, 1].
5959
- target_fn: Optional. Target thrust vector function. Choose either 'sine' or 'step'.
60-
60+
6161
"""
6262

6363
import os
@@ -77,7 +77,6 @@ def main():
7777
env.render()
7878

7979
for i in range(1000):
80-
8180
# Random action
8281
# action = env.action_space.sample()
8382

@@ -97,4 +96,3 @@ def main():
9796

9897
if __name__ == "__main__":
9998
main()
100-

hydrogym/jaxfluids/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from .envs.nozzle import Nozzle2D, Nozzle3D
1+
from .envs.nozzle import Nozzle2D, Nozzle3D

hydrogym/jaxfluids/env_core.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,8 @@ class JAXFluidsFlowEnv(JAXFluidsEnv):
3434
"""
3535

3636
def _init_from_hf(self, env_config: dict) -> None:
37-
3837
# Initialize HF data manager
39-
self.hf_repo_id = env_config.get(
40-
"hf_repo_id", "dynamicslab/HydroGym-environments"
41-
)
38+
self.hf_repo_id = env_config.get("hf_repo_id", "dynamicslab/HydroGym-environments")
4239
self.local_fallback_dir = env_config.get("local_fallback_dir", None)
4340
self.use_clean_cache = env_config.get("use_clean_cache", True)
4441

@@ -59,9 +56,7 @@ def _init_from_hf(self, env_config: dict) -> None:
5956
self.env_data_path = self._setup_environment_data()
6057

6158
# Resolve and load configuration file
62-
self.configuration_file = self._resolve_configuration_file(
63-
env_config.get("configuration_file")
64-
)
59+
self.configuration_file = self._resolve_configuration_file(env_config.get("configuration_file"))
6560

6661
if not self.configuration_file:
6762
raise ConfigError(
@@ -96,13 +91,9 @@ def _setup_environment_data(self) -> str:
9691
print(f"Using environment data from: {env_path}")
9792
return env_path
9893
except Exception as e:
99-
raise ConfigError(
100-
f"Failed to setup environment data for {self.environment_name}: {e}"
101-
)
94+
raise ConfigError(f"Failed to setup environment data for {self.environment_name}: {e}")
10295

103-
def _resolve_configuration_file(
104-
self, config_file_input: Optional[str]
105-
) -> Optional[str]:
96+
def _resolve_configuration_file(self, config_file_input: Optional[str]) -> Optional[str]:
10697
"""
10798
Resolve configuration file path from various input formats.
10899
@@ -189,9 +180,7 @@ def _find_configuration_file(self) -> Optional[str]:
189180
for pattern in config_patterns:
190181
matches = glob.glob(os.path.join(self.env_data_path, pattern))
191182
if matches:
192-
print(
193-
f"Auto-detected configuration file: {os.path.basename(matches[0])}"
194-
)
183+
print(f"Auto-detected configuration file: {os.path.basename(matches[0])}")
195184
return matches[0]
196185

197186
# Not found
@@ -200,4 +189,3 @@ def _find_configuration_file(self) -> Optional[str]:
200189
print(f"Available files: {os.listdir(self.env_data_path)}")
201190

202191
return None
203-

0 commit comments

Comments
 (0)