Skip to content

Commit

Permalink
Created using Colab
Browse files Browse the repository at this point in the history
  • Loading branch information
gdtschuller committed Jan 28, 2025
1 parent 8111667 commit ded3010
Showing 1 changed file with 62 additions and 47 deletions.
109 changes: 62 additions & 47 deletions ADSP_12_Wiener_Filter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@
"cell_type": "code",
"metadata": {
"id": "auou57R3ZCGK",
"outputId": "df15f2af-18c1-4aa4-c39f-131a727f5094",
"outputId": "e2ddfba1-570f-4b60-98c3-c8c272f9c316",
"colab": {
"base_uri": "https://localhost:8080/"
}
Expand All @@ -852,14 +852,14 @@
"#Compute the quadratic error for the first 200000 samples:\n",
"print(sum(np.power(y[:200000]-x[:200000],2))/200000)\n"
],
"execution_count": 52,
"execution_count": 65,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"(207612, 1)\n",
"[[675984.81288129]]\n"
"[[894085.99546232]]\n"
]
}
]
Expand All @@ -877,21 +877,21 @@
"cell_type": "code",
"metadata": {
"id": "Cs8BxQfmZCGL",
"outputId": "eadb2b40-bc1b-4cd7-d3d8-d79c1d61944e",
"outputId": "fd033777-ca57-4600-9763-a6acd35647fc",
"colab": {
"base_uri": "https://localhost:8080/"
}
},
"source": [
"print(np.sum(np.power(xw[4:200004]-x[:200000].T,2))/200000)"
],
"execution_count": 53,
"execution_count": 66,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"606253.6424750639\n"
"374135.4923101797\n"
]
}
]
Expand Down Expand Up @@ -944,7 +944,7 @@
"cell_type": "code",
"metadata": {
"id": "Jxj7HcIpZCGL",
"outputId": "0dfb96f8-9640-4135-ef51-fc676f58cb40",
"outputId": "7a4c4ef5-6ca1-441e-8733-3b7c53af0347",
"colab": {
"base_uri": "https://localhost:8080/"
}
Expand All @@ -953,55 +953,53 @@
"print((A.T*A).shape)\n",
"(A.T*A)"
],
"execution_count": null,
"execution_count": 67,
"outputs": [
{
"output_type": "stream",
"name": "stdout",
"text": [
"(10, 10)\n"
],
"name": "stdout"
]
},
{
"output_type": "execute_result",
"data": {
"text/plain": [
"matrix([[1.08396658e+12, 9.21999193e+11, 8.65228937e+11, 9.02440013e+11,\n",
" 8.97265787e+11, 8.54153544e+11, 8.28472960e+11, 7.98431458e+11,\n",
" 7.64760915e+11, 7.42995204e+11],\n",
" [9.21999193e+11, 1.08396731e+12, 9.22000448e+11, 8.65229808e+11,\n",
" 9.02441117e+11, 8.97266945e+11, 8.54153705e+11, 8.28474119e+11,\n",
" 7.98431854e+11, 7.64762194e+11],\n",
" [8.65228937e+11, 9.22000448e+11, 1.08396929e+12, 9.22001169e+11,\n",
" 8.65231417e+11, 9.02442297e+11, 8.97267261e+11, 8.54155346e+11,\n",
" 8.28474791e+11, 7.98434067e+11],\n",
" [9.02440013e+11, 8.65229808e+11, 9.22001169e+11, 1.08396689e+12,\n",
" 9.22001199e+11, 8.65229202e+11, 9.02442662e+11, 8.97267080e+11,\n",
" 8.54155776e+11, 8.28476374e+11],\n",
" [8.97265787e+11, 9.02441117e+11, 8.65231417e+11, 9.22001199e+11,\n",
" 1.08396808e+12, 9.22001608e+11, 8.65229510e+11, 9.02443832e+11,\n",
" 8.97267664e+11, 8.54157733e+11],\n",
" [8.54153544e+11, 8.97266945e+11, 9.02442297e+11, 8.65229202e+11,\n",
" 9.22001608e+11, 1.08396616e+12, 9.22002044e+11, 8.65229716e+11,\n",
" 9.02444416e+11, 8.97269751e+11],\n",
" [8.28472960e+11, 8.54153705e+11, 8.97267261e+11, 9.02442662e+11,\n",
" 8.65229510e+11, 9.22002044e+11, 1.08396619e+12, 9.22002377e+11,\n",
" 8.65229806e+11, 9.02444695e+11],\n",
" [7.98431458e+11, 8.28474119e+11, 8.54155346e+11, 8.97267080e+11,\n",
" 9.02443832e+11, 8.65229716e+11, 9.22002377e+11, 1.08396732e+12,\n",
" 9.22002988e+11, 8.65231863e+11],\n",
" [7.64760915e+11, 7.98431854e+11, 8.28474791e+11, 8.54155776e+11,\n",
" 8.97267664e+11, 9.02444416e+11, 8.65229806e+11, 9.22002988e+11,\n",
" 1.08396753e+12, 9.22003683e+11],\n",
" [7.42995204e+11, 7.64762194e+11, 7.98434067e+11, 8.28476374e+11,\n",
" 8.54157733e+11, 8.97269751e+11, 9.02444695e+11, 8.65231863e+11,\n",
" 9.22003683e+11, 1.08396977e+12]])"
"matrix([[1.08304453e+12, 9.20388779e+11, 8.64619539e+11, 9.02667332e+11,\n",
" 8.96975518e+11, 8.53222979e+11, 8.29151239e+11, 7.99368911e+11,\n",
" 7.63598613e+11, 7.41824844e+11],\n",
" [9.20388779e+11, 1.08304665e+12, 9.20387635e+11, 8.64623113e+11,\n",
" 9.02667634e+11, 8.96977334e+11, 8.53227235e+11, 8.29150843e+11,\n",
" 7.99370527e+11, 7.63599086e+11],\n",
" [8.64619539e+11, 9.20387635e+11, 1.08304703e+12, 9.20386676e+11,\n",
" 8.64623612e+11, 9.02667012e+11, 8.96976411e+11, 8.53227873e+11,\n",
" 8.29149870e+11, 7.99370534e+11],\n",
" [9.02667332e+11, 8.64623113e+11, 9.20386676e+11, 1.08304909e+12,\n",
" 9.20384473e+11, 8.64625207e+11, 9.02668561e+11, 8.96974003e+11,\n",
" 8.53231014e+11, 8.29149596e+11],\n",
" [8.96975518e+11, 9.02667634e+11, 8.64623612e+11, 9.20384473e+11,\n",
" 1.08304727e+12, 9.20383731e+11, 8.64621969e+11, 9.02667310e+11,\n",
" 8.96974521e+11, 8.53230349e+11],\n",
" [8.53222979e+11, 8.96977334e+11, 9.02667012e+11, 8.64625207e+11,\n",
" 9.20383731e+11, 1.08304829e+12, 9.20385301e+11, 8.64620988e+11,\n",
" 9.02668847e+11, 8.96974532e+11],\n",
" [8.29151239e+11, 8.53227235e+11, 8.96976411e+11, 9.02668561e+11,\n",
" 8.64621969e+11, 9.20385301e+11, 1.08304886e+12, 9.20382038e+11,\n",
" 8.64624824e+11, 9.02668279e+11],\n",
" [7.99368911e+11, 8.29150843e+11, 8.53227873e+11, 8.96974003e+11,\n",
" 9.02667310e+11, 8.64620988e+11, 9.20382038e+11, 1.08304816e+12,\n",
" 9.20381923e+11, 8.64624266e+11],\n",
" [7.63598613e+11, 7.99370527e+11, 8.29149870e+11, 8.53231014e+11,\n",
" 8.96974521e+11, 9.02668847e+11, 8.64624824e+11, 9.20381923e+11,\n",
" 1.08304935e+12, 9.20382397e+11],\n",
" [7.41824844e+11, 7.63599086e+11, 7.99370534e+11, 8.29149596e+11,\n",
" 8.53230349e+11, 8.96974532e+11, 9.02668279e+11, 8.64624266e+11,\n",
" 9.20382397e+11, 1.08304917e+12]])"
]
},
"metadata": {
"tags": []
},
"execution_count": 21
"metadata": {},
"execution_count": 67
}
]
},
Expand Down Expand Up @@ -1125,10 +1123,10 @@
"metadata": {
"hide_input": false,
"id": "SIZhAX2pZCGN",
"outputId": "9989246c-ca93-4792-f4ac-663a44940ae8",
"outputId": "afc0d72f-6ba8-4138-ffc3-0d623035455c",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 76
"height": 266
}
},
"source": [
Expand All @@ -1137,8 +1135,25 @@
"x/=np.abs(x).max()\n",
"display(ipd.Audio(x, rate = sr ))"
],
"execution_count": null,
"execution_count": 68,
"outputs": [
{
"output_type": "stream",
"name": "stderr",
"text": [
"Exception ignored in: <function Wave_write.__del__ at 0x7bca30720360>\n",
"Traceback (most recent call last):\n",
" File \"/usr/lib/python3.11/wave.py\", line 447, in __del__\n",
" self.close()\n",
" File \"/usr/lib/python3.11/wave.py\", line 565, in close\n",
" self._ensure_header_written(0)\n",
" File \"/usr/lib/python3.11/wave.py\", line 588, in _ensure_header_written\n",
" self._write_header(datasize)\n",
" File \"/usr/lib/python3.11/wave.py\", line 592, in _write_header\n",
" self._file.write(b'RIFF')\n",
"ValueError: I/O operation on closed file.\n"
]
},
{
"output_type": "display_data",
"data": {
Expand Down

0 comments on commit ded3010

Please sign in to comment.