mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Minor change.
parent
52c4eec72a
commit
fcc31f22e7
|
|
@ -1,5 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
|
||||
class Profile(object):
|
||||
def __init__(self, num: int = 0,
|
||||
kp:float = 0.0, name:str = "",
|
||||
|
|
@ -102,3 +104,7 @@ class Profile(object):
|
|||
"""
|
||||
return [point for point in self._points
|
||||
if point.point_is_named()]
|
||||
|
||||
# Abstract method, must be implemented for in non abstract class
|
||||
def get_station(self):
|
||||
raise NotImplementedMethodeError(self, self.get_station)
|
||||
|
|
|
|||
|
|
@ -179,6 +179,26 @@ class ProfileXYZ(Profile):
|
|||
"""
|
||||
return [x for x in lst if not np.isnan(x)]
|
||||
|
||||
def _first_point_not_nan(self):
|
||||
first_point = self._points[0]
|
||||
|
||||
for point in self._points:
|
||||
if not point.is_nan():
|
||||
first_point = point
|
||||
break
|
||||
|
||||
return first_point
|
||||
|
||||
def _last_point_not_nan(self):
|
||||
last_point = self._points[-1]
|
||||
|
||||
for point in self._points[::-1]:
|
||||
if not point.is_nan():
|
||||
last_point = point
|
||||
break
|
||||
|
||||
return last_point
|
||||
|
||||
def get_station(self) -> np.ndarray:
|
||||
"""Projection of the points of the profile on a plane.
|
||||
|
||||
|
|
@ -249,23 +269,3 @@ class ProfileXYZ(Profile):
|
|||
constant = ret[index_profile_z_min]
|
||||
|
||||
return (ret - constant)
|
||||
|
||||
def _first_point_not_nan(self):
|
||||
first_point = self._points[0]
|
||||
|
||||
for point in self._points:
|
||||
if not point.is_nan():
|
||||
first_point = point
|
||||
break
|
||||
|
||||
return first_point
|
||||
|
||||
def _last_point_not_nan(self):
|
||||
last_point = self._points[-1]
|
||||
|
||||
for point in self._points[::-1]:
|
||||
if not point.is_nan():
|
||||
last_point = point
|
||||
break
|
||||
|
||||
return last_point
|
||||
|
|
|
|||
Loading…
Reference in New Issue