mirror of
https://gitlab.science.ru.nl/mthesis-edeboone/m-thesis-introduction.git
synced 2024-11-14 02:23:32 +01:00
21 lines
388 B
Python
21 lines
388 B
Python
|
"""
|
||
|
Various useful utilities (duh)
|
||
|
"""
|
||
|
|
||
|
import numpy as np
|
||
|
|
||
|
def sampled_time(sample_rate=1, start=0, end=1, offset=0):
|
||
|
return offset + np.arange(start, end, 1/sample_rate)
|
||
|
|
||
|
def rot_vector(phi1=0.12345):
|
||
|
"""
|
||
|
Return a unit vector rotated by phi radians.
|
||
|
"""
|
||
|
|
||
|
unit = np.array([
|
||
|
phi1,
|
||
|
phi1 - np.pi/2
|
||
|
])
|
||
|
|
||
|
return np.cos(unit)
|