Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions freegs/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ def triangularityUpper(self, npoints=360):
return (R0 - R_P2) / a

def triangularityLower(self, npoints=360):
"""Calculates plasma upper triangularity, delta_u.
"""Calculates plasma lower triangularity, delta_u.
P4 is the point at the lower extent of the plasma.

tri_l = (R0 - R(P4))/a
Expand All @@ -945,14 +945,14 @@ def triangularityLower(self, npoints=360):
Rlcfs = np.array([i[0] for i in separatrix])
Zlcfs = np.array([i[1] for i in separatrix])

ind_P2 = np.argmax(Zlcfs)
ind_P4 = np.argmin(Zlcfs)

R_P2 = Rlcfs[ind_P2]
R_P4 = Rlcfs[ind_P4]

R0 = self.Rgeometric(npoints=npoints)
a = self.minorRadius(npoints=npoints)

return (R0 - R_P2) / a
return (R0 - R_P4) / a

def triangularity(self, npoints=360):
"""Calculates plasma triangularity, delta.
Expand Down
5 changes: 2 additions & 3 deletions freegs/test_optimiser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def test_quadratic():

# Answer should be close to (1,2)
expected_point = np.array((1, 2))
start_distance = np.sqrt(np.sum((expected_point - start_values)**2))
result_distance = np.sqrt(np.sum((expected_point - result)**2))
start_distance = np.sqrt(np.sum((expected_point - start_values) ** 2))
result_distance = np.sqrt(np.sum((expected_point - result) ** 2))
# It should always get _closer_, even if it doesn't get particularly close
assert result_distance < start_distance
assert np.isclose(result_distance, 0, atol=1e-1)
Expand Down Expand Up @@ -130,7 +130,6 @@ def test_pick_excludes():
def monitor(generation, best, pop):
global best_point
global pop_points
global axis

# Change the color of the previous points
# to grey and light red
Expand Down
Loading