Variable size plot symbols, variable hue plot colors in Python (MatPlotLib) ?

2005-02-10 Thread Dr. Colombes
Using MatPlotLib plot function, is there a way to get variable size
plot symbols?  For example, using symbol strings like 'o' (circle), 's'
(square), 'x' (cross), etc., is there a way to specify other plot
symbols such a small circle, Medium square, LARGE cross, etc.?

Similarly, using the MatPlotLib plot function, is there a way to get
variable hue (RGB-specified) plot colors?  For example, using symbol
strings like 'b' (blue), 'g' (green), 'red' (red), etc., is there a way
to specify other colors such as light blue, dark green, pink, etc.?

Or perhaps is there some other Python MatPlotLib or other Python module
functions that allow variable size plot symbols and variable hue plot
colors in Python ?

Thank you for your suggestions.

-- 
http://mail.python.org/mailman/listinfo/python-list


MatPlotLib.MatLab troubles (how to install/run matplotlib.PyLab?)

2005-02-21 Thread Dr. Colombes
On my home laptop computer, I'm trying to install the appropriate
modules so that  Python version 2.3.3 and IDLE version 1.0.2 (with an
"import matplotlib.matlab" statement) can produce nice MatLab-like
plots.

I have a matplotlib.matlab-capable Python set-up running OK on my
office desktop, which I obtained after downloading and installing a few
more modules (numarray and numeric, I think).

Now I get the following message about matplotlib.matlab being
deprecated:

-

matplotlib.matlab deprecated, please import matplotlib.pylab or simply
pylab instead.  See http://matplotlib.sf.net/matplotlib_to_pylab.py
for a script which explains this change and will automatically convert
your python scripts that use matplotlib.matlab.  This change was made
because we were concerned about trademark infringement on The
Mathwork's trademark of matlab.

---

Unfortunately, the above URL does not exist.

Thanks for suggestions, any help you can offer.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: MatPlotLib.MatLab troubles (how to install/run matplotlib.PyLab?)

2005-02-22 Thread Dr. Colombes

John Hunter wrote:
> > "Colombes" == Colombes  <[EMAIL PROTECTED]> writes:
>
> Colombes> matplotlib.matlab deprecated, please import
> Colombes> matplotlib.pylab or simply pylab instead.  See
> Colombes> http://matplotlib.sf.net/matplotlib_to_pylab.py for a
> Colombes> script which explains this change and will
automatically
> Colombes> convert your python scripts that use matplotlib.matlab.
> Colombes> This change was made because we were concerned about
> Colombes> trademark infringement on The Mathwork's trademark of
> Colombes> matlab.
>
> Colombes> Unfortunately, the above URL does not exist.
>
> Oops -- that should be
> http://matplotlib.sourceforge.net/matlab_to_pylab.py
>
> In a nutshell, wherever you previously imported matplotlib.matlab you
> can import matplotlib.pylab or equivalently, simply pylab
>
> OLD:
> from matplotlib.matlab import plot
>
> NEW:
> from pylab import plot
>
> The script linked above will recursively search and replace these
> strings for you in your scripts directory.
>
> JDH


John:

   Thanks for the help with the MatLab --> PyLab conversion.

   Now I only need to figure out how to install the correct "Numeric"
module(s).  I'm making progress, almost have my home laptop fully
capable with the MatLab-like (PyLab) graphs, plots.

-- 
http://mail.python.org/mailman/listinfo/python-list


How to generate (enumerate) 2**N tuples representing all vertices of unit hypercube in N-dimensional hyperspace ?

2006-01-03 Thread Dr. Colombes
I'm looking for a good Python way to generate (enumerate) the 2**N
tuples representing all vertices of the unit hypercube in N-dimensional
hyperspace.

For example, for N=4 the Python code should generate the following 2**N
= 16 tuples:

(1,1,1,1),  (1,1,1,-1),
(1,1,-1, 1),  (1,1,-1,-1),
(1,-1,1,1),  (1,-1,1,-1),
(1,-1,-1, 1),  (1,-1,-1,-1),
(-1,1,1,1),  (-1,1,1,-1),
(-1,1,-1, 1),  (-1,1,-1,-1),
(-1,-1,1,1),  (-1,-1,1,-1),
(-1,-1,-1, 1),  (-1,-1,-1,-1)

Maybe converting each integer in the range(2**N) to binary, then
converting to bit string, then applying the "tuple" function to each
bit string?  

Thanks for your help.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How to generate (enumerate) 2**N tuples representing all vertices of unit hypercube in N-dimensional hyperspace ?

2006-01-04 Thread Dr. Colombes
Paul, Heiko:

   Thank you for the quality, parsimony and promptness of your
excellent suggestions.

I wasn't familiar with the Python  "yield" function.

   Dr. Colombes

-- 
http://mail.python.org/mailman/listinfo/python-list


How to modify EVDEV.py to record Keyboard Key RELEASE times?

2007-10-13 Thread Dr. Colombes
   I'm using a modified EVDEV.py program (see below) to record inter-keystroke 
times for Keystroke triples and doubles (t2 - t1, t3 -t1).   These times are 
key PRESS times.   

   How - where can EVDEV.py be modified (without too much trouble) to record 
Keystroke RELEASE times also ?

   Thanks for your help.

---

#!/usr/bin/env python
""" evdev.py

This is a Python interface to the Linux input system's event device.
Events can be read from an open event file and decoded into spiffy
python objects. The Event objects can optionally be fed into a Device
object that represents the complete state of the device being monitored.

Copyright (C) 2003-2004 Micah Dowty <[EMAIL PROTECTED]>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
"""

import struct, sys, os, time
from socket import gethostname
from fcntl import ioctl

__all__ = ["Event", "Device"]


def demo():
"""Open the event device named on the command line, use incoming
   events to update a device, and show the state of this device.
   """
dev = Device(sys.argv[1])
try:
while 1:
dev.poll()
except:
dev.log.close()
return dev.get_filename()



class BaseDevice:
"""Base class representing the state of an input device, with axes and 
buttons.
   Event instances can be fed into the Device to update its state.
   """
def __init__(self):
self.axes = {}
self.buttons = {}

self.name = None
self.next2last = None
self.next2lasttime = None
self.next2lastpress = 'NONE'
self.last = None
self.lasttime = None
self.lastpress = 'NONE'


self.echo = {}
#make log directory
if not os.path.isdir("./logs"):
os.mkdir("./logs")
#new filename
hostname = str(gethostname())
filename = str(hostname) + "_log_" + str(time.asctime()).replace(":", 
"_").replace(" ", "_")
#open log file
self.log = open("./logs/" + filename, "w")
self.filename = "./logs/" + filename
#self.log.write("\n\n\n\nHOSTNAME:  " + str(hostname) + "\n" + ("_" * 
60) + "\n")

def get_filename(self):
return self.filename

def __repr__(self):
return "" % (
self.name, self.axes, self.buttons)

def update(self, event):
f = getattr(self, "update_%s" % event.type, None)
if f:
f(event)

def update_EV_KEY(self, event):
if event.code not in self.echo:
self.echo[event.code] = 0
if self.echo[event.code] >= 1:
self.echo[event.code] = 0
return
else:
self.echo[event.code] += 1

now = time.time()

if self.lasttime == None:
#self.lasttime = time.time()
self.lasttime = now
if self.next2lasttime == None:
self.next2lasttime = now
#now = time.time()
newtime = now - self.lasttime
new3time = now - self.next2lasttime
#self.log.write(repr(self.lastpress) + "_" + repr(event.code) + "\t\t" 
+ str(newtime) + "\n")
self.log.write(self.lastpress + "_" + event.code + "\t\t" + 
str(newtime) + "\n")

self.log.write(self.next2lastpress + "_" + self.lastpress + "_" + 
event.code + "\t\t" + str(new3time) + "\n")

self.next2lastpress = self.lastpress
self.lastpress = event.code

self.next2lasttime = self.lasttime
self.lasttime = now


def update_EV_ABS(self, event):
self.axes[event.code] = event.value

def update_EV_REL(self, event):
self.axes[event.code] = self.axes.get(event.code, 0) + event.value

def __getitem__(self, name):
"""Retrieve the current value of an axis or button,
   or zero if no data has been received for it yet.
   """
if name in self.axes:
return self.axes[name]
else:
return self.buttons.get(name, 0)


# evdev ioctl constants. The horrible mess here
# is to silence silly FutureWarnings
EVIOCGNAME_512 = ~int(~0x82004506L & 0xL)
EVIOCGID   = ~int(~0x80084502L & 0xL)
EVIOCGBIT_512  = ~int(~0x81fe4520L & 0xL)
EVIOCGABS_512  = ~int(~0x80144540L & 0xL)


class Device(BaseDevice):
"""An abstract input device attache

Easy-to-install-and-use scientific graphics (plotting) package for Python 2.5.1 on Linux Ubuntu 7.1

2008-04-03 Thread Dr. Colombes
Is there an easy scientific graphics (plotting) package for Python
2.5.1 running on Ubuntu Linux 7.1 ("Gutsy Gibbon")?

A few years ago I used PyLab (a MatLab-like plotting module for
Python) on a Windows machine, but I don't know if there is a similar
easy-to-install-and-use Python 2.5.1-compatible graphics package for
Ubuntu Linux 7.1?

Thanks for any suggestions.
-- 
http://mail.python.org/mailman/listinfo/python-list


How to modify EVDEV.py to record ASCII characters instead of keystrokes ?

2008-04-10 Thread Dr. Colombes
I've used EVDEV.py successfully as a keystroke logger on Linux
machines.

How should EVDEV.py be modified to function as an ASCII character
logger?  That is,  to record upper and lower case letters, lower case
"5" and upper case "%" characters, etc.

Shift and Caps Lock key press events are recorded by EVDEV.py, but the
press event of the Shift and Caps Lock keys do not specify which, if
any, of the subsequent keys are to be interpreted as "upper case"
characters.

Thanks for your suggestions.
-- 
http://mail.python.org/mailman/listinfo/python-list


ASCII character logger program in Python? (Or how to modify EVDEV.py)

2008-05-08 Thread Dr. Colombes
   I've used a very nice Keystroke Logger Python shareware program
(EVDEV.py), written by Micah Dowty.

  But I couldn't find a dedicated ASCII Character Logger program.

  Does anyone know of an ASCII Character Logger program (preferably
Python)?

  Or how  to modify EVDEV.py to log ASCII characters transmitted by
keystrokes?  For example, how to "upper case" keystrokes between a
SHIFT PRESS and SHIFT RELEASE keystroke event pair?  Or "upper casing"
keystrokes between a pair of CAPS LOCK PRESS keystroke events.

  (I don't fully understand the object-oriented keystroke event code
in EVDEV.py., for example, how  to distinguish a PRESS event from a
RELEASE event.)

  Thanks for any suggestions, help you can offer.

--
http://mail.python.org/mailman/listinfo/python-list