Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- def get_values():
- x = np.arange(-15, 10)
- y = np.empty(30)
- start = np.random.randint(10, 85)
- y[0] = start
- i = 0
- while i < 25:
- if i > 1 and y[i-2] < y[i-1]:
- if np.random.rand() < 0.2:
- y[i + 1] = y[i]
- i = i+1
- continue
- elif np.random.rand() < 0.1:
- y[i + 1] = y[i]
- y[i + 2] = y[i]
- y[i + 3] = y[i]
- i = i+3
- if y[i] >= 100:
- y[i] = np.random.randint(82, 98)
- curr = y[i]
- i += 1
- if curr < np.random.randint(15, 30):
- if np.random.rand() < 0.1:
- y[i] = curr - np.random.randint(4, 6)
- else:
- while y[i] < np.random.randint(70, 98):
- y[i] = y[i - 1] + np.random.randint(25, 35)
- if i > 25:
- break
- if y[i] > 95:
- y[i] = np.random.randint(82, 98)
- i -= 1
- continue
- i += 1
- else:
- y[i] = curr - np.random.randint(3, 10)
- if y[i] >= 100:
- y[i] = np.random.randint(82, 98)
- return x.tolist(), y.tolist()[:25]
- def get_data():
- x, y = get_values()
- return [[i, y if i <= 0 else None, y if i >= 0 else None] for x, y, i in zip(x, y, range(-15,11))]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement