[ANN] pyspread 0.4.3

2015-06-01 Thread Martin Manns
==
pyspread 0.4.3
==

Pyspread 0.4.3 is released.

Please note that pyspread 0.4.2 is not available on pypi because of a
deployment issue.

Major changes to 0.4.1:

 * Full screen mode added
 * Some changes to improve results on Debian CI tests
 * Updates to first steps document
 * Linux distribution logos removed from first steps document


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: https://manns.github.io/pyspread/
Download page:   https://pypi.python.org/pypi/pyspread
Source code: https://github.com/manns/pyspread

Enjoy

Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] pyspread 0.4

2014-12-15 Thread Martin Manns

pyspread 0.4


Pyspread 0.4 is released.

In this release, rendering has switched to Cairo, which enhances
quality and performance.
Grid content can now be exported into high quality PDF and SVG files.
Cells can now display SVG images and text with markups.
The nn function now removes None from lists, tuples, etc.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/
Download page:   https://pypi.python.org/pypi/pyspread


Enjoy

Martin

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


[ANN] pyspread 0.3.3

2014-09-06 Thread Martin Manns
==
pyspread 0.3.3
==


Pyspread 0.3.3 is released.

This is a wxPython 3.x related bugfix release that fixes a segfault
when initially creating and choosing GPG keys.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/
Download page:   https://pypi.python.org/pypi/pyspread


Enjoy

Martin

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


[ANN] pyspread 0.3.1

2014-07-12 Thread Martin Manns
==
pyspread 0.3.1
==


Pyspread 0.3.1 is released.

This is a bugfix release that removes an annoying warning on the
console.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/
Download page:   https://pypi.python.org/pypi/pyspread


What is new in 0.3.1



 + Bugfix
 + Updated German localization
 + Updated Ukrainian localization


Enjoy

Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] pyspread 0.3.0

2014-07-09 Thread Martin Manns
==
pyspread 0.3.0
==


Pyspread 0.3.0 is released.

This update is the first release that runs with wxPython 3.x.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/
Download page:   https://pypi.python.org/pypi/pyspread


What is new in 0.3.0



 + wxPython 3.x support
 + Entryline code completion (use )
 + EntryLine tooltip now displays docstrings for methods and builtins
   (use )
 + nn function added to remove None from result array
 + Uncompressed pysu save file format
 + Writing xls files (still experimental)
 + Cell locking
 + Cell sorting
 + Frozen cells can now be updated periodically (>=100 ms/update)
 + Reference to a selection can now be copied the the clipboard with
 +  + R  now moves the active cell to the first column of
 + the actual row  +  now selects the current row
 +  +  now selects the current column
 + Fingerprint in gpg key choice dialog
 + Tooltips for toolbar icons



Known issues


 + Selection mode is disabled in Windows.
 + Sometimes, pressing redo when there is nothing left to redo has
   undesired effects such as redoing an operation again.
 + On some (not all) Windows system lockup prevention does not work



Martin



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


Re: Reading OpenOffice spreadsheet in Python?

2014-05-20 Thread Martin Manns
On Tue, 20 May 2014 11:38:06 -0500
Skip Montanaro  wrote:

> I am so fed up with LibreOffice's inability to properly support really
> basic Excel capabilities, I'm about ready to throw my computer out the

Could you please give some examples, what basic Excel capabilities you
are missing?

> I'm open to other options as well. I see a number of Google
> spreadsheet modules, and there is pyspread. The former has the
> permission issue (besides, where I work everything goes into Git), and
> I'm not sure how full-featured or stable the latter is (but, will
> investigate).

Maybe gnumeric may be an option, too.

Pyspread should run fine on the Mac. However, Macs are not officially
supported because there are no testers for OSX, yet.

Please note that pyspread does not translate Excel "xls" files into
Python but only imports cell contents and formatting via xlrd. If you
use Excel cell functions or VBA then you would have to migrate your
code to Python.


Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] pyspread 0.2.6

2014-02-03 Thread Martin Manns
==
pyspread 0.2.6
==


Pyspread 0.2.6 is released.

This update brings Excel xls file reading and prevents many
pyspread lock ups that were caused by misbehaving user code.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/
Download page:   https://pypi.python.org/pypi/pyspread


What is new in 0.2.6


 + Reading support for Excel xls files (requires dependency xlrd)
 + Code execution timeout, i. e. buggy code such as infinite loops does
   not lock up pyspread any more.
   Note: The timeout does not work for C operations such as
 a ** 
 + Macro dialog now provides an error message field
 + Multiple rows/columns can now be resized together when selected
 + Show frozen option added that changes background of frozen cells
 + The cell editor now is resized when the text grows too large
 + Cells are now always clipped
 + Example macro for in cell LaTeX equations added
 + Contour plots and Sankey charts added to chart dialog
 + Pie chart can now be rotated in the chart dialog
 + Chart fonts and ticks can now be changed in chart dialog
 + Some bug fixes

Known issues


 + Selection mode is disabled in Windows.
 + Sometimes, pressing redo when there is nothing left to redo has
   undesired effects such as redoing an operation again.
 + Pyspread with wxPython 3.x instead of 2.8.x may be slow and buggy
 + On some (not all) Windows system lockup prevention does not work


Enjoy

Martin


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


Re: Slicing with negative strides

2013-11-03 Thread Martin Manns
On 29 Oct 2013 05:22:00 GMT
Steven D'Aprano  wrote:

> Does anyone here use slices (or range/xrange) with negative strides
> other than -1?

I have used negative strides for comparing discrete sequences e. g. for
turbulence analysis, and I hope that my code will still run in Python 4.

Martin
-- 
https://mail.python.org/mailman/listinfo/python-list


[ANN] pyspread 0.2.5

2013-09-23 Thread Martin Manns
==
pyspread 0.2.5
==


Pyspread 0.2.5 is released.

This is mainly a bug fix release with some improvements in chart
creation and CSV import.

About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/


What is new in 0.2.5


 + Brazilian Portuguese localization added
 + Pyspread now displays dates with matplotlib 1.3.0
 + CSV import now allows different file encodings
 + All unit tests now succeed in Windows
 + Chart grid lines are now separately selectable for each axis
 + Chart annotation texts are now treated as code instead of strings
 + Tooltip text for pie chart colors is extended
 + Chart padding fixed
 + Default font size for renderer is now set explicitly if 0 (OS X fix)
 + String representation method of S removed


Known issues


 + Selection mode is disabled in Windows.
 + Paste As... does not work if dates are present in the data structure.
 + Sometimes, pressing redo when there is nothing left to redo has
   undesired effects such as redoing an operation again.

Enjoy

Martin

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


[ANN] pyspread 0.2.4

2013-07-24 Thread Martin Manns
==
pyspread 0.2.4
==


Pyspread 0.2.4 is released.

Besides Linux, the new version also runs on Windows (Windows 7 64bit
and Windows XP 32bit tested).


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/


What is new in 0.2.4


 + Windows compatibility
 + More charts and chart options (box plots, histograms, pie charts)
 + Export of matplotlib charts to svg, png, pdf, eps and ps
 + Import from UTF-8 encoded csv files (no other encoding, yet)
 + More than 64k characters supported in one cell
 + Insertion and deletion of rows and columns now affect only the
   current table
 + High quality in-cell bitmaps images (with transparency) supported
 + Iterable data can be pasted into multiple cells via Paste As...
 + Pyspread can now be started from other Python applications
 + Partly localized in Nowegian Nynorsk and Bokmaal

Known issues


 + Selection mode is disabled in Windows.
 + "Find & Replace All" is slow in grids with much data unless pyspread
   is minimized.
 + Paste As... does not work if dates are present in the data structure.
 + Sometimes, pressing redo when there is nothing left to redo has
   undesired effects such as redoing an operation again.
 + When updating from a non-release version (from git), the file 
   ~/.pyspreadrc (in Windows pyspread's registry entry) may have to be
   deleted.

Enjoy

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


[ANN] pyspread 0.2.3

2013-01-14 Thread Martin Manns
==
pyspread 0.2.3
==


Pyspread 0.2.3 is released.

The new version improves GPG integration.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.
Pyspread is designed for Linux and other GTK platforms.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/


What is new in 0.2.3


 * GUI front-end for matplotlib charts
 * Image display in cells
 * Localization in German, Dutch, Danish and Ukrainian (partly finished)
 * Dependency to PyMe, rpy and gmpy removed for easier packaging
 * New dependencies matplotlib, python-gnupg
 * New example files
 * Various bug fixes


Enjoy

Martin

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


[ANN] pyspread 0.2.1

2012-03-13 Thread Martin Manns
==
pyspread 0.2.1
==


Pyspread 0.2.1 is released.

The new version improves GPG integration.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in the programming language Python. 

The goal of pyspread is to be the most pythonic spreadsheet application.
Pyspread is designed for Linux and other GTK platforms.

Pyspread is free software. It is released under the GPL v3.

Project website: http://manns.github.com/pyspread/


What is new in 0.2.1


 * Format menu added
 * Printing bug (first line not printed) fixed
 * GPG key choice dialog added
 * Secret key generation dialog added
 * Password saving in .pyspreadrc is now optional
 * Preferences dialog entries are now validated
 * Toolbar positions are now saved on exit
 * Absolute addressing with mouse changed to  + 
 * Relative addressing with mouse changed to  + 


Enjoy

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


Re: open office in another language?

2012-01-11 Thread Martin Manns
On Tue, 10 Jan 2012 18:43:09 -0300
Sean Wolfe  wrote:
 
> Has there been any talk of doing another similar office suite, or
> maybe just writer + spreadsheet, in a better language eg python? I
> expect it's a huge undertaking but ... thought I'd ask around at
> least.

If you are looking for Python based spreadsheets, 
you may be interested in ResolverOne (commercial product)

http://www.resolversystems.com/products/resolver-one/

or in pyspread (GPL, my own effort)

http://manns.github.com/pyspread/

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


[ANN] pyspread 0.2.0

2011-12-24 Thread Martin Manns

==
pyspread 0.2.0
==


Pyspread 0.2.0 has been released.

The new version is an almost complete rewrite for better stability and
maintainability.


About pyspread
==

Pyspread is a non-traditional spreadsheet application that is based on
and written in Python. Pyspread expects Python expressions in its grid
cells, which makes a spreadsheet specific language obsolete.

Pyspread is free software. It is released under the GPL v3.

The project website has changed to http://manns.github.com/pyspread/


What's new in 0.2.0
===

 + Windows support discontinued

 + New pys save file format

 + A lot of bug fixes and small changes to the user interface


Enjoy

Martin


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


Re: Something is rotten in Denmark...

2011-05-31 Thread Martin Manns
On Tue, 31 May 2011 15:47:33 -0600
Ian Kelly  wrote:

> The i variable is part of the global scope, and as you iterate over
> range(10) again it coincidentally takes on the same values as in the
> original list comprehension.  You don't see this in Python 3 because
> the scope of i is limited to the list comprehension, not global.

I read about the scope change. 
However, list comprehension scope being global still feels "right" for
me because I am still using Python 2.

I feel that I should start worrying more about future migration issues.

Cheers 

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


Re: Something is rotten in Denmark...

2011-05-31 Thread Martin Manns
On Tue, 31 May 2011 01:48:05 -0500
harrismh777  wrote:

> >>> fs=[]
> >>> fs = [(lambda n: i + n) for i in range(10)]
> >>> [fs[i](1) for i in range(10)]
> [10, 10, 10, 10, 10, 10, 10, 10, 10, 10] <=== not good
> 
>  ( that was a big surprise! . . . )
>  ( let's try it another way . . . )

After being confused I figured out it is a 3.x example:



$ python
Python 2.6.6 (r266:84292, Apr 20 2011, 11:58:30) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> fs=[]
>>> fs = [(lambda n: i + n) for i in range(10)]
>>> [fs[i](1) for i in range(10)]  
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]



$ python3.1 
Python 3.1.3 (r313:86834, Nov 28 2010, 11:28:10) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> fs=[]
>>> fs = [(lambda n: i + n) for i in range(10)]
>>> [fs[i](1) for i in range(10)]  
[10, 10, 10, 10, 10, 10, 10, 10, 10, 10]



Is this fixed automatically by 2to3?

Martin

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


Re: Collision of rotated rectangles without pygame

2010-12-07 Thread Martin Manns
On Tue, 07 Dec 2010 00:53:27 -0800
John Nagle  wrote:

> On 12/5/2010 2:49 PM, Martin Manns wrote:
> Probably because you seem to be trying to compute the intersection
> point for coincident lines, which is not well-defined.

I found the problem: 
pygame returns one pixel more for the right border than wx.

> Incidentally, a dictionary lookup in Python is far more expensive
> than computing trig functions.  If you need to speed this up
> for large numbers of rectangles, there are algorithms that are
> several orders of magnitude faster.  Realistically, though,
> this is the kind of problem that runs slow in CPython.

This was taken from the vizier code. I fixed it.

> This is why you don't write your own collision library.
> (I once did, for 3D, but that was in 1996, when it was
> cutting-edge technology.)

Is there a pure Python collision library other than vizier?

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


Re: Collision of rotated rectangles without pygame

2010-12-05 Thread Martin Manns
On Sun, 5 Dec 2010 23:49:36 +0100
Martin Manns  wrote:

> Is my replacement of the rectangle object wrong or is vizier not
> working correctly with pygame as well?

Answering my first question:

Vizier works O.K. with pygame. 
I am unsure what I did wrong in the rect replacement though.

Cheers

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


Collision of rotated rectangles without pygame

2010-12-05 Thread Martin Manns
Hello,

I am looking for a Python library for 2D collision checks of rotated
rectangles. Currently, I have found vizier 0.5b that is based on pygame.

Since I do not want to add a pygame dependency to my app, I replaced the
pygame.rect.Rect by a wxPython wx.Rect (see code below).

However, collision checks do not work correctly, i. e. identical rects
are not found to be colliding:

$ python
Python 2.6.6 (r266:84292, Nov 28 2010, 18:42:58) 
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xrect
>>> r=xrect.RotoRect(10,10,30,20,angle=34)
>>> s=xrect.RotoRect(10,10,30,20,angle=34)
>>> r.rotocollide(s)
False
>>> 


Is my replacement of the rectangle object wrong or is vizier not
working correctly with pygame as well?

Do you know of any other pure Python library for rotated rectangle
collision checks?

Cheers

Martin




from __future__ import division
import math
import wx
##


cos_table = dict([(deg, math.cos(math.radians(deg))) for deg in xrange(360)])
sin_table = dict([(deg, math.sin(math.radians(deg))) for deg in xrange(360)])


class RotoRect(wx.Rect):

def __init__(self, *a, **kw):
self.deg = kw.pop('angle')
wx.Rect.__init__(self, *a, **kw)

# pygame rect compatibility for wx.Rect

def get_center(self):
return self.centerx, self.centery

def set_center(self, center):
self.centerx, self.centery = center

def get_centerx(self):
return self.x + self.width / 2

def set_centerx(self, centerx):
self.SetX(centerx - self.width / 2)

def get_centery(self):
return self.y + self.height / 2

def set_centery(self, centery):
self.SetY(centery - self.height / 2)

def get_topleft(self):
return self.GetTopLeft()

def set_topleft(self, p):
self.SetTopLeft(p)

def get_topright(self):
return self.GetTopRight()

def set_topright(self, p):
self.SetTopRight(p)


center = property(get_center, set_center)
centerx = property(get_centerx, set_centerx)
centery = property(get_centery, set_centery)
topleft = property(get_topleft, set_topleft)
topright = property(get_topright, set_topright)

# Now for the vizier code

def rotate(self, point, origin = 0):
"""Returns coords of point p rotated self.theta radians with 

the rectangle around its center

"""

if not origin: origin = self.center
p_x = point[0]
p_y = point[1]
o_x = origin[0]
o_y = origin[1]
costheta = cos_table[self.deg]
sintheta = sin_table[self.deg]
return ((o_x + costheta * (p_x - o_x)) - (sintheta * (p_y - o_y)),
   (o_y + sintheta * (p_x - o_x)) + (costheta * (p_y - o_y)))

def rotoxt(self, a, b):
"""Returns the y extremity xt of rect between self.rect"""

a_x = a[0]
a_y = a[1]
b_x = b[0]
b_y = b[1]

#calculate difference between self.left and b_x
dxl = self.left - b_x 

#calculate difference between self.right and b_x
dxr = self.right - b_x

#if b_x isn't between self.left and self.right
if (dxl * dxr) > 0:   
#if dxl < 1, b_x is on the right
if (dxl < 0):   
#xt = (m * dxr) + b_y
xt = b_y - (-a_y)) / (b_x - (-a_x))) * dxr) + b_y)
else: 
#else b_x is on the left
#xt = (m * dxl) + b_y
xt = b_y - a_y) / (b_x - a_x)) * dxl) + b_y)
return xt
else: 
#else b_x is between self.left and self.right, and xt = b_y
return b_y

def rotocollide(self, rect):
"""Check for collision between self.rect and rect"""

#initialize collision to False
col = False   

#transforming the plane to set rect's center to the origin
transplane = rect.center  

#set rect's center to the origin
rect.center = (0, 0)  

#transform self.rect's center by the transplane amount
self.center = (self.centerx - transplane[0],
   self.centery - transplane[1]) 

#transforming the plane to set self.rect's the

[ANN] Pyspread 0.1.2 released

2010-10-30 Thread Martin Manns

Pyspread 0.1.2 released
===

I am pleased to announce the new release 0.1.2 of pyspread.

 
About: 
--

Pyspread is a cross-platform Python spreadsheet application. 
It is based on and written in the programming language Python.

Instead of spreadsheet formulas, Python expressions are entered into
the spreadsheet cells. Each expression returns a Python object that can
be accessed from other cells. These objects can represent anything
including lists or matrices.

Pyspread runs on Linux and *nix platforms with GTK support as well as
on Windows (XP and Vista tested). On Mac OS X, some icons are too small
but the application basically works.


Homepage


http://pyspread.sourceforge.net


Changes to 0.1.1


New features:

* Added function to make a cell visible
* Third cell justification "center" added
* Ctrl-F now points to find toolbar instead of find dialog
* Frozen state is now saved
* Entering text in a cell now deletes old text
* Added function F5 (in menu View) for refreshing selected cells
* Save option "pys file with/without gpg signature" added

Bug fixes:

* Grid flicker reduced
* Printing works again
* Changing the table now empties the entry line and does not mess
  up  data any more (BUG 3030172)
* 1D printing bug fixed (BUG 2790444)
* Loading a file from command line no longer deletes cell 0,0,0
  (BUG 3030880)
* Undoing paste operations now works (BUG 3019334)
* Bitmap toggle buttons now work in Windows as well
* Marks undo and redo operation do not accumulate any more
* Undoing text font and textattribute changes works now
* CSV import dialog apply button removed
* Cell limit (2**26) for 32 bit systems removed
* Prints of off-screen areas now correctly center on page
* Help now works when not in the home directory
* Double underscores in Tutorial corrected
* Pyspread gpg key name changed to pyspread_
* Deleting rows and columns can be undone again
* When reversing search, all values are now found
* Saved pys files now have .pys suffix added automatically
* Fixed font size reset bug when setting font attributes
* Loading a file from command line now checks signature correctly
* Fixed moving cells bug for edits in non top-left grid position in
  wx.GTK


Enjoy

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


Re: Anyone using GPG or PGP encryption/signatures in your Python apps?

2010-07-02 Thread Martin Manns
On Thu, 01 Jul 2010 14:48:47 -0400
pyt...@bdurham.com wrote:

> Curious if any of you are using GPG or PGP encryption and/or
> signatures in your Python apps?
...
> 4. generating signatures for files that you are exchanging/posting for
> download?

I use pyme to create and check save file signatures.

> 5. what public keyring services are you using?

None
 
> Any comments on using the subprocess module to wrap the gpg or openssl
> command line utilities? This seems to be a common technique for
> encryption and signing solutions and appears to the technique used by
> python-gnupg (for example).

pyme works great with Linux.
However, I have never installed it on a Windows system.

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


Re: xrange issue 7721

2010-05-30 Thread Martin Manns
On Sun, 30 May 2010 00:49:11 +0100
Mark Lawrence  wrote:
 
>  From http://docs.python.org/dev/library/itertools.html
> "Unlike regular slicing, islice()  does not support negative values
> for start, stop, or step."
> 
> Rule 1 of programming never assume anything, particularly wrt
> testing. I assume that you are ok with this. :) Dreadful I know :)

Right, never post before reading the fine manual :)

> > I found the msg97928 code pretty obvious when seeing the snippet.
> > If you disagree you may consider re-opening the issue.
> I trust that you get my point regarding the failure to raise a 
> ValueError :)  Or am I wearing my extremely stupid hat today?

Since you seem to find this issue important, are you going to re-open
the issue?

Cheers

Martin

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


Re: xrange issue 7721

2010-05-29 Thread Martin Manns
On Sat, 29 May 2010 19:46:28 +0100
Mark Lawrence  wrote:

> I've had an OverflowError using xrange with Python 2.6.5 on Windows. 
> Googling got me to the subject line.
> 
> msg97928 gives a code snippet to overcome the limitations of xrange, 
> allowing for negative steps, however it doesn't raise a ValueError
> for a zero step. msg99624 gives a docs change that has been
> implemented for V2.6, but this doesn't refer to the msg97928 code
> snippet, rather it refers to a one liner that only works for positive
> steps.  The docs for V2.7 haven't been changed at all.

Mark:

Thank you for posting.

2.7 is not affected by issue 7721 because itertools.islice behavior is
changed. Therefore, the original snippet should work in 2.7 (I have not
tested this).

I found the msg97928 code pretty obvious when seeing the snippet. 
If you disagree you may consider re-opening the issue.

Martin

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


[ANN] Pyspread 0.1.1 released

2010-05-08 Thread Martin Manns
Pyspread 0.1.1 released
===

I am pleased to announce the new release 0.1.1 of pyspread.

 
About: 
--

Pyspread is a cross-platform Python spreadsheet application. 
It is based on and written in the programming language Python.

Instead of spreadsheet formulas, Python expressions are entered into
the spreadsheet cells. Each expression returns a Python object that can
be accessed from other cells. These objects can represent anything
including lists or matrices.

Pyspread runs on Linux and *nix platforms with GTK support as well as
on Windows (XP and Vista tested). On Mac OS X, some icons are too small
but the application basically works.


Homepage


http://pyspread.sourceforge.net


Changes to 0.1
--

 * Grid is faster.
 * Copying only partly filled cells works now.
 * Cells that get attributes but no string no longer display None.

Enjoy

Martin

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


[ANN] Pyspread 0.1 released

2010-03-20 Thread Martin Manns

Pyspread 0.1 released
=

After a long and eventful Alpha period, pyspread has finally reached
Beta stage. I thank all contributors and testers who have helped
getting pyspread to this point.

About: 
--

Pyspread is a cross-platform Python spreadsheet application. It is
based on and written in the programming language Python.

Instead of spreadsheet formulas, Python expressions are entered into
the spreadsheet cells. Each expression returns a Python object that can
be accessed from other cells. These objects can represent anything
including lists or matrices. 

Stability and compatibility
---

Pyspread runs pretty stable in CPython. Please note that old save files
are not compatible. Load them in the old version and copy the code to a
new version of pyspread via the clipboard. Being in Beta means
increased code stability. Save files are now going to be downwards
compatible. However, major beta releases (e. g. 0.1 to 0.2) may still
break compatibility. Such a change may occur only after being announced
in the previous major beta release.

New features


* New macro editor dialog.
* Macros can now contain any Python code.
* Macros load and save files are now plain text files.
* Macros are now saved within the pys-file.
* Macros files are now signed and included in the trusted file
  concept.

Bug fixes
-

* Cells can now be correctly accessed with negative index (BUG
  2965144)


Homepage


http://pyspread.sourceforge.net



Enjoy

Martin

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


[ANN] Pyspread 0.0.14b released

2010-03-13 Thread Martin Manns
Pyspread 0.0.14b released
=

I am pleased to announce the new release 0.0.14b of pyspread.

 
About: 
--

Pyspread is a cross-platform Python spreadsheet application. 
It is based on and written in the programming language Python.

Instead of spreadsheet formulas, Python expressions are entered into
the spreadsheet cells. Each expression returns a Python object that can
be accessed from other cells. These objects can represent anything
including lists or matrices.

Pyspread runs on Linux and *nix platforms with GTK support as well as
on Windows (XP and Vista tested). On Mac OS X, some icons are too small
but the application basically works.


Homepage


http://pyspread.sourceforge.net


New features


 * Cell border can be changed independently.
 * Cell access allows negative indices when not slicing.


Enjoy

Martin

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


Re: Long integers and ways around xrange

2010-01-16 Thread Martin Manns
On 16 Jan 2010 20:25:44 GMT
Steven D'Aprano  wrote:

> On Sat, 16 Jan 2010 20:04:09 +0100, Martin Manns wrote:
> >> islice(count(start, step), (stop-start+step-1)//step).
> > 
> > However, count only accepts one parameter, so that this solution
> > does not work. Furthermore, islice only accepts positive values for
> > step.
> 
> This should be reported as a documentation bug.

I added a bug report [issue7721].

Thanks for the code review.

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


Long integers and ways around xrange

2010-01-16 Thread Martin Manns
Hi

As stated in the manual, xrange raises an OverflowError for 
long integer parameters. Looking for a xrange like generator 
for long integers, I found this in the manual 
(http://docs.python.org/library/functions.html):

> CPython implementation detail: xrange() is intended to be simple and
> fast. Implementations may impose restrictions to achieve this. The C
> implementation of Python restricts all arguments to native C longs
> (“short” Python integers), and also requires that the number of
> elements fit in a native C long. If a larger range is needed, an
> alternate version can be crafted using the itertools module:
> islice(count(start, step), (stop-start+step-1)//step).

However, count only accepts one parameter, so that this solution does
not work. Furthermore, islice only accepts positive values for step.

I came up with a solution that I have pasted below. 

Is there a standard long integer replacement for xrange? 
Do you have ideas for improving the code?

Best Regards

Martin


File irange.py:


#! /usr/bin/env python
# -*- coding: utf-8 -*-

from itertools import count, imap, islice

def scount(n=0, step=1):
"""Count that supports a step attribute"""

return imap(lambda x: x * step + n, count())

def irange(start, stop=None, step=1):
"""Range for long integers

Usage: irange([start], stop, [step])

Parameters
--
start: Integer, defaults to 0
stop: Integer
step: Integer, defaults to 1

Note on long integers
-

Each of the three parameters can be long integers.
If stop < start: start(stop-start+step-1) // step) must be a short integer.
If stop > start: start(stop-start+step+1) // step) must be a short integer.

"""

if start is None:
raise TypeError, "range() integer argument expected, got NoneType"

if stop is None:
stop = start
start = 0

if step is None:
step = 1

if step > 0:
if stop < start:
return (_ for _ in [])
return islice(scount(start, step), (stop-start+step-1) // step)

elif step < 0:
if stop > start:
return (_ for _ in [])
return islice(scount(start, step), (stop-start+step+1) // step)

else:
raise ValueError, "irange() step argument must not be zero"






File test_irange.py


#! /usr/bin/env python
# -*- coding: utf-8 -*-

from irange import scount, irange 

# Unit test for irange.py (py.test)

class TestIrange(object):
'Unit test for MainGridBase'
__module__ = __name__

def setup_method(self, method):
pass

def test_irange(self):
test_values = [ \
 [2],
 [1],
 [-23],
 (0, 1), 
 (0, 2),
 (0, 1),
 (1, 2),
 (100, 1000),
 (4, 0),
 (4, -1),
 (2**65-512, 2**65),
 (-1, 1),
 (-100, 0),
 (0, 1, 1),
 (0, 2, 1),
 (0, 10, 1),
 (0, 100, 1),
 (0, -1, 1),
 (0, 2, 2),
 (0, 10, 3),
 (0, 100, 4),
 (0, 1000, 60),
 (0, 2**65, 2**60),
 (1, 0, -1),
 (10, 0, -1),
 (12312, 0, -1),
 (2**65, 0, -2**61),
 (1, 0, -2),
 (10, 0, -3),
 (12312, 0, -4),
 (2**65, 0, -2**60),
 (2**67, 0, -2**67+1000),
 (-10, 2, 1),
 (-2, 10, 1),
 (3, 100, 1),
 (1000-1000, 1000, 1),
 (2**65, 2**66, 2**63),
 (-120, 2**65, 2**63),
 (1, -2334234, -1),
 (1, 10, 100),
 (10, 1, 100),
 (1, 10, -100),
 (1, 2, 2**65),
 (1, -2, 2**65),
]

for val in test_values:
assert list(irange(*val)) == range(*val)

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


[ANN] Pyspread 0.0.13 released

2009-12-27 Thread Martin Manns
Pyspread 0.0.13 released


I am pleased to announce the new release 0.0.13 of pyspread.

 
About: 
--

Pyspread is a cross-platform Python spreadsheet application. 
It is based on and written in the programming language Python.

Instead of spreadsheet formulas, Python expressions are entered into
the spreadsheet cells. Each expression returns a Python object that can
be accessed from other cells. These objects can represent anything
including lists or matrices.

Pyspread runs on Linux and *nix platforms with GTK support as well as
on Windows (XP and Vista tested). On Mac OS X, some icons are too small
but the application basically works.


Homepage


http://pyspread.sourceforge.net


New features in 0.0.13
--

* Print framework now supports colors and drawn elements
* Splash screen removed
* Some drawing speed improvements


Bug fixes
-

+ Small white rectangle in upper left corner removed (BUG 2918360)
+ setup.py does not copy directories fixed (BUG 2913911)
+ Folder renaming to fix installation errors (BUG 2909017)


Enjoy

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


pyspread 0.0.12a released

2009-11-22 Thread Martin Manns
Pyspread is getting close to the first Beta. This new release should
work with Windows as well as with Linux.


About
-

Pyspread is a cross-platform Python spreadsheet application. It is
based on and written in the programming language Python.

Instead of spreadsheet formulas, Python expressions are entered into
the spreadsheet cells. Each expression returns a Python object that can
be accessed from other cells. These objects can represent anything
including lists or matrices.

Pyspread runs on Linux, Windows and *nix platforms with GTK+ support. 
I have reports that it works with MacOS X as well.


Homepage


http://pyspread.sf.net


New features in 0.0.12a
---

* pys file support more secure
* ODF file support removed
* Left and right alignment to cell attributes added
* Custom grid & cell drawing on refresh added
* Save functionality for row and column size added
* Problem with update of cells that contain strings, lists solved
* Frozen cells toolbar update fixed
* Windows missing cell background bug removed



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


Which sparse matrix package?

2008-12-18 Thread Martin Manns
Hi:

I am writing a spreadsheet application in Python

http://pyspread.sf.net

which currently uses numpy.array for:

+ storing object references 
  (each array element corresponds to one grid cell)
+ slicing (read and write)
+ mapping from/to smaller numpy.array
+ searching and replacing
+ growing and shrinking
+ transpose operation.

While fast and stable, this is really memory inefficient for large grids
(i.e. larger than 1E7 rows and columns), so that I am looking into dicts
and sparse matrices.

The dict that I tried out is of the type:

{(1,2,3): "2323", (1,2,545): "2324234", ... }

It is too slow for my application when it grows. One slicing operation
with list comprehensions takes about 1/2 s on my computer for 1E6
elements.

Therefore, I looked into sparse matrices and found scipy.sparse and
pysparse. I tried out both lil_matrix objects. (I wrote a wrapper that
turns them into Python object arrays.)

scipy.sparse.lil_matrix allowed __getitem__ slicing only for one of the
dimensions and used much memory when increasing the number of
columns above 1E7.

pysparse.spmatrix.ll_mat was faster, uses less space and allows slicing
for both dimensions. However, its methods are not documented well and
I am not able to compile it in Debian testing due to some g77
dependencies. Even though the deb package works well, I am concerned
about having a dependency to a problematic package.


Now my questions:

Is there a better suited / maintained module for such sparse matrices
(or multi-dim arrays)? 

Should I use another type of matrix in scipy.sparse? If yes which?

Does a different data-structure suit my above-stated needs better?

Best Regards

Martin

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


Re: Python Linear Programming on Ubuntu

2008-09-17 Thread Martin Manns
On Tue, 16 Sep 2008 19:25:58 -0700 (PDT)
Fett <[EMAIL PROTECTED]> wrote:

> # SciPy -- http://www.scipy.org - supposedly has this, but as I said,
> I can't find any mention of it anywhere but on the site you linked.

I found OpenOpt on the site:
http://scipy.org/scipy/scikits/wiki/MILP

I downloaded the svn version and installed it on my Debian box.
There were some error messages while installing. However, the example
seems to work anyways. I am using the solver glpk from the
package python-glpk.

I hope that this works on your Ubuntu system as well.
--
http://mail.python.org/mailman/listinfo/python-list


ANN: pyspread 0.0.9

2008-08-25 Thread Martin Manns
pyspread 0.0.9 has been released.

About:
pyspread is a spreadsheet that accepts a pure python expression in
each cell.

New features:
+ Find & Replace
+ Undo & Redo
+ New context menu in grid
+ Improved speed especially for large grids
+ Relative addressing revamped
+ CSV import improved
+ Icons changed to Tango iconset
+ Docstrings improved
+ Bug fixes in print framework

Highlights:
+ Numpy high performance arrays for spreadsheet calculation
+ Full access to python batteries from each cell
+ No non-python syntax add-ons
+ 3D grid
+ Cell access via slicing of numpy array S
+ X, Y, and Z yield current cell location for relative reference

Notes:
Please use distutils for installation.
Make sure that the old files are deleted:
$ su
$ rm -Rf [MyPythonPath]/site-packages/pyspread*
$ python setup.py install
$ exit
$ pyspread.py

Requires: Python >=2.4, Numpy >=1.1.0, and wxPython >=2.8.7.1.
License: GPL

Project page: http://pyspread.sourceforge.net

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


Re: ANN: pyspread 0.0.8

2008-08-03 Thread Martin Manns
On Sun, 03 Aug 2008 14:25:11 -0400
"Colin J. Williams" <[EMAIL PROTECTED]> wrote:
> I've copied your tutorial in my 
> site-packages\pyspread directory

I wrote the tutorial in this thread as a step by step guide that
can be followed manually. You do not need to put it anywhere on your
hard drive. Start pyspread and type in the lines starting with "> "
manually.

> When I try it (a) I can't open your test 
> data and (b)I enter 1 in [0,0], 'abc' in 
> [0,1], 'def' in [0,2] and 'ghi' in [1.2].

I assume that you tried to open the "test.pys" file. This file is not
needed for the tutorial. Type in as you did into the empty grid and it
should work.
(Please tell me if it does not display 1 in [0,0], abc in [0,1], def in
[0,2] and ghi in [1,2].)

> The first gives an unable to find rpy 
> message and the second doesn't display.

The "test.pys" file is an example how to use the 3rd party package rpy
for convenient plotting. Probably on your system, rpy is not installed.
When you install rpy, do not forget to install the statistics package R
that it depends on as well.

However, you do not have to use rpy for plotting. If you prefer other
plotting packages (e.g. gnuplot), feel free to import them as displayed
with the decimal built-in package. You can import (almost) everything
that you can import in any Python program (though matplotlib made some
trouble the last time I tried). 

(Hint: pyspread does *not* protect your system in any special way. So if
you write a system command to delete all files and have sufficient
rights to do this, the files will be deleted.)

Please let me know, which OS you are using (Unix/Linux, MacOS, Windows
or something else).

Best Regards

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


pyspread 0.0.7

2008-06-01 Thread Martin Manns
pyspread 0.0.7 has been released.

--

New features:
+ CSV import dialog with preview grid

Bug fixes:
+ setup.py now installs correctly into a sub-folder (tested for Linux
and WinXP).

--

About: 
pyspread is a spreadsheet that accepts a pure python expression in
each cell.

--

Highlights:
+ No non-python syntax add-ons
+ Access to python modules from cells
+ 3D grid
+ Numpy object array for representation of string entry into grid cell
+ Numpy object array for representation of eval function array
+ Cell access via slicing of numpy function array
+ X, Y, and Z yield current cell location for relative reference

Requires: Python >=2.4, Numpy 1.0.4, and wxPython 2.8.7.1.
License: GPL

Project page: http://pyspread.sourceforge.net

Best Regards

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


Re: Getting a set of lambda functions

2008-05-25 Thread Martin Manns
On Sun, 25 May 2008 14:39:28 -0700 (PDT)
[EMAIL PROTECTED] wrote:

> This may have some bugs left, but it looks a bit better:
[...]
> self._hash = hash(self._func.func_code) ^ \
>  hash(tuple(signature[0]) + tuple(signature[1:3]))
> def __eq__(self, other):
> return self._func.func_code == other._func.func_code and \
>getargspec(self._func) == getargspec(other._func)
> def __hash__(self):
> return self._hash
> def __call__(self, *args, **kwargs):
> return self._func(*args, **kwargs)
> 
> I haven't put a full hashing of getargspec(self._func) too into the
> __init__() because it may contain too much nested unhashable
> structures, but the __eq__() is able to tell them apart anyway, with
> some collisions.

Looking at a function:

>>> a=lambda x:x
>>> dir(a)
['__call__', '__class__', '__delattr__', '__dict__', '__doc__',
'__get__', '__getattribute__', '__hash__', '__init__', '__module__',
'__name__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__str__', 'func_closure', 'func_code', 'func_defaults',
'func_dict', 'func_doc', 'func_globals', 'func_name']

Should func_globals and func_name also be taken into account for
__eq__()?

Best Regards

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


Re: Getting a set of lambda functions

2008-05-25 Thread Martin Manns
On Sun, 25 May 2008 12:14:25 + (UTC)
Ivan Illarionov <[EMAIL PROTECTED]> wrote:

> On Sun, 25 May 2008 13:43:15 +0200, Martin Manns wrote:
> 
> Maybe make a set of code objects?
> 
> func_code_set = set([f.func_code for f in funclist])
> 
> funclist = []
> for fc in func_code_set:
> f = lambda x: x
> f.func_code = fc
> funclist.append(f)

Works for me.

Thanks

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


Getting a set of lambda functions

2008-05-25 Thread Martin Manns
Hi,

I try to get a set of lambda functions that allows me executing each
function code exactly once. Therefore, I would like to modify the set
function to compare the func_code properties (or the lambda
functions to use this property for comparison). 

(The reason is that the real function list is quite large (> 1E5), there
are only few functions with non-equal code and the order of execution
is not important.)

How can I achieve this?

>>> func_strings=['x', 'x+1', 'x+2', 'x']
>>> funclist = [eval('lambda x:' + func) for func in func_strings]
>>> len(funclist)
4
>>> len(set(funclist))
4
>>> funclist[0].func_code == funclist[3].func_code
True
>>> funclist[0] == funclist[3]  
False


Thanks in advance

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


distutils directory problem

2008-05-18 Thread Martin Manns
Hi,

I have the following problem with the distutils package:
(I have now spent hours reading and searching the manuals and tutorials,
and I am still stuck.)

I have a working directory
~/pyspread
in which my libraries are situated and two icons directories
~/pyspread/icons and ~/pyspread/icons/actions

Now I would like to create a setup.py file inside my ~/pyspread
directory that installs my .py modules in .../site-packages/pyspread
and the icons in appropriate sub-folders and adds pyspread.pth to
.../site-packages so that .../site-packages/pyspread is in the
PYTHONPATH.

However, my setup.py puts everything  (including .pyc files) into
site-packages *and* into the sub-folders. What am I doing wrong?

I am looking for a platform-independent solution. Currently, I am using
python 2.5 on Linux.

Here my setup.py

#!/usr/bin/env python

from distutils.core import setup
setup(name='pyspread',
  version='0.0.7',
  description='A spreadsheet that accepts a pure python expression in each 
cell.',
  license='GPL v3 :: GNU General Public License',
  classifiers=[ 'Development Status :: 3 - Alpha',
'Intended Audience :: End Users/Desktop',
  ],
  author='Martin Manns',
  author_email='[EMAIL PROTECTED]',
  url='http://sourceforge.net/projects/pyspread/',
  packages=['pyspread'],
  package_dir={'pyspread': '.'},
  scripts=['pyspread.py'],
  py_modules=['pyspread.mainapp', 'pyspread.pysgrid', 
'pyspread.mygrid','pyspread.icontheme'],
  package_data={'pyspread': ['icons/*.png', 'icons/actions/*.png' ,\
 'test.pys', 'test.csv', 'test2.csv', \
 'README', 'COPYING']},
)


Thanks in advance

Martin


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


ANN: pyspread 0.0.6

2008-05-13 Thread Martin Manns
On Tue, 13 May 2008 00:23:12 +0200
Martin Manns <[EMAIL PROTECTED]> wrote:

pyspread 0.0.5 has been released.
It is a bugfix release for Mac and Windows.

> --
> 
> About: 
> pyspread is a spreadsheet that accepts a pure python expression in
> each cell.
> 
> --
> 
> Highlights:
> + No non-python syntax add-ons
> + Access to python modules from cells
> + 3D grid
> + Numpy object array for representation of string entry into grid cell
> + Numpy object array for representation of eval function array
> + Cell access via slicing of numpy function array
> + X, Y, and Z yield current cell location for relative reference
> 
> Requires: Python >=2.4, Numpy 1.0.4, and wxPython 2.8.7.1.
> License: GPL
> 
> Project page: http://pyspread.sourceforge.net
 
Best Regards

Martin



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


ANN: pyspread 0.0.5

2008-05-13 Thread Martin Manns
pyspread 0.0.5 has been released.

--

New features are:
+ X, Y, Z for relative cell relations are now pre-processed (easier to
use)
+ Cells can be given a name with =. These names are
located in the global namespace
+ Arrays and matrices within one cell can now easily be spread out to a
cell range in the grid with the spread function. (spread(x,y,z,value)
where x,y,z represents the top-left-front target cell and value is
replaced by the origin cell reference)
+ Rows and columns can be inserted and deleted
+ Copy, Paste and Delete behaviour improved
+ Copy and Paste now work in cell editor when no selection is present
+ Basic tab-delimited text import added

--

About: 
pyspread is a spreadsheet that accepts a pure python expression in
each cell.

--

Highlights:
+ No non-python syntax add-ons
+ Access to python modules from cells
+ 3D grid
+ Numpy object array for representation of string entry into grid cell
+ Numpy object array for representation of eval function array
+ Cell access via slicing of numpy function array
+ X, Y, and Z yield current cell location for relative reference

Requires: Python >=2.4, Numpy 1.0.4, and wxPython 2.8.7.1.
License: GPL

Project page: http://pyspread.sourceforge.net

Best Regards

Martin


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


Re: ANN: pyspread 0.0.4

2008-04-28 Thread Martin Manns
On Sun, 27 Apr 2008 05:21:56 +0200
Martin Manns <[EMAIL PROTECTED]> wrote:

> The newest version pyspread 0.0.4 now runs on 
> + GTK
> + Windows
> + Mac (not tested myself but got positive reports)
> 
> New features in 0.0.4:
> + Column, line and table insertion and deletion
> + Themeable toolbar

I forgot to post the short description and the link:

pyspread is a spreadsheet that accepts a pure python expression in
each cell.

Highlights:
+ No non-python syntax add-ons
+ Access to python modules from cells
+ 3D grid
+ Numpy object array for representation of string entry into grid cell
+ Numpy object array for representation of eval function array
+ Cell access via slicing of numpy function array
+ X, Y, and Z yield current cell location for relative reference

Requires: Python >=2.4, Numpy 1.0.4, and wxPython 2.8.7.1.
License: GPL

Project page: http://pyspread.sourceforge.net

Best Regards

Martin

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


ANN: pyspread 0.0.4

2008-04-27 Thread Martin Manns
Hi,

The newest version pyspread 0.0.4 now runs on 
+ GTK
+ Windows
+ Mac (not tested myself but got positive reports)

New features in 0.0.4:
+ Column, line and table insertion and deletion
+ Themeable toolbar

Feedback is very welcome!

Best Regards

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


Re: ANN: pyspread 0.0.1

2008-04-19 Thread Martin Manns
On Fri, 18 Apr 2008 04:46:38 +0200
Martin Manns <[EMAIL PROTECTED]> wrote:

> pyspread 0.0.1 is now available at:
> http://pyspread.sourceforge.net

Hi,

I updated to version 0.0.2 that fixes the tarballs and zip files.
Any information about the package working on different platforms is
appreciated.

I got it working on Gentoo and on Debian (python 2.4).


Best Regards

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


ANN: pyspread 0.0.1

2008-04-18 Thread Martin Manns
pyspread 0.0.1 is now available at:
http://pyspread.sourceforge.net

pyspread is a spreadsheet that accepts a pure python expression in
each cell.

Highlights:
+ No non-python syntax add-ons
+ Access to python modules from cells
+ 3D grid
+ Numpy object array for representation of string entry into grid cell
+ Numpy object array for representation of eval function array
+ Cell access via slicing of numpy function array
+ X, Y, and Z yield current cell location for relative reference

Requires: Python 2.5, Numpy 1.0.4, and wxPython 2.8.7.1.
License: GPL

Best Regards
Martin Manns
--
mmanns  gmx.net
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: How can I make a function equal to 0?

2008-03-21 Thread Martin Manns
On Fri, 21 Mar 2008 14:51:49 -0700 (PDT)
Gabriel Genellina <[EMAIL PROTECTED]> wrote:

> > If I fill the array with 0 instead of the functions that
> > return "" this works really fast.
> >
> > However, I would like to be able call the content of each
> > cell in the array as a function.
> 
> If you drop this condition then you could fill the array with zeroes
> as before, replace only the interesting ones with actual functions,
> and write:
> 
> for item in myarray[nonzero(myarray)]:
> print item() if callable(item) else item

Works for me.

Thank you

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


Re: How can I make a function equal to 0?

2008-03-21 Thread Martin Manns
On Fri, 21 Mar 2008 13:12:56 -0700 (PDT)
Arnaud Delobelle <[EMAIL PROTECTED]> wrote:

> On Mar 21, 7:48 pm, Martin Manns <[EMAIL PROTECTED]> wrote:
> Why do you want to do that?

First thank you for your help, the callable object works.

Basically I have a lot of functions inside a numpy array,
of which most return "" and actually are derived as follows:

from numpy import *

grid_size = 100

class F(object):  
def __cmp__(self, other): return 0
def __call__(self, dummy): return ""
f = F()
myarray = array([f] * grid_size, dtype="O")

# I re-define an element in the array

myarray[34424] = lambda x: "23"

# Now, I would like to loop over all re-defined elements:

for i in itertools.izip(*nonzero(myarray)):
print myarray[i]()

If I fill the array with 0 instead of the functions that 
return "" this works really fast.

However, I would like to be able call the content of each
cell in the array as a function.

As I said, the callable object approach works but is
about as slow as iterating through the whole array.
Perhaps I should add a __call__ function to the built-in
0? But I doubt that this helps.

Martin

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


Re: How can I make a function equal to 0?

2008-03-21 Thread Martin Manns
On 21 Mar 2008 12:52:12 -0700
Paul Rubin  wrote:

> def f(): return 0

Let us try it:

Python 2.5.1 (r251:54863, Jan 26 2008, 01:34:00) 
[GCC 4.1.2 (Gentoo 4.1.2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> def f(): return 0
... 
>>> f==0
False
>>> f()==0
True
>>> 


I do not want the function to return 0 but to equal 0.

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


How can I make a function equal to 0?

2008-03-21 Thread Martin Manns
Hi,

Is there a way to create a function that is equal to 0?
I try to redefine __cmp__ but I am pretty stuck.

Something like:

>>> def f(): return ""
...
>>> # Some magic
>>> f == 0
True

Thanks in advance

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


pyfov Package Index link broken

2008-01-25 Thread Martin Manns
Hi,

I am looking for the code of pyfov, which is on the Package Index.
However, the link is broken and the author does not seem to respond to
e-mails.

Any chance to get hands on the code?

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


Re: A GUI framework for running simulations

2008-01-23 Thread Martin Manns
On Wed, 23 Jan 2008 06:10:07 -0800 (PST)
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:

> Hello! I am currently working on writing a simulation engine for
> special relativity physics. I'm writing it in Python, of course. I'm
> doing fine with the engine, but I want a GUI framework in which I
> could use it conveniently, and test different setups on it. I'm not so
> strong with GUI programming. I looked at Tkinter, I looked at
> WxPython, I looked at PythonCard. It all looks pretty daunting.

If you want to keep things simple, pygame could be an alternative for
visualizing simulations and setting parameters even though it does not
provide all these fancy widgets around.

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


Re: Slicing wrapped numpy arrays

2008-01-13 Thread Martin Manns
On Sun, 13 Jan 2008 16:03:16 -0600
Robert Kern <[EMAIL PROTECTED]> wrote:

> Martin Manns wrote:
> > Hi,
> > 
> > I have created a class that wraps a numpy array of custom objects. I
> > would like to be able to slice respective objects (without copying
> > the array if possible).
> > 
> > I have browsed the doc and found some hints at __getitem__.
> > However, I still do not grasp how to do it.  How do I implement
> > __getitem__ correctly?
> 
> > mymap[10:20,15:20,:] # This line should work afterwards
> 
> The first thing you should do is simply implement a very basic,
> nonfunctional version just to see what objects come in:
> 
> In [1]: class Sliceable(object):
> ...: def __getitem__(self, arg):
> ...: print arg
> ...:

I did that and got here:

> (slice(None, None, 2), slice(10, None, 10))

However, I still do not see how I get a Map object that employs a
slice of the array without creating a new Map object.

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


Slicing wrapped numpy arrays

2008-01-13 Thread Martin Manns
Hi,

I have created a class that wraps a numpy array of custom objects. I
would like to be able to slice respective objects (without copying the
array if possible).

I have browsed the doc and found some hints at __getitem__. However, I
still do not grasp how to do it.  How do I implement __getitem__
correctly?


from numpy import *

class Cell(object):
pass

class Map(object):
def __init__(self, dimensions):
self.generate_map(dimensions)

def generate_map(self, dimensions):
map_range = xrange(reduce(lambda x,y: x*y, dimensions))
self.map = array([Cell() for i in map_range])
self.map = self.map.reshape(dimensions)

mymap = Map((100, 100, 100))
mymap[10:20,15:20,:] # This line should work afterwards


Thanks in advance

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


Re: Method calls and stack consumption

2007-04-15 Thread Martin Manns
On Sun, 15 Apr 2007 07:27:25 +0200
Peter Otten <[EMAIL PROTECTED]> wrote:

> Martin Manns wrote:
> 
> > Calling methods of other object instances seems quite expensive on
> > the stack (see example below). Is there a better way of traversing
> > through methods of instances that are connected in a cyclic graph?
> > (The real program's graph contains multiple successors in lists.)

> a = a.a
> while True:
> a = a()
> 
> That's how you can do it if your real program is similar enough to the
> example...

Thanks for pointing out the oversimplified nature of the original
example.I hope that the following one clarifies the problem.

(I do not know, what has to be stored on the stack, but it should not be
that much, because all recursion calls originate from inside the return
statement.)


from random import randint,seed
import sys
seed()
sys.setrecursionlimit(100)

class Node(object):
def __init__(self):
self.state = abs(randint(1,1000))
def GetDepState(self):
return self.state + max(s.GetDepState() for s in S[self])

class ConditionalBreakNode(Node):
def GetDepState(self):
if randint(1,5) > 1:
return Node.GetDepState(self)
else:
return self.state

S = {}
nodes = [Node()]

def AppendNode(curr_node, depth=1):
global nodes
r = randint(1,30)
if r >= depth:
for i in xrange(randint(1,3)):
newnode = Node()
nodes += [newnode]
try: S[curr_node] += [newnode]
except: S[curr_node] = [newnode]
AppendNode(newnode, depth+1)
else:
newnode = ConditionalBreakNode()
nodes += [newnode]
try: S[curr_node] += [newnode]
except: S[curr_node] = [newnode]
S[newnode] = [nodes[0]]

AppendNode(nodes[0])
print len(nodes)
print nodes[0].GetDepState()

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


Method calls and stack consumption

2007-04-14 Thread Martin Manns
Hi,

Calling methods of other object instances seems quite expensive on the
stack (see example below). Is there a better way of traversing through
methods of instances that are connected in a cyclic graph? (The real
program's graph contains multiple successors in lists.)

class A(object):
def __init__(self):
self.i = 0
def a(self):
if self.i % 1000 == 0:
print self.i
self.i += 1 
return S[self].a()

a = A()
b = A()
S = {a:b, b:a}

import sys
sys.setrecursionlimit(100)
print a.a()


0
0
1000
1000
[...]
69000
69000
Segmentation fault
~ $ ulimit -s
65536
~ $

Thus, each call seems to be about 480 bytes on the stack.

Is there a good way to reduce stack consumption per call?
Could and should I resort to stackless?
If yes, how can the graph structure be realized?
Would I need a tasklet for each instance?

I am currently hesitant to depend on something from svn.
How stable and robust is stackless?

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


Re: grandparent method with super

2007-04-05 Thread Martin Manns
On 5 Apr 2007 15:05:25 -0700
[EMAIL PROTECTED] wrote:
> 
> class E(C,D):
> def m(self):
> for cls in E.__mro__:
> if cls != E and cls not in E.__bases__:
> cls.m(self)
> break
> 
> 
> ... but it's probably better that you
> rethink your class hierarchy.

After seeing the implications and the solutions, I will.

Thank you everyone for your help

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


Re: grandparent method with super

2007-04-05 Thread Martin Manns
On Thu, 5 Apr 2007 16:55:38 -0400
"John Clark" <[EMAIL PROTECTED]> wrote:
> >That works, but when I replace A with something else, I do not get
> >the  
> grandparent anymore   
> >without changing all the method calls. Basically, I would like to
> >call the  
> method m in the first   
> >grandparent of D.
> >
> >Martin  
> 
> I think the problem you may run into is with the term "first
> grandparent" - when you look at the method resolution order of the
> class D, you will find that the MRO goes "D, C, B, A"... I think it's
> going to be difficult to figure out where the "first grandparent" is
> in the MRO. 
> 
> For example: 
> 
> class A(object):
>   def m(self):
>   pass
> class B(A):
>   def m(self):
>   pass
> class C(B):
>   def m(self):
>   pass
> class D(A):
>   def m(self):
>   pass
> class E(C,D):
>   def m(self):
>   firstgrandparent(E,self).m() #Should call B.m
> class F(D,C):
>   def m(self):
>   firstgrandparent(F,self).m() # Should call F.m
> 
> 
> The mro for class E is going to be "E,C,B,D,A" where as the mro for
> class F is going to be "F,D,C,B,A".  However, the first grandparent
> for E should be B, where as the first grandparent for F should be A.  
> 
> Because the MRO isn't just a depth first traversal, the term "first
> grandparent" gets tricky to define...  

Not really. The first grandparent would be the first occurrence in the
list from left to right, which satisfies the requirement that its
shortest path to the current class is 2.

The only problem: How do I get it?

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


Re: grandparent method with super

2007-04-05 Thread Martin Manns
On Thu, 5 Apr 2007 16:33:37 -0400
"John Clark" <[EMAIL PROTECTED]> wrote:

> Pretty sure you can do this:
> 
> class A(object):
>   def m(self):
> class B(A):
>   def m(self):
> class C(A):
>   def m(self):
> class D(B,C):
>   def m(self):
>   A.m(self)
>  
> I don't think you want to try to use super() in this case.

That works, but when I replace A with something else, I do not get the
grandparent anymore without changing all the method calls. Basically, I
would like to call the method m in the first grandparent of D.

Martin

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


grandparent method with super

2007-04-05 Thread Martin Manns
Hi,

I have a class structure as follows and I would like to invoke the
method A.m() from D.m

class A(object):
def m(self):
class B(A):
def m(self):
class C(A):
def m(self):
class D(B,C):
def m(self):
# Call A.m with super?

I have read http://www.python.org/download/releases/2.2/descrintro/ but
I am still stuck.

Thanks in advance

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


inf class (was: gmpy floating point exception)

2007-03-29 Thread Martin Manns
On Thu, 29 Mar 2007 00:57:03 -0700
[EMAIL PROTECTED] (Alex Martelli) wrote:

> Martin Manns <[EMAIL PROTECTED]> wrote:
> > 2) Is there any inf type around with
> > a + inf == inf
> > inf > a (as long as a != inf)
> > etc.
> > that works with any other type?
> 
> You mean something like:
> 
> class inf(object):
> def __radd__(self, other): return self
> def __gt__(self, other): return self is not other
> # etc
> inf = inf()

Actually, I meant something a bit more sophisticated:
a=inf()
b=inf()
c=-inf()
d=1e9
e=numpy.float64(1e9)
f=gmpy.mpq(1,2)

a > b   OverflowError (AmbiguousValueError?)
a == b  OverflowError (AmbiguousValueError?)
a + b   inf (New inf instance)
a + c   OverflowError (AmbiguousValueError?)
a + d   a
max(a,b)inf (New inf instance)
max(a,c)a
max(a,d)a
max(a,b) == a   OverflowError (AmbiguousValueError?)
max(a,b) == b   OverflowError (AmbiguousValueError?)
max(a,b) > aOverflowError (AmbiguousValueError?)
max(a,b) >= a   True (if somehow possible)
max(a,b) < aFalse (if somehow possible)
a is b  False
a > c   True
a == -a False
a == -c OverflowError (AmbiguousValueError?)
a > d   True
a > e   True
c > f   False

The idea is a class that permits non-ambiguous comparisons but throws
exceptions if ambiguous comparisons are made. Since I think that
setting up such a class involves quite some effort (especially
considering things such as a + a) I just wanted to know if something
similar is already around. I am aware of the PEP 326 but I feel that it
does not really address the problem.

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


gmpy floating point exception

2007-03-28 Thread Martin Manns
Hi,

I am experiencing some trouble with gmpy v1.01.
Multiplying an mpq with inf results in a floating point exception that
exits python. Has this already been fixed in newer gmpy versions? 

~ $ python
Python 2.4.3 (#1, Mar 26 2007, 00:32:54) 
[GCC 4.1.1 (Gentoo 4.1.1-r3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gmpy import mpq as Rational
>>> a=Rational(2,3)
>>> b=1.0e9
>>> b
inf
>>> int(b)
Traceback (most recent call last):
  File "", line 1, in ?
OverflowError: cannot convert float infinity to long
>>> a+b
Floating point exception
~ $


BTW.
1) What is the best way to test for inf regardless of type?
2) Is there any inf type around with
a + inf == inf
inf > a (as long as a != inf)
etc.
that works with any other type?

Thanks in advance

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


Re: Rational numbers

2007-02-23 Thread Martin Manns
On 23 Feb 2007 22:19:30 -0800
[EMAIL PROTECTED] wrote:

> > Looks pretty much the same as mx.Number
> >
> > Does this warning come up from gmp? Do I have to compile it with
> > different flags?
> > Or do both wrappers use the same code?
> >
> > I would like to encourage the python community (i.e. the guys
> > maintaining the python docs) to point out a recommended rational
> > library. In one of the rational PEPs, it is stated that there are
> > multiple robust rational wrappers for python. But it is not stated,
> > which ones were thoroughly reviewed.
> >
> That specific error message is only a warning that occurs the first
> time a comparison operation is performed. I've successfully used gmpy
> and just ignored the one-time only error. You can use the "warnings"
> module to filter out that error. If I remember correctly, it was fixed
> in version 1.01. I know it is fixed in the SVN version.
> 
> Which specific version of gmpy are you using? (What is
> gmpy.version()?)
> 
$ python
Python 2.4.3 (#1, Jan 13 2007, 20:53:15) 
[GCC 4.1.1 (Gentoo 4.1.1-r3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gmpy
>>> gmpy.version()
'1.01'
>>> 

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


Re: Rational numbers

2007-02-23 Thread Martin Manns
On Fri, 23 Feb 2007 20:20:12 -0300
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote:

> En Fri, 23 Feb 2007 12:35:19 -0300, Martin Manns <[EMAIL PROTECTED]>
> escribió:
> 
> > I am starting to use rationals and since I found no batteries
> > included, I tried out the mxNumber package.
> >
> > However, I get strange warnings on comparison operations
> > (which however seem to yield correct results):
> 
> mx.Number.Rational is horribly broken. They break this rule:
> 
> a==b => hash(a)==hash(b)
> 
> so they can'b be used as dictionary keys, by example.
> Try the other packages suggested. I've used clnum without problems.
> 

I would be interested, under which circumstances the rule is broken.
In my (few) tests, hash(a)==hash(b) worked.

But I will definitely try clnum.
However, I already started trying out gmpy (1.1):

$ python
Python 2.4.3 (#1, Jan 13 2007, 20:53:15) 
[GCC 4.1.1 (Gentoo 4.1.1-r3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from gmpy import *
>>> a=mpq(0,1)
>>> a
mpq(0)
>>> b=-500
>>> a==b
__main__:1: RuntimeWarning: tp_compare didn't return -1, 0 or 1
False
>>>

Looks pretty much the same as mx.Number

Does this warning come up from gmp? Do I have to compile it with
different flags?
Or do both wrappers use the same code?

I would like to encourage the python community (i.e. the guys
maintaining the python docs) to point out a recommended rational
library. In one of the rational PEPs, it is stated that there are
multiple robust rational wrappers for python. But it is not stated,
which ones were thoroughly reviewed.

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


Re: Rational numbers

2007-02-23 Thread Martin Manns
On 23 Feb 2007 12:00:10 -0800
[EMAIL PROTECTED] wrote:
> 
> I worked with Alex Martelli (gmpy's maintainer) to fix a bug found by
> mensanator. With Alex's permission, I released it as gmpy 1.04a. Alex
> has not updated cvs with the fix.
> 
> gmpy 1.04a compiles cleanly with the latest releases of Python and
> GMP, so I consider it stable.
> 
> >
> > Actually, gmpy is being maitained even if SourceForge isn't up to
> > date.
> >
> > I got my gmpy 1.04a for Python 2.5 Windows binary from
> >
> > 
> >
> > I haven't used the rationals all that much, but been very
> > happy with them when I have.
> >
> 
> casevh
> 

Thank you for all the replies.

I think that I am going to switch to gmpy.

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


Re: Rational numbers / alternatives to mxNumber

2007-02-23 Thread Martin Manns
On Fri, 23 Feb 2007 11:39:11 -0500
Martin Manns <[EMAIL PROTECTED]> wrote:

> + boost indeed is a quite nice C++ library. However, I fear that I
> would end up writing the python wrappers for operators (+ - * / min
> max cmp etc.) myself. I would like to avoid this since these operators
> should work correctly for any type (not just int and float) and I have
> little experience with verifying such generic code. The problems
> encountered in the mxNumber wrapper support this notion.


I just saw the pyboost-linux-0.1.1 package and tried it out.

ImportError: /home/mn/notes/libboost_python.so.1.34.0: undefined
symbol: PyUnicodeUCS4_FromEncodedObject

It seems to have problems with UCS2 compiled python.
Any robust rational wrapper out there?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Rational numbers

2007-02-23 Thread Martin Manns
On Fri, 23 Feb 2007 09:52:06 -0600
Larry Bates <[EMAIL PROTECTED]> wrote:
> I quick search of Google turned up:
> 
> http://books.google.com/books?id=1Shx_VXS6ioC&pg=PA625&lpg=PA625&dq=python+rational+number+library&source=web&ots=BA8_4EXdQ4&sig=aDEnYA99ssKe7PSweVNyi8cS2eg
> http://calcrpnpy.sourceforge.net/clnum.html
> http://gmpy.sourceforge.net/

Sorry that I did not point these out initially.

+ clnum seems to be slower and for speed may be compiled to wrap gmp so
that it is just an additional layer between python and gmp .

+ gmpy is looking pretty unmaintained (dead) to me (newest update of
cvs 10 months ago).

+ boost indeed is a quite nice C++ library. However, I fear that I
would end up writing the python wrappers for operators (+ - * / min
max cmp etc.) myself. I would like to avoid this since these operators
should work correctly for any type (not just int and float) and I have
little experience with verifying such generic code. The problems
encountered in the mxNumber wrapper support this notion.

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


Rational numbers

2007-02-23 Thread Martin Manns
Hi,

I am starting to use rationals and since I found no batteries included,
I tried out the mxNumber package.

However, I get strange warnings on comparison operations
(which however seem to yield correct results):

---
$ python
Python 2.4.3 (#1, Jan 15 2007, 15:46:19) 
[GCC 4.1.1 (Gentoo 4.1.1-r3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from mx.Number import *
>>> a=Rational(0,1)
>>> a
0/1
>>> str(a)
'0.0'
>>> b=-50
>>> b
-50L
>>> a==b
__main__:1: RuntimeWarning: tp_compare didn't return -1, 0 or 1
False
>>> 
---

How do I get rid of these warnings?

Is there any rational number library around that
1) is comparably fast for large denominators
2) allows deriving types from Rationals without wrapping?

Regards

Martin

P.S. The respective mailing list does not like me, so that I try my
luck here.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: trees

2006-12-18 Thread Martin Manns
John Nagle wrote:

>SpeedTree, of course.
> 
> http://www.speedtree.com
> 
>They have great downloadable demos.

And how do you distribute the code in a python program?
Is there a wrapper for an available static library
or do I have to compile the speedtree source when
running the python program?

:)

M
--
>From the homepage:
What parts of SpeedTree can I distribute with my game?

Before any sort of distribution, a full license of SpeedTree must be purchased.
Following this, the SpeedTreeRT library must be fully integrated with your game
before distribution. This means that either a static library is used or the 
source
code must be built in (no DLLs may be distributed). No source code from the SDK 
can
be distributed, with some exceptions for modified wrapper classes from the 
samples
(contact [EMAIL PROTECTED] for verification).
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Max-plus library

2006-10-17 Thread Martin Manns
Sébastien Boisgérault wrote:
> Robert Kern wrote:
>> Martin Manns wrote:
>>> Hello,
>>>
>>> Is there any library that allows employing max-plus dioids in
>>> python (e.g. based on numpy/scipy)?
>> Google says "no" and I haven't heard of any, so I imagine that there aren't.
>> There might be something buried in some of the control theory packages, but 
>> as I
>> neither know what max-plus dioids are, nor have I any current interest in 
>> them,
>> I can't give you any better pointers.
> 
> See http://cermics.enpc.fr/~cohen-g//SED/index-e.html for a two-page
> introduction to the field and its applications. Definitely worth a look
> IMHO.
> 
> The second software you refer to
> (http://www-rocq.inria.fr/MaxplusOrg/soft.html) is a Scilab package but
> essentially made of C and Fortran files. Getting a working binding for
> Python may not be that hard ...
> 

Thank you for the fast replies. Since I currently have not the time to
write bindings, I will probably have to stick to the Matlab implementation.

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


Max-plus library

2006-10-16 Thread Martin Manns
Hello,

Is there any library that allows employing max-plus dioids in
python (e.g. based on numpy/scipy)?

The only libraries that I found so far are for Matlab / Octave,
Scilab and Maple:
http://ifatwww.et.uni-magdeburg.de/~stanczyk/mpa/index.php
http://www-rocq.inria.fr/MaxplusOrg/soft.html

Thanks

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


Matplotlib eps export

2006-07-04 Thread Martin Manns
Hi,

When I use matplotlib for a scatter plot with both dots and connecting lines,
the exported eps file is huge, if the distances between many points are small.
I think of this as a bug, since no preview tiff is included in the generated eps
and a variety of text processing applications (including OpenOffice) crash
when I try to import the eps. Ghostscript takes forever, too. Is there anything
that I can do in order to export reasonable eps files?

I am using:
python 2.4.2
matplotlib 0.87.2
numpy 0.9.8

with Linux

The following small example illustrates the problem:
--
import pylab,numpy,random
random.seed()
x=[random.gauss(0,1)/float(i)**2 for i in xrange(1,100)]
X=numpy.array(x,numpy.Float32)
pylab.plot(X[1:],X[:-1],"-", c="#ee")
pylab.plot(X[1:],X[:-1],"xk")
pylab.show()
--

The resulting eps file:
-rw-r- 1 xx users 212190257 Jul  4 09:39 image.eps

Thanks a lot in advance

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


Re: Numpy and cPickle

2006-04-12 Thread Martin Manns
Robert Kern wrote:
> Martin Manns wrote:

>> If I cPickle a numpy array under Linux and un-cPickle it under Solaris
>> 10, my arrays seem to be transposed. 
> Transposed? That's odd. There was a byteorder issue with pickles going across
> differently-endianed platforms that was fixed in the past few days. Could you
> come up with a small bit of code that shows the problem and post it and the
> incorrect output to the bug tracker?

Sorry, I my ad-hoc small example does not reproduce the error even
though the files generated on both platforms differ. I will try to set
up the code tomorrow.

Thank you though for the fast response

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


Numpy and cPickle

2006-04-12 Thread Martin Manns
Hi

If I cPickle a numpy array under Linux and un-cPickle it under Solaris
10, my arrays seem to be transposed. Is there any way to get the same
behavior on both platforms without testing which platform the python
script runs on and then transposing the array?

I am using python 2.4.2 and numpy 0.9.6 on both machines.

Thanks in advance

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