11aa590cf2
Resolve all 374 ruff errors across 36 Python files (E501, E702, E722, E741, F821, F841, invalid-syntax) bringing `ruff check .` to zero errors repo-wide with line-length=100. Rewrite CI workflow to use uv for dependency management, whole-repo `ruff check .`, py_compile syntax gate, and merged python-tests job. Add pyproject.toml with ruff config and uv dependency groups. CI structure proposed by hcm444.
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
import numpy as np
|
|
from numpy.fft import fft, ifft
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
|
fs=125*pow(10,6) #sampling frequency
|
|
Ts=1/fs # sampling time
|
|
Tb=0.25*pow(10,-6) # burst time
|
|
Tau=1.5*pow(10,-6) # pulse repetition time
|
|
fmax=32*pow(10,6) # maximum frequency on ramp
|
|
fmin=1*pow(10,6) # minimum frequency on ramp
|
|
n=int(Tb/Ts) # number of samples per ramp
|
|
N = np.arange(0, n, 1)
|
|
theta_n= 2*np.pi*(pow(N,2)*pow(Ts,2)*(fmax-fmin)/(2*Tb)+fmin*N*Ts) # instantaneous phase
|
|
y = 1 + np.sin(theta_n) # ramp signal in time domain
|
|
|
|
M = np.arange(n, 2*n, 1)
|
|
theta_m= (
|
|
2*np.pi*(pow(M,2)*pow(Ts,2)*(-fmax+fmin)/(2*Tb)+(-fmin+2*fmax)*M*Ts)
|
|
- 2*np.pi*((fmin-fmax)*Tb/2+(2*fmax-fmin)*Tb)
|
|
) # instantaneous phase
|
|
z = 1 + np.sin(theta_m) # ramp signal in time domain
|
|
|
|
x = np.concatenate((y, z))
|
|
|
|
t = Ts*np.arange(0,2*n,1)
|
|
plt.plot(t, x)
|
|
X = fft(x)
|
|
L =len(X)
|
|
freq_indices = np.arange(L)
|
|
T = L*Ts
|
|
freq = freq_indices/T
|
|
|
|
print("The Array is: ", x) #printing the array
|
|
|
|
plt.figure(figsize = (12, 6))
|
|
plt.subplot(121)
|
|
plt.stem(freq, np.abs(X), 'b', \
|
|
markerfmt=" ", basefmt="-b")
|
|
plt.xlabel('Freq (Hz)')
|
|
plt.ylabel('FFT Amplitude |Y(freq)|')
|
|
plt.xlim(0, (fmax+fmax/10))
|
|
plt.ylim(0, 20)
|
|
|
|
plt.subplot(122)
|
|
plt.plot(t, ifft(X), 'r')
|
|
plt.xlabel('Time (s)')
|
|
plt.ylabel('Amplitude')
|
|
plt.tight_layout()
|
|
|
|
plt.show()
|
|
|