-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcurve.py
57 lines (36 loc) · 1014 Bytes
/
curve.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
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
# -*- coding: utf-8 -*-
"""
Define curve generator functions.
The sample data of curve can be easily replaced with numpy array.
When the generation of a curve depends on other curves, the name of the curve is used as a parameter.
The @reg_node decorator will recognizes and stores the dependencies.
This file can be generated from configuration file or written by customers.
"""
from expander import reg_node
from risk import lerp, sincos
import math
import random
@reg_node
def c1():
return [1] * 200
@reg_node
def c2():
return [math.log(x + 1) for x in range(1, 200)]
@reg_node
def c3():
return [random.random() for x in range(200)]
@reg_node
def c4():
return [math.cos(x) for x in range(200)]
@reg_node
def c5():
return [math.sin(x) for x in range(200)]
@reg_node
def c11(c1, c3):
return [x - sincos(y) for x, y in zip(c1, c3)]
@reg_node
def c12(c2, c4):
return [2 * x + lerp(x, y, 0.2) for x, y in zip(c2, c4)]
@reg_node
def c13(c11, c12):
return [1] * 200