Ejemplo n.º 1
0
def measureUp():
    stepamplitude=3
    data_power=np.zeros(1000)
    for i in np.arange(0,999):
        data_power[i]=powermeter.getPower()
        stage.up(1, stepamplitude)
        
    plt.plot(data_power)
    plt.show()
    
    #get the index of the maximal power. so we know how many steps to move back to get to the position
    max_index=np.argmax(data_power)
    stage.down(1000-(max_index+1), stepamplitude)   #max_index+1 because of the indexing which starts at 0
Ejemplo n.º 2
0
# Mayor Library imports
from numpy import linspace, random, pi

# Enthought library imports
from enthought.chaco.shell import plot, hold, title, show


# Create some data
x = linspace(-2*pi, 2*pi, 100)
y1 = random.random(100)
y2 = random.random(100)

# Create some scatter plots
plot(x, y1, "b.")
hold()
plot(x, y2, "g+", marker_size=2)

# Add some titles
title("simple scatter plots")

# This command is only necessary if running from command line
show()

Ejemplo n.º 3
0
# Mayor Library imports
from numpy import linspace, pi, sin

# Enthought library imports
from enthought.chaco.shell import show, plot, title, curplot
from enthought.chaco.scales.api import CalendarScaleSystem

# Create some data
numpoints = 100
x = linspace(-2*pi, 2*pi, numpoints)
y1 = sin(x)

# Create the dates
import time
now = time.time()
dt = 24 * 3600    # data points are spaced by 1 day
dates = linspace(now, now + numpoints*dt, numpoints)

# Create some line plots
plot(dates, y1, "b-", bgcolor="white")

# Add some titles
title("Plotting Dates")

# Set the plot's horizontal axis to be a time scale
curplot().x_axis.tick_generator.scale = CalendarScaleSystem()

#This command is only necessary if running from command line
show()

Ejemplo n.º 4
0
#!/usr/bin/env python

# Mayor Library imports
from numpy import linspace, pi, sin, cos

from enthought.mayavi.core.source import Source

# Enthought library imports
from enthought.chaco.shell import plot, hold, title, show

# Create some data
x = linspace(-2*pi, 2*pi, 100)
y = sin(x)

# Create some line plots
plot(x, y, "b-", bgcolor="white")

#This command is only necessary if running from command line
#show()
Ejemplo n.º 5
0
# -*- coding: utf-8 -*-
import numpy as np
import enthought.chaco.shell as cs

x = np.linspace(-2 * np.pi, 2 * np.pi, 100)
y = np.sin(x)

cs.plot(x, y, "r-")
cs.title("First plot")
cs.ytitle("sin(x)")
cs.show()
Ejemplo n.º 6
0
""" This example displays some line plots in different colors and styles using
the chaco.shell subpackage.  The functions in the chaco.shell package allow us
to quickly generate plots with some basic interactivity without using the
object-oriented core of Chaco.
"""

from numpy import linspace, pi, sin, cos
from enthought.chaco.shell import plot, hold, title, show

# Create some data
x = linspace(-2*pi, 2*pi, 100)
y1 = sin(x)
y2 = cos(x)

# Create some line plots using the plot() command and using
# Matlab-style format specifiers
plot(x, y1, "b-", bgcolor="white")
hold()
plot(x, y2, "g-.", marker_size=2)

# Set the plot title
title("simple line plots")

# If running this from the command line and outside of a wxPython
# application or process, the show() command is necessary to keep
# the plot from disappearing instantly.  If a wxPython mainloop
# is already running, then this command is not necessary.
show()

Ejemplo n.º 7
0
# -*- coding: utf-8 -*-
import numpy as np
import enthought.chaco.shell as cs 

x = np.linspace(-2*np.pi, 2*np.pi, 100)
y = np.sin(x)

cs.plot(x, y, "r-") 
cs.title("First plot")
cs.ytitle("sin(x)")
cs.show()