Skip to content

Commit b1951c7

Browse files
committed
fix: Prevent too small ymin
1 parent 909cad9 commit b1951c7

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

src/radiosim/ppdisks/config/fargo/planets.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ def _get_content(self) -> list[str]:
177177
def __repr__(self):
178178
return f"PlanetConfig(name={self.name}, planets={list(self.planets.keys())})"
179179

180-
def get_max_distance(self) -> None:
181-
distances = [planet.distance for planet in self.planets.values()]
182-
return np.max(distances) * self._unit_system.length
180+
def get_distances(self) -> np.ndarray:
181+
return np.array([planet.distance for planet in self.planets.values()])
183182

184183
@classmethod
185184
def get_configs(cls) -> list["PlanetConfig"]:

src/radiosim/ppdisks/simulation.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,11 +262,15 @@ def simulate(
262262
## Mesh Parameters
263263
mesh_parameters = samples["mesh_parameters"]
264264

265+
distances = self._planet_config.get_distances()
266+
265267
param_config["mesh_parameters.ymin"] = (
266-
(mesh_parameters["y_min"] * un.AU).to(self._unit_system.length).value
268+
(np.min([mesh_parameters["y_min"], distances.min()]) * un.AU)
269+
.to(self._unit_system.length)
270+
.value
267271
)
268272

269-
max_orbit_radius = self._planet_config.get_max_distance()
273+
max_orbit_radius = distances.max()
270274
param_config["mesh_parameters.ymax"] = (
271275
mesh_parameters["y_max_ratio"]
272276
* max_orbit_radius.to(self._unit_system.length).value

0 commit comments

Comments
 (0)