Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I have this script, which does a bunch of image aligning in parallel: https://gist.github.com/8848a25a15da013ed1ad

However, on EVERY print, Mathematica also prints from what Kernel the message came and what the kernel's status is, etc. Is there a way to supress these debug messages?

Edit: The messages in question are these: https://gist.github.com/e8ae961dc46c66ed809f And example images are available here: http://dl.dropbox.com/u/10190786/done.zip

share|improve this question
    
Have you tried Quiet[]? –  J. M. Feb 2 '12 at 10:59
    
I looked at its documentation, but i'm unsure where and how i would add it to my script. –  Mithaldu Feb 2 '12 at 11:44
add comment

3 Answers 3

up vote 3 down vote accepted

It is the Check function which is throwing the error. Try using:

ParallelDo[
 Do[Quiet@Check[{i[[1]], j[[1]], 
     FindGeometricTransform[i[[2]], j[[2]], 
      Transformation -> "Translation"]}, {i[[1]], j[[1]], err}], {i, 
   files}],
 {j, files}]

If you leave off the Print command, it will silence all kernel outputs, and also speed up your computation (I'm sure other's could expound on this, but displaying outputs while running loops tends to slow things down). If you want to monitor the output of a parallel computation while it's running, check this SO post.


Edit Just realized that putting Quiet on Check kills the whole point of your computation. I think it would be best if you just do the calculation as a Table and extract the data at the end:

Quiet@ParallelTable[{i[[1]], j[[1]], 
    Quiet[FindGeometricTransform[i[[2]], j[[2]], 
      Transformation -> "Translation"]]}, {i, files}, {j, files}];

I'm not completely sure why I need both of those Quiet commands, but it seems to need it.

share|improve this answer
    
This looks promising. I used print because the goal here is to run these things on the command line and capture the output and because i know nothing about Mathematica. I only use it because it can do a single algorithm i need. Edit: Figured out that the ParallelTable bit needed a check to supress output on non-matches, now it's perfect. Thanks! :) –  Mithaldu Feb 2 '12 at 18:26
    
Once that table is generated, you can always Export or Put or DumpSave to get at the results. –  Eli Lansey Feb 2 '12 at 20:02
    
I just Printed it, since i post-process with Perl it's all fine. :) –  Mithaldu Feb 2 '12 at 20:17
add comment

Have you tried

Quiet[Parallelize[
  Do[Do[Print@
     Check[{i[[1]], j[[1]], 
       FindGeometricTransform[i[[2]], j[[2]], 
        Transformation -> "Translation"]}, {i[[1]], j[[1]], err}], {i,
      files}], {j, files}]]]

in your code? (ie, just silence all messages)?

share|improve this answer
    
if this does not work, could you provide examples of files that do give the error? Because I tried with files = {{"n1", Polygon[{{1, 0}, {0, Sqrt[3]}, {-1, 0}}]}, {"n2", Polygon[{{1, 0}, {0, Sqrt[3] - 0.5}, {-0.5, 0}}]}} and I get no messages. Also, it is possible to prevent only certain messages from being displayed (which is probably best so that you can see if something actually goes wrong) –  acl Feb 2 '12 at 14:06
    
Example images are available here: dl.dropbox.com/u/10190786/done.zip I also added a link to a paste of the messages that are annoying me. And well, adding Quiet around the Parallelize did nothing for me. :/ If it makes any difference, i'm using Mathematica 8 on Windows. –  Mithaldu Feb 2 '12 at 14:47
add comment

For anyone coming here looking for how to get rid of seemingly garbage messages like this when running parallel kernels in -script mode:

StringForm[From `1`:, Parallel`Kernels`kernel[Parallel`Kernels`Private`bk[
SubKernels`LocalKernels`localKernel[SubKernels`LocalKernels`Private`lk[
LinkObject[/usr/local/Wolfram/Mathematica/9/Executables/math
-subkernel -noinit -mathlink, 100, 1], {/usr/local/Wolfram/Mathematica/9/Executables/math -subkernel
-noinit -mathlink, SubKernels`LocalKernels`LowerPriority -> True}, 
SubKernels`LocalKernels`Private`speed$2381]], Parallel`Kernels`Private`id
$2384, Parallel`Kernels`Private`name$2384], Parallel`Kernels`Private`ek
    [Parallel`Kernels`Private`nev$2385, Parallel`Kernels`Private`pb$2385, 
Parallel`Kernels`Private`rd$2385], Parallel`Kernels`Private`sk
[Parallel`Kernels`Private`q$2386, Parallel`Kernels`Private`n0$2386, 
    Parallel`Kernels`Private`n1$2386]]]

This is because the -script mode defaults to returning everything in InputForm mode, which does not work to well in this case.

The workaround, add this at the beginning of your script:

SetOptions[$Output, FormatType->OutputForm];
share|improve this answer
    
Your input here would be very valuable. –  Szabolcs Jun 20 at 14:38
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.