def apply(self): ########################################################################### if (self.__new_mode is not None): # DrawCommand has the right to change draw mode _set_draw_mode(self.__new_mode) engine().interface().draw() # redraw
def interact(self): ########################################################################### # Enter loop for this turn while (self._end_turns == 0): # Watch for pygame events. for event in pygame.event.get(): if (event.type == pygame.QUIT): engine().quit() break elif (event.type == pygame.MOUSEBUTTONDOWN): try: button1, button2, button3 = pygame.mouse.get_pressed() mouse_pos = pygame.mouse.get_pos() command_str = self.__drawer.clicked( mouse_pos, button1, button2, button3) if (command_str is not None): print command_str command = CommandFactory.parse_command(command_str) command.apply() self.__flush_spell_report_buffer() except UserError, error: self.__drawer.popup("Error", error) # Successful commands should redraw if (command_str is not None): self.draw()
def get(self, people_id=None): if people_id: res = engine().execute(self.sel_con, {'people_id': people_id}) else: res = engine().execute(self.sel) return dump(res)
def help(cls, extra_args=None): ########################################################################### if (_is_text_interface()): full_usage = "%s Learnable spells:\n" % cls._TEXT_USAGE # Add info on learnable spells to usage string for spell_name, spell_level in engine().player().learnable(): full_usage += " %s%s\n" % (spell_name, "" if spell_level == 1 else " (new)") return _create_text_help_str(cls, full_usage) else: prequire(extra_args is not None and len(extra_args) == 1, "Expect spell name in extra_args") spell_name = extra_args[0] spell = SpellFactory.create_spell(spell_name) help_str = cls._GRAPHICAL_USAGE help_str += "\nDescription of %s spell:\n" % spell_name help_str += spell.info() + "\n" help_str += "Player has skill level %d in this spell\n" % \ engine().player().spell_skill(spell_name) return help_str
def play(postfn=None): global score, cities score = 0 cities = NCITIES engine.add_obj(Ground(MINX, GROUNDY, MAXX, MINY)) draw_score() draw_stars() # we built this city on rock and roll xcoords = list(range(MINX, MAXX, WIDTH // (NCITIES+1)))[1:-1] for x in xcoords: engine.add_obj(City(x, GROUNDY)) engine.add_random_event(NEWENEMYPROB, newenemy_cb) engine.register_collision(City, Enemy, coll_city1) engine.register_collision(Enemy, City, coll_city2) engine.register_collision(Ground, Enemy, coll_ground1) engine.register_collision(Enemy, Ground, coll_ground2) engine.register_collision(Enemy, Missile, coll_air2air) engine.register_collision(Missile, Enemy, coll_air2air) engine.register_collision(Ground, Missile, coll_groundnoboom1) engine.register_collision(Missile, Ground, coll_groundnoboom2) if postfn: postfn() engine.engine()
def play(postfn=None): global s, score s = S() score = 0 engine.add_obj(Ground(MINX, GROUNDY, MAXX, MINY)) engine.add_random_event(0.002, Holes_cb) engine.add_random_event(0.007, Rocks_cb) engine.register_collision(Me, Holes, coll_Me) engine.register_collision(Holes, Me, coll_Me2) engine.register_collision(Me, Rocks, coll_Me) engine.register_collision(Rocks, Me, coll_Me2) engine.register_collision(Me, Rocks, coll_Me) engine.register_collision(Rocks, Me, coll_Me) engine.register_collision(missileside, Rocks, coll_missile) engine.register_collision(Rocks, missileside, coll_missile) draw_stars() draw_score() s.me = Me() engine.add_obj(s.me) s.playing = True if postfn: postfn() engine.engine()
def get(self, doctor_id=None): if doctor_id: res = engine().execute(self.sel_con, {'doctor_id': doctor_id}) else: res = engine().execute(self.sel) return dump(res)
def play(postfn=None): global score, cities score = 0 cities = NCITIES engine.add_obj(Ground(MINX, GROUNDY, MAXX, MINY)) draw_score() draw_stars() # we built this city on rock and roll xcoords = list(range(MINX, MAXX, WIDTH // (NCITIES + 1)))[1:-1] for x in xcoords: engine.add_obj(City(x, GROUNDY)) engine.add_random_event(NEWENEMYPROB, newenemy_cb) engine.register_collision(City, Enemy, coll_city1) engine.register_collision(Enemy, City, coll_city2) engine.register_collision(Ground, Enemy, coll_ground1) engine.register_collision(Enemy, Ground, coll_ground2) engine.register_collision(Enemy, Missile, coll_air2air) engine.register_collision(Missile, Enemy, coll_air2air) engine.register_collision(Ground, Missile, coll_groundnoboom1) engine.register_collision(Missile, Ground, coll_groundnoboom2) if postfn: postfn() engine.engine()
def get(self, treatment_id=None): if treatment_id: res = engine().execute(self.sel_con, {'treatment_id': treatment_id}) else: res = engine().execute(self.sel) return dump(res)
def graphitem(zart, sortfield, **kwargs): """This command retrieves graphitems.""" zart.command = 'graphitem' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def hostinterface(zart, sortfield, **kwargs): """This command retrieves hostinterfaces.""" zart.command = 'hostinterface' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def templatescreen(zart, sortfield, **kwargs): """This command retrieves templatescreens.""" zart.command = 'templatescreen' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def dashboard(zart, sortfield, **kwargs): """This command retrieves dashboards.""" zart.command = 'dashboard' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def action(zart, sortfield, **kwargs): """This command retrieves actions.""" zart.command = 'action' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def triggerprototype(zart, sortfield, **kwargs): """This command retrieves triggerprototypes.""" zart.command = 'triggerprototype' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def usermedia(zart, sortfield, **kwargs): """This command retrieves usermedias.""" zart.command = 'usermedia' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def script(zart, sortfield, **kwargs): """This command retrieves scripts.""" zart.command = 'script' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def discoveryrule(zart, sortfield, **kwargs): """This command retrieves discoveryrules.""" zart.command = 'discoveryrule' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def valuemap(zart, sortfield, **kwargs): """This command retrieves valuemaps.""" zart.command = 'valuemap' logging.debug('zart.command: %s', zart.command) if sortfield: kwargs['sortfield'] = sortfield logging.debug('kwargs[\'sortfield\']: %s', kwargs['sortfield']) logging.debug(kwargs) engine.engine(zart, **kwargs)
def apply(self): ########################################################################### player = engine().player() if (self.__exp is not None): exp_gained = self.__exp else: exp_gained = player.next_level_cost() - player.exp() engine().player().gain_exp(exp_gained)
def get(self, treatment_id=None, people_id=None): if treatment_id: res = engine().execute(self.sel_treatment, {'treatment_id': treatment_id}) elif people_id: res = engine().execute(self.sel_people, {'people_id': people_id}) else: res = engine().execute(self.sel) return dump(res)
def play(): global s s = S() engine.init_engine() engine.set_keyboard_handler(input_cb) engine.set_mouse_handler(fire_cb) s.me = Me() engine.add_obj(s.me) s.playing = True engine.engine()
def start(): pygame.mixer.music.load('music\\third_level.mp3') pygame.mixer.music.play() fon = load_image('headpiece2.png') screen.blit(fon, (0, 0)) while True: for event in pygame.event.get(): if event.type == pygame.QUIT: terminate() if event.type == pygame.KEYDOWN or event.type == pygame.MOUSEBUTTONDOWN: engine() pygame.display.flip() clock.tick(FPS)
def play(): global s s = S() engine.init_engine() engine.set_keyboard_handler(input_cb) engine.add_random_event(1.0, newpipe_cb) engine.register_collision(Me, Pipe, coll_cb) engine.register_collision(Pipe, Me, coll_cb2) s.me = Me() engine.add_obj(s.me) s.playing = True engine.engine()
def upload_and_classify(): if request.method == 'POST': # check if the post request has the file part if 'file' not in request.files: flash('No file part') return redirect(url_for('assess')) file = request.files['file'] # if user does not select file, browser also # submit a empty part without filename if file.filename == '': flash('No selected file') return redirect(url_for('assess')) if file and allowed_file(file.filename): filename = secure_filename(file.filename) # used to secure a filename before storing it directly on the filesystem file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) # return redirect(url_for('uploaded_file', # filename=filename)) filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename) model_results = engine.engine(filepath) return render_template('results.html', result=model_results, scroll='third', filename=filename) flash('Invalid file format - please try your upload again.') return redirect(url_for('assess'))
def draw(self): ########################################################################### # Begin draw cycle self.__drawer.begin_draw() # Draw world self.__drawer.draw(engine().world()) # Draw Player self.__drawer.draw(engine().player()) # Draw AI Player self.__drawer.draw(engine().ai_player()) # End draw cycle self.__drawer.end_draw()
def draw(self): ########################################################################### clear_screen() # Draw world self.__drawer.draw(engine().world()) # Draw Player self.__drawer.draw(engine().player()) print # Draw AI Player self.__drawer.draw(engine().ai_player()) print sys.stdout.flush()
def __cycle_turn_impl(self): ########################################################################### check_access(self.ALLOW_CYCLE_TURN) cls = self.__class__ world = engine().world() cities_orig = list(world.cities()) # Manage cities. Note that this may cause additional cities to # be created, which is why we needed the list copy above for city in cities_orig: city.cycle_turn() # Adjust tech based on population tech_points = cls.__TECH_POINT_FUNC(self.population()) self.__tech_points += tech_points # Check if level-up in tech while (self.__tech_points >= self.__next_tech_level_cost): self.__tech_level += 1 self.__tech_points -= self.__next_tech_level_cost # rollover points self.__next_tech_level_cost = \ cls.__TECH_NEXT_LEVEL_COST_FUNC(self.tech_level()) # Tech invariants prequire(self.__tech_points < self.__next_tech_level_cost, "Expect tech-points(", self.__tech_points, ") < tech-cost(", self.__next_tech_level_cost, ")")
def upload_and_classify(): if request.method == 'POST': if 'file' not in request.files: flash('No file part') return redirect(url_for('assess')) file = request.files['file'] if file.filename == '': flash('No selected file') return redirect(url_for('assess')) if file and allowed_file(file.filename): filename = secure_filename( file.filename ) # used to secure a filename before storing it directly on the filesystem file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename) model_results = engine.engine(filepath) return render_template('results.html', result=model_results, filename=filename) flash('Invalid file format - please try your upload again.') return redirect(url_for('assess'))
def _compute_nearby_food_and_prod_tiles(location, filter_tiles_near_other_cities=False): ############################################################################### """ Returns a 2-ple of (food-tiles, production-tiles); both lists are sorted from highest to lowest based on yield. Only unworked tiles are added. """ world = engine().world() food_tiles = [] # sorted highest to lowest prod_tiles = [] # sorted highest to lowest row, col = location.unpack() for row_delta in xrange(-1, 2): for col_delta in xrange(-1, 2): # Cannot work tile that has city if (row_delta != 0 or col_delta != 0): loc_delta = Location(row + row_delta, col + col_delta) if (world.in_bounds(loc_delta) and not (filter_tiles_near_other_cities and _is_too_close_to_any_city(loc_delta, 1))): tile = world.tile(loc_delta) prequire( not (filter_tiles_near_other_cities and tile.worked()), "How can tile be worked if it's not near a city") if (not tile.worked()): if (tile.yield_().food > 0): _ordered_insert(food_tiles, tile) else: _ordered_insert(prod_tiles, tile) return food_tiles, prod_tiles
def start_game(): global score engine.init_engine() engine.set_keyboard_handler(keyboard_cb) # Adds Ground and Car and Mountains engine.add_obj(Mountain('Mountain2', 'ivory4', (-SPEED/4))) engine.add_obj(Mountain('Mountain1', 'bisque', (-SPEED/2))) engine.add_obj(Ground(MIN_X, GROUND_Y, MAX_X, MIN_Y)) engine.add_obj(Car()) # Adds Wheels engine.add_obj(Wheel(2, GROUND_Y, -3)) engine.add_obj(Wheel(15, GROUND_Y, 3)) engine.add_obj(Wheel(28, GROUND_Y, -3)) # Random Events engine.add_random_event(0.006, hole_cb) engine.add_random_event(0.007, turtle_cb) engine.add_random_event(0.004, UFO_cb) # Collision Detection engine.register_collision(Car, Hole, hole_collision_cb) engine.register_collision(Hole, Car, hole_collision_cb2) engine.register_collision(Car, EnemyTurtle, turt_collision_cb) engine.register_collision(EnemyTurtle, Car, turt_collision_cb2) engine.register_collision(MissileRight, EnemyTurtle, miss_turt_collision_cb) engine.register_collision(EnemyTurtle, MissileRight, miss_turt_collision_cb2) engine.register_collision(MissleVertical, UFO, miss_ufo_collision_cb) engine.register_collision(UFO, MissleVertical, miss_ufo_collision_cb2) engine.register_collision(Car, UFO, car_ufo_collision_cb) engine.register_collision(UFO, Car, car_ufo_collision_cb2) engine.register_collision(Car, MissleVertical, car_miss_collision_cb) engine.register_collision(MissleVertical, Car, car_miss_collision_cb2) # Score and Stars drawn draw_score(False) draw_random_stars(50) engine.engine()
def play(): global s s = S() engine.init_engine() engine.set_keyboard_handler(input_cb) s.me = Me() engine.add_obj(s.me) engine.add_random_event(0.01, spawn_asteroid_cb) engine.register_collision(Asteroid, MyShot, col_asteroid) engine.register_collision(MyShot, Asteroid, col_asteroid2) engine.register_collision(Me, Asteroid, col_gameover) engine.register_collision(Asteroid, Me, col_gameover) draw_score() s.playing = True engine.engine()
def play(): global s s = S() engine.init_engine() engine.set_keyboard_handler(input_cb) engine.add_obj(Ground(MINX, GROUNDY, MAXX, MINY)) s.me = Me(0, GROUNDY + 10) engine.add_obj(s.me) # the grid o' evil for i in range(INVADERROWS): for j in range(INVADERCOLS): enemy = Invader(XGRIDSTART + j * INVADERHSPACE, YGRIDSTART - i * INVADERVSPACE, INVADERSPEED, 0) s.invaders.append(enemy) engine.add_obj(enemy) engine.add_random_event(FIREPROB, fire_cb) engine.add_random_event(UFOPROB, ufo_cb) # not quite so random - do this at start of each time step # order is important - if no invaders left, gridmove won't be happy engine.add_random_event(1.0, winlose_cb) engine.add_random_event(1.0, gridmove_cb) engine.register_collision(Ground, Bomb, coll_ground1) engine.register_collision(Bomb, Ground, coll_ground2) engine.register_collision(UFO, MyShot, coll_air2air_bonus) engine.register_collision(MyShot, UFO, coll_air2air_bonus) engine.register_collision(Invader, MyShot, coll_air2air) engine.register_collision(MyShot, Invader, coll_air2air) engine.register_collision(Ground, Invader, coll_gameover1) engine.register_collision(Invader, Ground, coll_gameover2) engine.register_collision(Me, Bomb, coll_loselife1) engine.register_collision(Bomb, Me, coll_loselife2) draw_score() engine.engine()
def play(): global s s = S() engine.init_engine() engine.set_keyboard_handler(input_cb) s.me = Me() engine.add_random_event(0.01, leftturn_straight_cb) engine.add_random_event(0.01, rightturn_straight_cb) engine.add_obj(s.me) place_default_post_cb() engine.register_collision(Me, Post, col_post) engine.register_collision(Post, Me, col_post2) draw_text() draw_score() s.playing = True engine.engine()
def __init__(self, name, fname, maxspikes, parent=None): super(glrun, self).__init__(parent) self.setWindowTitle("Run :: "+name) self.progress = QtGui.QProgressBar(self) self.progress.setMaximum(maxspikes) self.timer = QtCore.QTimer(self); cancelButton = QtGui.QPushButton(QtGui.QIcon(':/dialog-cancel.png'),"&Stop",self) hbox = QtGui.QHBoxLayout() hbox.addWidget(self.progress) hbox.addWidget(cancelButton) self.setLayout(hbox) size = self.size() self.resize(size.width()*3/4, 30) self.connect(cancelButton, QtCore.SIGNAL('clicked()'), self.stop) self.connect(self.timer, QtCore.SIGNAL('timeout()'), self.update) self.engine = engine.engine(filename=fname,mode="NONSTD") self.timer.setInterval(500) self.timer.start() self.engine.start()
def upload_and_classify(): if request.method == 'POST': if 'file' not in request.files: flash('No file part') return redirect(url_for('assess')) file = request.files['file'] if file.filename == '': flash('No selected file') return redirect(url_for('assess')) if file and allowed_file(file.filename): filename = secure_filename(file.filename) # used to secure a filename before storing it directly on the filesystem file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename)) filepath = os.path.join(app.config['UPLOAD_FOLDER'], filename) model_results = engine.engine(filepath) return render_template('results.html', result=model_results, filename=filename) flash('Invalid file format - please try your upload again.') return redirect(url_for('assess'))
def dbadd(conn, c, root, dir_name, sub_dirs, files,count,f,filecount): if (count==1): logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) logger.info(f + " is in " + dir_name) fpath = dir_name + '/' + f #used for db/by engine c.execute ("SELECT * FROM scan WHERE fpath = ?", (fpath,)) count += 1.0 #Returns a float percentage = count/filecount rows = c.fetchall() if (len(rows)!= 0): c.execute ("DELETE FROM scan WHERE fpath = ?", (fpath,)) at=os.path.getatime(os.path.join(dir_name, f))#last access time of file size = os.path.getsize(os.path.join(dir_name, f)) c.execute('INSERT INTO scan (fpath, accessDate) VALUES (?,?)', (fpath,at,))# adds files to sqlite 3 table "scan" boolUpload = engine.engine(fpath,at,size)#returns a value as to wether or not this file should be uploaded ''' if (boolUpload == True): #try and catch for a shit ton of errors to (maybe) upload.upload(putArgsHere) ''' conn.commit()#this might actually be c.commit idk what alex is doing
turtle.fd(B) # roof turtle.rt(45) turtle.fd(B * 3/4) # windshield turtle.lt(45) turtle.fd(B) # hood turtle.rt(90) turtle.fd(B * 3/4) # front turtle.rt(90) turtle.fd(B * 1/7) turtle.lt(90) turtle.circle(-B/2, 180) # front tire turtle.lt(90) turtle.fd(B) turtle.lt(90) turtle.circle(-B/2, 180) # back tire turtle.lt(90) turtle.fd(B * 1/7) turtle.rt(90) turtle.fd(B * 5/6) # back turtle.end_poly() poly = turtle.get_poly() turtle.register_shape('car', poly) if __name__ == '__main__': engine.init_screen(WIDTH, HEIGHT) engine.init_engine() makeshape() car = Car() engine.add_obj(car) engine.engine()
def simplerandom(seed): reportnl('simplerandom(' + `seed` + ')') return bin2rand(engine(md5gen(seed)).expand)
#!C:\python26\python.exe try: import sys from engine import engine except ImportError, err: print "couldn't load module, %s" % (err) sys.exit(2) # giver if __name__ == '__main__': e = engine() e.run()
# const=sum, default=max, # help='sum the integers (default: find the max)') #args = parser.parse_args() mode = 'check' subMode = '' for arg in sys.argv: if '-h' in arg or '--help' in arg: print ('by default this program does not need parameters for the check') print ('') print ('IF there are "missing" following accounts and you have unfollowed them by yourself, use:') print ('start.py --mode=mark iRemoved') print ('they will be tagged as "removed by me" and wont show up again.') exit() if '--mode=' in arg: mode = arg.replace('--mode=', '') if arg == 'iRemoved': subMode = 'iRemoved' if mode == 'check': eng = engine.engine() eng.doCheck() elif mode == 'mark': if subMode == '': print ('please set "iRemoved" to mark ALL lost followed as "removed by you"!') elif subMode == 'iRemoved': eng = engine.engine() eng.setMarkAs(1)
def sandbox(): clock = pygame.time.Clock() mainengine = engine.engine("sandbox", screen, clock, WIDTH,HEIGHT) mainengine.main()
def tutorial(): clock = pygame.time.Clock() mainengine = engine.engine("tutorial", screen, clock, WIDTH,HEIGHT) mainengine.main()
def single(): fig = plt.figure() xrange = (-3.0, 9.0) yrange = (-3.0, 9.0) xstep = 0.1 ystep = 0.1 samples1 = np.vstack( [ np.random.multivariate_normal(mean=np.array([0, 0]), cov=np.array(np.identity(2)), size=np.array([50])), np.random.multivariate_normal(mean=np.array([0, 6]), cov=np.array(np.identity(2)), size=np.array([50])), ] ) phi_1 = svm(samples1, Lambda=0.05, gamma=[0.125, 0.25, 0.5, 1, 2, 4, 8, 16]) a = fig.add_subplot(2, 2, 1) phi_1.contourPlot(fig=a, xrange=xrange, yrange=yrange, xstep=xstep, ystep=ystep) samples2 = np.vstack( [ np.random.multivariate_normal(mean=np.array([0, 0]), cov=np.array(np.identity(2)), size=np.array([50])), np.random.multivariate_normal(mean=np.array([6, 0]), cov=np.array(np.identity(2)), size=np.array([50])), ] ) phi_2 = svm(samples2, Lambda=0.05, gamma=[0.125, 0.25, 0.5, 1, 2, 4, 8, 16]) b = fig.add_subplot(2, 2, 2) phi_2.contourPlot(fig=b, xrange=xrange, yrange=yrange, xstep=xstep, ystep=ystep) samples = list() for i in range(10): samples.append( np.vstack( [ np.random.multivariate_normal( mean=np.array([0, 0]), cov=np.array(np.identity(2)), size=np.array([50]) ), np.random.multivariate_normal( mean=np.array([6, 0]), cov=np.array(np.identity(2)), size=np.array([50]) ), ] ) ) samples.append( np.vstack( [ np.random.multivariate_normal( mean=np.array([0, 0]), cov=np.array(np.identity(2)), size=np.array([50]) ), np.random.multivariate_normal( mean=np.array([0, 6]), cov=np.array(np.identity(2)), size=np.array([50]) ), ] ) ) for i in range(10): samples.append( np.vstack( [ np.random.multivariate_normal( mean=np.array([0, 0]), cov=np.array(np.identity(2)), size=np.array([5]) ), np.random.multivariate_normal( mean=np.array([6, 0]), cov=np.array(np.identity(2)), size=np.array([5]) ), ] ) ) samples.append( np.vstack( [ np.random.multivariate_normal( mean=np.array([0, 0]), cov=np.array(np.identity(2)), size=np.array([5]) ), np.random.multivariate_normal( mean=np.array([0, 6]), cov=np.array(np.identity(2)), size=np.array([5]) ), ] ) ) e = engine(estimates=(phi_1, phi_2), S=samples) test1 = np.vstack( [np.random.multivariate_normal(mean=np.array([0, 0]), cov=np.array(np.identity(2)), size=np.array([10]))] ) c = fig.add_subplot(2, 2, 3) e.contourPlot( S=test1, fig=c, xrange=xrange, yrange=yrange, xstep=xstep, ystep=ystep, title="derived distribution 1" ) # e.varphi.contourPlot( c, xrange=(-.1,0.), yrange=(-.1,0.), xstep=.005,ystep=.005 ) # e.varphiPlot(c) # c.hist(e.varphi.pdf( e.Delta ) ) test2 = np.vstack( [np.random.multivariate_normal(mean=np.array([0, 6]), cov=np.array(np.identity(2)), size=np.array([10]))] ) c = fig.add_subplot(2, 2, 4) e.contourPlot( S=test2, fig=c, xrange=xrange, yrange=yrange, xstep=xstep, ystep=ystep, title="derived distribution 2" ) plt.show()
def main(): clock = pygame.time.Clock() mainengine = engine.engine("main", screen, clock, WIDTH,HEIGHT) mainengine.main()