Prev: Why is InputField changing format of input formula?
Next: Volcanic Ash Cloud over Europe in 14 lines of Mathematica
From: Gehrmann on 19 Apr 2010 02:49 I am using Mathematica 7 to analyze a large data set and have written a program which runs successfully when invoked as follows: analyzer["C:\\mdtp\\Jim\\Data\\Data\\Field07Aout.txt", "abc", "All", "All", "-9", "PT", "-9", "CC", "EQ", "1", "1", "No", "{1}"]; However, I would like to create a button notebook which allows the user to change parameters and push a button once the desired parameters have been chosen. I've tried the following statements: Get["C:\\mdtp\\currentparameters.txt"]; (*reads the same parameters used above from a file*) Button["Click Here to Produce Summary and Question Analyses", analyzer[testnamex, sourcenm, specification, selecteddatnm, posttestcorr, posttestnm, coursecorr, coursecorrnm, equator, ToExpression[alph], ToExpression[bet], graffile, qtoshow]] which displays a button--on pushing the button the analyzer routine is invoked but doesn't complete--no error message is displayed. I believe that this button approach is exceeding some time or memory limit but haven't been able to determine which in order to make the button invocation method work. I would appreciate any help on this. Thanks.
From: Patrick Scheibe on 19 Apr 2010 05:59 Hi, and the documentation to Button doesn't help? >>> Typical possible settings for the Method option include "Preemptive" and "Queued". With the default setting Method->"Preemptive", button actions are performed immediately, preempting any other evaluation, but are allocated only a limited time to complete. With the setting Method->"Queued", button actions are added to the current queue of evaluations, and are performed when other evaluations are complete. No time limit is applied. <<< Hope this makes it clear. Cheers Patrick Am Apr 19, 2010 um 8:50 AM schrieb Gehrmann: > I am using Mathematica 7 to analyze a large data set and have written > a program which runs successfully when invoked as follows: > > analyzer["C:\\mdtp\\Jim\\Data\\Data\\Field07Aout.txt", "abc", "All", > "All", "-9", "PT", "-9", "CC", "EQ", "1", "1", "No", "{1}"]; > > However, I would like to create a button notebook which allows the > user to change parameters and push a button once the desired > parameters have been chosen. I've tried the following statements: > > Get["C:\\mdtp\\currentparameters.txt"]; (*reads the same parameters > used above from a file*) > > Button["Click Here to Produce Summary and Question Analyses", > analyzer[testnamex, sourcenm, specification, selecteddatnm, > posttestcorr, posttestnm, coursecorr, coursecorrnm, equator, > ToExpression[alph], ToExpression[bet], graffile, qtoshow]] > > which displays a button--on pushing the button the analyzer routine is > invoked but doesn't complete--no error message is displayed. I > believe that this button approach is exceeding some time or memory > limit but haven't been able to determine which in order to make the > button invocation method work. I would appreciate any help on this. > Thanks. >
From: Chris Degnen on 19 Apr 2010 06:49 Another way to avoid the time-out limit is to run this on initialisation: SetOptions[$FrontEnd, DynamicEvaluationTimeout -> 5000]; On 19 Apr, 07:49, Gehrmann <jim.gehrm...(a)gmail.com> wrote: > I am using Mathematica 7 to analyze a large data set and have written > a program which runs successfully when invoked as follows: > > analyzer["C:\\mdtp\\Jim\\Data\\Data\\Field07Aout.txt", "abc", "All", > "All", "-9", "PT", "-9", "CC", "EQ", "1", "1", "No", "{1}"]; > > However, I would like to create a button notebook which allows the > user to change parameters and push a button once the desired > parameters have been chosen. I've tried the following statements: > > Get["C:\\mdtp\\currentparameters.txt"]; (*reads the same parameters > used above from a file*) > > Button["Click Here to Produce Summary and Question Analyses", > analyzer[testnamex, sourcenm, specification, selecteddatnm, > posttestcorr, posttestnm, coursecorr, coursecorrnm, equator, > ToExpression[alph], ToExpression[bet], graffile, qtoshow]] > > which displays a button--on pushing the button the analyzer routine is > invoked but doesn't complete--no error message is displayed. I > believe that this button approach is exceeding some time or memory > limit but haven't been able to determine which in order to make the > button invocation method work. I would appreciate any help on this. > Thanks.
From: John Fultz on 20 Apr 2010 05:49 Yes, this works, but it's definitely not the preferred way. Some dangers.. . * When a button with Method->"Queued" is pressed, Mathematica remains full responsive, including to Dynamic computations and to presses of buttons with Method->"Preemptive" (the default). When a button with Method->"Preemptive " is pressed, it can freeze responsiveness. If such a button would take a long time to respond, then you risk hanging all of Mathematica until it finishes. * This setting is a global setting which covers all Dynamics and preemptive buttons, and it's what allows you to recover gracefully when developing such code and something goes astray (which happens even to the best of us). So it's probably best not to set it to such a huge number. Sincerely, John Fultz jfultz(a)wolfram.com User Interface Group Wolfram Research, Inc. On Mon, 19 Apr 2010 06:49:18 -0400 (EDT), Chris Degnen wrote: > Another way to avoid the time-out limit is to run this on > initialisation: > > SetOptions[$FrontEnd, DynamicEvaluationTimeout -> 5000]; > > > On 19 Apr, 07:49, Gehrmann <jim.gehrm...(a)gmail.com> wrote: >> I am using Mathematica 7 to analyze a large data set and have written >> a program which runs successfully when invoked as follows: >> >> analyzer["C:\\mdtp\\Jim\\Data\\Data\\Field07Aout.txt", "abc", "All", >> "All", "-9", "PT", "-9", "CC", "EQ", "1", "1", "No", "{1}"]; >> >> However, I would like to create a button notebook which allows the >> user to change parameters and push a button once the desired >> parameters have been chosen. I've tried the following statements: >> >> Get["C:\\mdtp\\currentparameters.txt"]; (*reads the same parameters >> used above from a file*) >> >> Button["Click Here to Produce Summary and Question Analyses", >> analyzer[testnamex, sourcenm, specification, selecteddatnm, >> posttestcorr, posttestnm, coursecorr, coursecorrnm, equator, >> ToExpression[alph], ToExpression[bet], graffile, qtoshow]] >> >> which displays a button--on pushing the button the analyzer routine is >> invoked but doesn't complete--no error message is displayed. I >> believe that this button approach is exceeding some time or memory >> limit but haven't been able to determine which in order to make the >> button invocation method work. I would appreciate any help on this. >> Thanks.
From: Gehrmann on 20 Apr 2010 05:49
On Apr 19, 2:59 am, Patrick Scheibe <psche...(a)trm.uni-leipzig.de> wrote: > Hi, > > and the documentation to Button doesn't help? > > >>> > Typical possible settings for the Method option include "Preemptive= " > and "Queued". > > With the default setting Method->"Preemptive", button actions are > performed immediately, preempting any other evaluation, but are > allocated only a limited time to complete. > > With the setting Method->"Queued", button actions are added to the > current queue of evaluations, and are performed when other evaluations = > are complete. No time limit is applied. > <<< > > Hope this makes it clear. > > Cheers > Patrick > > Am Apr 19, 2010 um 8:50 AM schrieb Gehrmann: > > > > > I am using Mathematica 7 to analyze a large data set and have written > > a program which runs successfully when invoked as follows: > > > analyzer["C:\\mdtp\\Jim\\Data\\Data\\Field07Aout.txt", "abc", "All", > > "All", "-9", "PT", "-9", "CC", "EQ", "1", "1", "No", "{1}"]; > > > However, I would like to create a button notebook which allows the > > user to change parameters and push a button once the desired > > parameters have been chosen. I've tried the following statements: > > > Get["C:\\mdtp\\currentparameters.txt"]; (*reads the same parameters > > used above from a file*) > > > Button["Click Here to Produce Summary and Question Analyses", > > analyzer[testnamex, sourcenm, specification, selecteddatnm, > > posttestcorr, posttestnm, coursecorr, coursecorrnm, equator, > > ToExpression[alph], ToExpression[bet], graffile, qtoshow]] > > > which displays a button--on pushing the button the analyzer routine is > > invoked but doesn't complete--no error message is displayed. I > > believe that this button approach is exceeding some time or memory > > limit but haven't been able to determine which in order to make the > > button invocation method work. I would appreciate any help on this. > > Thanks. Thanks to all who replied! My problem was solved by setting Method- >"Queued", the solution proposed by Patrick. |