예제 #1
0
파일: ldseq.py 프로젝트: ustaros-ai/pyopus
    # Dimension of space (plotting makes sense only with 2)
    n = 2

    # Round n to next greater or equal even number (nn)
    nn = int(np.ceil(n / 2) * 2)

    # Halton/Sobol sequence generator
    gen = ghalton.Halton(nn)
    # gen=sobol.Sobol(nn)

    # Skip first nn entries
    gen.get(nn)

    # Initialize gui thread, clean up.
    pyopl.init()
    pyopl.close()

    # Create first figure (plot window). This is now the active figure.
    f1 = pyopl.figure(windowTitle="Random points inside a disc",
                      figpx=(600, 400),
                      dpi=100)

    # Lock GUI
    pyopl.lock(True)

    # Check if figure is alive
    if pyopl.alive(f1):
        ax1 = f1.add_axes((0.12, 0.12, 0.76, 0.76))

        ax1.hold(True)
예제 #2
0
파일: ldseq.py 프로젝트: xanderhsia/pyopus
	# Dimension of space (plotting makes sense only with 2)
	n=2
	
	# Round n to next greater or equal even number (nn)
	nn=int(np.ceil(n/2)*2)
	
	# Halton/Sobol sequence generator
	gen=ghalton.Halton(nn)
	# gen=sobol.Sobol(nn)
	
	# Skip first nn entries
	gen.get(nn)
	
	# Initialize gui thread, clean up.
	pyopl.init()
	pyopl.close()
	
	# Create first figure (plot window). This is now the active figure.
	f1=pyopl.figure(windowTitle="Random points inside a disc", figpx=(600,400), dpi=100)
	
	# Lock GUI
	pyopl.lock(True)
	
	# Check if figure is alive
	if pyopl.alive(f1):
		ax1=f1.add_axes((0.12,0.12,0.76,0.76))
		
		ax1.hold(True)

		ii=0
		rskips=0
예제 #3
0
import pyopus.wxmplplot as pyopl
from numpy import arange, sin, cos, exp, pi, e

if __name__ == '__main__':
    # Initialize gui thread, clean up.
    pyopl.init()
    pyopl.close()

    # Plot data - sin(x), cos(x), exp(x/pi) .. for x in [0, 2pi] with 0.2 step.
    x = arange(0.0, 2 * pi, 0.2)
    y1 = sin(x)
    y2 = cos(x)
    y3 = exp(x / pi)

    # Create figure. Tag is assigned automatically by the system. Do not show it.
    f1 = pyopl.figure(windowTitle="Figure - single axes",
                      show=False,
                      figpx=(600, 400),
                      dpi=100)

    # Lock GUI
    pyopl.lock(True)

    # Check if figure is alive
    if pyopl.alive(f1):
        # Create axes in active figure.
        ax1 = f1.gca()

        # Add traces, legend, labels, axes title, grid, figure title
        ax1.plot(x, y1, '-o', label='sin(x)', color=(1, 0, 0))
        ax1.hold(True)