MathGroup Archive 2009

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

Search the Archive

Re: *slowing down* a Mathematica process (Dynamic/Refresh question)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101155] Re: [mg101100] *slowing down* a Mathematica process (Dynamic/Refresh question)
  • From: John Fultz <jfultz at wolfram.com>
  • Date: Thu, 25 Jun 2009 07:14:45 -0400 (EDT)
  • Reply-to: jfultz at wolfram.com

On Wed, 24 Jun 2009 06:31:23 -0400 (EDT), Michael Stern wrote:
> I hope to use Mathematica as an interface to an outside process, in
> which it periodically polls an outside data source and performs
> calculations on the data. The problem is, the loop is quick and
> Mathematica polls the outside datasource too often. UpdateInterval does
> not help (I think it effects how often the updated results are
> displayed, but the polling continues as quickly as Mathematica can do
> it). Adding a call to Pause[] doesn't help either, as it causes the
> entire session to freeze and become unusable.
>
> I have tried this a variety of ways, getting the same behavior each
> time. A schematic of one version of the code appears below
>
> DynamicModule[{holder},
> Dynamic[Refresh[FinishDynamic[]; holder = callToOutsideDataFeed[],
> UpdateInterval -> 1]]
>
> Are there any Dynamic/Refresh gurus out there who can help?
>
> Thank you,
>
> Michael Stern

To restate your problem in a way which can be observed without your code, I
think you're looking for this...

x = 0; Dynamic[Refresh[x++, UpdateInterval -> 1]]

to update at 1 second intervals rather than the minimum of 1 second and the
amount of time it takes to change x (which, in this case, is far less than 1
second).  To do this, you should do something like...

x = 0; Dynamic[Refresh[Refresh[x++, None], UpdateInterval -> 1]]

I.e., you're removing entirely the trigger of the changing value of x that 
causes the Dynamic to update, then adding a new trigger which causes an update 
every second.

Sincerely,
 
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.




  • Prev by Date: TSV files as a list of list of lists?
  • Next by Date: Re: FindInstance over Integers
  • Previous by thread: *slowing down* a Mathematica process (Dynamic/Refresh question)
  • Next by thread: Re: *slowing down* a Mathematica process (Dynamic/Refresh question)