diff --git a/tracepy/geometry.py b/tracepy/geometry.py index c295d00..b4ab5f0 100644 --- a/tracepy/geometry.py +++ b/tracepy/geometry.py @@ -86,8 +86,12 @@ def check_params(self) -> None: if self.kappa is None: raise Exception("Specify a kappa for this conic.") elif self.kappa > 0: - print("Warning: Specified c value is not used when kappa>0") - self.c = np.sqrt(1 / (self.kappa * pow(self.Diam / 2., 2))) + if pow(self.Diam / 2., 2) > 1/(self.kappa*pow(self.c, 2)): + print("Warning: Specified c value had to be changed in accordance with the conditions of the conic euqation.") + if self.c > 0: + self.c = np.sqrt(1 / (self.kappa * pow(self.Diam / 2., 2))) + elif self.c < 0: + self.c = -np.sqrt(1 / (self.kappa * pow(self.Diam / 2., 2))) elif self.c == 0 and self.kappa is None: # Used for planes, does not affect calculations. self.kappa = 1. @@ -212,4 +216,4 @@ def conics_plot(self, point: np.ndarray) -> np.ndarray: if self.kappa is None: raise ValueError("kappa must not be None for conic plot calculations") function[~nan_idx] = self.c * pow(rho, 2) / (1 + pow((1 - self.kappa * pow(self.c, 2) * pow(rho, 2)), 0.5)) - return function \ No newline at end of file + return function