← Back to team overview

yade-dev team mailing list archive

[svn] r1512 - trunk/gui/py

 

Author: eudoxos
Date: 2008-09-08 10:56:42 +0200 (Mon, 08 Sep 2008)
New Revision: 1512

Modified:
   trunk/gui/py/_utils.cpp
   trunk/gui/py/eudoxos.py
Log:
1. eudoxos module cleanups, young estimator arg chages
2. fix harmless compiler warning in _utils.cpp


Modified: trunk/gui/py/_utils.cpp
===================================================================
--- trunk/gui/py/_utils.cpp	2008-09-07 12:47:01 UTC (rev 1511)
+++ trunk/gui/py/_utils.cpp	2008-09-08 08:56:42 UTC (rev 1512)
@@ -38,7 +38,7 @@
 BOOST_PYTHON_FUNCTION_OVERLOADS(negPosExtremeIds_overloads,negPosExtremeIds,1,2);
 
 python::tuple coordsAndDisplacements(int axis,python::tuple AABB=python::tuple()){
-	Vector3r bbMin,bbMax; bool useBB=python::len(AABB)>0;
+	Vector3r bbMin(Vector3r::ZERO), bbMax(Vector3r::ZERO); bool useBB=python::len(AABB)>0;
 	if(useBB){bbMin=tuple2vec(extract<python::tuple>(AABB[0])());bbMax=tuple2vec(extract<python::tuple>(AABB[1])());}
 	python::list retCoord,retDispl;
 	FOREACH(const shared_ptr<Body>&b, *Omega::instance().getRootBody()->bodies){

Modified: trunk/gui/py/eudoxos.py
===================================================================
--- trunk/gui/py/eudoxos.py	2008-09-07 12:47:01 UTC (rev 1511)
+++ trunk/gui/py/eudoxos.py	2008-09-08 08:56:42 UTC (rev 1512)
@@ -16,7 +16,7 @@
 		bar(d[0],d[1],width=math.pi/(1.2*bins),fc=fc,alpha=.7,label=['yz','xz','xy'][axis])
 	pylab.show()
 
-def estimatePoissonYoung(principalAxis,stress=0,plot=False,keepRatio=1.):
+def estimatePoissonYoung(principalAxis,stress=0,plot=False,cutoff=0.):
 	"""Estimate Poisson's ration given the "principal" axis of straining.
 	For every base direction, homogenized strain is computed
 	(slope in linear regression on discrete function particle coordinate →
@@ -27,16 +27,17 @@
 	Young's modulus is computed as σ/ε₀; if stress σ is not given (default 0),
 	the result is 0.
 
-	keepRatio, if < 1., will take only smaller part (centered) or the specimen into account
+	cutoff, if > 0., will take only smaller part (centered) or the specimen into account
 	"""
 	dd=[] # storage for linear regression parameters
 	import pylab,numpy,stats
 	from yade import utils
-	if keepRatio<1.:
+	if cutoff>0:
 		aabb=utils.aabbExtrema(); half=[.5*(aabb[1][i]-aabb[0][i]) for i in [0,1,2]]
-		cut=(tuple([aabb[0][i]+(1.-keepRatio)*half[i] for i in [0,1,2]]),tuple([aabb[1][i]-(1.-keepRatio)*half[i] for i in [0,1,2]]))
+		cut=(tuple([aabb[0][i]+cutoff*half[i] for i in [0,1,2]]),tuple([aabb[1][i]-cutoff*half[i] for i in [0,1,2]]))
 	for axis in [0,1,2]:
-		if keepRatio<1.:
+		if cutoff>0:
+			#print cutoff,utils.aabbExtrema(),cut
 			w,dw=utils.coordsAndDisplacements(axis,AABB=cut)
 		else:
 			w,dw=utils.coordsAndDisplacements(axis)
@@ -97,11 +98,11 @@
 	return material+["%d %d"%(len(bodies),len(interactions))]+bodies+interactions
 
 
-import numpy
-from pylab import *
-from matplotlib.mlab import *
 
 def eliminateJumps(eps,sigma,numSteep=10,gapWidth=5,movWd=40):
+	from matplotlib.mlab import movavg
+	from numpy import diff,abs
+	import numpy
 	# get histogram of 'derivatives'
 	ds=abs(diff(sigma))
 	n,bins=numpy.histogram(ds)