Loading Igor Procedures- speed and memory

Is there a downside to have a large number of functions saved in the "Igor Procedures" folder so that they are loaded every time that Igor runs?

I assume that there's a slight penalty on the time that it takes to launch Igor, but does a large number of functions in the Igor Procedures window have subsequent penalties on either speed or memory usage?

If there is a penalty, is there a way to conditionally #include some functions depending upon which tasks the user wants to perform? I'd like to have a common front end that all users experience that allows them to perform any of the automated analyses that my team and I have written, but if there's a problem with pre-loading every function that they might want to use, I'm not sure how to write a procedure that just includes the .ipf files that the user needs.
Quote:
Is there a downside to have a large number of functions saved in the "Igor Procedures" folder so that they are loaded every time that Igor runs?


It takes time to compile the procedures. Whether it takes enough time to be a problem depends on how many procedure files you have loaded, how long they are, how fast your machine is, and how patient you are.

I recommend that you assume that it is not a problem. If it becomes a problem, you can look into loading and unloading packages as the user requests them. I wrote a simple demo of this but it appears to be broken. If you need it, I will try to get it to work and then post it.
jeremypmeyers wrote:
... is there a way to conditionally #include some functions depending upon which tasks the user wants to perform? I'd like to have a common front end that all users experience that allows them to perform any of the automated analyses that my team and I have written, but if there's a problem with pre-loading every function that they might want to use, I'm not sure how to write a procedure that just includes the .ipf files that the user needs.


I might suggest a few changes to your approach. First, use the User Procedures folder exclusively, not the Igor Procedures folder. Secondly, have one master pxp or ipf file (e.g. Master.pxp or Master.ipf) that users put in the User Procedures folder. The advantage of Master.pxp is, it gives one place where the user clicks to start. The disadvantage is, users can mistaken overwrite that pxp ... you should program an immediate SaveAs directive at startup to avoid this mistake. The advantage of a Master.ipf is, it is called by an #include directive in a user procedure and therefore remains separate from the user's own experiment (and is less prone to be accidentally overwritten). The disadvantage is, you have to tell users to put the #include Master.ipf comment in their experiments each time. Regardless of the choice ipf of pxp, inside the procedure file for the Master package, put the #include directives that are needed for your common front end. Also put the #include directives for each segment of the analysis that you want to provide. Finally, as best possible, make each segment of the analysis you want to provide in to an independent module. This way, it loads and compiles only once, regardless of what the user does to the overall experiment.

I took this approach many (many) years ago with SpXZeigR. It had baseline routines, peak fitting routines, smoothing routines, ... each in their own sub-folder in the main folder. The starting point was to use #include SpXZeigR as a directive.


--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH
I actually have a question related to this. Is there a way to automatically save the results of a program with a built-in function?
We're going to need more details on what you mean here. On the face of it, it sounds like the answer is, "of course". Assign the result to a wave element or global variable and save the experiment file. But that seems too easy; I suspect that you have something else in mind.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
I wrote a simple function that produces an answer in the form of a wave. I was wondering if I could automatically save the answer into a separate file each time I run the program, by inserting a specific command somewhere into the code.
You can save a wave as an Igor binary file or as a text file using the Save operation.
Yes, that is what I would like to do, but is there a way for the wave to be automatically saved anytime I run the program that I wrote? Either format would do.
You must call the Save operation from the program that you wrote. I am assuming that by "program that I wrote", you mean that you wrote Igor procedures.
Thanks for your replies. I just want to know how to call the save function in the procedure.
SB129 wrote:
Thanks for your replies. I just want to know how to call the save function in the procedure.


Look for command help on the Save command. The last line has a link to descriptions of how to import and export data. Here's a function call to start.

Function SaveIt(ww)
    wave ww

    Save ww
    return 0
end


It only gets easier after this depending on where and how you want to save the wave. :-)

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAH