What integer tick exactly divides two sampling periods?
gcd gives the greatest common divisor of two integer magnitudes, the coarsest integer tick that divides both periods exactly.
numpy.gcd in practice
Periods of twelve and eighteen milliseconds both fit a six-millisecond tick. A phase difference between clock origins still requires a separate offset.
import numpy as np
np.gcd(12,18)Result 6
中文
两种采样周期可以共用多长的整数刻度?
gcd 求两个整数绝对值的最大公约数,可用来寻找能整分两种周期的最粗整数刻度。
numpy.gcd 算例
周期 12 和 18 毫秒都可表示为 6 毫秒的整数倍。若两个时钟起始相位不同,仍需另存相位偏移。
import numpy as np
np.gcd(12,18)结果 6