Ejemplo n.º 1
0
#!/opt/local/bin/python

# Script generates two toy distributions in 3D (a cube and a hollow torus), 
# then runs XAMRT on them, plots, writes results to disk.
# Note that you'll need to be set up with GNUplot in the expected place to see the plots.

# Here's one way to invoke the script from a command line:
# PYTHONPATH=`pwd` python examples/toydata1.py

# Number of data points to generate in each
n = 1000

from numpy import *
a = (random.rand(n,3) * 2 + 2).round(2)
bpre = random.rand(n, 2) * pi * 2
b = array(map(lambda x: [cos(x[0]) * (cos(x[1])*0.5+1), sin(x[0]) * \
			(cos(x[1])*0.5+1), sin(x[1]) * 0.5], bpre)).round(2) + 5

from Xamrt import Xamrt
p = Xamrt(a, b, 3, maxdepth=12)
p.validate(a,b)

p.scatter()
p.vecmap(9, False)
p.vecmap()

p.write('./toydata1_output')
Ejemplo n.º 2
0
#!/opt/local/bin/python

# Like toydata1, but generates planar data in the shape of non-matching Ls:

# Number of data points to generate in each
n = 1000

from numpy import *
apre = random.rand(n,3)
for index, row in enumerate(apre):
	if row[0] < 0.5 and row[1] < 0.5:
		apre[index] = apre[index-1]

a = (apre * [2,2,0] + 2).round(2)
bpre = random.rand(n,3)
for index, row in enumerate(bpre):
	if row[0] > 0.5 and row[1] > 0.5:
		bpre[index] = bpre[index-1]

b = (bpre * [2,2,0] + 2).round(2)


from Xamrt import Xamrt
p = Xamrt(a, b, 3, maxdepth=8)
p.vecmap(Inf, False)
p.scatter(Inf, False)
p.scatter()
p.write('./toydata2_output')
Ejemplo n.º 3
0
#!/opt/local/bin/python

# Analyses formant data from JIPA paper by Hawkins & Midgley (see README).

# Here's one way to invoke the script from a command line:
# PYTHONPATH=`pwd` python examples/formantmap.py

apath = "examples/formant_data/hm_grp1.csv"
bpath = "examples/formant_data/hm_grp4.csv"
from Xamrt import Xamrt
p = Xamrt.processcsv(apath, bpath, 2, maxdepth=12, plot=True, prune=0.9)