MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Creating Notebook containing Dynamic object with Mathkernel

  • To: mathgroup at smc.vnet.net
  • Subject: [mg114153] Creating Notebook containing Dynamic object with Mathkernel
  • From: loire etienne <eloire at sb-roscoff.fr>
  • Date: Thu, 25 Nov 2010 05:58:37 -0500 (EST)

Hello,

My goal is to generate notebooks from different files, each containing 
an object created with a "Manipulate" function.
To do so, I  use a script that generate .m files which are given to the 
mathkernel.
Here is a 'generic example' of  a .m  file :


########################
SetDirectory["path/to/my/file"]
AfficheAnim[rep_, Ndeme_, deme_] := Module[{graph},
 
  graph = Manipulate[ListLinePlot[
     {
      Table[rep[[n, m]]/Ndeme, {m, 3, Length[rep[[1]]] - 3, 4}],
      Table[rep[[n, m]]/Ndeme, {m, 4, Length[rep[[1]]] - 2, 4}],
      Table[rep[[n, m]]/Ndeme, {m, 5, Length[rep[[1]]] - 1, 4}],
      Table[rep[[n, m]]/Ndeme, {m, 6, Length[rep[[1]]], 4}]
      }
     , PlotRange -> {{0, deme}, {0, 1}}], {n, 1, Length[rep], 1}]
  ; graph]



param = StringSplit[filename, "_"];
deme = ToExpression[StringDrop[param[[2]], 1]];
Ndeme = ToExpression[StringDrop[param[[3]], 1]];



UsingFrontEnd[
nb= CreateDocument[
{   
	rep=Import["A_file_name","Table"];
	AfficheAnim[rep_, Ndeme_, deme_]
   
},NotebookFileName -> FileNameJoin[{Directory[],filename <> ".nb"}]]
];

UsingFrontEnd[NotebookSave[nb]];
UsingFrontEnd[NotebookClose[nb]];

Exit[];
###################################################

Mathkernel is called with command :

math -noprompt -run "<< file.m"

which execute and generate the appropriate notebook. But it's stalled !
It goes all the way since the generated notebook is saved and that i can 
open it
but before I have to interrupt the process manually ( CTRL+C )
This is annoying since I plan to loop the command with a lot of files.
I tried in several ways, but I am stucked.
Of course, without the call to the function AfficheAnim, It works fine 
so my guess is that dynamic object evalution has something to do with my 
problem.
Any ideas ?
Thanks in advance,

Etienne Loire









  • Prev by Date: disappointing CUDA speed
  • Next by Date: Re: maximum of a series
  • Previous by thread: Re: disappointing CUDA speed
  • Next by thread: /. Hold -> Identity (Was: One more rules + ev<>rol problem)