Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions tracepy/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
return function