Commit 5ea429c4 authored by Artem Oppermann's avatar Artem Oppermann

initial commit

parent 5fdaeee7
import numpy as np
class Rectangle:
def __init__(self, x, y, width, height):
self.x=x
self.y=y
self.width=width
self.height=height
self.matrix_size=10
self.matrix=self._init_zeros_matrix()
self.fill()
def _init_zeros_matrix(self):
return np.zeros(shape=(self.matrix_size, self.matrix_size), dtype=np.float32)
def add_noise(self):
new_matrix=np.zeros(shape=(self.matrix_size, self.matrix_size), dtype=np.float32)
for i in range(10):
for j in range(10):
new_matrix[i][j]+=self.matrix[i][j]+np.random.poisson(lam=2.0)
return new_matrix
def fill(self):
for i in range(self.width):
for j in range(self.height):
self.matrix[self.x+i][self.y+j]=10.0
def get_matrix(self):
return self.matrix
rect1=Rectangle(0,0,width=3, height=5)
rect1=Rectangle(0,0,width=3, height=5)
recatangle=Rectangle(0,0,width=3, height=5)
recatangle=Rectangle(0,0,width=3, height=5)
rectangles={}
rectangles[0]= Rectangle(0,0,2,2)
rectangles[1]= Rectangle(3,3,2,2)
rectangles[2]= Rectangle(5,5,2,2)
rectangles[3]= Rectangle(7,7,2,2)
rect_data=[]
for i in range(1,10001):
index=i%4
rect_data.append((rectangles[index].add_noise(),index))
with open('data.txt', 'w'):
for datapoint in range(len(rect_data)):
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment