Re: Batch
- To: mathgroup at smc.vnet.net
- Subject: [mg60449] Re: [mg60364] Batch
- From: Maria Cristina Dias Tavares <cristina at dsce.fee.unicamp.br>
- Date: Fri, 16 Sep 2005 03:50:49 -0400 (EDT)
- References: <20050915043753.D50C7B150@mfep8.connect.com.au>
- Sender: owner-wri-mathgroup at wolfram.com
Hi all, I thank both Dave and Luc very much, I manage to go one step further. I have tryed SelectionEvaluation before, but I could not identify the notebook properly. Now after you told me I tryed with NotebookOpen and it couldn't find the file ($Failed). I had to include my working directory in the preferences, and now it works. I prepare a very simple test, just a notebook calling a second nb which calls a third one. It works perfectly, opened and executed each notebook without a problem. Then I put these callings inside a loop (Do) which would just print the loop iteration number. Now I come to another problem. All the expressions inside the loop are executed and only afterwards the execution of the second notebook is performed. Only after that the execution of notebook 3 is evaluated. This is not what I need. I need that the calling of the notebook evalutaion is treated like if it were a routine, the program is deviated to the second notebook and after evaluating it completely it would come back to the following command inside the loop. Can anyone give me another advice ? Thank you very much. Regards, Maria Cristina David Annetts wrote: >Hi Maria, > > I will put my question in a different way. > > What I do now is to read the data directories/file names in a >loop and then I start the calculation. The calculation is performed inside a >Do, where I generate my tables, save them in the appropriate directories, >and generate the graphics and save them also in different directories. That >works, but this is not a well-organized procedure because I have all the >calculations inside a very large Do loop, that means that my notebook is >almost a single large Do cell. > > I think it would be much better if I could have my calculation >inside another notebook and if I call this notebook inside the Do loop. > > My first try was to have a notebook to read the data file and >directory names and the call a second notebook. In this notebook I have part >of my calculation, rather documented and it called the last notebook which >would finish the calculation and return to the next data. In the front end I >manage to call the second notebook but it was only opened, not evaluated, I >have to evaluate it manually. Perhaps the problem does not involve batch, >but rather one notebook calling and evaluating another notebook. > >======================= > >Luc's suggestion of SelectionEvaluate[] is a good one, especially if you're >going to automatically generate the batch process. > >Sorry for being so blunt, but it sounds to me like the problem is not so >much the number of points you have to deal with, nor the fact that data live >in different directories, but that the the problem of processing has not >been thought through properly. You may well be over complicating things. > >Another comment I'd make is to caution against splitting your processing >over several notebooks. To me, this is a recipe for disaster since I lose >the one good feature of notebooks -- to perform processing or calculations >in one place. If you must split processing amongst files, consigning >operations to packages is much prefered. > >In light of your question's rephrasing, I'd suggest something different. >Why not reorganise your notebook using sections along the lines of > >1. initialise (get any packages that are needed & set any constants) >2. get the data from files >3. process the data >4. tabulation >5. processing >6. clean things up > >Sections can be expanded or collapsed, depending on the detail you require. >I have had success with this method, reading multi-channel data from >hundreds of files in different directories, processing them, then plotting >them & dumping BMP files for later animations. It works, even on machines >with 128Mb RAM. > >Debugging is easy since specific errors are easier to find in the notebook. >Running the notebook, because everything is in the one place, is a matter of >"evaluate notebook", then letting things run until they are complete, rather >than waiting until one notebook loads, then evaluating that. > >Regards, > >Dave. > > -- Profa Maria Cristina Tavares Faculdade de Engenharia Elétrica e de Computação UNICAMP / FEEC / DSCE CP 6101 - CEP 13083-970 tel : (19) 3788 3738 fax : (19) 3289 1395 http://www.dsce.fee.unicamp.br/~cristina