Browse Source

py3, some flake8

hyposat
Marius Kriegerowski 4 years ago
parent
commit
c066fd4313
2 changed files with 6 additions and 6 deletions
  1. +2
    -2
      okada/okada.py
  2. +4
    -4
      okada/source.py

+ 2
- 2
okada/okada.py View File

@ -17,10 +17,10 @@ def tryfuncs( kwargs, *funcs ):
return f( **kwargs )
except TypeError:
pass
raise Exception, 'not supported: ' + ', '.join( kwargs.keys() )
raise Exception('not supported: ' + ', '.join( kwargs.keys() ))
class OkadaSource( Source ):
class OkadaSource(Source):
def __init__( self, **kwargs ):
strike, dip, length, width, xbottom, ybottom, zbottom, geom_args = tryfuncs( kwargs,


+ 4
- 4
okada/source.py View File

@ -1,7 +1,7 @@
import numpy
class Source( object ):
class Source(object):
def strain( self, xyz, poisson ):
grad = self.gradient( xyz, poisson )
@ -34,7 +34,7 @@ class Source( object ):
return self.__mul__( other )
class AddSource( Source ):
class AddSource(Source):
def __init__( self, source1, source2 ):
assert isinstance( source1, Source )
@ -51,7 +51,7 @@ class AddSource( Source ):
+ self.source2.gradient( xyz, poisson )
class ScaleSource( Source ):
class ScaleSource(Source):
def __init__( self, source, scale ):
assert isinstance( source, Source )
@ -69,7 +69,7 @@ class ScaleSource( Source ):
return self.source.__mul__( self.scale * scale )
def diag( A ):
def diag(A):
assert A.shape[-1] == A.shape[-2]
return numpy.lib.stride_tricks.as_strided( A, shape=A.shape[:-1], strides=A.strides[:-2]+(A.strides[-2]+A.strides[-1],) )

Loading…
Cancel
Save