<jupyter_start><jupyter_text>Test for presentation<jupyter_code>t_init = 0
t_end = 365
gaia = Satellite(t_init, t_end, dt=1/24/10)

sirio = Source("sirio", 101.28, -16.7161, 379.21, -546.05, -1223.14, -7.6)
vega = Source("vega", 279.2333, 38.78, 128.91, 201.03, 286.23, -13.9)
proxima = Source("proxima", 217.42, -62, 768.7, 3775.40, 769.33, 21.7)

scanner = Scanner(double_telescope=True) 
scanner.scan(gaia, sirio, ti=t_init, tf=t_end)

calc_sirio = Calc_source(obs_times=scanner.obs_times.copy(), source=sirio)

Solver = Agis(gaia, calc_sources, sources, updating='scanned source', double_telescope=True)

Solver.iterate(10)<jupyter_output><empty_output><jupyter_text>1.- Compare quaternions  1.1 compare quaternion initialization<jupyter_code>v=np.array([0,0,1])
a=-np.radians(50)

Q = Quaternion(vector=v, angle=a)
q = quaternion.from_rotation_vector(v*a)
Q
q<jupyter_output><empty_output><jupyter_text>2.-tests_2<jupyter_code>a = np.array([[1,2,3,4], [1,2,3,4]])

q1 = quaternion.from_float_array(a)
print(q1)
q2 = Quaternion(1,2,3,4)
print(q2)

Solver.all_obs_times[0]<jupyter_output><empty_output><jupyter_text>2.1 Timing test<jupyter_code>t0 = time.time()
for t in Solver.all_obs_times:
    (Quaternion(Solver.attitude_splines[0](t),
                        Solver.attitude_splines[1](t),
                        Solver.attitude_splines[2](t),
                        Solver.attitude_splines[3](t)))
print('Our implementation: ', time.time()-t0)

t0 = time.time()
s_w = Solver.attitude_splines[0](Solver.all_obs_times)
s_x = gaia.s_x(Solver.all_obs_times)
s_y = gaia.s_y(Solver.all_obs_times)
s_z = gaia.s_z(Solver.all_obs_times)
a = np.array([s_w, s_x, s_y, s_z]).T
q1 = quaternion.from_float_array(a)
print('mobbles quaternion: ', time.time()-t0)
q1.shape

q1 = quaternion.from_float_array(a)
q1.shape

q1[0]

quaternion.from_float_array(np.array([s_w[0], s_x[0], s_y[0], s_z[0]]))

quaternion.as_float_array(q1)

tmp_dict = {}
for i in range(10):
    tmp_dict[i] = i

alpha = np.array [1,2,3]
delta = np.array [4,5,6]
ft.compute_pqr(alpha, delta)

gaia.ephemeris_bcrs(np.array([3,4]))

v = np.array([2,1,3])
v = helpers.normalize(v)
angle = np.pi/2
print(Quaternion(vector=v, angle=angle) )# .unit()
print(quaternion.from_rotation_vector(angle*v))

qq = Quaternion(vector=v, angle=angle)
qa = quaternion.from_rotation_vector(angle*v)

print(qq.to_4D_vector())
print(quaternion.as_float_array(qa))









a = np.array([[1,2,3], [4,5,6]])
np.linalg.norm(a, axis=1)

a.shape

b = np.array([1,2,3])
b = b.reshape(-1,3)
np.linalg.norm(b, axis=1)

len(a.shape)

q2 = np.quaternion(1,2,3,4)
q3 = np.quaternion(5,2,3,4)

q2.normalized()

q2

q3*q2

np.quaternion.conj()

quaternion.as_float_array(q3)

quaternion.as_rotation_vector(q3)

q3*(quaternion.z + quaternion.y + quaternion.x)

quaternion.as_float_array(q4)

ft.quat_to_vector(q4)

q3.normalized()

np.quaternion.absolute(q5)

quaternion.rotate_vectors()

np.quaternion(1,2,3,4).normalized()

q2 = q2.normalized()

np.quaternion.inverse(q2)

np.quaternion.conjugate(q2)

Quaternion(1,2,3,4).reciprocal()<jupyter_output>[quaternion(1, 2, 3, 4) quaternion(1, 2, 3, 4)]
Quaternion(1 + 2 i + 3 j + 4 k)
{'fraction_non_alphanumeric': 0.17425679949399114, 'fraction_numerical': 0.0683111954459203, 'mean_word_length': 5.35140562248996, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '537108', 'license': 'MIT', 'n_tokens_mistral': 1575, 'n_tokens_neox': 1475, 'n_words': 202, 'path': 'notebooks/Drafts/10-check quaternions.ipynb', 'repo_name': 'bombrun/GaiaLab', 'size': '3162'}