/[escript]/trunk/escript/py_src/util.py
ViewVC logotype

Diff of /trunk/escript/py_src/util.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 396 by gross, Wed Dec 21 05:08:25 2005 UTC revision 400 by gross, Wed Dec 21 23:13:39 2005 UTC
# Line 43  import os Line 43  import os
43  # def matchType(arg0=0.,arg1=0.):  # def matchType(arg0=0.,arg1=0.):
44  # def matchShape(arg0,arg1):  # def matchShape(arg0,arg1):
45    
 # def maximum(arg0,arg1):  
 # def minimum(arg0,arg1):  
 # def clip(arg,minval,maxval)  
   
46  # def transpose(arg,axis=None):  # def transpose(arg,axis=None):
47  # def trace(arg,axis0=0,axis1=1):  # def trace(arg,axis0=0,axis1=1):
48  # def reorderComponents(arg,index):  # def reorderComponents(arg,index):
# Line 916  def wherePositive(arg): Line 912  def wherePositive(arg):
912     @raises TypeError: if the type of the argument is not expected.     @raises TypeError: if the type of the argument is not expected.
913     """     """
914     if isinstance(arg,numarray.NumArray):     if isinstance(arg,numarray.NumArray):
915        out=numarray.greater(arg,numarray.zeros(arg.shape,numarray.Float))        out=numarray.greater(arg,numarray.zeros(arg.shape,numarray.Float))*1.
916        if isinstance(out,float): out=numarray.array(out)        if isinstance(out,float): out=numarray.array(out)
917        return out        return out
918     elif isinstance(arg,escript.Data):     elif isinstance(arg,escript.Data):
# Line 998  def whereNegative(arg): Line 994  def whereNegative(arg):
994     @raises TypeError: if the type of the argument is not expected.     @raises TypeError: if the type of the argument is not expected.
995     """     """
996     if isinstance(arg,numarray.NumArray):     if isinstance(arg,numarray.NumArray):
997        out=numarray.less(arg,numarray.zeros(arg.shape,numarray.Float))        out=numarray.less(arg,numarray.zeros(arg.shape,numarray.Float))*1.
998        if isinstance(out,float): out=numarray.array(out)        if isinstance(out,float): out=numarray.array(out)
999        return out        return out
1000     elif isinstance(arg,escript.Data):     elif isinstance(arg,escript.Data):
# Line 1080  def whereNonNegative(arg): Line 1076  def whereNonNegative(arg):
1076     @raises TypeError: if the type of the argument is not expected.     @raises TypeError: if the type of the argument is not expected.
1077     """     """
1078     if isinstance(arg,numarray.NumArray):     if isinstance(arg,numarray.NumArray):
1079        out=numarray.greater_equal(arg,numarray.zeros(arg.shape,numarray.Float))        out=numarray.greater_equal(arg,numarray.zeros(arg.shape,numarray.Float))*1.
1080        if isinstance(out,float): out=numarray.array(out)        if isinstance(out,float): out=numarray.array(out)
1081        return out        return out
1082     elif isinstance(arg,escript.Data):     elif isinstance(arg,escript.Data):
# Line 3319  def clip(arg,minval=0.,maxval=1.): Line 3315  def clip(arg,minval=0.,maxval=1.):
3315      @type arg: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{int} or C{float}      @type arg: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{int} or C{float}
3316      @param minval: lower range      @param minval: lower range
3317      @type arg: C{float}      @type arg: C{float}
3318      @param maxval: uper range      @param maxval: upper range
3319      @type arg: C{float}      @type arg: C{float}
3320      @return: is on object with all its value between minval and maxval. value of the argument that greater then minval and      @return: is on object with all its value between minval and maxval. value of the argument that greater then minval and
3321               less then maxval are unchanged.               less then maxval are unchanged.
3322      @rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{int} or C{float} depending on the input      @rtype: L{numarray.NumArray}, L{escript.Data}, L{Symbol}, C{int} or C{float} depending on the input
3323        @raise ValueError: if minval>maxval
3324      """      """
3325      if minval>maxval:      if minval>maxval:
3326         raise ValueError,"minval = %s must be less then maxval %s"%(minval,maxval)         raise ValueError,"minval = %s must be less then maxval %s"%(minval,maxval)

Legend:
Removed from v.396  
changed lines
  Added in v.400

  ViewVC Help
Powered by ViewVC 1.1.26