Skip to content

Commit

Permalink
User Array(csg') when passing to imshow. Workaround until people get …
Browse files Browse the repository at this point in the history
…their shit together on transposes
  • Loading branch information
cako committed Sep 25, 2018
1 parent 6741895 commit a9677f3
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 50 deletions.
32 changes: 7 additions & 25 deletions notebooks/LayerCake-RegularizationPart1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 6.292222 seconds (3.40 M allocations: 175.176 MiB, 1.23% gc time)\n"
" 8.913833 seconds (3.40 M allocations: 175.250 MiB, 1.09% gc time)\n"
]
}
],
Expand Down Expand Up @@ -313,24 +313,6 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.\n",
"│ Specialize `strides(::LinearAlgebra.Adjoint)` if `LinearAlgebra.Adjoint` indeed uses a strided representation in memory.\n",
"│ Warning: inappropriately implementing this method for an array type that does not use strided\n",
"│ storage may lead to incorrect results or segfaults.\n",
"│ caller = stride at abstractarray.jl:350 [inlined]\n",
"└ @ Core ./abstractarray.jl:350\n",
"┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.\n",
"│ Specialize `strides(::LinearAlgebra.Adjoint)` if `LinearAlgebra.Adjoint` indeed uses a strided representation in memory.\n",
"│ Warning: inappropriately implementing this method for an array type that does not use strided\n",
"│ storage may lead to incorrect results or segfaults.\n",
"│ caller = stride at abstractarray.jl:350 [inlined]\n",
"└ @ Core ./abstractarray.jl:350\n"
]
}
],
"source": [
Expand All @@ -340,7 +322,7 @@
"fig, ax = plt.subplots(rows, div(ns, rows), figsize=(10,4rows))\n",
"idx = reshape(1:rows*div(ns, rows), div(ns, rows), rows)'\n",
"for (i, axi) in enumerate(ax)\n",
" csg = data[:,idx[i],:]'\n",
" csg = Array(data[:,idx[i],:]')\n",
" axi[:imshow](csg, extent=[rec_x[1], rec_x[end], t[end], t[1]],\n",
" vmin=-0.5maximum(abs.(csg)), vmax=0.5maximum(abs.(csg)), aspect=\"auto\", cmap=\"gray\", interpolation=\"none\")\n",
" axi[:scatter](src_x[idx[i]], t[1], color=\"#d62728\", marker=\"*\", s=200, clip_on=false, zorder=100)\n",
Expand Down Expand Up @@ -373,7 +355,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 3.113558 seconds (2.20 M allocations: 121.930 MiB, 2.04% gc time)\n"
" 4.919327 seconds (2.19 M allocations: 121.769 MiB, 2.23% gc time)\n"
]
}
],
Expand Down Expand Up @@ -450,7 +432,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 7.793007 seconds (4.57 M allocations: 695.879 MiB, 3.84% gc time)\n"
" 12.370639 seconds (4.57 M allocations: 696.037 MiB, 3.49% gc time)\n"
]
}
],
Expand All @@ -468,7 +450,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 14.428752 seconds (10.57 M allocations: 1.205 GiB, 3.44% gc time)\n"
" 19.144294 seconds (10.56 M allocations: 1.205 GiB, 3.02% gc time)\n"
]
}
],
Expand All @@ -486,7 +468,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 5.660292 seconds (3.32 M allocations: 632.830 MiB, 3.08% gc time)\n"
" 8.563079 seconds (3.32 M allocations: 632.829 MiB, 2.72% gc time)\n"
]
}
],
Expand Down Expand Up @@ -515,7 +497,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 6.294866 seconds (4.54 M allocations: 723.020 MiB, 3.64% gc time)\n"
" 9.742759 seconds (4.54 M allocations: 723.040 MiB, 3.11% gc time)\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion notebooks/LayerCake-RegularizationPart1.jl
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ rows = 2
fig, ax = plt.subplots(rows, div(ns, rows), figsize=(10,4rows))
idx = reshape(1:rows*div(ns, rows), div(ns, rows), rows)'
for (i, axi) in enumerate(ax)
csg = data[:,idx[i],:]'
csg = Array(data[:,idx[i],:]')
axi[:imshow](csg, extent=[rec_x[1], rec_x[end], t[end], t[1]],
vmin=-0.5maximum(abs.(csg)), vmax=0.5maximum(abs.(csg)), aspect="auto", cmap="gray", interpolation="none")
axi[:scatter](src_x[idx[i]], t[1], color="#d62728", marker="*", s=200, clip_on=false, zorder=100)
Expand Down
37 changes: 14 additions & 23 deletions notebooks/LayerCake.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,16 @@
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Warning: Using only one worker\n",
"└ @ KirchMig /home/cdacosta/.julia/dev/KirchMig/src/map.jl:70\n"
]
}
],
"source": [
"t = 0:0.008:1; nt = length(t)\n",
"G = KirchMig.KirchMap(t, trav);"
Expand All @@ -241,7 +250,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 6.497352 seconds (3.40 M allocations: 186.707 MiB, 1.46% gc time)\n"
" 4.373891 seconds (3.58 M allocations: 679.408 MiB, 3.27% gc time)\n"
]
}
],
Expand Down Expand Up @@ -286,24 +295,6 @@
},
"metadata": {},
"output_type": "display_data"
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.\n",
"│ Specialize `strides(::LinearAlgebra.Adjoint)` if `LinearAlgebra.Adjoint` indeed uses a strided representation in memory.\n",
"│ Warning: inappropriately implementing this method for an array type that does not use strided\n",
"│ storage may lead to incorrect results or segfaults.\n",
"│ caller = stride at abstractarray.jl:350 [inlined]\n",
"└ @ Core ./abstractarray.jl:350\n",
"┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.\n",
"│ Specialize `strides(::LinearAlgebra.Adjoint)` if `LinearAlgebra.Adjoint` indeed uses a strided representation in memory.\n",
"│ Warning: inappropriately implementing this method for an array type that does not use strided\n",
"│ storage may lead to incorrect results or segfaults.\n",
"│ caller = stride at abstractarray.jl:350 [inlined]\n",
"└ @ Core ./abstractarray.jl:350\n"
]
}
],
"source": [
Expand All @@ -313,7 +304,7 @@
"fig, ax = plt.subplots(rows, div(ns, rows), figsize=(12,4rows))\n",
"idx = reshape(1:rows*div(ns, rows), div(ns, rows), rows)'\n",
"for (i, axi) in enumerate(ax)\n",
" csg = data[:,idx[i],:]'\n",
" csg = Array(data[:,idx[i],:]')\n",
" cax = axi[:imshow](csg, extent=[src_x[1], src_x[end], t[end], t[1]],\n",
" vmin=-0.5maximum(abs.(csg)), vmax=0.5maximum(abs.(csg)), aspect=\"auto\", cmap=\"gray\", interpolation=\"none\")\n",
" axi[:scatter](src_x[idx[i]], t[1], color=\"#d62728\", marker=\"*\", s=200, clip_on=false, zorder=100)\n",
Expand Down Expand Up @@ -346,7 +337,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 4.290552 seconds (2.75 M allocations: 197.732 MiB, 2.45% gc time)\n"
" 4.315508 seconds (2.69 M allocations: 798.308 MiB, 3.99% gc time)\n"
]
}
],
Expand Down Expand Up @@ -410,7 +401,7 @@
"name": "stdout",
"output_type": "stream",
"text": [
" 25.127645 seconds (12.57 M allocations: 2.573 GiB, 5.42% gc time)\n"
" 37.751308 seconds (14.75 M allocations: 19.763 GiB, 9.00% gc time)\n"
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion notebooks/LayerCake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ rows = 10
fig, ax = plt.subplots(rows, div(ns, rows), figsize=(12,4rows))
idx = reshape(1:rows*div(ns, rows), div(ns, rows), rows)'
for (i, axi) in enumerate(ax)
csg = data[:,idx[i],:]'
csg = Array(data[:,idx[i],:]')
cax = axi[:imshow](csg, extent=[src_x[1], src_x[end], t[end], t[1]],
vmin=-0.5maximum(abs.(csg)), vmax=0.5maximum(abs.(csg)), aspect="auto", cmap="gray", interpolation="none")
axi[:scatter](src_x[idx[i]], t[1], color="#d62728", marker="*", s=200, clip_on=false, zorder=100)
Expand Down

0 comments on commit a9677f3

Please sign in to comment.