0
$\begingroup$

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}]
$\endgroup$
6
  • $\begingroup$ The dark blue means the kernel has crashed. Likely, part 3 is generating an intermediate that doesn't fit into memory. That said, the code works fine on my machine. How much memory is available on the system you're doing this on? $\endgroup$
    – eyorble
    Commented Feb 11, 2020 at 20:18
  • $\begingroup$ Okay, I can reproduce on my machine. Looks like it's the Suggestions Bar that's crashing, consider disabling it in Preferences. $\endgroup$
    – eyorble
    Commented Feb 11, 2020 at 20:27
  • $\begingroup$ @eyorble it is 8GB machine and during execution, i can now see that after executing the last line, one of the kernels crashes (After opening the notebook, i have two processes called Mathematica and two WolframKernel). After executing the last line, one of the kernels crashes as well as some process called xml.exe. $\endgroup$
    – atapaka
    Commented Feb 11, 2020 at 20:31
  • 3
    $\begingroup$ Possible duplicate: Don't leave the Suggestions Bar enabled $\endgroup$
    – Michael E2
    Commented Feb 11, 2020 at 20:35
  • 1
    $\begingroup$ Anyways, the source of the crash from the Suggestions Bar is apparently the form of the array output for 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$
    – eyorble
    Commented Feb 11, 2020 at 20:45

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.