-
Notifications
You must be signed in to change notification settings - Fork 14
/
feature_test23.py
32 lines (25 loc) · 1.03 KB
/
feature_test23.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Test2 and Test3 feature extractors."""
from laserchicken.feature_extractor.abc import AbstractFeatureExtractor
from laserchicken import utils
class Test2FeatureExtractor(AbstractFeatureExtractor):
@classmethod
def requires(cls):
return ['test1_b']
@classmethod
def provides(cls):
return ['test2_a', 'test2_b', 'test2_c']
def extract(self,sourcepc,neighborhood,targetpc,targetindex):
t1b = utils.get_feature(targetpc,targetindex,self.requires()[0])
x,y,z = utils.get_point(targetpc,targetindex)
return [x + t1b,y + t1b,z + t1b] # x + 3z/2, y + 3z/2, 5z/2
class Test3FeatureExtractor(AbstractFeatureExtractor):
@classmethod
def requires(cls):
return ['test1_a', 'test2_c']
@classmethod
def provides(cls):
return ['test3_a']
def extract(self,sourcepc,neighborhood,targetpc,targetindex):
t2a,t2c = utils.get_features(targetpc,targetindex,self.requires())
x,y,z = utils.get_point(targetpc,targetindex)
return t2c - t2a - z # z