本文整理汇总了Python中vector.Vector.z方法的典型用法代码示例。如果您正苦于以下问题:Python Vector.z方法的具体用法?Python Vector.z怎么用?Python Vector.z使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector.Vector
的用法示例。
在下文中一共展示了Vector.z方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ehrefest_force
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import z [as 别名]
def ehrefest_force(dBz, pos, psi):
force = Vector([0., 0., 0.])
force.x = np.dot(psi.conj().transpose(),
np.dot(force_evolution_operator_x(dBz, pos), psi)).real
force.y = np.dot(psi.conj().transpose(),
np.dot(force_evolution_operator_y(dBz, pos), psi)).real
force.z = np.dot(psi.conj().transpose(),
np.dot(force_evolution_operator_z(dBz, pos), psi)).real
return force
示例2: test_vec_coords_3d
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import z [as 别名]
def test_vec_coords_3d(self):
v = Vector(1, 2, 3)
self.assertEqual(v.x, 1)
self.assertEqual(v.y, 2)
self.assertEqual(v.z, 3)
v.x, v.y, v.z = 4, 5, 6
self.assertEqual(v.x, 4)
self.assertEqual(v.y, 5)
self.assertEqual(v.z, 6)
v = Vector(7, 8)
v.z = 9
self.assertEqual(v.x, 7)
self.assertEqual(v.y, 8)
self.assertEqual(v.z, 9)
示例3: Vector
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import z [as 别名]
print "TIME_WINDOW_MIN: ", TIME_WINDOW_MIN
print "TIME_WINDOW_MAX: ", TIME_WINDOW_MAX
print "PRECISION: ", PRECISION
two_seconds_elapsed = time.time()
while True:
if sample_size == SAMPLE_SIZE:
sample_size = 0
# print "--------------------------------- finished 50 samples \n"
dynamic_threshold.x = (accel_max.x + accel_min.x) / 2
dynamic_threshold.y = (accel_max.y + accel_min.y) / 2
dynamic_threshold.z = (accel_max.z + accel_min.z) / 2
accel_max = Vector(0, 0, 0)
accel_min = Vector(sys.maxint, sys.maxint, sys.maxint)
first_time = False
# filter accelerometer values
accel_xout = read_word_2c(mpu_address, 0x3B)
accel_yout = read_word_2c(mpu_address, 0x3D)
accel_zout = read_word_2c(mpu_address, 0x3F)
accel_val = Vector(accel_xout, accel_yout, accel_zout)
accel_val.x = (
accel_filter_list[0].x + accel_filter_list[1].x + accel_filter_list[2].x + accel_filter_list[3].x + accel_val.x
示例4: while
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import z [as 别名]
first_time = True
print "TIME_WINDOW: ", TIME_WINDOW
print "PRECISION: " , PRECISION
two_seconds_elapsed = time.time()
while(True):
if(sample_size == 50):
sample_size = 0
# print "--------------------------------- finished 50 samples \n"
dynamic_threshold.x = (accel_sum.x) / SAMPLE_SIZE
dynamic_threshold.y = (accel_sum.y) / SAMPLE_SIZE
dynamic_threshold.z = (accel_sum.z) / SAMPLE_SIZE
accel_sum.x = 0
accel_sum.y = 0
accel_sum.z = 0
first_time = False
accel_xout = read_word_2c(0x3b)
accel_yout = read_word_2c(0x3d)
accel_zout = read_word_2c(0x3f)
accel_val = Vector(accel_xout, accel_yout, accel_zout)
if(compare(accel_val, MAX_STATIONARY_ACCEL) < 0 and compare(accel_val, MIN_STATIONARY_ACCEL) > 0):
示例5: open
# 需要导入模块: from vector import Vector [as 别名]
# 或者: from vector.Vector import z [as 别名]
accel_graph = open('accel_graph-stride_length.txt', 'w')
# execution stage
time_elapsed = time.time()
while(time.time() - time_elapsed <= 15):
# filter accelerometer values
accel_xout = read_word_2c(mpu_address, 0x3b) - accel_offset_x
accel_yout = read_word_2c(mpu_address, 0x3d) - accel_offset_y
accel_zout = read_word_2c(mpu_address, 0x3f) - accel_offset_z
accel_val = Vector(accel_xout, accel_yout, accel_zout)
gravity.x = HIGH_PASS * gravity.x + (1 - HIGH_PASS) * accel_val.x
gravity.y = 0
gravity.z = HIGH_PASS * gravity.z + (1 - HIGH_PASS) * accel_val.z
accel_val.x = accel_val.x - gravity.x
accel_val.y = accel_val.y - gravity.y
accel_val.z = accel_val.z - gravity.z
accel_val.x = (accel_filter_list[0].x + accel_filter_list[1].x + accel_filter_list[2].x + accel_filter_list[3].x + accel_val.x) / 5
accel_val.y = (accel_filter_list[0].y + accel_filter_list[1].y + accel_filter_list[2].y + accel_filter_list[3].y + accel_val.y) / 5
accel_val.z = (accel_filter_list[0].z + accel_filter_list[1].z + accel_filter_list[2].z + accel_filter_list[3].z + accel_val.z) / 5
accel_filter_list.insert(moving_index, accel_val)
moving_index = (moving_index + 1) % 4
# finding minima and maxima
if(not first_time):