version 0.0.8
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
[metadata]
|
||||
# replace with your username:
|
||||
name = guan
|
||||
version = 0.0.7
|
||||
version = 0.0.8
|
||||
author = guanjihuan
|
||||
author_email = guanjihuan@163.com
|
||||
description = An open source python package
|
||||
|
@@ -38,4 +38,17 @@ def find_vector_with_the_same_gauge_with_binary_search(vector_target, vector_ref
|
||||
vector_target = vector_target*cmath.exp(1j*phase)
|
||||
if show_phase==1:
|
||||
print('Phase=', phase)
|
||||
return vector_target
|
||||
return vector_target
|
||||
|
||||
def find_vector_with_fixed_gauge_by_making_one_component_real(vector, precision=0.005):
|
||||
index = np.argmax(np.abs(vector))
|
||||
sign_pre = np.sign(np.imag(vector[index]))
|
||||
for phase in np.arange(0, 2*pi, precision):
|
||||
sign = np.sign(np.imag(vector[index]*cmath.exp(1j*phase)))
|
||||
if np.abs(np.imag(vector[index]*cmath.exp(1j*phase))) < 1e-9 or sign == -sign_pre:
|
||||
break
|
||||
sign_pre = sign
|
||||
vector = vector*cmath.exp(1j*phase)
|
||||
if np.real(vector[index]) < 0:
|
||||
vector = -vector
|
||||
return vector
|
Reference in New Issue
Block a user