Here are the examples of the python api numpy.multiply taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
145 Examples
3
View Complete Implementation : RigidPatching.py
Copyright Apache License 2.0
Author : thomaskuestner
Copyright Apache License 2.0
Author : thomaskuestner
def fcalculatepatches(imageSize, patchSize, patchOverlap):
dOverlap = np.round(np.multiply(patchSize, patchOverlap))
dNotOverlap = np.round(np.multiply(patchSize, (1 - patchOverlap)))
size_zero_pad = np.array(
([math.ceil((imageSize[0] - dOverlap[0]) / (dNotOverlap[0])) * dNotOverlap[0] + dOverlap[0],
math.ceil((imageSize[1] - dOverlap[1]) / (dNotOverlap[1])) * dNotOverlap[1] + dOverlap[1],
math.ceil((imageSize[2] - dOverlap[2]) / (dNotOverlap[2])) * dNotOverlap[2] + dOverlap[2]]))
idxPatch = 0
for iZ in range(0, int(size_zero_pad[2] - dOverlap[2]), int(dNotOverlap[2])):
for iY in range(0, int(size_zero_pad[0] - dOverlap[0]), int(dNotOverlap[0])):
for iX in range(0, int(size_zero_pad[1] - dOverlap[1]), int(dNotOverlap[1])):
idxPatch += 1
return idxPatch
3
View Complete Implementation : normalize_greens_fcns.py
Copyright GNU General Public License v3.0
Author : hrmartens
Copyright GNU General Public License v3.0
Author : hrmartens
def main(theta,u,v,rad):
# rad = radius of body
# Convert Theta to Radians
theta_rad = np.multiply(theta,(pi/180.))
# Normalize Displacement Greens Functions
# According to Agnew (2012) Convention (and Farrell 1972)
unorm = (rad**2) * u * (2*np.sin(theta_rad/2.))
vnorm = (rad**2) * v * (2*np.sin(theta_rad/2.))
# Return Normalized Displacement Greens Fcns
return unorm,vnorm
3
View Complete Implementation : convolve_global_grid.py
Copyright GNU General Public License v3.0
Author : hrmartens
Copyright GNU General Public License v3.0
Author : hrmartens
def main(c1,c2,gfr,gfe,gfn):
# Perform Convolution
ec1 = np.multiply(c1,gfe)
ec2 = np.multiply(c2,gfe)
nc1 = np.multiply(c1,gfn)
nc2 = np.multiply(c2,gfn)
vc1 = np.multiply(c1,gfr)
vc2 = np.multiply(c2,gfr)
# Return Harmonic Coefficients for All 3 Components
return ec1,ec2,nc1,nc2,vc1,vc2
3
View Complete Implementation : mass_conservation.py
Copyright GNU General Public License v3.0
Author : hrmartens
Copyright GNU General Public License v3.0
Author : hrmartens
def main(ic1,ic2,iarea):
# See Agnew (1983), Geophys. J. R. astr. Soc.
ic1 = ic1 - np.divide(np.sum(np.multiply(ic1,iarea)),\
(np.sum(iarea)))
ic2 = ic2 - np.divide(np.sum(np.multiply(ic2,iarea)),\
(np.sum(iarea)))
# Return Variables
return ic1,ic2
3
View Complete Implementation : compute_specific_greens_fcns.py
Copyright GNU General Public License v3.0
Author : hrmartens
Copyright GNU General Public License v3.0
Author : hrmartens
def main(haz,uint,vint):
# Vertical Component of Displacement Only Depends on Angular Source-Receiver Distance
ur = uint.copy()
# Convert haz to Radians
haz_rad = np.multiply(haz,(pi/180.))
# Compute East and North Components of Horizontal Displacement Greens Functions
ue = np.multiply(vint,np.sin(haz_rad))
un = np.multiply(vint,np.cos(haz_rad))
# Return Specific (Geographically Tied) Greens Functions for Each Load Point
return ur,ue,un
3
View Complete Implementation : convert_to_SI.py
Copyright GNU General Public License v3.0
Author : hrmartens
Copyright GNU General Public License v3.0
Author : hrmartens
def main(r,vp,vs,rho):
rSI = np.multiply(r,1000.)
vpSI = np.multiply(vp,1000.)
vsSI = np.multiply(vs,1000.)
rhoSI = np.multiply(rho,1000.)
return rSI,vpSI,vsSI,rhoSI
3
View Complete Implementation : minitaur.py
Copyright BSD 2-Clause "Simplified" License
Author : utra-robosoccer
Copyright BSD 2-Clause "Simplified" License
Author : utra-robosoccer
def GetTrueMotorVelocities(self):
"""Get the velocity of all eight motors.
Returns:
Velocities of all eight motors.
"""
motor_velocities = [
self._pybullet_client.getJointState(self.quadruped, motor_id)[1]
for motor_id in self._motor_id_list
]
motor_velocities = np.multiply(motor_velocities, self._motor_direction)
return motor_velocities
3
View Complete Implementation : minitaur.py
Copyright BSD 2-Clause "Simplified" License
Author : utra-robosoccer
Copyright BSD 2-Clause "Simplified" License
Author : utra-robosoccer
def GetMotorTorques(self):
"""Get the amount of torques the motors are exerting.
Returns:
Motor torques of all eight motors.
"""
if self._accurate_motor_model_enabled or self._pd_control_enabled:
return self._observed_motor_torques
else:
motor_torques = [
self._pybullet_client.getJointState(self.quadruped, motor_id)[3]
for motor_id in self._motor_id_list
]
motor_torques = np.multiply(motor_torques, self._motor_direction)
return motor_torques
3
View Complete Implementation : test_subclassing.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def __array_wrap__(self, obj, context=None):
obj = super(ComplicatedSubArray, self).__array_wrap__(obj, context)
if context is not None and context[0] is np.multiply:
obj.info['multiplied'] = obj.info.get('multiplied', 0) + 1
return obj
3
View Complete Implementation : test_subclassing.py
Copyright MIT License
Author : PacktPublishing
Copyright MIT License
Author : PacktPublishing
def __array_wrap__(self, obj, context=None):
obj = super(ComplicatedSubArray, self).__array_wrap__(obj, context)
if context is not None and context[0] is np.multiply:
obj.info['multiplied'] = obj.info.get('multiplied', 0) + 1
return obj