Skip to content

Commit 08ec8dc

Browse files
committed
Update find_cross_point_between_parabolas
1 parent e92da77 commit 08ec8dc

File tree

2 files changed

+6
-18
lines changed

2 files changed

+6
-18
lines changed

discorpy/losa/loadersaver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
3232
"""
3333

34-
import os
3534
import platform
3635
from pathlib import Path
3736
import h5py
@@ -55,6 +54,7 @@ def __correct_path(file_path):
5554
'\r': r'\r',
5655
'\t': r'\t',
5756
'\v': r'\v',
57+
'\0': r'\0',
5858
}
5959
for char, escaped in escape_sequences.items():
6060
if char in file_path:

discorpy/proc/processing.py

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -780,24 +780,12 @@ def _find_cross_point_between_parabolas(para_coef_hor, para_coef_ver):
780780
"""
781781
a1, b1, c1 = para_coef_hor[0:3]
782782
a2, b2, c2 = para_coef_ver[0:3]
783-
# coefs = [a1 ** 2 * a2, 2 * a1 * a2 * b1,
784-
# a2 * b1 ** 2 + a1 * b2 + 2 * a1 * a2 * c1,
785-
# -1 + b1 * b2 + 2 * a2 * b1 * c1,
786-
# b2 * c1 + a2 * c1 ** 2 + c2]
787-
# xvals = np.float32(np.real(np.roots(coefs)))
788-
# if len(xvals) == 0:
789-
# raise ValueError("Can't find a cross point between two parabolas")
790-
# if len(xvals) > 1:
791-
# x = xvals[np.argmin(np.abs(xvals - c2))]
792-
# else:
793-
# x = xvals[0]
794-
# y = a1 * x ** 2 + b1 * x + c1
795-
796-
def equations(p):
797-
x, y = p
783+
784+
def __equations(vals):
785+
x, y = vals
798786
return a1 * x ** 2 + b1 * x + c1 - y, a2 * y ** 2 + b2 * y + c2 - x
799-
solution = optimize.fsolve(equations, (0, 0))
800-
x, y = solution
787+
788+
x, y = optimize.fsolve(__equations, (0, 0))
801789
return x, y
802790

803791

0 commit comments

Comments
 (0)