code
stringlengths
1
1.72M
language
stringclasses
1 value
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python '''Graphically show all devices available via the pyglet.input interface. Each device is shown in its own collapsed panel. Click on a device panel to expand it, revealing that device's controls. The controls show the current live values, and flash white when the value changes. ''' __docformat...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python ''' ''' __docformat__ = 'restructuredtext' __version__ = '$Id: $' import pyglet window = pyglet.window.Window() devices = pyglet.input.get_devices() def watch_control(device, control): @control.event def on_change(value): print '%r: %r.on_change(%r)' % (device, control, value)...
Python
#!/usr/bin/env python ''' ''' __docformat__ = 'restructuredtext' __version__ = '$Id: $' import pyglet import sys window = pyglet.window.Window() @window.event def on_draw(): window.clear() remote = pyglet.input.get_apple_remote() if not remote: print 'Apple IR Remote not available.' sys.exit(0) remot...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistribu...
Python
#!/usr/bin/env python # ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are ...
Python
#!/usr/bin/python # $Id:$ import pyglet window = pyglet.window.Window() tablets = pyglet.input.get_tablets() canvases = [] if tablets: print 'Tablets:' for i, tablet in enumerate(tablets): print ' (%d) %s' % (i + 1, tablet.name) print 'Press number key to open corresponding tablet d...
Python
#!/usr/bin/env python '''Demonstrates basic use of IncrementalTextLayout and Caret. A simple widget-like system is created in this example supporting keyboard and mouse focus. ''' __docformat__ = 'restructuredtext' __version__ = '$Id: $' import pyglet class Rectangle(object): '''Draws a rectangle into a batch....
Python
import pyglet window = pyglet.window.Window() # Er 640, 480 by default # Ég var fáránlega lengi að láta collision testin virka og þess vegna er forritið mjög ljótt # og líklega erfitt að skilja af hverju ég geri sumt en ég breytti oft bara hlutum til þess að þau mundu virka # sama hvort ég sá ástæðuna eða ekki. Þessi...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/basic-som.py # Basic self-organizing maps ################################################################################ # We import numpy f...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/linear-prediction.py # Using neural networks to predict number sequences #######################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/xor-problem.py # Solving the exclusive-or problem ################################################################################ # Please, fo...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/basic-neural-network.py # Basic example of using neural networks ###############################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/radial-basis-function.py # Radial basis functions for interpolation. ###########################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/polynomial-regression.py # Using neural networks to approximate functions by polynomials. ######################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/linear-prediction.py # Using neural networks to predict number sequences #######################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/k-means.py # Example of using K-Means implementation ################################################################################ # We impo...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/mapping-a-plane.py # Using a neuron to map a plane ################################################################################ # Please, f...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/custom-activation.py # Using custom activation functions ################################################################################ # Ple...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/self-organizing-maps.py # Extended example on self-organizing maps #############################################################################...
Python
# -*- coding: utf-8 -*- ################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/hopfield-network.py # Hopfield neural networks for recovering patterns #################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: mutivariate-optmization.py # Optimization of two-variable functions ################################################################################ # ...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: derivative-optmization.py # Simple optimization of one-variable functions by derivative methods #########################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: binary-simulated-annealing.py # Optimization of functions by binary simulated annealing #################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: particle-swarm-optimization.py # Optimization of functions by particle swarms ###########################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: linear-optmization.py # Simple optimization of one-variable functions ################################################################################ ...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: particle-swarm-optimization.py # Optimization of functions by particle swarms ###########################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: quasi-newton-optimization.py # Optimization of two-variable functions by quasi-newton methods ###########################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: continuous-simulated-annealing.py # Optimization of functions by simulated annealing ####################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/simple-controller.py # A simgle-input-single-output Mamdani controller ###################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/norms-conorms.py # How to use t-norms and s-norms (norms and conorms) ####################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/fuzzy-defuzzy.py # Fuzzification and defuzzification are not complementary operations ####################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/membership-functions.py # How to use pre-defined membership functions ####################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/fuzzy-c-means.py # Basic example of Fuzzy C-Means ################################################################################ # We import...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/defuzzification.py # Defuzzification methods ################################################################################ # We im...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/control-surface.py # Generating the control surface for a two-variable fuzzy controller ##################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: tutorial/custom-membership.py # Using custom membership functions ################################################################################ # Ple...
Python
# -*- coding: utf-8 -*- ##################################################################### # Peach - Python para Inteligência Computacional # José Alexandre Nalon # # Este arquivo: demo07.py # Demonstração e teste, Mapeamento de uma função não linear. ################################################################...
Python
# -*- coding: utf-8 -*- ################################################################################ # Widget to draw the flock. # Jose Alexandre Nalon # # Date: 22-10-2007 ################################################################################ ###################################################...
Python
# -*- coding: utf-8 -*- ################################################################################ # A Demonstration of Swarm in Action # Jose Alexandre Nalon # # Date: 22-10-2007 # This is the main program ################################################################################ # Obs.: Since th...
Python
# -*- coding: utf-8 -*- ################################################################################ # General graph plotting widget for the PyQt4 toolkit # Some of this was taken from a page that I didn't register the link to. # probably the Qwt page itself. # Jose Alexandre Nalon # # Date: 28-01-2008 # Graphic pl...
Python
# -*- coding: utf-8 -*- ################################################################################ # Simulation of linear regression using a single linear neuron # Jose Alexandre Nalon # # Date: 14-11-2011 # This is the main program ##########################################################################...
Python
# -*- coding: utf-8 -*- ################################################################################ # General graph plotting widget for the PyQt4 toolkit # Some of this was taken from a page that I didn't register the link to. # probably the Qwt page itself. # Jose Alexandre Nalon # # Date: 28-01-2008 # Graphic pl...
Python
# -*- coding: utf-8 -*- ################################################################################ # A Complete Simulation of a Inverted Pendulum, controlled with a # Fuzzy Logic Controller # Jose Alexandre Nalon # # Date: 06-12-2007 # This is the main program #############################################...
Python
# -*- coding: utf-8 -*- ################################################################################ # Mathematical model of an inverted pendulum # Jose Alexandre Nalon # # Date: 06-12-2007 # this file implements the dynamical model of the pendulum. ##################################################################...
Python
# -*- coding: utf-8 -*- ################################################################################ # Widget to draw the inverted pendulum. # Jose Alexandre Nalon # # Date: 06-12-2007 ################################################################################ #######################################...
Python
#!/usr/bin/env python # -*- coding: utf-8 -*- try: from setuptools import setup except ImportError as e: from distutils.core import setup long_description = ''' Peach is a pure-python module, based on SciPy and NumPy to implement algorithms for computational intelligence and machine learning. Methods ...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: nn/nn.py # Basic topologies of neural networks ################################################################################ # Doc string, reStructur...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: nn/nn.py # Basic topologies of neural networks ################################################################################ # Doc string, reStructur...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: nn/base.py # Basic definitions for layers of neurons ################################################################################ # Doc string, reSt...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: nn/af.py # Activation functions and base class ################################################################################ # Doc string, reStructur...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: nn/mem.py # Associative memories and Hopfield models ################################################################################ # Doc string, reSt...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: nn/kmeans.py # Clustering for use in radial basis functions ################################################################################ # Doc strin...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: nn/lrules.py # Learning rules for neural networks ################################################################################ # Doc string, reStruc...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: nn/__init__.py # Makes the nn directory a python package and initializes it. ############################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: ga/ga.py # Basic genetic algorithm ################################################################################ # Doc string, reStructuredText forma...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: ga/mutation.py # Basic definitions for mutation on chromosomes ################################################################################ # Doc st...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: ga/chrossover.py # Basic definitions for crossover among chromosomes ################################################################################ # ...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: ga/chromosome.py # Basic definitions for manipulating chromosomes ################################################################################ # Doc...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: ga/fitness.py # Basic definitions for declaring fitness functions ################################################################################ # Doc...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: ga/chrossover.py # Basic definitions for crossover among chromosomes ################################################################################ # ...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: ga/__init__.py # Makes the ga directory a python package and initializes it. ############################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: pso/base.py # Basic particle swarm optimization ################################################################################ # Doc string, reStructu...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: pso/acc.py # Functions to update the velocity of particles in a swarm. ################################################################################ ...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: pso/__init__.py # Makes the pso directory a package and initializes it. ################################################################################ ...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: fuzzy/fuzzy.py # Fuzzy logic basic definitions ################################################################################ # Doc string, reStructur...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: fuzzy/control.py # Fuzzy based controllers, or fuzzy inference systems ################################################################################ ...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: fuzzy/defuzzy.py # Defuzzification methods ################################################################################ # Doc string, reStructuredTe...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: fuzzy/norms.py # Norms, conorms and negations ################################################################################ # Doc string, reStructur...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: fuzzy/cmeans.py # Fuzzy C-Means algorithm ################################################################################ # Doc string, reStructuredTex...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: fuzzy/__init__.py # Makes the fuzzy directory a python package and initializes it. ######################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: fuzzy/mf.py # Membership functions for fuzzy logic ################################################################################ # Doc string, reStru...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: sa/base.py # Simulated Annealing ################################################################################ # Doc string, reStructuredText formatt...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: sa/neighbor.py # Simulated Annealing ################################################################################ # Doc string, reStructuredText for...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: sa/__init__.py # Makes the sa directory a package and initializes it. ################################################################################ #...
Python
# -*- coding: utf-8 -*- ################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: __init__.py # Makes the peach directory a package and initializes it. ###########################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: optm/sa.py # Simulated Annealing ################################################################################ # Doc string, reStructuredText formatt...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: optm/optm.py # Basic definitions and base class ################################################################################ # Doc string, reStructu...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: optm/quasinewton.py # Quasi-newton multivariable search methods ################################################################################ # Doc s...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: optm/__init__.py # Makes the optm directory a package and initializes it. ###############################################################################...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: optm/multivar.py # Gradient and multivariable search methods ################################################################################ # Doc stri...
Python
################################################################################ # Peach - Computational Intelligence for Python # Jose Alexandre Nalon # # This file: optm/linear.py # 1D search methods ################################################################################ # Doc string, reStructuredText forma...
Python
#!/usr/bin/env python from django.core.management import execute_manager try: import settings # Assumed to be in the same directory. except ImportError: import sys sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll ha...
Python
from django import forms from django.forms import ModelForm from models import * class FormEvento(ModelForm): datahora = forms.DateTimeField( widget=forms.DateInput(format='%d/%m/%Y'), input_formats=['%d/%m/%y', '%d/%m/%Y']) categoria = forms.ModelChoiceField(queryset=Categoria.objects.all...
Python
# -*- coding: utf-8 -*- from django.db import models from datetime import datetime class Categoria(models.Model): nome = models.CharField(max_length=50) maximo = models.FloatField() minimo = models.FloatField() class Meta: ordering = ('nome',) def __unicode__(self): return self.nome ...
Python
""" This file demonstrates two different styles of tests (one doctest and one unittest). These will both pass when you run "manage.py test". Replace these with more appropriate tests for your application. """ from django.test import TestCase class SimpleTest(TestCase): def test_basic_addition(self): ...
Python
#!/usr/bin/python from pychartdir import * def GerarGrafico(valor, tempo, evento): # The data for the line chart listaValor = [] for x in valor: listaValor.append(x) # The labels for the line chart listaTempo = [] for x in tempo: listaTempo.append(str(x)) # Create a XYChart object of size 50...
Python