def __init__(self, screen, initial_pos): pygame.sprite.Sprite.__init__(self) self.images = load_images(['Turret1.bmp', 'Turret2.bmp', 'Turret3.bmp', 'Turret4.bmp'], -1) self.flashImages = load_images(['Fire1.bmp', 'Fire2.bmp', 'Fire3.bmp', 'Fire4.bmp'], -1) self.flash = 0 self.image = self.images[0] self.rect = self.image.get_rect() self.rect.center = initial_pos self.rotationCounter = 360 self.rotationOffset = 0 self.isShooting = 0 self.shells = pygame.sprite.Group() # self.isFlashing = 0 self.screen = screen
def __init__(self, screen, initial_pos): pygame.sprite.Sprite.__init__(self) self.images = load_images( ['Turret1.bmp', 'Turret2.bmp', 'Turret3.bmp', 'Turret4.bmp'], -1) self.flashImages = load_images( ['Fire1.bmp', 'Fire2.bmp', 'Fire3.bmp', 'Fire4.bmp'], -1) self.flash = 0 self.image = self.images[0] self.rect = self.image.get_rect() self.rect.center = initial_pos self.rotationCounter = 360 self.rotationOffset = 0 self.isShooting = 0 self.shells = pygame.sprite.Group() # self.isFlashing = 0 self.screen = screen
def __init__(self, initial_pos): pygame.sprite.Sprite.__init__(self) self.images = load_images( ['Turret1.bmp', 'Turret2.bmp', 'Turret3.bmp', 'Turret4.bmp'], -1) self.image = self.images[0] self.rect = self.image.get_rect() self.rect.center = initial_pos self.rotationCounter = 360
def __init__(self, screen, initial_pos): pygame.sprite.Sprite.__init__(self) self.images = load_images(['TankBase1.bmp','TankBase2.bmp','TankBase3.bmp','TankBase4.bmp'], -1) self.explosion = SpriteStripAnim('Explode3.bmp', (0,0,48,48), 4, -1, True, 10) + SpriteStripAnim('Explode3.bmp', (48,48,48,48), 4, -1, True, 10), self.image = self.images[0] self.rect = self.image.get_rect() self.rect.center = initial_pos self.turret = Turret(screen, initial_pos) self.rotationCounter = 360 self.screen = screen
def __init__(self, screen, initial_pos): pygame.sprite.Sprite.__init__(self) self.images = load_images([ 'TankBase1.bmp', 'TankBase2.bmp', 'TankBase3.bmp', 'TankBase4.bmp' ], -1) self.explosion = SpriteStripAnim( 'Explode3.bmp', (0, 0, 48, 48), 4, -1, True, 10) + SpriteStripAnim( 'Explode3.bmp', (48, 48, 48, 48), 4, -1, True, 10), self.image = self.images[0] self.rect = self.image.get_rect() self.rect.center = initial_pos self.turret = Turret(screen, initial_pos) self.rotationCounter = 360 self.screen = screen
def gen_whitening_nodes(patchDim, imgNr4wnodes = 10000): rawImages = load_images() x = sample_images(rawImages, imgNr4wnodes, patchDim) x = log(x+2) x = x - repmat(mean(x,0),imgNr4wnodes,1).reshape(imgNr4wnodes, patchDim, patchDim) x = x.reshape(imgNr4wnodes, patchDim**2) sigma = cov(x.T) lambd, U = linalg.eig(sigma) wnode = (dot(U, dot(diag(lambd ** (-.5)), U.T))).real savetxt('wnodes_%d.txt' %(patchDim ** 2), wnode) return
import numpy as np import random import matplotlib.pyplot as plt import matplotlib.image as mpimg import numba import os from skimage import color import time from celluloid import Camera t1 = time.time() """initialize global variables""" gv.init() """load images and process""" load_images("../images") convert_im_to_I() """set up adjacency matrix and tensors for neuro and astro networks""" neuro_connection() # set up neuronal connections neuroastro_connection() astroneuro_connection() """ fig = plt.figure() camera = Camera(fig) for step in range(1, num_steps): step_V_U(step, gv.images[0].T)