Skip to content

Commit a9677f3

Browse files
committed
User Array(csg') when passing to imshow. Workaround until people get their shit together on transposes
1 parent 6741895 commit a9677f3

File tree

4 files changed

+23
-50
lines changed

4 files changed

+23
-50
lines changed

notebooks/LayerCake-RegularizationPart1.ipynb

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
"name": "stdout",
251251
"output_type": "stream",
252252
"text": [
253-
" 6.292222 seconds (3.40 M allocations: 175.176 MiB, 1.23% gc time)\n"
253+
" 8.913833 seconds (3.40 M allocations: 175.250 MiB, 1.09% gc time)\n"
254254
]
255255
}
256256
],
@@ -313,24 +313,6 @@
313313
},
314314
"metadata": {},
315315
"output_type": "display_data"
316-
},
317-
{
318-
"name": "stderr",
319-
"output_type": "stream",
320-
"text": [
321-
"┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.\n",
322-
"│ Specialize `strides(::LinearAlgebra.Adjoint)` if `LinearAlgebra.Adjoint` indeed uses a strided representation in memory.\n",
323-
"│ Warning: inappropriately implementing this method for an array type that does not use strided\n",
324-
"│ storage may lead to incorrect results or segfaults.\n",
325-
"│ caller = stride at abstractarray.jl:350 [inlined]\n",
326-
"└ @ Core ./abstractarray.jl:350\n",
327-
"┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.\n",
328-
"│ Specialize `strides(::LinearAlgebra.Adjoint)` if `LinearAlgebra.Adjoint` indeed uses a strided representation in memory.\n",
329-
"│ Warning: inappropriately implementing this method for an array type that does not use strided\n",
330-
"│ storage may lead to incorrect results or segfaults.\n",
331-
"│ caller = stride at abstractarray.jl:350 [inlined]\n",
332-
"└ @ Core ./abstractarray.jl:350\n"
333-
]
334316
}
335317
],
336318
"source": [
@@ -340,7 +322,7 @@
340322
"fig, ax = plt.subplots(rows, div(ns, rows), figsize=(10,4rows))\n",
341323
"idx = reshape(1:rows*div(ns, rows), div(ns, rows), rows)'\n",
342324
"for (i, axi) in enumerate(ax)\n",
343-
" csg = data[:,idx[i],:]'\n",
325+
" csg = Array(data[:,idx[i],:]')\n",
344326
" axi[:imshow](csg, extent=[rec_x[1], rec_x[end], t[end], t[1]],\n",
345327
" vmin=-0.5maximum(abs.(csg)), vmax=0.5maximum(abs.(csg)), aspect=\"auto\", cmap=\"gray\", interpolation=\"none\")\n",
346328
" axi[:scatter](src_x[idx[i]], t[1], color=\"#d62728\", marker=\"*\", s=200, clip_on=false, zorder=100)\n",
@@ -373,7 +355,7 @@
373355
"name": "stdout",
374356
"output_type": "stream",
375357
"text": [
376-
" 3.113558 seconds (2.20 M allocations: 121.930 MiB, 2.04% gc time)\n"
358+
" 4.919327 seconds (2.19 M allocations: 121.769 MiB, 2.23% gc time)\n"
377359
]
378360
}
379361
],
@@ -450,7 +432,7 @@
450432
"name": "stdout",
451433
"output_type": "stream",
452434
"text": [
453-
" 7.793007 seconds (4.57 M allocations: 695.879 MiB, 3.84% gc time)\n"
435+
" 12.370639 seconds (4.57 M allocations: 696.037 MiB, 3.49% gc time)\n"
454436
]
455437
}
456438
],
@@ -468,7 +450,7 @@
468450
"name": "stdout",
469451
"output_type": "stream",
470452
"text": [
471-
" 14.428752 seconds (10.57 M allocations: 1.205 GiB, 3.44% gc time)\n"
453+
" 19.144294 seconds (10.56 M allocations: 1.205 GiB, 3.02% gc time)\n"
472454
]
473455
}
474456
],
@@ -486,7 +468,7 @@
486468
"name": "stdout",
487469
"output_type": "stream",
488470
"text": [
489-
" 5.660292 seconds (3.32 M allocations: 632.830 MiB, 3.08% gc time)\n"
471+
" 8.563079 seconds (3.32 M allocations: 632.829 MiB, 2.72% gc time)\n"
490472
]
491473
}
492474
],
@@ -515,7 +497,7 @@
515497
"name": "stdout",
516498
"output_type": "stream",
517499
"text": [
518-
" 6.294866 seconds (4.54 M allocations: 723.020 MiB, 3.64% gc time)\n"
500+
" 9.742759 seconds (4.54 M allocations: 723.040 MiB, 3.11% gc time)\n"
519501
]
520502
}
521503
],

notebooks/LayerCake-RegularizationPart1.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ rows = 2
111111
fig, ax = plt.subplots(rows, div(ns, rows), figsize=(10,4rows))
112112
idx = reshape(1:rows*div(ns, rows), div(ns, rows), rows)'
113113
for (i, axi) in enumerate(ax)
114-
csg = data[:,idx[i],:]'
114+
csg = Array(data[:,idx[i],:]')
115115
axi[:imshow](csg, extent=[rec_x[1], rec_x[end], t[end], t[1]],
116116
vmin=-0.5maximum(abs.(csg)), vmax=0.5maximum(abs.(csg)), aspect="auto", cmap="gray", interpolation="none")
117117
axi[:scatter](src_x[idx[i]], t[1], color="#d62728", marker="*", s=200, clip_on=false, zorder=100)

notebooks/LayerCake.ipynb

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,16 @@
219219
"cell_type": "code",
220220
"execution_count": 7,
221221
"metadata": {},
222-
"outputs": [],
222+
"outputs": [
223+
{
224+
"name": "stderr",
225+
"output_type": "stream",
226+
"text": [
227+
"┌ Warning: Using only one worker\n",
228+
"└ @ KirchMig /home/cdacosta/.julia/dev/KirchMig/src/map.jl:70\n"
229+
]
230+
}
231+
],
223232
"source": [
224233
"t = 0:0.008:1; nt = length(t)\n",
225234
"G = KirchMig.KirchMap(t, trav);"
@@ -241,7 +250,7 @@
241250
"name": "stdout",
242251
"output_type": "stream",
243252
"text": [
244-
" 6.497352 seconds (3.40 M allocations: 186.707 MiB, 1.46% gc time)\n"
253+
" 4.373891 seconds (3.58 M allocations: 679.408 MiB, 3.27% gc time)\n"
245254
]
246255
}
247256
],
@@ -286,24 +295,6 @@
286295
},
287296
"metadata": {},
288297
"output_type": "display_data"
289-
},
290-
{
291-
"name": "stderr",
292-
"output_type": "stream",
293-
"text": [
294-
"┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.\n",
295-
"│ Specialize `strides(::LinearAlgebra.Adjoint)` if `LinearAlgebra.Adjoint` indeed uses a strided representation in memory.\n",
296-
"│ Warning: inappropriately implementing this method for an array type that does not use strided\n",
297-
"│ storage may lead to incorrect results or segfaults.\n",
298-
"│ caller = stride at abstractarray.jl:350 [inlined]\n",
299-
"└ @ Core ./abstractarray.jl:350\n",
300-
"┌ Warning: The default `strides(a::AbstractArray)` implementation is deprecated for general arrays.\n",
301-
"│ Specialize `strides(::LinearAlgebra.Adjoint)` if `LinearAlgebra.Adjoint` indeed uses a strided representation in memory.\n",
302-
"│ Warning: inappropriately implementing this method for an array type that does not use strided\n",
303-
"│ storage may lead to incorrect results or segfaults.\n",
304-
"│ caller = stride at abstractarray.jl:350 [inlined]\n",
305-
"└ @ Core ./abstractarray.jl:350\n"
306-
]
307298
}
308299
],
309300
"source": [
@@ -313,7 +304,7 @@
313304
"fig, ax = plt.subplots(rows, div(ns, rows), figsize=(12,4rows))\n",
314305
"idx = reshape(1:rows*div(ns, rows), div(ns, rows), rows)'\n",
315306
"for (i, axi) in enumerate(ax)\n",
316-
" csg = data[:,idx[i],:]'\n",
307+
" csg = Array(data[:,idx[i],:]')\n",
317308
" cax = axi[:imshow](csg, extent=[src_x[1], src_x[end], t[end], t[1]],\n",
318309
" vmin=-0.5maximum(abs.(csg)), vmax=0.5maximum(abs.(csg)), aspect=\"auto\", cmap=\"gray\", interpolation=\"none\")\n",
319310
" axi[:scatter](src_x[idx[i]], t[1], color=\"#d62728\", marker=\"*\", s=200, clip_on=false, zorder=100)\n",
@@ -346,7 +337,7 @@
346337
"name": "stdout",
347338
"output_type": "stream",
348339
"text": [
349-
" 4.290552 seconds (2.75 M allocations: 197.732 MiB, 2.45% gc time)\n"
340+
" 4.315508 seconds (2.69 M allocations: 798.308 MiB, 3.99% gc time)\n"
350341
]
351342
}
352343
],
@@ -410,7 +401,7 @@
410401
"name": "stdout",
411402
"output_type": "stream",
412403
"text": [
413-
" 25.127645 seconds (12.57 M allocations: 2.573 GiB, 5.42% gc time)\n"
404+
" 37.751308 seconds (14.75 M allocations: 19.763 GiB, 9.00% gc time)\n"
414405
]
415406
}
416407
],

notebooks/LayerCake.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ rows = 10
9898
fig, ax = plt.subplots(rows, div(ns, rows), figsize=(12,4rows))
9999
idx = reshape(1:rows*div(ns, rows), div(ns, rows), rows)'
100100
for (i, axi) in enumerate(ax)
101-
csg = data[:,idx[i],:]'
101+
csg = Array(data[:,idx[i],:]')
102102
cax = axi[:imshow](csg, extent=[src_x[1], src_x[end], t[end], t[1]],
103103
vmin=-0.5maximum(abs.(csg)), vmax=0.5maximum(abs.(csg)), aspect="auto", cmap="gray", interpolation="none")
104104
axi[:scatter](src_x[idx[i]], t[1], color="#d62728", marker="*", s=200, clip_on=false, zorder=100)

0 commit comments

Comments
 (0)