diff --git a/.gitignore b/.gitignore index 5d381cc..0368e1f 100644 --- a/.gitignore +++ b/.gitignore @@ -160,3 +160,5 @@ cython_debug/ # option (not recommended) you can uncomment the following to ignore the entire idea folder. #.idea/ +.png +.gif diff --git a/0.png b/0.png new file mode 100644 index 0000000..9d74298 Binary files /dev/null and b/0.png differ diff --git a/1.png b/1.png new file mode 100644 index 0000000..bc48e9e Binary files /dev/null and b/1.png differ diff --git a/2.png b/2.png new file mode 100644 index 0000000..93a1c04 Binary files /dev/null and b/2.png differ diff --git a/3.png b/3.png new file mode 100644 index 0000000..861ca89 Binary files /dev/null and b/3.png differ diff --git a/4.png b/4.png new file mode 100644 index 0000000..082badd Binary files /dev/null and b/4.png differ diff --git a/5.png b/5.png new file mode 100644 index 0000000..c29cfce Binary files /dev/null and b/5.png differ diff --git a/6.png b/6.png new file mode 100644 index 0000000..05e4db3 Binary files /dev/null and b/6.png differ diff --git a/7.png b/7.png new file mode 100644 index 0000000..d2cc0b4 Binary files /dev/null and b/7.png differ diff --git a/8.png b/8.png new file mode 100644 index 0000000..4825c4e Binary files /dev/null and b/8.png differ diff --git a/9.png b/9.png new file mode 100644 index 0000000..3d63078 Binary files /dev/null and b/9.png differ diff --git a/output.gif b/output.gif new file mode 100644 index 0000000..9f01f20 Binary files /dev/null and b/output.gif differ diff --git a/qpsk.py b/qpsk.py new file mode 100644 index 0000000..bcebe8c --- /dev/null +++ b/qpsk.py @@ -0,0 +1,39 @@ +import time +import numpy as np +import matplotlib.pyplot as plt +from PIL import Image + +symbol_count = 1000 + +x_integer = np.random.randint(0, 4, symbol_count) # generates random integers between 0 and 4 to fill out our symbol values. (generates a random number for each symbol in 'symbol_count') +x_degrees = x_integer*360/4.0 + 45 # four possible angles (degrees), spaced at 45 (45, 135, 225, 315) +x_radians = x_degrees*np.pi/180.0 # sin() and cos() both need radians, this just converts x_degrees to radians for that one use case +x_symbols = np.cos(x_radians) + 1j*np.sin(x_radians) + +noise_power = 0.05 + +timer = 0 +while timer < 10: + noise = (np.random.randn(symbol_count) + 1j*np.random.randn(symbol_count))/np.sqrt(2) + noisy_symbols = x_symbols + noise * np.sqrt(noise_power) + plt.plot(np.real(noisy_symbols), np.imag(noisy_symbols), ',b') + plt.grid(True) + plt.savefig(f"{timer}.png") + timer = timer + 1 + +def create_gif(image_paths, output_path, duration=500, loop=0): + """ + Creates a GIF from a list of images. + + Args: + image_paths (list): A list of file paths to the images. + output_path (str): The path to save the output GIF. + duration (int, optional): The duration of each frame in milliseconds. Defaults to 500. + loop (int, optional): Number of times the GIF should loop. 0 means infinite loop. Defaults to 0. + """ + images = [Image.open(image_path) for image_path in image_paths] + images[0].save(output_path, save_all=True, append_images=images[1:], duration=duration, loop=loop) + +image_paths = ["0.png", "1.png", "2.png", "3.png", "4.png", "5.png", "6.png", "7.png", "8.png", "9.png" ] +output_path = "output.gif" +create_gif(image_paths, output_path) \ No newline at end of file diff --git a/whatthefreak.py b/whatthefreak.py new file mode 100644 index 0000000..c68bd8a --- /dev/null +++ b/whatthefreak.py @@ -0,0 +1,19 @@ +import numpy as np +import matplotlib.pyplot as plt + +# Generate tone plus noise +t = np.arange(1024*1000)/sample_rate # time vector +f = 50e3 # freq of tone +x = np.sin(2*np.pi*f*t) + +# simulate the signal above, or use your own signal + +fft_size = 1024 +num_rows = len(x) // fft_size # // is an integer division which rounds down +spectrogram = np.zeros((num_rows, fft_size)) +for i in range(num_rows): + spectrogram[i,:] = 10*np.log10(np.abs(np.fft.fftshift(np.fft.fft(x[i*fft_size:(i+1)*fft_size])))**2) + +# different thingy + +av_pwr = np.mean(np.abs(x)**2) \ No newline at end of file