Unnormalizer.emadl 2.34 KB
Newer Older
1
2
3
package dp.subcomponents;

component Unnormalizer {
4
    ports in Q^{14,1,1} normalizedPredictions,
5
6
7
          out Affordance affordance;

    implementation Math {
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
	oldMin = 0.1
	oldMax = 0.9
	oldRange = oldMax - oldMin

	newMin = -0.5
    	newMax = 0.5
    	newRange = newMax - newMin
        affordance.angle = (((normalizedPredictions(0,0,0) - oldMin) * newRange) / oldRange) + newMin
	
	newMin = -7
    	newMax = -2.5
    	newRange = newMax - newMin
	affordance.toMarkingL = (((normalizedPredictions(0,0,1) - oldMin) * newRange) / oldRange) + newMin
	
	newMin = -2
    	newMax = 3.5
    	newRange = newMax - newMin
        affordance.toMarkingM = (((normalizedPredictions(0,0,2) - oldMin) * newRange) / oldRange) + newMin
	
	newMin = 2.5
    	newMax = 7
    	newRange = newMax - newMin
        affordance.toMarkingR = (((normalizedPredictions(0,0,3) - oldMin) * newRange) / oldRange) + newMin
	
	newMin = 0
    	newMax = 75
    	newRange = newMax - newMin
        affordance.distL = (((normalizedPredictions(0,0,4) - oldMin) * newRange) / oldRange) + newMin
        affordance.distR = (((normalizedPredictions(0,0,5) - oldMin) * newRange) / oldRange) + newMin
	
	newMin = -9.5
    	newMax = -4
    	newRange = newMax - newMin
        affordance.toMarkingLL = (((normalizedPredictions(0,0,6) - oldMin) * newRange) / oldRange) + newMin

	newMin = -5.5
    	newMax = -0.5
    	newRange = newMax - newMin
        affordance.toMarkingML = (((normalizedPredictions(0,0,7) - oldMin) * newRange) / oldRange) + newMin
	
	newMin = 0.5
    	newMax = 5.5
    	newRange = newMax - newMin
        affordance.toMarkingMR = (((normalizedPredictions(0,0,8) - oldMin) * newRange) / oldRange) + newMin

	newMin = 4
    	newMax = 9.5
    	newRange = newMax - newMin
        affordance.toMarkingRR = (((normalizedPredictions(0,0,9) - oldMin) * newRange) / oldRange) + newMin
	
	newMin = 0
    	newMax = 75
    	newRange = newMax - newMin
        affordance.distLL = (((normalizedPredictions(0,0,10) - oldMin) * newRange) / oldRange) + newMin
        affordance.distMM = (((normalizedPredictions(0,0,11) - oldMin) * newRange) / oldRange) + newMin
        affordance.distRR = (((normalizedPredictions(0,0,12) - oldMin) * newRange) / oldRange) + newMin

	newMin = 0
    	newMax = 1
    	newRange = newMax - newMin
	affordance.fast = (((normalizedPredictions(0,0,13) - oldMin) * newRange) / oldRange) + newMin
69
    }
70
}