This question is related to this one in the sense that it uses the code from there.
What happens is best illustrated in the video here. When I run (* part 1 *)
everything behaves as expected, the same when i run (* part 2 *)
but when i run (* part 3 *)
after a second or two, every expression turns blue and nothing is defined any more, not even intrinsic expressions such as Transpose
. Also not that the blue that everything turns into is darker than the standard blue of undefined expression. (this is experienced on Linux with Mathematica 12.0)
How can I even begin determining what happened and why it behaves the way it does? Note that if I use the code exactly from the post here as mentioned above, the problem does not appear.
The text files that are being used in the code above can be downloaded here. The offending notebook file can be directly downloaded from here.
The related code rewritten is this:
(* part 1 *)
runs = {9, 11, 12, 13, 14};
data = Import[
StringJoin["KBr-run", ToString@#, ".txt"],
"Table"] & /@ runs;
values = data[[#]][[500 ;;, 2]] & /@ Range[Length@runs];
peaks = MapThread[
Function[{u, v},
FindPeaks[u, 0, Automatic, v,
InterpolationOrder -> 1]], {values, {1300, 500, 500, 500,
500}}];
peakangles =
MapThread[
Function[{u, v}, u[[#]] & /@ v], {data,
Floor@peaks[[All, All, 1]] + 499}];
peakangles2 =
PadRight[#, Max@(Length /@ peakangles), {{0, 0}}] & /@ peakangles;
zero = {{1, 2, 0, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0}, {1, 2, 0,
3, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 0}, {1, 2, 0, 3, 0, 4, 0, 5,
6, 7, 0, 8, 9, 10, 0}, {1, 2, 0, 3, 0, 4, 0, 5, 6, 7, 0, 8, 9, 10,
0}};
(* part 2 *)
orglist[l1r_, assocr_] := Map[If[# != 0, l1r[[#]], 0] &, assocr];
(* part 3 *)
l2 = MapThread[orglist, {peakangles2[[2 ;;]], zero}]
Mathematica
and twoWolframKernel
). After executing the last line, one of the kernels crashes as well as some process calledxml.exe
. $\endgroup$l2
. A smaller (non-)working example that I found is{{{1, 2}, 0}, {{3, 4}, {5, 6}, 0}}
. Given that just having these kinds of nested sub-lists can cause kernel crashes is probably a great reason to turn the Suggestions Bar off and leave it off. $\endgroup$