more /NWOK

This may be an obvious thing that's in the pipeline, but I didn't find any discussion so here it is as a feature request:

Would it be possible to add something like the /NWOK flag for curvefit to other commands that can optionally take an X wave?

Display w vs w_x /NWOK
AppendToGraph w vs w_x /NWOK
and interpolate2 are the commands that I most frequently wish had such a flag.

I end up with a lot of if blocks in my code that look like this:

if (waveexists(w_x))
    appendtograph  w vs w_x
else
    appendtograph  w
endif


Hmmmm...

Part of the driver for my addition of /NWOK for CurveFit and FuncFit was the shear number of optional waves in curve fitting. The only practical way to deal with it was to allow null wave references, or to use Execute, which is distasteful.

Display has just the one optional wave. Not saying no, but it's less compelling.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
The motivation for this is that packages for spectroscopic data are useful to a wider user-base when they handle waveform and x-y data. It's easier to code just for waveform data. My thought was that the activation energy for writing more generally useful code could be lowered if I didn't have to write separate chunks of code for each. The code would also be significantly more compact.
A slightly less-ugly solution than scattering if-blocks all over the place would be a utility function something like this:
Function AppendWithPossibleX(WAVE yw, WAVE/Z xw, String gname)
    if (WaveExists(xw))
        AppendToGraph/W=$gname yw vs xw
    else
        AppendToGraph/W=$gname yw
    endif
end

The /Z flag tells igor that a NULL wave is OK for xw; the WaveExists() function tests for the NULL wave.

This localizes the ugliness to just one function :)

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
johnweeks wrote:
A slightly less-ugly solution than scattering if-blocks all over the place would be a utility function something like this:
Function AppendWithPossibleX(WAVE yw, WAVE/Z xw, String gname)
    if (WaveExists(xw))
        AppendToGraph/W=$gname yw vs xw
    else
        AppendToGraph/W=$gname yw
    endif
end

The /Z flag tells igor that a NULL wave is OK for xw; the WaveExists() function tests for the NULL wave.

This localizes the ugliness to just one function :)

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com


Haha, that is just what I do!!