{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python Docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load\n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the read-only \"../input/\" directory\n# For example, running this (by clicking run or pressing Shift+Enter) will list all files under the input directory\n\nimport os\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in filenames:\n        print(os.path.join(dirname, filename))\n\n# You can write up to 20GB to the current directory (/kaggle/working/) that gets preserved as output when you create a version using \"Save & Run All\" \n# You can also write temporary files to /kaggle/temp/, but they won't be saved outside of the current session","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:25.013422Z","iopub.execute_input":"2022-10-29T07:59:25.013937Z","iopub.status.idle":"2022-10-29T07:59:26.921863Z","shell.execute_reply.started":"2022-10-29T07:59:25.013888Z","shell.execute_reply":"2022-10-29T07:59:26.920505Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Playground Sandbox\nDisclaimer:\nThis is not a competion script. It has no scientific or technical value. It was made for fun to see how data is looking: Just some fun images. \n\n* Signal representaation in Mesh grid.\n* 2D image/array conversion to polar scatter coordinates.\n* 2D image/array conversion to polar meshgrid coordinates. And flower power : conversion of numpy 2D array with real values to scatter polar projections (frequency is direction, signal is range, color is linked to calculated power.\n\n","metadata":{}},{"cell_type":"code","source":"import h5py\nfrom glob import glob\nfrom pathlib import Path","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:26.924476Z","iopub.execute_input":"2022-10-29T07:59:26.924938Z","iopub.status.idle":"2022-10-29T07:59:26.931688Z","shell.execute_reply.started":"2022-10-29T07:59:26.924896Z","shell.execute_reply":"2022-10-29T07:59:26.930264Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from numpy import savetxt\nfrom numpy import save\nfrom numpy import loadtxt","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:26.933352Z","iopub.execute_input":"2022-10-29T07:59:26.933758Z","iopub.status.idle":"2022-10-29T07:59:26.944156Z","shell.execute_reply.started":"2022-10-29T07:59:26.93372Z","shell.execute_reply":"2022-10-29T07:59:26.942639Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import matplotlib.pyplot as plt\nimport matplotlib.image\nimport seaborn as sns","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:26.946936Z","iopub.execute_input":"2022-10-29T07:59:26.947369Z","iopub.status.idle":"2022-10-29T07:59:26.960298Z","shell.execute_reply.started":"2022-10-29T07:59:26.947322Z","shell.execute_reply":"2022-10-29T07:59:26.958766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"OUTPUT_DIR = '/kaggle/working/'\nif not os.path.exists(os.path.join(OUTPUT_DIR, 'spectrogram-images')):\n    os.mkdir(os.path.join(OUTPUT_DIR, 'spectrogram-images'))\n#     os.mkdir(os.path.join(OUTPUT_DIR, 'spectrogram-images',\"true\"))\n#     os.mkdir(os.path.join(OUTPUT_DIR, 'spectrogram-images',\"false\"))","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:26.962019Z","iopub.execute_input":"2022-10-29T07:59:26.96256Z","iopub.status.idle":"2022-10-29T07:59:26.97337Z","shell.execute_reply.started":"2022-10-29T07:59:26.962508Z","shell.execute_reply":"2022-10-29T07:59:26.972276Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# str_path0=\"/kaggle/working/spectrogram-images/0\"\n# path0 = Path(str_path0)\n# str_path1=\"/kaggle/working/spectrogram-images/1\"\n# path1 = Path(str_path1)\n# str_path2=\"/kaggle/working/spectrogram-images/test\"\n# path2 = Path(str_path2)\n\nstr_path3=\"/kaggle/working/spectrogram-images/train/\"\npath3 = Path(str_path3)\nstr_path1=\"/kaggle/working/spectrogram-images/train/signal\"\npath1 = Path(str_path1)\nstr_path2=\"/kaggle/working/spectrogram-images/test\"\npath2 = Path(str_path2)\nstr_path0=\"/kaggle/working/spectrogram-images/train/noise\"\npath0 = Path(str_path0)\n\nif not os.path.exists(path3):\n    os.mkdir(path3)\nprint(path3)\nif not os.path.exists(path0):\n    os.mkdir(path0)\nif not os.path.exists(path1):\n    os.mkdir(path1)\nif not os.path.exists(path2):\n    os.mkdir(path2)\n\ndef calea(label):\n    if label == 0:\n        return path0\n    else:\n        return path1","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:26.975155Z","iopub.execute_input":"2022-10-29T07:59:26.976102Z","iopub.status.idle":"2022-10-29T07:59:26.990968Z","shell.execute_reply.started":"2022-10-29T07:59:26.976049Z","shell.execute_reply":"2022-10-29T07:59:26.989589Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cale=calea(1)\ncale","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:26.992296Z","iopub.execute_input":"2022-10-29T07:59:26.992746Z","iopub.status.idle":"2022-10-29T07:59:27.009587Z","shell.execute_reply.started":"2022-10-29T07:59:26.99271Z","shell.execute_reply":"2022-10-29T07:59:27.008482Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"ROOT_DIR = '../input/g2net-detecting-continuous-gravitational-waves'\nos.path.isdir(ROOT_DIR)","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:27.01059Z","iopub.execute_input":"2022-10-29T07:59:27.010917Z","iopub.status.idle":"2022-10-29T07:59:27.023343Z","shell.execute_reply.started":"2022-10-29T07:59:27.010887Z","shell.execute_reply":"2022-10-29T07:59:27.022433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"train_labels = pd.read_csv(f\"{ROOT_DIR}/train_labels.csv\")\ntest = pd.read_csv('../input/g2net-detecting-continuous-gravitational-waves/sample_submission.csv')\ntrain_files = glob(f\"{ROOT_DIR}/train/*.hdf5\")\ntest_files = glob(f\"{ROOT_DIR}/test/*.hdf5\")\ntrain_files[:5]","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:27.024819Z","iopub.execute_input":"2022-10-29T07:59:27.025137Z","iopub.status.idle":"2022-10-29T07:59:27.075938Z","shell.execute_reply.started":"2022-10-29T07:59:27.025108Z","shell.execute_reply":"2022-10-29T07:59:27.074762Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Utility to read hdf5 file\ndef read_data(file: Path):\n    with h5py.File(file, \"r\") as f:\n        filename = file.stem\n        f = f[filename]\n        h1 = f[\"H1\"]\n        l1 = f[\"L1\"]\n        freq_hz = list(f[\"frequency_Hz\"])\n        ###\n        h1_stft = h1[\"SFTs\"][()]\n        ###\n        h1_timestamp = h1[\"timestamps_GPS\"][()]\n        # H2 data\n        l1_stft = l1[\"SFTs\"][()]\n        l1_timestamp = l1[\"timestamps_GPS\"][()]\n        \n        return {\n            \"H1\": [h1_stft, h1_timestamp],\n            \"L1\": [l1_stft, l1_timestamp],\n            \"freq_hz\": freq_hz\n        }","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:27.081424Z","iopub.execute_input":"2022-10-29T07:59:27.081815Z","iopub.status.idle":"2022-10-29T07:59:27.090917Z","shell.execute_reply.started":"2022-10-29T07:59:27.08178Z","shell.execute_reply":"2022-10-29T07:59:27.08962Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def power_spectrogram(h1_sft,cale,z,ind):\n    img = np.empty((1,360, 128), dtype=np.float32)\n    a=h1_sft[:, :4096] * 1e23\n    p = a.real**2 + a.imag**2  # power\n    p /= np.mean(p)  # normalize\n    p = np.mean(p.reshape(360, 128, 32), axis=2)\n    img[0] = p\n    numefisier=ind+z+\"_power.jpg\"\n    file_path_1 = os.path.join(cale,numefisier)\n    matplotlib.rcParams['image.cmap'] = 'BuPu'\n    matplotlib.image.imsave( file_path_1, img[0])\ndef power_spectrogram_noise(h1_sft,cale,z,ind):\n    img = np.empty((3,360, 128), dtype=np.float32)\n    a=h1_sft[:, :4096] * 1e23\n    p = a.real**2 + a.imag**2  # power\n    #p /= np.mean(p)  # normalize\n    praw=p.reshape(360, 128, 32)\n    #p = np.mean(p.reshape(360, 128, 32), axis=2)  \n    p=np.mean(praw[:,:,0:26],axis=2)\n    img[0] = p\n    p=np.mean(praw[:,:,27:29],axis=2)\n    img[1]= p\n    p=np.mean(praw[:,:,18:31],axis=2)\n    img[2]= p\n    img[0] = p\n    numefisier0=ind+z+\"_power.jpg\"\n    numefisier2=ind+z+\"_1_power.jpg\"\n    numefisier3=ind+z+\"_2_power.jpg\"\n    file_path_1 = os.path.join(cale,numefisier0)\n    file_path_2 = os.path.join(cale,numefisier2)\n    file_path_3 = os.path.join(cale,numefisier3)\n    matplotlib.rcParams['image.cmap'] = 'BuPu'\n    matplotlib.image.imsave( file_path_1, img[0])\n    matplotlib.image.imsave( file_path_2, img[1])\n    matplotlib.image.imsave( file_path_3, img[2])\ndef power_spectrogram_test(h1_sft,cale,z,ind):    \n    img = np.empty((1,360, 128), dtype=np.float32)\n    a=h1_sft[:, :4096] * 1e22\n    p = 2*(a.real**2 + a.imag**2)/(1800 * 1e24** 2) \n    #p = a.real**2 + a.imag**2  # power\n    p /= np.mean(p)  # normalize\n    p = np.mean(p.reshape(360, 128, 32), axis=2)\n    img[0] = p\n    numefisier=ind+z+\"_power.png\"\n    file_path_1 = os.path.join(cale,numefisier)\n    matplotlib.rcParams['image.cmap'] = 'BuPu'\n    matplotlib.image.imsave( file_path_1, img[0])\n    plt.figure(figsize = (20,10))\n    plt.imshow(img[0], interpolation = 'sinc')\ndef power_spectrogram_test_phase(h1_sft,cale,z,ind): \n    matplotlib.rcParams['image.cmap'] = 'BuPu'\n    img = np.empty((1,360, 128), dtype=np.float32)\n    a=h1_sft[:, :4096] * 1e22\n    #p = 2*(a.real**2 + a.imag**2)/(1800 * 1e24** 2) \n    #p = a.real**2 + a.imag**2  # power\n    p=np.absolute(a)+np.angle(a)\n    p /= np.mean(p)  # normalize\n    \n    powersp=p.reshape(360, 128, 32)\n    p1=powersp[:,:,0:8]\n    p2=powersp[:,:,8:16]\n    p3=powersp[:,:,0:8]\n    p4=powersp[:,:,8:16]\n    \n    fig, axs = plt.subplots(nrows=2, ncols=2, figsize=(15, 12))\n    plt.subplots_adjust(hspace=0.5)\n    fig.suptitle(\"Pseudo power spectrogram\", fontsize=18, y=0.95)\n    for elem, ax in (p1,p2,p3,p4):\n        elem=np.mean(elem)\n        img[0]=elem\n        plt.plot(img[0])\n        plt.show()     \n\n#     p = np.mean(p.reshape(360, 128, 32), axis=2)\n#     img[0] = p\n#     numefisier=ind+z+\"_power.png\"\n#     file_path_1 = os.path.join(cale,numefisier)\n#     matplotlib.rcParams['image.cmap'] = 'BuPu'\n#     matplotlib.image.imsave( file_path_1, img[0])\n#     plt.figure(figsize = (20,10))\n#     plt.imshow(img[0], interpolation = 'sinc')\ndef power_spectrogram256(h1_sft,cale,z,ind):\n    img = np.empty((1,360, 256), dtype=np.float32)\n    a=h1_sft[:, :4096] * 1e22\n    p = a.real**2 + a.imag**2  # power\n    p /= np.mean(p)  # normalize\n    p = np.mean(p.reshape(360, 256, 16), axis=2)\n    img[0] = p\n    numefisier=ind+z+\"_power.jpg\"\n    file_path_1 = os.path.join(cale,numefisier)\n    matplotlib.image.imsave( file_path_1, img[0])\n    #matplotlib.rcParams['image.cmap'] = 'BuPu'\ndef augumented_noise(h1_sft,cale,z,ind,label):\n    if label ==1:\n        power_spectrogram(h1_sft,cale,z,ind)\n    else:\n        power_spectrogram_noise(h1_sft,cale,z,ind)\ndef get_sft(i):\n    fisier = Path(train_files[i])\n    data = read_data(fisier)\n    h1_sft, h1_ts = data[\"H1\"]\n    l1_sft, l1_ts = data[\"L1\"]\n    freq_hz = data[\"freq_hz\"]\n    #label = train_labels.loc[train_labels[\"id\"] == ind][\"target\"].values[0]\n    return h1_sft,l1_sft\n\ndef plot_power(h1_sft):\n    a=h1_sft[:, :4096] * 1e22\n    p = a.real**2 + a.imag**2  # power\n    p /= np.mean(p)  # normalize\n    p = np.mean(p.reshape(360, 128, 32), axis=2)\n    img[0] = p\n    plt.imshow(img[0])\ndef plot_power2(h1_sft):\n    a=h1_sft[:, :4096] * 1e24\n    p = np.absolute(a)+np.angle(a) # power\n    p /= np.mean(p)  # normalize\n    p = np.mean(p.reshape(360, 128, 32), axis=2)\n    img[0] = p\n    plt.imshow(img[0])","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:27.093267Z","iopub.execute_input":"2022-10-29T07:59:27.094134Z","iopub.status.idle":"2022-10-29T07:59:27.126981Z","shell.execute_reply.started":"2022-10-29T07:59:27.094086Z","shell.execute_reply":"2022-10-29T07:59:27.125701Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"file = Path(train_files[1])\nprint(file)\n#label = train_labels.loc[train_labels[\"id\"] == ind][\"target\"].values[0]\ndata = read_data(file)\nh1_sft, h1_ts = data[\"H1\"]\nl1_sft, l1_ts = data[\"L1\"]\nfreq_hz = data[\"freq_hz\"]","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:27.128495Z","iopub.execute_input":"2022-10-29T07:59:27.12909Z","iopub.status.idle":"2022-10-29T07:59:28.068485Z","shell.execute_reply.started":"2022-10-29T07:59:27.129055Z","shell.execute_reply":"2022-10-29T07:59:28.067599Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### Spectrogram \n> verify that there is some signal from sample","metadata":{}},{"cell_type":"code","source":"path_test=\"/kaggle/working/\"\nz='bubu'\nind=\"test_image\"\npower_spectrogram_test(h1_sft,path_test,z,ind)","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:28.07002Z","iopub.execute_input":"2022-10-29T07:59:28.071117Z","iopub.status.idle":"2022-10-29T07:59:28.782554Z","shell.execute_reply.started":"2022-10-29T07:59:28.071071Z","shell.execute_reply":"2022-10-29T07:59:28.781324Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## Meshgrid\nhttps://likegeeks.com/numpy-meshgrid/","metadata":{}},{"cell_type":"markdown","source":"###### represent the data in 3D meshgrid ","metadata":{}},{"cell_type":"code","source":"from mpl_toolkits.mplot3d import Axes3D\n#X = np.linspace(-20,20,100)\nX = np.linspace(0,360,num=360)\nY = np.linspace(0, 128, num=128)\nX, Y = np.meshgrid(X,Y)\nprint(X.shape,Y.shape)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:28.783882Z","iopub.execute_input":"2022-10-29T07:59:28.784212Z","iopub.status.idle":"2022-10-29T07:59:28.792164Z","shell.execute_reply.started":"2022-10-29T07:59:28.784182Z","shell.execute_reply":"2022-10-29T07:59:28.790858Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a=h1_sft[:, :4096] * 1e24\np = np.absolute(a)+np.angle(a) # power\np /= np.mean(p)  # normalize\np = np.mean(p.reshape(360, 128, 32), axis=2)\np.shape","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:28.794001Z","iopub.execute_input":"2022-10-29T07:59:28.794987Z","iopub.status.idle":"2022-10-29T07:59:28.887757Z","shell.execute_reply.started":"2022-10-29T07:59:28.794939Z","shell.execute_reply":"2022-10-29T07:59:28.88678Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#Z = 4*xx**2 + yy**2\nZ=p.T\n","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:28.888859Z","iopub.execute_input":"2022-10-29T07:59:28.889949Z","iopub.status.idle":"2022-10-29T07:59:28.895916Z","shell.execute_reply.started":"2022-10-29T07:59:28.889899Z","shell.execute_reply":"2022-10-29T07:59:28.894406Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = plt.figure(figsize=(15, 15))\nax = fig.add_subplot(111, projection='3d')\nax.plot_surface(X, Y, Z, cmap=\"hsv\", linewidth=0, antialiased=False, alpha=0.3)\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:28.897374Z","iopub.execute_input":"2022-10-29T07:59:28.897751Z","iopub.status.idle":"2022-10-29T07:59:29.636433Z","shell.execute_reply.started":"2022-10-29T07:59:28.897719Z","shell.execute_reply":"2022-10-29T07:59:29.635543Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"https://matplotlib.org/3.1.1/gallery/misc/transoffset.html#sphx-glr-gallery-misc-transoffset-py","metadata":{}},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Let's forget about time for a second \n:)\n## frequency ","metadata":{}},{"cell_type":"code","source":"\n#a=h1_sft[:, :1024] * 1e22\na=h1_sft[:, :4096] * 1e22\ndf=pd.DataFrame(a)\ndf_real=pd.DataFrame(a.real)\ndf_imag=pd.DataFrame(a.imag)\ndf_power=df_real**2+df_imag*2","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:29.637533Z","iopub.execute_input":"2022-10-29T07:59:29.638536Z","iopub.status.idle":"2022-10-29T07:59:29.666736Z","shell.execute_reply.started":"2022-10-29T07:59:29.638498Z","shell.execute_reply":"2022-10-29T07:59:29.665822Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#df_power.tail()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:29.667809Z","iopub.execute_input":"2022-10-29T07:59:29.668981Z","iopub.status.idle":"2022-10-29T07:59:29.673084Z","shell.execute_reply.started":"2022-10-29T07:59:29.668942Z","shell.execute_reply":"2022-10-29T07:59:29.671846Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"column=str(df.columns)\ncolumn","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:29.674565Z","iopub.execute_input":"2022-10-29T07:59:29.675099Z","iopub.status.idle":"2022-10-29T07:59:29.689516Z","shell.execute_reply.started":"2022-10-29T07:59:29.674983Z","shell.execute_reply":"2022-10-29T07:59:29.6883Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"df[\"id\"] = df.index\ndf_real[\"id\"] = df.index\ndf_imag[\"id\"] = df.index\ndf_power[\"id\"] = df.index","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:29.691023Z","iopub.execute_input":"2022-10-29T07:59:29.69271Z","iopub.status.idle":"2022-10-29T07:59:29.708148Z","shell.execute_reply.started":"2022-10-29T07:59:29.692654Z","shell.execute_reply":"2022-10-29T07:59:29.706597Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"melted_df=df.melt(id_vars=['id'])","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:29.710648Z","iopub.execute_input":"2022-10-29T07:59:29.711162Z","iopub.status.idle":"2022-10-29T07:59:29.771973Z","shell.execute_reply.started":"2022-10-29T07:59:29.711117Z","shell.execute_reply":"2022-10-29T07:59:29.770754Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"melted_df.head(1)","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:29.77339Z","iopub.execute_input":"2022-10-29T07:59:29.773742Z","iopub.status.idle":"2022-10-29T07:59:29.785984Z","shell.execute_reply.started":"2022-10-29T07:59:29.77371Z","shell.execute_reply":"2022-10-29T07:59:29.784828Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"melted_df.rename(columns={\"variable\": \"angle\", \"value\": \"range\"})","metadata":{"_kg_hide-input":true,"execution":{"iopub.status.busy":"2022-10-29T07:59:29.787355Z","iopub.execute_input":"2022-10-29T07:59:29.788025Z","iopub.status.idle":"2022-10-29T07:59:29.815435Z","shell.execute_reply.started":"2022-10-29T07:59:29.78799Z","shell.execute_reply":"2022-10-29T07:59:29.814283Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"polar_real=df_real.melt(id_vars=['id'])\n#polar_real=polar_real[\"angle\",\"range\"]\npolar_imag=df_imag.melt(id_vars=['id'])\n#polar_imag=polar_real[\"angle\",\"range\"]\npolar_power=df_power.melt(id_vars=['id'])\n#polar_power=polar_real[\"angle\",\"range\"]","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:29.816813Z","iopub.execute_input":"2022-10-29T07:59:29.81777Z","iopub.status.idle":"2022-10-29T07:59:29.992078Z","shell.execute_reply.started":"2022-10-29T07:59:29.817736Z","shell.execute_reply":"2022-10-29T07:59:29.990723Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"polar_real=polar_real.rename(columns={\"variable\": \"angle\", \"value\": \"range\"})\n\npolar_imag=polar_imag.rename(columns={\"variable\": \"angle\", \"value\": \"range\"})\n\npolar_power=polar_power.rename(columns={\"variable\": \"angle\", \"value\": \"range\"})\n","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:29.994015Z","iopub.execute_input":"2022-10-29T07:59:29.994489Z","iopub.status.idle":"2022-10-29T07:59:30.048508Z","shell.execute_reply.started":"2022-10-29T07:59:29.994445Z","shell.execute_reply":"2022-10-29T07:59:30.047152Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#plt.axes(projection = 'polar')\ndeg = polar_real.angle\nraza=polar_real.range\nnorm = matplotlib.colors.Normalize(vmin = np.min(polar_imag.range), vmax = np.max(polar_imag.range), clip = False)\n#colors = polar_imag.range.tolist()\ncolors =(polar_imag.range-polar_imag.range.mean())/polar_imag.range.std()\narea = 1","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:30.050381Z","iopub.execute_input":"2022-10-29T07:59:30.050821Z","iopub.status.idle":"2022-10-29T07:59:30.08859Z","shell.execute_reply.started":"2022-10-29T07:59:30.050778Z","shell.execute_reply":"2022-10-29T07:59:30.087106Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Imaginary part color\n1. frequency is direction\n2. range is real part\n3. color is imaginary part","metadata":{}},{"cell_type":"code","source":"fig = plt.figure(figsize=(15, 15))\nax = fig.add_subplot(projection='polar')\nc = ax.scatter(deg, raza, c=colors, s=area, cmap='hsv', alpha=0.75)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T07:59:30.097616Z","iopub.execute_input":"2022-10-29T07:59:30.098038Z","iopub.status.idle":"2022-10-29T08:00:05.34954Z","shell.execute_reply.started":"2022-10-29T07:59:30.098002Z","shell.execute_reply":"2022-10-29T08:00:05.347859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### Power Color\n1. frequency is direction\n2. range is real part\n3. color is power","metadata":{}},{"cell_type":"code","source":"\ncolors =(polar_power.range-polar_power.range.mean())/polar_power.range.std()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:05.352439Z","iopub.execute_input":"2022-10-29T08:00:05.353173Z","iopub.status.idle":"2022-10-29T08:00:05.381684Z","shell.execute_reply.started":"2022-10-29T08:00:05.353124Z","shell.execute_reply":"2022-10-29T08:00:05.380332Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = plt.figure(figsize=(15, 15))\nax = fig.add_subplot(projection='polar')\nc = ax.scatter(deg, raza, c=colors, s=area, cmap='plasma', alpha=0.75)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:05.383943Z","iopub.execute_input":"2022-10-29T08:00:05.384659Z","iopub.status.idle":"2022-10-29T08:00:40.840819Z","shell.execute_reply.started":"2022-10-29T08:00:05.384616Z","shell.execute_reply":"2022-10-29T08:00:40.839352Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Spectrogram","metadata":{}},{"cell_type":"code","source":"h1_sf,l1_sft=get_sft(1)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:40.842219Z","iopub.execute_input":"2022-10-29T08:00:40.842596Z","iopub.status.idle":"2022-10-29T08:00:41.51967Z","shell.execute_reply.started":"2022-10-29T08:00:40.842564Z","shell.execute_reply":"2022-10-29T08:00:41.518549Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path_test=\"/kaggle/working/\"\nz='bubu'\nind=\"test_image\"\npower_spectrogram_test(h1_sft,path_test,z,ind)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:41.521399Z","iopub.execute_input":"2022-10-29T08:00:41.521946Z","iopub.status.idle":"2022-10-29T08:00:42.048016Z","shell.execute_reply.started":"2022-10-29T08:00:41.521914Z","shell.execute_reply":"2022-10-29T08:00:42.04683Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"img = np.empty((3,360, 128), dtype=np.float32)\na=h1_sft[:, :4096] * 1e22\np = (a.real**2 + a.imag**2)# power\np /= np.mean(p)  # normalize\np=p.reshape(360, 128, 32)\n#split the compression\np1=p[:,:,0:16]\np2=p[:,:,16:32]\np = np.mean(p, axis=2)\np1 = np.mean(p1, axis=2)\np2 = np.mean(p2, axis=2)\nimg[0] = p1\nimg[1] = p2\nimg[2] = p\nfig, (ax1, ax2,ax3) = plt.subplots(1, 3,figsize=(10, 10))\nplt.rcParams['image.cmap'] = 'BuPu'\nfig.suptitle('power density - and zoom of the zoom')\nax1.set_title(\"slice 0:16\")\nax2.set_title(\"slice 16:32\")\nax3.set_title(\"compressed 0:32\")\nax1.imshow(img[0])\nax2.imshow(img[1])\nax3.imshow(img[2])\nfig.tight_layout()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:42.049908Z","iopub.execute_input":"2022-10-29T08:00:42.050409Z","iopub.status.idle":"2022-10-29T08:00:42.900856Z","shell.execute_reply.started":"2022-10-29T08:00:42.050346Z","shell.execute_reply":"2022-10-29T08:00:42.899715Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### Polar Meshgrid -reprojection of 2D array in polar coordinates\n1. direction is frequency\n2. range is fixed - 128 \n3. color is power","metadata":{}},{"cell_type":"code","source":"h1_sf,l1_sft=get_sft(2)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:42.902198Z","iopub.execute_input":"2022-10-29T08:00:42.903293Z","iopub.status.idle":"2022-10-29T08:00:43.529517Z","shell.execute_reply.started":"2022-10-29T08:00:42.903225Z","shell.execute_reply":"2022-10-29T08:00:43.528553Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"a=h1_sft[:, :4096] * 1e22\np = (a.real**2 + a.imag**2)# power\np /= np.mean(p)  # normalize\np=p.reshape(360, 128, 32)\np = np.mean(p, axis=2)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.5307Z","iopub.execute_input":"2022-10-29T08:00:43.531532Z","iopub.status.idle":"2022-10-29T08:00:43.549451Z","shell.execute_reply.started":"2022-10-29T08:00:43.531499Z","shell.execute_reply":"2022-10-29T08:00:43.548232Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import gc\ngc.collect","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.550717Z","iopub.execute_input":"2022-10-29T08:00:43.551168Z","iopub.status.idle":"2022-10-29T08:00:43.559649Z","shell.execute_reply.started":"2022-10-29T08:00:43.551129Z","shell.execute_reply":"2022-10-29T08:00:43.558433Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"p.shape","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.561215Z","iopub.execute_input":"2022-10-29T08:00:43.561744Z","iopub.status.idle":"2022-10-29T08:00:43.571868Z","shell.execute_reply.started":"2022-10-29T08:00:43.561702Z","shell.execute_reply":"2022-10-29T08:00:43.570711Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"unghi=np.arange(0,360,1)\ndistanta=np.arange(0,128,1)\ndistanta, unghi = np.meshgrid(distanta, unghi)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.573211Z","iopub.execute_input":"2022-10-29T08:00:43.573637Z","iopub.status.idle":"2022-10-29T08:00:43.584946Z","shell.execute_reply.started":"2022-10-29T08:00:43.573604Z","shell.execute_reply":"2022-10-29T08:00:43.583959Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"p = (a.real**2 + a.imag**2)# power\np /= np.mean(p)  # normalize\np=p.reshape(360, 128, 32)\np = np.mean(p, axis=2)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.586134Z","iopub.execute_input":"2022-10-29T08:00:43.586737Z","iopub.status.idle":"2022-10-29T08:00:43.606662Z","shell.execute_reply.started":"2022-10-29T08:00:43.586703Z","shell.execute_reply":"2022-10-29T08:00:43.605525Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"p","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.608158Z","iopub.execute_input":"2022-10-29T08:00:43.608775Z","iopub.status.idle":"2022-10-29T08:00:43.619451Z","shell.execute_reply.started":"2022-10-29T08:00:43.608723Z","shell.execute_reply":"2022-10-29T08:00:43.617558Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"colors =pd.DataFrame(p)\n#colors  = df.apply(lambda iterator: ((iterator - iterator.mean())/iterator.std()).round(2))\ncolors =colors.apply(lambda iterator: ((iterator.max() - iterator)/(iterator.max() - iterator.min())).round(2))","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.62121Z","iopub.execute_input":"2022-10-29T08:00:43.622055Z","iopub.status.idle":"2022-10-29T08:00:43.718526Z","shell.execute_reply.started":"2022-10-29T08:00:43.622008Z","shell.execute_reply":"2022-10-29T08:00:43.717487Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"colors","metadata":{"_kg_hide-input":true,"_kg_hide-output":true,"execution":{"iopub.status.busy":"2022-10-29T08:00:43.720066Z","iopub.execute_input":"2022-10-29T08:00:43.720603Z","iopub.status.idle":"2022-10-29T08:00:43.763313Z","shell.execute_reply.started":"2022-10-29T08:00:43.720558Z","shell.execute_reply":"2022-10-29T08:00:43.762438Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# colors =pd.DataFrame(p)\n# colors  = df.apply(lambda iterator: ((iterator - iterator.mean())/iterator.std()).round(2))\n# colors =colors.apply(lambda iterator: ((iterator.max() - iterator)/(iterator.max() - iterator.min())).round(2))\nC=colors \n#area = 4\narea = 0.1 * distanta","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.764348Z","iopub.execute_input":"2022-10-29T08:00:43.765303Z","iopub.status.idle":"2022-10-29T08:00:43.770183Z","shell.execute_reply.started":"2022-10-29T08:00:43.76527Z","shell.execute_reply":"2022-10-29T08:00:43.769002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# ax = plt.subplot(111, polar=True)\n# ax.plot(unghi , distanta, marker='.', ls='none')\n# plt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.771646Z","iopub.execute_input":"2022-10-29T08:00:43.771998Z","iopub.status.idle":"2022-10-29T08:00:43.782984Z","shell.execute_reply.started":"2022-10-29T08:00:43.771937Z","shell.execute_reply":"2022-10-29T08:00:43.781832Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#distanta, unghi = np.meshgrid(distanta, unghi)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.784427Z","iopub.execute_input":"2022-10-29T08:00:43.785299Z","iopub.status.idle":"2022-10-29T08:00:43.795953Z","shell.execute_reply.started":"2022-10-29T08:00:43.785224Z","shell.execute_reply":"2022-10-29T08:00:43.79473Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#result = df.apply(lambda iterator: ((iterator - iterator.mean())/iterator.std()).round(2))\n#result = df.apply(lambda iterator: ((iterator.max() - iterator)/(iterator.max() - iterator.min())).round(2))","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.797613Z","iopub.execute_input":"2022-10-29T08:00:43.798105Z","iopub.status.idle":"2022-10-29T08:00:43.809152Z","shell.execute_reply.started":"2022-10-29T08:00:43.798067Z","shell.execute_reply":"2022-10-29T08:00:43.808004Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = plt.figure(figsize=(15, 15))\nax = fig.add_subplot(projection='polar')\nc = ax.scatter(unghi, distanta, c=colors, s=area, cmap='viridis', alpha=0.75)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:43.810684Z","iopub.execute_input":"2022-10-29T08:00:43.811132Z","iopub.status.idle":"2022-10-29T08:00:45.830986Z","shell.execute_reply.started":"2022-10-29T08:00:43.811088Z","shell.execute_reply":"2022-10-29T08:00:45.829758Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig = plt.figure(figsize=(15, 15))\nax = fig.add_subplot(projection='polar')\nc = ax.scatter(unghi, distanta, c=colors, s=area, cmap='plasma', alpha=0.75)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:45.832838Z","iopub.execute_input":"2022-10-29T08:00:45.833397Z","iopub.status.idle":"2022-10-29T08:00:47.877021Z","shell.execute_reply.started":"2022-10-29T08:00:45.833352Z","shell.execute_reply":"2022-10-29T08:00:47.875671Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"#### Old fashion way","metadata":{}},{"cell_type":"markdown","source":"https://matplotlib.org/stable/gallery/images_contours_and_fields/pcolormesh_grids.html\n\nhttps://stackoverflow.com/questions/8218608/scipy-savefig-without-frames-axes-only-content","metadata":{}},{"cell_type":"code","source":"def _annotate(ax, x, y, title):\n    # this all gets repeated below:\n    X, Y = np.meshgrid(x, y)\n    ax.plot(X.flat, Y.flat, 'o', color='m')\n    ax.set_xlim(0.0, 128)\n    ax.set_ylim(0.0, 320)\n    ax.set_title(title)\n\n#_annotate(ax, x, y, \"shading='flat'\")","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:47.878619Z","iopub.execute_input":"2022-10-29T08:00:47.87971Z","iopub.status.idle":"2022-10-29T08:00:47.885982Z","shell.execute_reply.started":"2022-10-29T08:00:47.87967Z","shell.execute_reply":"2022-10-29T08:00:47.884831Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"colors =pd.DataFrame(p)\n#colors  = df.apply(lambda iterator: ((iterator - iterator.mean())/iterator.std()).round(2))\ncolors =colors.apply(lambda iterator: ((iterator.max() - iterator)/(iterator.max() - iterator.min())).round(2))","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:47.887398Z","iopub.execute_input":"2022-10-29T08:00:47.88843Z","iopub.status.idle":"2022-10-29T08:00:48.013873Z","shell.execute_reply.started":"2022-10-29T08:00:47.888392Z","shell.execute_reply":"2022-10-29T08:00:48.012604Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"colplot=colors","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:48.015296Z","iopub.execute_input":"2022-10-29T08:00:48.015641Z","iopub.status.idle":"2022-10-29T08:00:48.021052Z","shell.execute_reply.started":"2022-10-29T08:00:48.01561Z","shell.execute_reply":"2022-10-29T08:00:48.019694Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"cx=p.T","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:48.022502Z","iopub.execute_input":"2022-10-29T08:00:48.02346Z","iopub.status.idle":"2022-10-29T08:00:48.03326Z","shell.execute_reply.started":"2022-10-29T08:00:48.023414Z","shell.execute_reply":"2022-10-29T08:00:48.032048Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots(constrained_layout=True)\nx = np.arange(0,360,1)\ny = np.arange(0,128,1)\nax.pcolormesh(x, y, cx, shading='gouraud', vmin=cx.min(), vmax=cx.max())\n#_annotate(ax, x, y, \"shading='gouraud'; X, Y same shape as Z\")\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:48.034912Z","iopub.execute_input":"2022-10-29T08:00:48.035669Z","iopub.status.idle":"2022-10-29T08:00:48.609741Z","shell.execute_reply.started":"2022-10-29T08:00:48.035568Z","shell.execute_reply":"2022-10-29T08:00:48.608613Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"gc.collect","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:48.611429Z","iopub.execute_input":"2022-10-29T08:00:48.612091Z","iopub.status.idle":"2022-10-29T08:00:48.619356Z","shell.execute_reply.started":"2022-10-29T08:00:48.612057Z","shell.execute_reply":"2022-10-29T08:00:48.618215Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, ax = plt.subplots()\nax.pcolormesh(x, y, cx, shading='nearest', vmin=cx.min(), vmax=cx.max())\n# _annotate(x, y, cx, \"shading='nearest'\")","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:48.62059Z","iopub.execute_input":"2022-10-29T08:00:48.621211Z","iopub.status.idle":"2022-10-29T08:00:48.8938Z","shell.execute_reply.started":"2022-10-29T08:00:48.621168Z","shell.execute_reply":"2022-10-29T08:00:48.892892Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"\n# fig, ax = plt.subplots()\n# ax.pcolormesh(x, y, Z[:-1, :-1], shading='flat', vmin=Z.min(), vmax=Z.max())\n# _annotate(ax, x, y, \"shading='flat': X, Y, C same shape\")","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:48.895199Z","iopub.execute_input":"2022-10-29T08:00:48.895817Z","iopub.status.idle":"2022-10-29T08:00:48.899599Z","shell.execute_reply.started":"2022-10-29T08:00:48.895784Z","shell.execute_reply":"2022-10-29T08:00:48.89859Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"Z=cx\nfig, axs = plt.subplots(2, 1, constrained_layout=True)\nax = axs[0]\n\nax.pcolormesh(x, y, Z, shading='auto', vmin=Z.min(), vmax=Z.max())\n#_annotate(ax, x, y, \"shading='auto'; X, Y, Z: same shape (nearest)\")\n\nax = axs[1]\n\nax.pcolormesh(x, y, Z, shading='auto', vmin=Z.min(), vmax=Z.max(),cmap='plasma')\n#_annotate(ax, x, y, \"shading='auto'; X, Y one larger than Z (flat)\")\n","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:48.900911Z","iopub.execute_input":"2022-10-29T08:00:48.901462Z","iopub.status.idle":"2022-10-29T08:00:49.489787Z","shell.execute_reply.started":"2022-10-29T08:00:48.901429Z","shell.execute_reply":"2022-10-29T08:00:49.488659Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"fig, axs = plt.subplots(2, 1, constrained_layout=True)\nax = axs[0]\n\nax.pcolormesh(x, y, Z, shading='nearest', vmin=Z.min(), vmax=Z.max(),cmap='viridis')\n#_annotate(ax, x, y, \"shading='auto'; X, Y one larger than Z (flat)\")\nax = axs[1]\n\nax.pcolormesh(x, y, Z,  shading='gouraud', vmin=Z.min(), vmax=Z.max(),cmap='inferno',)\n#_annotate(ax, x, y, \"shading='auto'; X, Y one larger than Z (flat)\")","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:49.491126Z","iopub.execute_input":"2022-10-29T08:00:49.491488Z","iopub.status.idle":"2022-10-29T08:00:50.461213Z","shell.execute_reply.started":"2022-10-29T08:00:49.491456Z","shell.execute_reply":"2022-10-29T08:00:50.45999Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"To do","metadata":{}},{"cell_type":"markdown","source":"https://matplotlib.org/stable/gallery/images_contours_and_fields/pcolormesh_levels.html","metadata":{}},{"cell_type":"code","source":"file = Path(train_files[2])\nprint(file)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:50.462597Z","iopub.execute_input":"2022-10-29T08:00:50.462946Z","iopub.status.idle":"2022-10-29T08:00:50.469365Z","shell.execute_reply.started":"2022-10-29T08:00:50.462913Z","shell.execute_reply":"2022-10-29T08:00:50.468072Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"str(file) ==\"../input/g2net-detecting-continuous-gravitational-waves/train/067b3fb4b.hdf5\"","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:50.471023Z","iopub.execute_input":"2022-10-29T08:00:50.471774Z","iopub.status.idle":"2022-10-29T08:00:50.486154Z","shell.execute_reply.started":"2022-10-29T08:00:50.47174Z","shell.execute_reply":"2022-10-29T08:00:50.484523Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"file = Path(train_files[2])\nprint(file)\n#label = train_labels.loc[train_labels[\"id\"] == ind][\"target\"].values[0]\ndata = read_data(file)\nh1_sft, h1_ts = data[\"H1\"]\nl1_sft, l1_ts = data[\"L1\"]\nfreq_hz = data[\"freq_hz\"]","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:50.488492Z","iopub.execute_input":"2022-10-29T08:00:50.488917Z","iopub.status.idle":"2022-10-29T08:00:51.069598Z","shell.execute_reply.started":"2022-10-29T08:00:50.488883Z","shell.execute_reply":"2022-10-29T08:00:51.068488Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"path_test=\"/kaggle/working/\"\nz='bubu'\nind=\"test_image\"\npower_spectrogram_test(h1_sft,path_test,z,ind)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:51.071042Z","iopub.execute_input":"2022-10-29T08:00:51.071427Z","iopub.status.idle":"2022-10-29T08:00:51.592172Z","shell.execute_reply.started":"2022-10-29T08:00:51.071395Z","shell.execute_reply":"2022-10-29T08:00:51.590954Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport numpy, cv2\nfrom PIL import Image\nimg = np.empty((3,360, 128), dtype=np.float32)\na=h1_sft[:, :4096] * 1e22\np = (a.real**2 + a.imag**2)# power\np /= np.mean(p)  # normalize\np=p.reshape(360, 128, 32)\n#split the compression\np1=p[:,:,0:16]\np2=p[:,:,16:32]\np = np.mean(p, axis=2)\np1 = np.mean(p1, axis=2)\np2 = np.mean(p2, axis=2)\nimg[0] = p1\nimg[1] = p2\nimg[2] = p\nfig, (ax1, ax2,ax3) = plt.subplots(1, 3,figsize=(10, 10))\nplt.rcParams['image.cmap'] = 'BuPu'\nfig.suptitle('power density - and zoom of the zoom')\nax1.set_title(\"slice 0:16\")\nax2.set_title(\"slice 16:32\")\nax3.set_title(\"compressed 0:32\")\nax1.imshow(img[0])\nax2.imshow(img[1])\nax3.imshow(img[2])\nfig.tight_layout()\n\nimg  = Image.fromarray(img[0], mode=\"L\")\nimg.save('L.png')\nimg2  = Image.fromarray(p, mode=\"RGB\")\nimg2.save('RGB.png')\nimg3  = Image.fromarray(p, mode=\"YCbCr\")\nimg3.save('YCbCr.jpg')\nimg4  = Image.fromarray(p, mode=\"CMYK\")\nimg4.save('CMYK.jpg')","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:51.593707Z","iopub.execute_input":"2022-10-29T08:00:51.594066Z","iopub.status.idle":"2022-10-29T08:00:52.474817Z","shell.execute_reply.started":"2022-10-29T08:00:51.594031Z","shell.execute_reply":"2022-10-29T08:00:52.47361Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"### To DO  Filter","metadata":{}},{"cell_type":"code","source":"#a=h1_sft[:, :4096] * 1e22","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:52.476447Z","iopub.execute_input":"2022-10-29T08:00:52.476797Z","iopub.status.idle":"2022-10-29T08:00:52.481164Z","shell.execute_reply.started":"2022-10-29T08:00:52.476765Z","shell.execute_reply":"2022-10-29T08:00:52.480334Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# # Removing the outliers\n# # https://www.geeksforgeeks.org/how-to-use-pandas-filter-with-iqr/\n# def removeOutliers(data, col):\n#     Q3 = np.quantile(data[col], 0.75)\n#     Q1 = np.quantile(data[col], 0.25)\n#     IQR = Q3 - Q1\n \n#     print(\"IQR value for column %s is: %s\" % (col, IQR))\n#     global outlier_free_list\n#     global filtered_data\n \n#     lower_range = Q1 - 1.5 * IQR\n#     upper_range = Q3 + 1.5 * IQR\n#     outlier_free_list = [x for x in data[col] if (\n#         (x > lower_range) & (x < upper_range))]\n#     filtered_data = data.loc[data[col].isin(outlier_free_list)]\n \n# for i in data.columns:\n#       if i == data.columns[0]:\n#       removeOutliers(data, i)\n#     else:\n#       removeOutliers(filtered_data, i)\n \n# # Assigning filtered data back to our original variable\n# data = filtered_data\n# print(\"Shape of data after outlier removal is: \", data.shape)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:52.482312Z","iopub.execute_input":"2022-10-29T08:00:52.482956Z","iopub.status.idle":"2022-10-29T08:00:52.495377Z","shell.execute_reply.started":"2022-10-29T08:00:52.482912Z","shell.execute_reply":"2022-10-29T08:00:52.494306Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# img = np.empty((3,360, 128), dtype=np.float32)\n# a=h1_sft[:, :4096] * 1e22\n# p = (a.real**2 + a.imag**2)# power\n# p /= np.mean(p)  # normalize\n# p=p.reshape(360, 128, 32)\n# #split the compression\n# p1=p[:,:,0:16]\n# p2=p[:,:,16:32]\n# p = np.mean(p, axis=2)\n# df_compress=pd.DataFrame(p)\n# df_compress.describe()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:52.496824Z","iopub.execute_input":"2022-10-29T08:00:52.497213Z","iopub.status.idle":"2022-10-29T08:00:52.511277Z","shell.execute_reply.started":"2022-10-29T08:00:52.49718Z","shell.execute_reply":"2022-10-29T08:00:52.509705Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"h1_sft,l1_sft=get_sft(2)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:52.512953Z","iopub.execute_input":"2022-10-29T08:00:52.513372Z","iopub.status.idle":"2022-10-29T08:00:52.773918Z","shell.execute_reply.started":"2022-10-29T08:00:52.513338Z","shell.execute_reply":"2022-10-29T08:00:52.772992Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport numpy, cv2\nfrom PIL import Image\nimg = np.empty((3,360, 128), dtype=np.float32)\nimage = np.empty((360, 128), dtype=np.float32)\na=h1_sft[:, :4096] * 1e22\np = (a.real**2 + a.imag**2)# power\np /= np.mean(p)  # normalize\np=p.reshape(360, 128, 32)\np = np.mean(p, axis=2)\n#image *= (255.0/p.max())\nimage  = Image.fromarray(p, mode=\"RGB\")\nimage.save('imageRGB.png')\nplt.imsave('pilimageRGB21.png', p, cmap='viridis')\n# plt.imshow(image)\n# plt.title('image')\n# plt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:24:49.300629Z","iopub.execute_input":"2022-10-29T08:24:49.301699Z","iopub.status.idle":"2022-10-29T08:24:49.362741Z","shell.execute_reply.started":"2022-10-29T08:24:49.301647Z","shell.execute_reply":"2022-10-29T08:24:49.36162Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Convolution experiments 1 power","metadata":{}},{"cell_type":"code","source":"import cv2\nimport math\n\n\nclass Kernel(object):\n    def H_Function(self, Dh, Dv, u, v, centerX, centerY, theta, n):\n        return 1 / (1 + 0.414 * math.sqrt(math.pow(self.U_Star(u, centerX, centerY, theta) / Dh + self.V_Star(v, centerX, centerY, theta) / Dv, 2 * n)))\n\n    def U_Star(self, u, centerX, centerY, theta):\n        return math.cos(theta) * (u + self.Tx(centerX, theta)) + math.sin(theta) * (u + self.Ty(centerY, theta))\n\n    def V_Star(self, u, centerX, centerY, theta):\n        return (-math.sin(theta)) * (u + self.Tx(centerX, theta)) + math.cos(theta) * (u + self.Ty(centerY, theta))\n\n    def Tx(self, center, theta):\n        return center * math.cos(theta)\n\n    def Ty(self, center, theta):\n        return center * math.sin(theta)\n\nK = Kernel()\n\nsize = 5, 10\nkernel = np.zeros(size, dtype=np.float)\nDh=2\nDv=2\ncenterX = -size[0] / 2\ncenterY = -size[1] / 2\ntheta=0.9\nn=4\n\nfor u in range(0, size[0]):\n    for v in range(0, size[1]):\n        kernel[u][v] = K.H_Function(Dh, Dv, u, v, centerX, centerY, theta, n) \nkernelNorm = np.copy(kernel)\ncv2.normalize(kernel, kernel, 1.0, 0, cv2.NORM_L1)\ncv2.normalize(kernelNorm, kernelNorm, 0, 255, cv2.NORM_MINMAX)\ncv2.imwrite(\"kernel.jpg\", kernelNorm)\n\nimgSrc = cv2.imread('pilimageRGB21.png',0)\n#imgSrc = cv2.imread('pilimageRGB21.png')\n#remove image\n#os.remove('pilimageRGB21.png', *, dir_fd = None)\nplt.imshow(imgSrc)\nplt.title('imgSrc')\nplt.show()\nconvolved = cv2.filter2D(imgSrc,-1,kernel)\ncv2.normalize(convolved, convolved, 0, 255, cv2.NORM_MINMAX)\ncv2.imwrite(\"conv.jpg\", convolved)\nplt.imshow(convolved)\nplt.title('convolved')\nplt.show()\nth, thresholded = cv2.threshold(convolved, 100, 255, cv2.THRESH_BINARY)\ncv2.imwrite(\"thresh.jpg\", thresholded)\nplt.imshow(thresholded)\nplt.title('thresholded')\nplt.show()\nim_h = cv2.hconcat([imgSrc, convolved])\nim_h = cv2.hconcat([im_h, thresholded])\ncv2.imwrite(\"im_h.jpg\", im_h)\nplt.imshow(im_h)\nplt.title('im_h')\nplt.show()","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:04:56.863357Z","iopub.execute_input":"2022-10-29T08:04:56.863807Z","iopub.status.idle":"2022-10-29T08:04:57.55169Z","shell.execute_reply.started":"2022-10-29T08:04:56.863772Z","shell.execute_reply":"2022-10-29T08:04:57.549963Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"height, width = im_h.shape[:2]\nprint('height, width',height, width)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:53.799338Z","iopub.execute_input":"2022-10-29T08:00:53.799734Z","iopub.status.idle":"2022-10-29T08:00:53.806098Z","shell.execute_reply.started":"2022-10-29T08:00:53.799701Z","shell.execute_reply":"2022-10-29T08:00:53.804861Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Convolution experiments 2 power","metadata":{}},{"cell_type":"code","source":"import cv2\nimport math\nimport numpy as np\nimport numpy, cv2\nfrom PIL import Image\nimg = np.empty((1,360, 1), dtype=np.float32)\nimage = np.empty((360, 4096), dtype=np.float32)\na=h1_sft[:, :4096] * 1e22\np = (a.real**2 + a.imag**2)# power\np /= np.mean(p)  # normalize\n# p=p.reshape(360, 128, 32)\n#p = np.mean(p, axis=2)\nimage *= (255.0/p.max())\nimage  = Image.fromarray(p, mode=\"RGB\")\nimage.save('imageRGB2.png')\nplt.imsave('pilimageRGB2.png', p, cmap='BuPu')\nplt.imsave('pilimageRGB3.png', p, cmap='Greys')\n\nclass Kernel(object):\n    def H_Function(self, Dh, Dv, u, v, centerX, centerY, theta, n):\n        return 1 / (1 + 0.414 * math.sqrt(math.pow(self.U_Star(u, centerX, centerY, theta) / Dh + self.V_Star(v, centerX, centerY, theta) / Dv, 2 * n)))\n\n    def U_Star(self, u, centerX, centerY, theta):\n        return math.cos(theta) * (u + self.Tx(centerX, theta)) + math.sin(theta) * (u + self.Ty(centerY, theta))\n\n    def V_Star(self, u, centerX, centerY, theta):\n        return (-math.sin(theta)) * (u + self.Tx(centerX, theta)) + math.cos(theta) * (u + self.Ty(centerY, theta))\n\n    def Tx(self, center, theta):\n        return center * math.cos(theta)\n\n    def Ty(self, center, theta):\n        return center * math.sin(theta)\n\nK = Kernel()\n\nsize = 15, 5\nkernel = np.zeros(size, dtype=np.float)\nDh=2\nDv=2\ncenterX = -size[0] / 2\ncenterY = -size[1] / 2\ntheta=0.9\nn=4\n\nfor u in range(0, size[0]):\n    for v in range(0, size[1]):\n        kernel[u][v] = K.H_Function(Dh, Dv, u, v, centerX, centerY, theta, n) \nkernelNorm = np.copy(kernel)\ncv2.normalize(kernel, kernel, 1.0, 0, cv2.NORM_L1)\ncv2.normalize(kernelNorm, kernelNorm, 0, 255, cv2.NORM_MINMAX)\ncv2.imwrite(\"kernel2.jpg\", kernelNorm)\n\nimgSrc = cv2.imread('pilimageRGB2.png',0)\n\nconvolved = cv2.filter2D(imgSrc,-1,kernel)\ncv2.normalize(convolved, convolved, 0, 255, cv2.NORM_MINMAX)\ncv2.imwrite(\"conv2.jpg\", convolved)\nth, thresholded = cv2.threshold(convolved, 100, 255, cv2.THRESH_BINARY)\ncv2.imwrite(\"thresh2.jpg\", thresholded)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T08:00:53.807697Z","iopub.execute_input":"2022-10-29T08:00:53.808086Z","iopub.status.idle":"2022-10-29T08:00:55.9304Z","shell.execute_reply.started":"2022-10-29T08:00:53.808051Z","shell.execute_reply":"2022-10-29T08:00:55.929141Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"h1_sft,l1_sft=get_sft(2)","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"help (cv2.STEREO_SGBM_create())","metadata":{"execution":{"iopub.status.busy":"2022-10-29T09:41:24.472655Z","iopub.execute_input":"2022-10-29T09:41:24.473682Z","iopub.status.idle":"2022-10-29T09:41:24.490167Z","shell.execute_reply.started":"2022-10-29T09:41:24.47364Z","shell.execute_reply":"2022-10-29T09:41:24.488668Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import cv2\nimport math\nimport numpy as np\nimport numpy, cv2\nfrom PIL import Image\nplt.rcParams[\"figure.figsize\"] = (2,5)\nclass Kernel(object):\n    def H_Function(self, Dh, Dv, u, v, centerX, centerY, theta, n):\n        return 1 / (1 + 0.414 * math.sqrt(math.pow(self.U_Star(u, centerX, centerY, theta) / Dh + self.V_Star(v, centerX, centerY, theta) / Dv, 2 * n)))\n\n    def U_Star(self, u, centerX, centerY, theta):\n        return math.cos(theta) * (u + self.Tx(centerX, theta)) + math.sin(theta) * (u + self.Ty(centerY, theta))\n\n    def V_Star(self, u, centerX, centerY, theta):\n        return (-math.sin(theta)) * (u + self.Tx(centerX, theta)) + math.cos(theta) * (u + self.Ty(centerY, theta))\n\n    def Tx(self, center, theta):\n        return center * math.cos(theta)\n\n    def Ty(self, center, theta):\n        return center * math.sin(theta)\ndef get_thresholds(image):\n    K = Kernel()\n    size = 15, 15\n    kernel = np.zeros(size, dtype=np.float)\n    Dh=2\n    Dv=2\n    centerX = -size[0] / 2\n    centerY = -size[1] / 2\n    theta=0.9\n    n=4\n\n    for u in range(0, size[0]):\n        for v in range(0, size[1]):\n            kernel[u][v] = K.H_Function(Dh, Dv, u, v, centerX, centerY, theta, n) \n    kernelNorm = np.copy(kernel)\n    cv2.normalize(kernel, kernel, 1.0, 0, cv2.NORM_L1)\n    cv2.normalize(kernelNorm, kernelNorm, 0, 255, cv2.NORM_MINMAX)\n    cv2.imwrite(\"kernel2.jpg\", kernelNorm)\n    #image='pilimageRGB2.png'\n    imgSrc = cv2.imread(image,0)\n    convolved = cv2.filter2D(imgSrc,-1,kernel)\n    cv2.normalize(convolved, convolved, 0, 255, cv2.NORM_MINMAX)\n    cv2.imwrite(\"conv2.jpg\", convolved)\n    th, thresholded = cv2.threshold(convolved, 80, 255, cv2.THRESH_BINARY)\n    cv2.imwrite(\"thresh2.jpg\", thresholded)\n    return convolved,thresholded\n\ndef sft_to_numpy(h1_sft):\n    #img = np.empty((2,360, 128), dtype=np.float32)\n    a=h1_sft[:, :4096] * 1e22\n    p = (a.real**2 + a.imag**2)# powerp /= np.mean(p)  # normalize\n    p=p.reshape(360, 128, 32)\n    p = np.mean(p, axis=2)\n    p *= (255.0/p.max())\n    return p\n\ndef get_images(h1_sft,l1_sft):\n    img = np.empty((2,360, 128), dtype=np.float32)\n    p=sft_to_numpy(h1_sft)\n    q=sft_to_numpy(h1_sft)\n    img[0]=p\n    img[1]=q\n    ######\n    plt.imsave('h1_viridis.jpg', img[0], cmap='PuBu')\n    plt.imsave('l1_viridis.jpg', img[1], cmap='BuPu')\n    img1 = cv2.imread('h1_viridis.jpg')\n    img2 = cv2.imread('l1_viridis.jpg')\n    ######\n        ######()\n    #stereo_matcher=cv2.STEREO_SGBM_create()\n    gray1 = cv2.cvtColor(img1, cv2.COLOR_BGR2GRAY)\n    gray2 = cv2.cvtColor(img2, cv2.COLOR_BGR2GRAY)\n    stereo = cv2.StereoBM_create(numDisparities=16, blockSize=5)\n    disparity = stereo.compute(gray1, gray2)\n    #plt.imshow(gray1, 'gray')\n    plt.imshow(disparity, 'gray')\n    plt.axis('off')\n    plt.show()\n    \n    ######\n    ######\n    c1,th1=get_thresholds('h1_viridis.jpg')\n    c2,th2=get_thresholds('l1_viridis.jpg')\n    ######\n    plt.imsave('th1.jpg',th1)\n    plt.imsave('th2.jpg',th2)\n    th1= cv2.imread('th1.jpg')\n    th2= cv2.imread('th2.jpg')\n    \n \n    ######\n    img1 = cv2.hconcat([th1, img1])\n    img2= cv2.hconcat([img2, th2])\n\n    \n    imgOrig = cv2.hconcat([img1, img2])\n\n    #####\n#     fig, ax = plt.subplots(1, 3,figsize=(10, 10))\n    figsize=(10, 10)\n    plt.axis('off')\n    plt.imshow(imgOrig)\n    #plt.show()\n#     image.save('imageRGB2.png')\n#     plt.imsave('pilimageRGB2.png', p, cmap='BuPu')\n#     plt.imsave('pilimageRGB3.png', p, cmap='Greys')\ndef get_images2(h1_sft):\n    img = np.empty((1,360, 128), dtype=np.float32)\n    p = (a.real**2 + a.imag**2)# power\n    p=p.reshape(360, 128, 32)\n    p /= np.mean(p)  # normalize\n    p = np.mean(p, axis=2)\n    cx=p\n    print(Z.shape)\n    fig, ax = plt.subplots(constrained_layout=True)\n    y = np.arange(0,360,1)\n    x = np.arange(0,128,1)\n    #fig = plt.figure(figsize=(2,8))\n    ax.pcolormesh(x, y, cx, shading='gouraud', vmin=cx.min(), vmax=cx.max(),cmap='viridis')\n#_annotate(ax, x, y, \"shading='gouraud'; X, Y same shape as Z\")\n    plt.axis('off')\n    plt.savefig('0test.png')\n    plt.show()\n    \n    \n#     fig, axs = plt.subplots(2, 1, constrained_layout=True)\n#     ax = axs[0]\n#     x=p.shape[0]\n#     print(x)\n#     y=p.shape[1]\n#     print(y)\n#     ax.pcolormesh(x, y, Z, shading='auto', vmin=Z.min(), vmax=Z.max())\n#     #_annotate(ax, x, y, \"shading='auto'; X, Y, Z: same shape (nearest)\")\n#     ax = axs[1]\n#     ax.pcolormesh(x, y, Z, shading='auto', vmin=Z.min(), vmax=Z.max(),cmap='plasma')\n#     ######\n    \n    \n","metadata":{"execution":{"iopub.status.busy":"2022-10-29T10:28:57.502511Z","iopub.execute_input":"2022-10-29T10:28:57.502891Z","iopub.status.idle":"2022-10-29T10:28:57.533149Z","shell.execute_reply.started":"2022-10-29T10:28:57.50286Z","shell.execute_reply":"2022-10-29T10:28:57.532262Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"get_images2(h1_sft)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T10:28:58.156196Z","iopub.execute_input":"2022-10-29T10:28:58.156801Z","iopub.status.idle":"2022-10-29T10:28:59.065151Z","shell.execute_reply.started":"2022-10-29T10:28:58.156767Z","shell.execute_reply":"2022-10-29T10:28:59.063915Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#get_images(h1_sft,l1_sft)","metadata":{"execution":{"iopub.status.busy":"2022-10-29T09:59:54.996525Z","iopub.execute_input":"2022-10-29T09:59:54.997139Z","iopub.status.idle":"2022-10-29T09:59:55.423291Z","shell.execute_reply.started":"2022-10-29T09:59:54.997104Z","shell.execute_reply":"2022-10-29T09:59:55.421436Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}