Ejemplo n.º 1
0
    def nb_sim(self):
        for i in range(len(sim_freqs)):
            # pick a center frequence for sinusoid 
	    f=sim_freqs[i]
            # Calculate effective angle based on its bearing
	    b=self.d_t * math.cos(sim_bearings[i] * math.pi/180.0)
            for j in range(sensors):
		# Introduce phase shifts in selected sinusoid in accordance with the sensor ID
		dt = float(j) * b
                self.t_dt = self.t + dt
                self.t_dt *= 2 * math.pi * f
                self.t_dt = elm.cos(self.t_dt)
                self.t_dt *= 3
		# Multiplex phase shifted sinusoids corresponding to a specific sensor
                self.data[j,:] += self.t_dt
Ejemplo n.º 2
0
#
# This file is part of OpenVSIP. It is made available under the
# license contained in the accompanying LICENSE.BSD file.

import numpy as np
from numpy import array
from vsip import vector, matrix
from vsip.math import elementwise as elm

a1 = np.arange(16, dtype=float)
v1 = vector(array=a1)


# Unary functions

assert array(elm.cos(v1) == np.cos(a1)).all()
assert array(elm.sin(v1) == np.sin(a1)).all()

a2 = np.arange(16, dtype=float)
v2 = vector(array=a2)

# Binary functions

assert array(elm.mul(v1, v2) == a1*a2).all()

a3 = np.arange(16, dtype=float)
v3 = vector(array=a3)

# Ternary functions

assert array(elm.am(v1, v2, v3) == (a1+a2)*a3).all()
Ejemplo n.º 3
0
# All rights reserved.
#
# This file is part of OpenVSIP. It is made available under the
# license contained in the accompanying LICENSE.BSD file.

import numpy as np
from numpy import array
from vsip import vector, matrix
from vsip.math import elementwise as elm

a1 = np.arange(16, dtype=float)
v1 = vector(array=a1)

# Unary functions

assert array(elm.cos(v1) == np.cos(a1)).all()
assert array(elm.sin(v1) == np.sin(a1)).all()

a2 = np.arange(16, dtype=float)
v2 = vector(array=a2)

# Binary functions

assert array(elm.mul(v1, v2) == a1 * a2).all()

a3 = np.arange(16, dtype=float)
v3 = vector(array=a3)

# Ternary functions

assert array(elm.am(v1, v2, v3) == (a1 + a2) * a3).all()