{ "cells": [ { "cell_type": "code", "execution_count": 11, "id": "4fdb98fc-65bb-467e-be0c-168fee9b0fca", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "cuda:0\n" ] }, { "data": { "text/plain": [ "" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "import numpy as np\n", "import matplotlib.pyplot as plt\n", "import time\n", "import io\n", "import cv2\n", "import copy\n", "import os\n", "from tqdm import tqdm\n", "import torch.nn as nn\n", "import torch\n", "import torchvision\n", "from torch.utils.data import Dataset\n", "from torch import default_generator, randperm\n", "from PIL import Image\n", "#from torch._utils import _accumulate\n", "import csv\n", "from torch.utils.data.dataset import Subset\n", "from scipy import ndimage\n", "device = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n", "print(device)\n", "batch_size = 16\n", "momentum=0.9\n", "lr = 1e-3\n", "import random\n", "sub_sample = 0.5\n", "import matplotlib\n", "import gc\n", "import torchsig.utils as u\n", "import torchsig.transforms.transforms as T\n", "matplotlib.use('Agg')\n", "import matplotlib as mpl\n", "mpl.rcParams['agg.path.chunksize'] = 256*256\n", "plt.ioff()" ] }, { "cell_type": "code", "execution_count": 12, "id": "4848b066-2e09-4c1c-b8fa-8e3fa84d907a", "metadata": {}, "outputs": [], "source": [ "s = T.Spectrogram(nperseg=256)" ] }, { "cell_type": "code", "execution_count": 13, "id": "9267fbe1", "metadata": {}, "outputs": [], "source": [ "def sig2pic_with_spec(path_to_data, filename, specT=None, figsize=(16,16), dpi=16, resize = None):\n", " def standartize_signal(signal):\n", " mean = np.mean(signal)\n", " std = np.std(signal)\n", " standardized_signal = (signal - mean) / std\n", " return standardized_signal\n", " \n", " try:\n", " if specT is None:\n", " specT = T.Spectrogram(nperseg=256)\n", " with open(path_to_data + filename, 'rb') as file:\n", " tmp = np.frombuffer(file.read(), dtype=np.complex64)\n", " signal = tmp\n", " print(len(signal))\n", " spectr = np.array(specT(signal)['data']['samples'][:,:figsize[0] * dpi])\n", " mag = np.abs(signal)\n", " mag = standartize_signal(mag)\n", " real = signal.real\n", " real = standartize_signal(real)\n", "\n", " fig2 = plt.figure(figsize = figsize)\n", " plt.axes(ylim=(-1, 1))\n", "\n", " plt.plot(real, color='black')\n", " plt.gca().set_axis_off()\n", " plt.subplots_adjust(top = 1, bottom = 0, right = 1, left = 0, hspace = 0, wspace = 0)\n", " plt.margins(0,0)\n", " buf2 = io.BytesIO()\n", " fig2.savefig(buf2, format=\"png\", dpi=dpi)\n", " buf2.seek(0)\n", " img_arr2 = np.frombuffer(buf2.getvalue(), dtype=np.uint8)\n", " buf2.close()\n", " img2 = cv2.imdecode(img_arr2, 1)\n", " img2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)\n", " plt.clf()\n", " plt.cla()\n", " plt.close()\n", " plt.close(fig2)\n", "\n", " fig3 = plt.figure(figsize = figsize)\n", " plt.axes(ylim=(-1, 1))\n", "\n", " plt.plot(mag, color='black')\n", " plt.gca().set_axis_off()\n", " plt.subplots_adjust(top = 1, bottom = 0, right = 1, left = 0, hspace = 0, wspace = 0)\n", " plt.margins(0,0)\n", " buf3 = io.BytesIO()\n", " fig3.savefig(buf3, format=\"png\", dpi=dpi)\n", " buf3.seek(0)\n", " img_arr3 = np.frombuffer(buf3.getvalue(), dtype=np.uint8)\n", " buf3.close()\n", " img3 = cv2.imdecode(img_arr3, 1)\n", " img3 = cv2.cvtColor(img3, cv2.COLOR_BGR2GRAY)\n", " plt.clf()\n", " plt.cla()\n", " plt.close()\n", " plt.close(fig3)\n", "\n", " if resize != None:\n", " resized_real = cv2.resize(img2, resize)\n", " resized_mag = cv2.resize(img3, resize)\n", " resized_spectr = cv2.resize(spectr, resize)\n", " img = np.asarray([resized_real, resized_mag, resized_spectr], dtype=np.float32)\n", " return img\n", " img = np.asarray([img2, img3, spectr], dtype=np.float32)\n", " return img\n", " except Exception as e:\n", " print(str(e))\n", " return None\n", "\n", "def plot_signal_and_magnitude(path_to_data, filename, filename_signal):\n", " def remove_outliers(signal, threshold):\n", " filtered_signal = np.where(np.abs(signal) <= threshold, signal, np.nan)\n", " return np.nan_to_num(filtered_signal)\n", " \n", " def standartize_signal(signal):\n", " mean = np.mean(signal)\n", " std = np.std(signal)\n", " standardized_signal = (signal - mean) / std\n", " return standardized_signal\n", " \n", " with open(path_to_data + filename, 'rb') as file:\n", " signal = np.frombuffer(file.read(), dtype=np.complex64)\n", " print(max(np.real(signal)))\n", " print(signal[:100])\n", " plt.figure(figsize=(12, 6))\n", " plt.subplot(2, 1, 1)\n", " plt.plot(remove_outliers(standartize_signal(np.real(signal)),1)[10000:], label='Real Part')\n", " plt.plot(remove_outliers(standartize_signal(np.imag(signal)),1)[10000:], label='Imaginary Part')\n", " plt.title('QAM Signal')\n", " plt.legend()\n", " plt.subplot(2, 1, 2)\n", " plt.plot(np.abs(signal), label='Magnitude')\n", " plt.title('Magnitude of QAM Signal')\n", " plt.legend()\n", " plt.tight_layout()\n", " plt.savefig(filename_signal)\n", " plt.close()" ] }, { "cell_type": "code", "execution_count": 14, "id": "448da74a-e0ae-44d8-9877-8dd1f257a24f", "metadata": {}, "outputs": [], "source": [ "path_to_binaries = 'C:/Users/snytk/Datasets/2400_9K'\n", "path_to_pictures = 'C:/Users/snytk/Datasets/1200_9K_jpg'" ] }, { "cell_type": "code", "execution_count": 15, "id": "ac4945a8-29c4-4da4-945f-08658953e3e5", "metadata": {}, "outputs": [], "source": [ "from tqdm import tqdm" ] }, { "cell_type": "code", "execution_count": 16, "id": "6a5f4c51", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "\r", " 0%| | 0/707 [00:00 13\u001b[0m img \u001b[38;5;241m=\u001b[39m \u001b[43mplot_signal_and_magnitude\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath_to_data\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfilepath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfilename\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mfile\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfilename_signal\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43m \u001b[49m\u001b[43msavepath_real_png\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 14\u001b[0m gc\u001b[38;5;241m.\u001b[39mcollect()\n\u001b[0;32m 15\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mDir: \u001b[39m\u001b[38;5;124m'\u001b[39m, subdir , \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m finished!\u001b[39m\u001b[38;5;124m'\u001b[39m)\n", "Cell \u001b[1;32mIn[13], line 97\u001b[0m, in \u001b[0;36mplot_signal_and_magnitude\u001b[1;34m(path_to_data, filename, filename_signal)\u001b[0m\n\u001b[0;32m 95\u001b[0m plt\u001b[38;5;241m.\u001b[39mlegend()\n\u001b[0;32m 96\u001b[0m plt\u001b[38;5;241m.\u001b[39mtight_layout()\n\u001b[1;32m---> 97\u001b[0m \u001b[43mplt\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msavefig\u001b[49m\u001b[43m(\u001b[49m\u001b[43mfilename_signal\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 98\u001b[0m plt\u001b[38;5;241m.\u001b[39mclose()\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\pyplot.py:1135\u001b[0m, in \u001b[0;36msavefig\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 1132\u001b[0m \u001b[38;5;66;03m# savefig default implementation has no return, so mypy is unhappy\u001b[39;00m\n\u001b[0;32m 1133\u001b[0m \u001b[38;5;66;03m# presumably this is here because subclasses can return?\u001b[39;00m\n\u001b[0;32m 1134\u001b[0m res \u001b[38;5;241m=\u001b[39m fig\u001b[38;5;241m.\u001b[39msavefig(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;66;03m# type: ignore[func-returns-value]\u001b[39;00m\n\u001b[1;32m-> 1135\u001b[0m \u001b[43mfig\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcanvas\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdraw_idle\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;66;03m# Need this if 'transparent=True', to reset colors.\u001b[39;00m\n\u001b[0;32m 1136\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m res\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\backend_bases.py:1893\u001b[0m, in \u001b[0;36mFigureCanvasBase.draw_idle\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 1891\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_is_idle_drawing:\n\u001b[0;32m 1892\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_idle_draw_cntx():\n\u001b[1;32m-> 1893\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\backends\\backend_agg.py:388\u001b[0m, in \u001b[0;36mFigureCanvasAgg.draw\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 385\u001b[0m \u001b[38;5;66;03m# Acquire a lock on the shared font cache.\u001b[39;00m\n\u001b[0;32m 386\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m (\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtoolbar\u001b[38;5;241m.\u001b[39m_wait_cursor_for_draw_cm() \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtoolbar\n\u001b[0;32m 387\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m nullcontext()):\n\u001b[1;32m--> 388\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfigure\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 389\u001b[0m \u001b[38;5;66;03m# A GUI class may be need to update a window using this draw, so\u001b[39;00m\n\u001b[0;32m 390\u001b[0m \u001b[38;5;66;03m# don't forget to call the superclass.\u001b[39;00m\n\u001b[0;32m 391\u001b[0m \u001b[38;5;28msuper\u001b[39m()\u001b[38;5;241m.\u001b[39mdraw()\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\artist.py:95\u001b[0m, in \u001b[0;36m_finalize_rasterization..draw_wrapper\u001b[1;34m(artist, renderer, *args, **kwargs)\u001b[0m\n\u001b[0;32m 93\u001b[0m \u001b[38;5;129m@wraps\u001b[39m(draw)\n\u001b[0;32m 94\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mdraw_wrapper\u001b[39m(artist, renderer, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m---> 95\u001b[0m result \u001b[38;5;241m=\u001b[39m \u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43martist\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 96\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m renderer\u001b[38;5;241m.\u001b[39m_rasterizing:\n\u001b[0;32m 97\u001b[0m renderer\u001b[38;5;241m.\u001b[39mstop_rasterizing()\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\artist.py:72\u001b[0m, in \u001b[0;36mallow_rasterization..draw_wrapper\u001b[1;34m(artist, renderer)\u001b[0m\n\u001b[0;32m 69\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m artist\u001b[38;5;241m.\u001b[39mget_agg_filter() \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 70\u001b[0m renderer\u001b[38;5;241m.\u001b[39mstart_filter()\n\u001b[1;32m---> 72\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43martist\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 73\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[0;32m 74\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m artist\u001b[38;5;241m.\u001b[39mget_agg_filter() \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\figure.py:3154\u001b[0m, in \u001b[0;36mFigure.draw\u001b[1;34m(self, renderer)\u001b[0m\n\u001b[0;32m 3151\u001b[0m \u001b[38;5;66;03m# ValueError can occur when resizing a window.\u001b[39;00m\n\u001b[0;32m 3153\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpatch\u001b[38;5;241m.\u001b[39mdraw(renderer)\n\u001b[1;32m-> 3154\u001b[0m \u001b[43mmimage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_draw_list_compositing_images\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 3155\u001b[0m \u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43martists\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msuppressComposite\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 3157\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m sfig \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msubfigs:\n\u001b[0;32m 3158\u001b[0m sfig\u001b[38;5;241m.\u001b[39mdraw(renderer)\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\image.py:132\u001b[0m, in \u001b[0;36m_draw_list_compositing_images\u001b[1;34m(renderer, parent, artists, suppress_composite)\u001b[0m\n\u001b[0;32m 130\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m not_composite \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m has_images:\n\u001b[0;32m 131\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m a \u001b[38;5;129;01min\u001b[39;00m artists:\n\u001b[1;32m--> 132\u001b[0m \u001b[43ma\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 133\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 134\u001b[0m \u001b[38;5;66;03m# Composite any adjacent images together\u001b[39;00m\n\u001b[0;32m 135\u001b[0m image_group \u001b[38;5;241m=\u001b[39m []\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\artist.py:72\u001b[0m, in \u001b[0;36mallow_rasterization..draw_wrapper\u001b[1;34m(artist, renderer)\u001b[0m\n\u001b[0;32m 69\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m artist\u001b[38;5;241m.\u001b[39mget_agg_filter() \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 70\u001b[0m renderer\u001b[38;5;241m.\u001b[39mstart_filter()\n\u001b[1;32m---> 72\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43martist\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 73\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[0;32m 74\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m artist\u001b[38;5;241m.\u001b[39mget_agg_filter() \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\axes\\_base.py:3070\u001b[0m, in \u001b[0;36m_AxesBase.draw\u001b[1;34m(self, renderer)\u001b[0m\n\u001b[0;32m 3067\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m artists_rasterized:\n\u001b[0;32m 3068\u001b[0m _draw_rasterized(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfigure, artists_rasterized, renderer)\n\u001b[1;32m-> 3070\u001b[0m \u001b[43mmimage\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_draw_list_compositing_images\u001b[49m\u001b[43m(\u001b[49m\n\u001b[0;32m 3071\u001b[0m \u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43martists\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mfigure\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msuppressComposite\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 3073\u001b[0m renderer\u001b[38;5;241m.\u001b[39mclose_group(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124maxes\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 3074\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstale \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\image.py:132\u001b[0m, in \u001b[0;36m_draw_list_compositing_images\u001b[1;34m(renderer, parent, artists, suppress_composite)\u001b[0m\n\u001b[0;32m 130\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m not_composite \u001b[38;5;129;01mor\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m has_images:\n\u001b[0;32m 131\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m a \u001b[38;5;129;01min\u001b[39;00m artists:\n\u001b[1;32m--> 132\u001b[0m \u001b[43ma\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 133\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m 134\u001b[0m \u001b[38;5;66;03m# Composite any adjacent images together\u001b[39;00m\n\u001b[0;32m 135\u001b[0m image_group \u001b[38;5;241m=\u001b[39m []\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\artist.py:72\u001b[0m, in \u001b[0;36mallow_rasterization..draw_wrapper\u001b[1;34m(artist, renderer)\u001b[0m\n\u001b[0;32m 69\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m artist\u001b[38;5;241m.\u001b[39mget_agg_filter() \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 70\u001b[0m renderer\u001b[38;5;241m.\u001b[39mstart_filter()\n\u001b[1;32m---> 72\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43martist\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 73\u001b[0m \u001b[38;5;28;01mfinally\u001b[39;00m:\n\u001b[0;32m 74\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m artist\u001b[38;5;241m.\u001b[39mget_agg_filter() \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\legend.py:780\u001b[0m, in \u001b[0;36mLegend.draw\u001b[1;34m(self, renderer)\u001b[0m\n\u001b[0;32m 777\u001b[0m Shadow(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlegendPatch, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_shadow_props)\u001b[38;5;241m.\u001b[39mdraw(renderer)\n\u001b[0;32m 779\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mlegendPatch\u001b[38;5;241m.\u001b[39mdraw(renderer)\n\u001b[1;32m--> 780\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_legend_box\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 782\u001b[0m renderer\u001b[38;5;241m.\u001b[39mclose_group(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlegend\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 783\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mstale \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\artist.py:39\u001b[0m, in \u001b[0;36m_prevent_rasterization..draw_wrapper\u001b[1;34m(artist, renderer, *args, **kwargs)\u001b[0m\n\u001b[0;32m 36\u001b[0m renderer\u001b[38;5;241m.\u001b[39mstop_rasterizing()\n\u001b[0;32m 37\u001b[0m renderer\u001b[38;5;241m.\u001b[39m_rasterizing \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mFalse\u001b[39;00m\n\u001b[1;32m---> 39\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mdraw\u001b[49m\u001b[43m(\u001b[49m\u001b[43martist\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\offsetbox.py:412\u001b[0m, in \u001b[0;36mOffsetBox.draw\u001b[1;34m(self, renderer)\u001b[0m\n\u001b[0;32m 407\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 408\u001b[0m \u001b[38;5;124;03mUpdate the location of children if necessary and draw them\u001b[39;00m\n\u001b[0;32m 409\u001b[0m \u001b[38;5;124;03mto the given *renderer*.\u001b[39;00m\n\u001b[0;32m 410\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 411\u001b[0m bbox, offsets \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_get_bbox_and_child_offsets(renderer)\n\u001b[1;32m--> 412\u001b[0m px, py \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_offset\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbbox\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 413\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m c, (ox, oy) \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mzip\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mget_visible_children(), offsets):\n\u001b[0;32m 414\u001b[0m c\u001b[38;5;241m.\u001b[39mset_offset((px \u001b[38;5;241m+\u001b[39m ox, py \u001b[38;5;241m+\u001b[39m oy))\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\offsetbox.py:60\u001b[0m, in \u001b[0;36m_compat_get_offset..get_offset\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 56\u001b[0m params \u001b[38;5;241m=\u001b[39m _api\u001b[38;5;241m.\u001b[39mselect_matching_signature(sigs, \u001b[38;5;28mself\u001b[39m, \u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[0;32m 57\u001b[0m bbox \u001b[38;5;241m=\u001b[39m (params[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbbox\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mbbox\u001b[39m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;129;01min\u001b[39;00m params \u001b[38;5;28;01melse\u001b[39;00m\n\u001b[0;32m 58\u001b[0m Bbox\u001b[38;5;241m.\u001b[39mfrom_bounds(\u001b[38;5;241m-\u001b[39mparams[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mxdescent\u001b[39m\u001b[38;5;124m\"\u001b[39m], \u001b[38;5;241m-\u001b[39mparams[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mydescent\u001b[39m\u001b[38;5;124m\"\u001b[39m],\n\u001b[0;32m 59\u001b[0m params[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mwidth\u001b[39m\u001b[38;5;124m\"\u001b[39m], params[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mheight\u001b[39m\u001b[38;5;124m\"\u001b[39m]))\n\u001b[1;32m---> 60\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mmeth\u001b[49m\u001b[43m(\u001b[49m\u001b[43mparams\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mself\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbbox\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mrenderer\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\offsetbox.py:312\u001b[0m, in \u001b[0;36mOffsetBox.get_offset\u001b[1;34m(self, bbox, renderer)\u001b[0m\n\u001b[0;32m 297\u001b[0m \u001b[38;5;129m@_compat_get_offset\u001b[39m\n\u001b[0;32m 298\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget_offset\u001b[39m(\u001b[38;5;28mself\u001b[39m, bbox, renderer):\n\u001b[0;32m 299\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 300\u001b[0m \u001b[38;5;124;03m Return the offset as a tuple (x, y).\u001b[39;00m\n\u001b[0;32m 301\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 309\u001b[0m \u001b[38;5;124;03m renderer : `.RendererBase` subclass\u001b[39;00m\n\u001b[0;32m 310\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m 311\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m (\n\u001b[1;32m--> 312\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_offset\u001b[49m\u001b[43m(\u001b[49m\u001b[43mbbox\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mwidth\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mbbox\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheight\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43mbbox\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mx0\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m-\u001b[39;49m\u001b[43mbbox\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43my0\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 313\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mcallable\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_offset)\n\u001b[0;32m 314\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_offset)\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\legend.py:738\u001b[0m, in \u001b[0;36mLegend._findoffset\u001b[1;34m(self, width, height, xdescent, ydescent, renderer)\u001b[0m\n\u001b[0;32m 735\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"Helper function to locate the legend.\"\"\"\u001b[39;00m\n\u001b[0;32m 737\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_loc \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m: \u001b[38;5;66;03m# \"best\".\u001b[39;00m\n\u001b[1;32m--> 738\u001b[0m x, y \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_find_best_position\u001b[49m\u001b[43m(\u001b[49m\u001b[43mwidth\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mheight\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mrenderer\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 739\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_loc \u001b[38;5;129;01min\u001b[39;00m Legend\u001b[38;5;241m.\u001b[39mcodes\u001b[38;5;241m.\u001b[39mvalues(): \u001b[38;5;66;03m# Fixed location.\u001b[39;00m\n\u001b[0;32m 740\u001b[0m bbox \u001b[38;5;241m=\u001b[39m Bbox\u001b[38;5;241m.\u001b[39mfrom_bounds(\u001b[38;5;241m0\u001b[39m, \u001b[38;5;241m0\u001b[39m, width, height)\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\legend.py:1186\u001b[0m, in \u001b[0;36mLegend._find_best_position\u001b[1;34m(self, width, height, renderer, consider)\u001b[0m\n\u001b[0;32m 1183\u001b[0m badness \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m 1184\u001b[0m \u001b[38;5;66;03m# XXX TODO: If markers are present, it would be good to take them\u001b[39;00m\n\u001b[0;32m 1185\u001b[0m \u001b[38;5;66;03m# into account when checking vertex overlaps in the next line.\u001b[39;00m\n\u001b[1;32m-> 1186\u001b[0m badness \u001b[38;5;241m=\u001b[39m (\u001b[38;5;28msum\u001b[39m(legendBox\u001b[38;5;241m.\u001b[39mcount_contains(line\u001b[38;5;241m.\u001b[39mvertices)\n\u001b[0;32m 1187\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m line \u001b[38;5;129;01min\u001b[39;00m lines)\n\u001b[0;32m 1188\u001b[0m \u001b[38;5;241m+\u001b[39m legendBox\u001b[38;5;241m.\u001b[39mcount_contains(offsets)\n\u001b[0;32m 1189\u001b[0m \u001b[38;5;241m+\u001b[39m legendBox\u001b[38;5;241m.\u001b[39mcount_overlaps(bboxes)\n\u001b[0;32m 1190\u001b[0m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28msum\u001b[39m(line\u001b[38;5;241m.\u001b[39mintersects_bbox(legendBox, filled\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[0;32m 1191\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m line \u001b[38;5;129;01min\u001b[39;00m lines))\n\u001b[0;32m 1192\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m badness \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m 1193\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m l, b\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\legend.py:1186\u001b[0m, in \u001b[0;36m\u001b[1;34m(.0)\u001b[0m\n\u001b[0;32m 1183\u001b[0m badness \u001b[38;5;241m=\u001b[39m \u001b[38;5;241m0\u001b[39m\n\u001b[0;32m 1184\u001b[0m \u001b[38;5;66;03m# XXX TODO: If markers are present, it would be good to take them\u001b[39;00m\n\u001b[0;32m 1185\u001b[0m \u001b[38;5;66;03m# into account when checking vertex overlaps in the next line.\u001b[39;00m\n\u001b[1;32m-> 1186\u001b[0m badness \u001b[38;5;241m=\u001b[39m (\u001b[38;5;28msum\u001b[39m(\u001b[43mlegendBox\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcount_contains\u001b[49m\u001b[43m(\u001b[49m\u001b[43mline\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mvertices\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1187\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m line \u001b[38;5;129;01min\u001b[39;00m lines)\n\u001b[0;32m 1188\u001b[0m \u001b[38;5;241m+\u001b[39m legendBox\u001b[38;5;241m.\u001b[39mcount_contains(offsets)\n\u001b[0;32m 1189\u001b[0m \u001b[38;5;241m+\u001b[39m legendBox\u001b[38;5;241m.\u001b[39mcount_overlaps(bboxes)\n\u001b[0;32m 1190\u001b[0m \u001b[38;5;241m+\u001b[39m \u001b[38;5;28msum\u001b[39m(line\u001b[38;5;241m.\u001b[39mintersects_bbox(legendBox, filled\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[0;32m 1191\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m line \u001b[38;5;129;01min\u001b[39;00m lines))\n\u001b[0;32m 1192\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m badness \u001b[38;5;241m==\u001b[39m \u001b[38;5;241m0\u001b[39m:\n\u001b[0;32m 1193\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m l, b\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\transforms.py:583\u001b[0m, in \u001b[0;36mBboxBase.count_contains\u001b[1;34m(self, vertices)\u001b[0m\n\u001b[0;32m 580\u001b[0m vertices \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39masarray(vertices)\n\u001b[0;32m 581\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m np\u001b[38;5;241m.\u001b[39merrstate(invalid\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mignore\u001b[39m\u001b[38;5;124m'\u001b[39m):\n\u001b[0;32m 582\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m (\u001b[43m(\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmin\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m<\u001b[39;49m\u001b[43m \u001b[49m\u001b[43mvertices\u001b[49m\u001b[43m)\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m&\u001b[39;49m\n\u001b[1;32m--> 583\u001b[0m \u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[43mvertices\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m<\u001b[39;49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mall\u001b[49m\u001b[43m(\u001b[49m\u001b[43maxis\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39msum())\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\numpy\\core\\_methods.py:64\u001b[0m, in \u001b[0;36m_all\u001b[1;34m(a, axis, dtype, out, keepdims, where)\u001b[0m\n\u001b[0;32m 61\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m_all\u001b[39m(a, axis\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, dtype\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, out\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, keepdims\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m, \u001b[38;5;241m*\u001b[39m, where\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m):\n\u001b[0;32m 62\u001b[0m \u001b[38;5;66;03m# Parsing keyword arguments is currently fairly slow, so avoid it for now\u001b[39;00m\n\u001b[0;32m 63\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m where \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[1;32m---> 64\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m umr_all(a, axis, dtype, out, keepdims)\n\u001b[0;32m 65\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m umr_all(a, axis, dtype, out, keepdims, where\u001b[38;5;241m=\u001b[39mwhere)\n", "\u001b[1;31mKeyboardInterrupt\u001b[0m: " ] } ], "source": [ "size = (256,256)\n", "if not os.path.exists(path_to_pictures):\n", " os.mkdir(path_to_pictures)\n", "for subdir in os.listdir(path_to_binaries):\n", " filepath = path_to_binaries + '/' + subdir + '/'\n", " if not os.path.exists(path_to_pictures +'/' + subdir):\n", " os.mkdir(path_to_pictures + '/' + subdir)\n", " files = os.listdir(filepath)\n", " for file in tqdm(files):\n", " savepath = path_to_pictures +'/' + subdir + '/' + file + '.npy'\n", " savepath_real_png = path_to_pictures +'/' + subdir + '/' + file + '.png' \n", " if not os.path.exists(savepath):\n", " img = plot_signal_and_magnitude(path_to_data=filepath, filename=file, filename_signal= savepath_real_png)\n", " gc.collect()\n", " print('Dir: ', subdir , ' finished!')" ] }, { "cell_type": "code", "execution_count": 17, "id": "6f226f86-5d72-4573-8af6-750128b70263", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ " 0%| | 0/707 [00:00 19\u001b[0m \u001b[43mplt\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mimshow\u001b[49m\u001b[43m(\u001b[49m\u001b[43mimg\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 20\u001b[0m plt\u001b[38;5;241m.\u001b[39msavefig(savepath_real_png)\n\u001b[0;32m 21\u001b[0m plt\u001b[38;5;241m.\u001b[39mclf()\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\pyplot.py:3358\u001b[0m, in \u001b[0;36mimshow\u001b[1;34m(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, interpolation_stage, filternorm, filterrad, resample, url, data, **kwargs)\u001b[0m\n\u001b[0;32m 3337\u001b[0m \u001b[38;5;129m@_copy_docstring_and_deprecators\u001b[39m(Axes\u001b[38;5;241m.\u001b[39mimshow)\n\u001b[0;32m 3338\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mimshow\u001b[39m(\n\u001b[0;32m 3339\u001b[0m X: ArrayLike \u001b[38;5;241m|\u001b[39m PIL\u001b[38;5;241m.\u001b[39mImage\u001b[38;5;241m.\u001b[39mImage,\n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 3356\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[0;32m 3357\u001b[0m ) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m AxesImage:\n\u001b[1;32m-> 3358\u001b[0m __ret \u001b[38;5;241m=\u001b[39m \u001b[43mgca\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241m.\u001b[39mimshow(\n\u001b[0;32m 3359\u001b[0m X,\n\u001b[0;32m 3360\u001b[0m cmap\u001b[38;5;241m=\u001b[39mcmap,\n\u001b[0;32m 3361\u001b[0m norm\u001b[38;5;241m=\u001b[39mnorm,\n\u001b[0;32m 3362\u001b[0m aspect\u001b[38;5;241m=\u001b[39maspect,\n\u001b[0;32m 3363\u001b[0m interpolation\u001b[38;5;241m=\u001b[39minterpolation,\n\u001b[0;32m 3364\u001b[0m alpha\u001b[38;5;241m=\u001b[39malpha,\n\u001b[0;32m 3365\u001b[0m vmin\u001b[38;5;241m=\u001b[39mvmin,\n\u001b[0;32m 3366\u001b[0m vmax\u001b[38;5;241m=\u001b[39mvmax,\n\u001b[0;32m 3367\u001b[0m origin\u001b[38;5;241m=\u001b[39morigin,\n\u001b[0;32m 3368\u001b[0m extent\u001b[38;5;241m=\u001b[39mextent,\n\u001b[0;32m 3369\u001b[0m interpolation_stage\u001b[38;5;241m=\u001b[39minterpolation_stage,\n\u001b[0;32m 3370\u001b[0m filternorm\u001b[38;5;241m=\u001b[39mfilternorm,\n\u001b[0;32m 3371\u001b[0m filterrad\u001b[38;5;241m=\u001b[39mfilterrad,\n\u001b[0;32m 3372\u001b[0m resample\u001b[38;5;241m=\u001b[39mresample,\n\u001b[0;32m 3373\u001b[0m url\u001b[38;5;241m=\u001b[39murl,\n\u001b[0;32m 3374\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39m({\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mdata\u001b[39m\u001b[38;5;124m\"\u001b[39m: data} \u001b[38;5;28;01mif\u001b[39;00m data \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m {}),\n\u001b[0;32m 3375\u001b[0m \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs,\n\u001b[0;32m 3376\u001b[0m )\n\u001b[0;32m 3377\u001b[0m sci(__ret)\n\u001b[0;32m 3378\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m __ret\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\pyplot.py:2540\u001b[0m, in \u001b[0;36mgca\u001b[1;34m()\u001b[0m\n\u001b[0;32m 2538\u001b[0m \u001b[38;5;129m@_copy_docstring_and_deprecators\u001b[39m(Figure\u001b[38;5;241m.\u001b[39mgca)\n\u001b[0;32m 2539\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mgca\u001b[39m() \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Axes:\n\u001b[1;32m-> 2540\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mgcf\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgca\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\figure.py:1658\u001b[0m, in \u001b[0;36mFigureBase.gca\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 1648\u001b[0m \u001b[38;5;250m\u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 1649\u001b[0m \u001b[38;5;124;03mGet the current Axes.\u001b[39;00m\n\u001b[0;32m 1650\u001b[0m \n\u001b[1;32m (...)\u001b[0m\n\u001b[0;32m 1655\u001b[0m \u001b[38;5;124;03mwhether `.pyplot.get_fignums()` is empty.)\u001b[39;00m\n\u001b[0;32m 1656\u001b[0m \u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[0;32m 1657\u001b[0m ax \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_axstack\u001b[38;5;241m.\u001b[39mcurrent()\n\u001b[1;32m-> 1658\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ax \u001b[38;5;28;01mif\u001b[39;00m ax \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43madd_subplot\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\figure.py:782\u001b[0m, in \u001b[0;36mFigureBase.add_subplot\u001b[1;34m(self, *args, **kwargs)\u001b[0m\n\u001b[0;32m 780\u001b[0m args \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mtuple\u001b[39m(\u001b[38;5;28mmap\u001b[39m(\u001b[38;5;28mint\u001b[39m, \u001b[38;5;28mstr\u001b[39m(args[\u001b[38;5;241m0\u001b[39m])))\n\u001b[0;32m 781\u001b[0m projection_class, pkw \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_process_projection_requirements(\u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n\u001b[1;32m--> 782\u001b[0m ax \u001b[38;5;241m=\u001b[39m \u001b[43mprojection_class\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mpkw\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 783\u001b[0m key \u001b[38;5;241m=\u001b[39m (projection_class, pkw)\n\u001b[0;32m 784\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_add_axes_internal(ax, key)\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\axes\\_base.py:678\u001b[0m, in \u001b[0;36m_AxesBase.__init__\u001b[1;34m(self, fig, facecolor, frameon, sharex, sharey, label, xscale, yscale, box_aspect, *args, **kwargs)\u001b[0m\n\u001b[0;32m 675\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset_axisbelow(mpl\u001b[38;5;241m.\u001b[39mrcParams[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124maxes.axisbelow\u001b[39m\u001b[38;5;124m'\u001b[39m])\n\u001b[0;32m 677\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_rasterization_zorder \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[1;32m--> 678\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mclear\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 680\u001b[0m \u001b[38;5;66;03m# funcs used to format x and y - fall back on major formatters\u001b[39;00m\n\u001b[0;32m 681\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mfmt_xdata \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\axes\\_base.py:1388\u001b[0m, in \u001b[0;36m_AxesBase.clear\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 1386\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mcla()\n\u001b[0;32m 1387\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m-> 1388\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m__clear\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\axes\\_base.py:1355\u001b[0m, in \u001b[0;36m_AxesBase.__clear\u001b[1;34m(self)\u001b[0m\n\u001b[0;32m 1351\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpatch\u001b[38;5;241m.\u001b[39mset_transform(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mtransAxes)\n\u001b[0;32m 1353\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mset_axis_on()\n\u001b[1;32m-> 1355\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mxaxis\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mset_clip_path\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mpatch\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1356\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39myaxis\u001b[38;5;241m.\u001b[39mset_clip_path(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mpatch)\n\u001b[0;32m 1358\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_sharex \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\_api\\deprecation.py:297\u001b[0m, in \u001b[0;36mrename_parameter..wrapper\u001b[1;34m(*args, **kwargs)\u001b[0m\n\u001b[0;32m 292\u001b[0m warn_deprecated(\n\u001b[0;32m 293\u001b[0m since, message\u001b[38;5;241m=\u001b[39m\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mThe \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mold\u001b[38;5;132;01m!r}\u001b[39;00m\u001b[38;5;124m parameter of \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mfunc\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m() \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 294\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mhas been renamed \u001b[39m\u001b[38;5;132;01m{\u001b[39;00mnew\u001b[38;5;132;01m!r}\u001b[39;00m\u001b[38;5;124m since Matplotlib \u001b[39m\u001b[38;5;132;01m{\u001b[39;00msince\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m; support \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m 295\u001b[0m \u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mfor the old name will be dropped %(removal)s.\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 296\u001b[0m kwargs[new] \u001b[38;5;241m=\u001b[39m kwargs\u001b[38;5;241m.\u001b[39mpop(old)\n\u001b[1;32m--> 297\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\axis.py:1110\u001b[0m, in \u001b[0;36mAxis.set_clip_path\u001b[1;34m(self, path, transform)\u001b[0m\n\u001b[0;32m 1108\u001b[0m \u001b[38;5;129m@_api\u001b[39m\u001b[38;5;241m.\u001b[39mrename_parameter(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m3.8\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mclippath\u001b[39m\u001b[38;5;124m\"\u001b[39m, \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mpath\u001b[39m\u001b[38;5;124m\"\u001b[39m)\n\u001b[0;32m 1109\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mset_clip_path\u001b[39m(\u001b[38;5;28mself\u001b[39m, path, transform\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m):\n\u001b[1;32m-> 1110\u001b[0m \u001b[38;5;28;43msuper\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mset_clip_path\u001b[49m\u001b[43m(\u001b[49m\u001b[43mpath\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtransform\u001b[49m\u001b[43m)\u001b[49m\n\u001b[0;32m 1111\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m child \u001b[38;5;129;01min\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mmajorTicks \u001b[38;5;241m+\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mminorTicks:\n\u001b[0;32m 1112\u001b[0m child\u001b[38;5;241m.\u001b[39mset_clip_path(path, transform)\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\artist.py:802\u001b[0m, in \u001b[0;36mArtist.set_clip_path\u001b[1;34m(self, path, transform)\u001b[0m\n\u001b[0;32m 800\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m transform \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[0;32m 801\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(path, Rectangle):\n\u001b[1;32m--> 802\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mclipbox \u001b[38;5;241m=\u001b[39m TransformedBbox(\u001b[43mBbox\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43munit\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m,\n\u001b[0;32m 803\u001b[0m path\u001b[38;5;241m.\u001b[39mget_transform())\n\u001b[0;32m 804\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_clippath \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m 805\u001b[0m success \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\transforms.py:797\u001b[0m, in \u001b[0;36mBbox.unit\u001b[1;34m()\u001b[0m\n\u001b[0;32m 794\u001b[0m \u001b[38;5;129m@staticmethod\u001b[39m\n\u001b[0;32m 795\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21munit\u001b[39m():\n\u001b[0;32m 796\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"Create a new unit `Bbox` from (0, 0) to (1, 1).\"\"\"\u001b[39;00m\n\u001b[1;32m--> 797\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mBbox\u001b[49m\u001b[43m(\u001b[49m\u001b[43m[\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m0\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m1\u001b[39;49m\u001b[43m]\u001b[49m\u001b[43m]\u001b[49m\u001b[43m)\u001b[49m\n", "File \u001b[1;32m~\\miniconda3\\envs\\python311\\Lib\\site-packages\\matplotlib\\transforms.py:771\u001b[0m, in \u001b[0;36mBbox.__init__\u001b[1;34m(self, points, **kwargs)\u001b[0m\n\u001b[0;32m 768\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mValueError\u001b[39;00m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mBbox points must be of the form \u001b[39m\u001b[38;5;124m'\u001b[39m\n\u001b[0;32m 769\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m[[x0, y0], [x1, y1]]\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[0;32m 770\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_points \u001b[38;5;241m=\u001b[39m points\n\u001b[1;32m--> 771\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_minpos \u001b[38;5;241m=\u001b[39m _default_minpos\u001b[38;5;241m.\u001b[39mcopy()\n\u001b[0;32m 772\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_ignore \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;01mTrue\u001b[39;00m\n\u001b[0;32m 773\u001b[0m \u001b[38;5;66;03m# it is helpful in some contexts to know if the bbox is a\u001b[39;00m\n\u001b[0;32m 774\u001b[0m \u001b[38;5;66;03m# default or has been mutated; we store the orig points to\u001b[39;00m\n\u001b[0;32m 775\u001b[0m \u001b[38;5;66;03m# support the mutated methods\u001b[39;00m\n", "\u001b[1;31mKeyboardInterrupt\u001b[0m: " ] } ], "source": [ "size = (256,256)\n", "if not os.path.exists(path_to_pictures):\n", " os.mkdir(path_to_pictures)\n", "for subdir in os.listdir(path_to_binaries):\n", " filepath = path_to_binaries + '/' + subdir + '/'\n", " if not os.path.exists(path_to_pictures +'/' + subdir):\n", " os.mkdir(path_to_pictures + '/' + subdir)\n", " files = os.listdir(filepath)\n", " for file in tqdm(files):\n", " savepath = path_to_pictures +'/' + subdir + '/' + file + '.npy'\n", " savepath_real_png = path_to_pictures +'/' + subdir + '/' + file + '_real' + '.png' \n", " savepath_imag_png = path_to_pictures +'/' + subdir + '/' + file + '_imag' + '.png' \n", " savepath_spec_png = path_to_pictures +'/' + subdir + '/' + file + '_spec' + '.png'\n", " if not os.path.exists(savepath):\n", " img = sig2pic_with_spec(path_to_data=filepath, filename=file, specT=s, resize = size)\n", " gc.collect()\n", " try:\n", " \n", " plt.imshow(img[0])\n", " plt.savefig(savepath_real_png)\n", " plt.clf()\n", " plt.cla()\n", " plt.close()\n", " \n", " plt.imshow(img[1])\n", " plt.savefig(savepath_imag_png)\n", " plt.clf()\n", " plt.cla()\n", " plt.close()\n", "\n", " plt.imshow(img[2])\n", " plt.savefig(savepath_spec_png)\n", " plt.clf()\n", " plt.cla()\n", " plt.close()\n", " \n", " np.save(savepath, img)\n", " \n", " except Exception:\n", " continue\n", " print('Dir: ', subdir , ' finished!')" ] }, { "cell_type": "code", "execution_count": null, "id": "58ff5fbd", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "9f9ad366", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.6" } }, "nbformat": 4, "nbformat_minor": 5 }