|
From: <ai...@us...> - 2010-09-23 23:53:56
|
Revision: 11207
http://plplot.svn.sourceforge.net/plplot/?rev=11207&view=rev
Author: airwin
Date: 2010-09-23 23:53:50 +0000 (Thu, 23 Sep 2010)
Log Message:
-----------
Change name of test_memcairo.py to test_plsmem.py.in and treat this
file as configurable within CMake. Ignore test_mem.py and test_qt.py
within CMake.
This is the start of amalgamating the functionality of
test_memcairo.py, test_mem.py, and test_qt.py into the configurable
file test_plsmem.py.in, but the functionality of test_mem.py and
test_qt.py have not been amalgamated yet.
Modified Paths:
--------------
trunk/examples/python/CMakeLists.txt
Added Paths:
-----------
trunk/examples/python/test_plsmem.py.in
Removed Paths:
-------------
trunk/examples/python/test_memcairo.py
Modified: trunk/examples/python/CMakeLists.txt
===================================================================
--- trunk/examples/python/CMakeLists.txt 2010-09-23 23:23:40 UTC (rev 11206)
+++ trunk/examples/python/CMakeLists.txt 2010-09-23 23:53:50 UTC (rev 11207)
@@ -86,9 +86,6 @@
test_gradient.py
test_type1.py
test_hebrew_diacritic.py
- test_mem.py
- test_memcairo.py
- test_memqt.py
)
if(ENABLE_tk)
@@ -182,6 +179,11 @@
endif(ENABLE_pygcw)
endif(BUILD_TEST)
+ configure_file(
+ ${CMAKE_CURRENT_SOURCE_DIR}/test_plsmem.py.in
+ ${CMAKE_CURRENT_BINARY_DIR}/test_plsmem.py
+ )
+
set(PERM_SCRIPTS
OWNER_READ
OWNER_WRITE
@@ -191,7 +193,7 @@
WORLD_READ
WORLD_EXECUTE
)
- install(FILES ${python_SCRIPTS}
+ install(FILES ${python_SCRIPTS} ${CMAKE_CURRENT_BINARY_DIR}/test_plsmem.py
DESTINATION ${DATA_DIR}/examples/python
PERMISSIONS ${PERM_SCRIPTS}
)
@@ -250,7 +252,7 @@
else(CORE_BUILD)
set_property(GLOBAL PROPERTY FILES_examples_python)
- foreach(file ${python_SCRIPTS} ${python_DATA} plplot_python_start.py plplot_py_demos.py)
+ foreach(file ${python_SCRIPTS} ${python_DATA} plplot_python_start.py plplot_py_demos.py test_plsmem.py)
set_property(GLOBAL APPEND PROPERTY FILES_examples_python
${CMAKE_CURRENT_SOURCE_DIR}/${file}
)
Deleted: trunk/examples/python/test_memcairo.py
===================================================================
--- trunk/examples/python/test_memcairo.py 2010-09-23 23:23:40 UTC (rev 11206)
+++ trunk/examples/python/test_memcairo.py 2010-09-23 23:53:50 UTC (rev 11207)
@@ -1,134 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2010 Simon Wood
-
-# Simple demo of plsmem, plsmema and the memcairo device under Python.
-#
-# This file is part of PLplot.
-#
-# PLplot is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Library Public License as published
-# by the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# PLplot 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 Library General Public License for more details.
-#
-# You should have received a copy of the GNU Library General Public License
-# along with PLplot; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-#
-
-import Image
-import math
-import numpy.numarray
-
-from plplot_python_start import *
-
-from plplot import *
-
-# ---------------------------------------------------
-# Build random array (aka fake data)
-
-plseed(1234)
-x=[]
-y=[]
-
-for i in range(500) :
- x.append(plrandd() * 360)
- y.append(plrandd() * 90)
-
-# compute binned density on 15' boundaries
-# 360' gives 24 divisions
-# 90' gives 6 divisions
-
-width = 24
-height = 6
-
-max_val = 0
-data = numpy.numarray.zeros((width,height))
-
-for i in range(len(x)):
- data[int(x[i]/(360/width))][int(y[i]/(90/height))] += 1
- if data[int(x[i]/(360/width))][int(y[i]/(90/height))] > max_val:
- max_val +=1
-
-# ---------------------------------------------------
-# Initialise buffer
-
-# Start from a blank canvas
-width = 480
-height = 320
-# Darg gray background (necessarily opaque for RGB format).
-background = numpy.numarray.zeros(3, numpy.uint8) + 30
-my_buffer = numpy.numarray.zeros((height,width,3), numpy.uint8) + background
-# Dark gray semi-transparent background.
-background = numpy.numarray.zeros(4, numpy.uint8) + 30
-background[3] = 200
-my_buffer_alpha = numpy.numarray.zeros((height,width,4), numpy.uint8) + background
-
-'''
-# Or open an existing image
-# (note 'asarray' will fail as it sees PIL image as an array already and
-# does not perform a copy to make a writable array)
-src_img = Image.open("input.png")
-my_buffer = numpy.array(src_img.convert('RGB'), numpy.uint8)
-(width, height) = src_img.size
-'''
-
-# ---------------------------------------------------
-# Rectangular plot w/o alpha values
-
-# initialise for mem driver
-plsmem(width,height,my_buffer)
-plstart ("memcairo", 1, 1);
-
-plcol0(1)
-plenv(0, 360, 0, 90, 0, 2)
-plcol0(2)
-pllab("Azimuth", "Elevation", "Rectangular Sky View")
-
-# plot binned density
-plimage(data, 0, 360, 0, 90, 0, max_val, 0, 360, 0, 90)
-
-# plot points
-plpoin(x,y,5)
-
-# have to finish plotting so that the plot data gets
-# transferred back from the cairo working surface
-# to the user supplied memory.
-plend1()
-
-# Use fromstring as frombuffer will invert the image
-my_image = Image.fromstring("RGB", (width,height), my_buffer)
-my_image.save('memcairo_RGB.png')
-
-
-# ---------------------------------------------------
-# Rectangular plot with alpha values
-
-# initialise for mem driver
-plsmema(width,height,my_buffer_alpha)
-plstart ("memcairo", 1, 1);
-
-plcol0(1)
-plenv(0, 360, 0, 90, 0, 2)
-plcol0(2)
-pllab("Azimuth", "Elevation", "Rectangular Sky View")
-
-# plot binned density
-plimage(data, 0, 360, 0, 90, 0, max_val, 0, 360, 0, 90)
-
-# plot points
-plpoin(x,y,5)
-
-# have to finish plotting so that the plot data gets
-# transferred back from the cairo working surface
-# to the user supplied memory.
-plend()
-
-# Use fromstring as frombuffer will invert the image
-my_image = Image.fromstring("RGBA", (width,height), my_buffer_alpha)
-my_image.save('memcairo_RGBA.png')
Copied: trunk/examples/python/test_plsmem.py.in (from rev 11205, trunk/examples/python/test_memcairo.py)
===================================================================
--- trunk/examples/python/test_plsmem.py.in (rev 0)
+++ trunk/examples/python/test_plsmem.py.in 2010-09-23 23:53:50 UTC (rev 11207)
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+
+# Copyright (C) 2010 Simon Wood
+
+# Simple demo of plsmem, plsmema and the memcairo device under Python.
+#
+# This file is part of PLplot.
+#
+# PLplot is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Library Public License as published
+# by the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# PLplot 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 Library General Public License for more details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with PLplot; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+
+import Image
+import math
+import numpy.numarray
+
+from plplot_python_start import *
+
+from plplot import *
+
+# ---------------------------------------------------
+# Build random array (aka fake data)
+
+plseed(1234)
+x=[]
+y=[]
+
+for i in range(500) :
+ x.append(plrandd() * 360)
+ y.append(plrandd() * 90)
+
+# compute binned density on 15' boundaries
+# 360' gives 24 divisions
+# 90' gives 6 divisions
+
+width = 24
+height = 6
+
+max_val = 0
+data = numpy.numarray.zeros((width,height))
+
+for i in range(len(x)):
+ data[int(x[i]/(360/width))][int(y[i]/(90/height))] += 1
+ if data[int(x[i]/(360/width))][int(y[i]/(90/height))] > max_val:
+ max_val +=1
+
+# ---------------------------------------------------
+# Initialise buffer
+
+# Start from a blank canvas
+width = 480
+height = 320
+# Darg gray background (necessarily opaque for RGB format).
+background = numpy.numarray.zeros(3, numpy.uint8) + 30
+my_buffer = numpy.numarray.zeros((height,width,3), numpy.uint8) + background
+# Dark gray semi-transparent background.
+background = numpy.numarray.zeros(4, numpy.uint8) + 30
+background[3] = 200
+my_buffer_alpha = numpy.numarray.zeros((height,width,4), numpy.uint8) + background
+
+'''
+# Or open an existing image
+# (note 'asarray' will fail as it sees PIL image as an array already and
+# does not perform a copy to make a writable array)
+src_img = Image.open("input.png")
+my_buffer = numpy.array(src_img.convert('RGB'), numpy.uint8)
+(width, height) = src_img.size
+'''
+
+# ---------------------------------------------------
+# Rectangular plot w/o alpha values
+
+# initialise for mem driver
+plsmem(width,height,my_buffer)
+plstart ("memcairo", 1, 1);
+
+plcol0(1)
+plenv(0, 360, 0, 90, 0, 2)
+plcol0(2)
+pllab("Azimuth", "Elevation", "Rectangular Sky View")
+
+# plot binned density
+plimage(data, 0, 360, 0, 90, 0, max_val, 0, 360, 0, 90)
+
+# plot points
+plpoin(x,y,5)
+
+# have to finish plotting so that the plot data gets
+# transferred back from the cairo working surface
+# to the user supplied memory.
+plend1()
+
+# Use fromstring as frombuffer will invert the image
+my_image = Image.fromstring("RGB", (width,height), my_buffer)
+my_image.save('memcairo_RGB.png')
+
+
+# ---------------------------------------------------
+# Rectangular plot with alpha values
+
+# initialise for mem driver
+plsmema(width,height,my_buffer_alpha)
+plstart ("memcairo", 1, 1);
+
+plcol0(1)
+plenv(0, 360, 0, 90, 0, 2)
+plcol0(2)
+pllab("Azimuth", "Elevation", "Rectangular Sky View")
+
+# plot binned density
+plimage(data, 0, 360, 0, 90, 0, max_val, 0, 360, 0, 90)
+
+# plot points
+plpoin(x,y,5)
+
+# have to finish plotting so that the plot data gets
+# transferred back from the cairo working surface
+# to the user supplied memory.
+plend()
+
+# Use fromstring as frombuffer will invert the image
+my_image = Image.fromstring("RGBA", (width,height), my_buffer_alpha)
+my_image.save('memcairo_RGBA.png')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|