def _calc_arrays(self, offset): x0, y0 = self.centre[0], self.centre[1] A, B = self.x_max, self.y_max a, b = self.x_freq, self.y_freq d = self.phase_diff f = lambda t: y0 + A * np.sin(a * 2 * m.pi * (t+offset)/self.num + d) x = f(np.arange(self.num)) f = lambda t: B * np.sin(b * 2 * m.pi * (t+offset)/self.num) y = f(np.arange(self.num)) return x, y
def prepare_arrays(self, index_array): arrays = {} x0, y0 = self.centre[0], self.centre[1] A, B = self.x_max, self.y_max a, b = self.x_freq, self.y_freq d = self.phase_diff fx = lambda t: x0 + A * np.sin(a * 2 * m.pi * t / self.size + d) fy = lambda t: y0 + B * np.sin(b * 2 * m.pi * t / self.size) arrays[self.axes[0]] = fx(index_array) arrays[self.axes[1]] = fy(index_array) return arrays
def prepare_arrays(self, index_array): # parameterise phi with approximation: # phi(t) = k * sqrt(t) (for some k) phi = self.alpha * np.sqrt(index_array + 0.5) arrays = { self.axes[0]: self.centre[0] + self.beta * phi * np.sin(phi), self.axes[1]: self.centre[1] + self.beta * phi * np.cos(phi) } return arrays
def prepare_arrays(self, index_array): arrays = { self.axes[0]: self.centre[0] + self.x_max * np.sin( self.x_freq * self.increment * index_array + self.phase_diff ), self.axes[1]: self.centre[1] + self.y_max * np.sin( self.y_freq * self.increment * index_array ) } return arrays
def prepare_arrays(self, index_array): arrays = {} b = self.beta k = self.alpha size = self.size # parameterise phi with approximation: # phi(t) = k * sqrt(t) (for some k) phi_t = lambda t: k * np.sqrt(t + 0.5) phi = phi_t(index_array) x = self.centre[0] + b * phi * np.sin(phi) y = self.centre[1] + b * phi * np.cos(phi) arrays[self.axes[0]] = x arrays[self.axes[1]] = y return arrays
def _calc_arrays(self, offset): # spiral equation : r = b * phi # scale = 2 * pi * b # parameterise phi with approximation: # phi(t) = k * sqrt(t) (for some k) # number of possible t is solved by sqrt(t) = max_r / b*k b = self.scale / (2 * m.pi) k = m.sqrt(4 * m.pi) # magic scaling factor for our angle steps size = (self.radius) / (b * k) size *= size size = int(size) + 1 # TODO: Why the +1 ??? phi_t = lambda t: k * np.sqrt(t + offset) phi = phi_t(np.arange(size)) x = self.centre[0] + b * phi * np.sin(phi) y = self.centre[1] + b * phi * np.cos(phi) return x, y