Utilities https://www.wavemetrics.com/ en Super Quick Fit - Quick Fit with more options, derived values output and user-function support https://www.wavemetrics.com/node/21866 Super Quick Fit - Quick Fit with more options, derived values output and user-function support <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/chozo" lang="" about="/user/chozo" typeof="schema:Person" property="schema:name" datatype="">chozo</a></span> <span>Thu, 04/07/2022 - 07:48 am</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/49" hreflang="en">Analysis</a></span> <span class="entity-reference"><a href="/taxonomy/term/39" hreflang="en">Curve Fitting</a></span> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>This project supplants the built-in Quick Fit, which is user to quickly fit data displayed in a graph. Super Quick Fit provides all functionality of Quick Fit and adds several convenient features. I tried my best to test everything thoroughly, but sometimes bugs slip through. Bug reports and suggestions for new features are always welcome. I am happy to add more useful settings, peak shapes or derived values if I receive feedback. Currently, 2D fit support may not be perfect since I don't have any meaningful data to test everything. If you have suggestions for improvement of 2D fitting or can test this functionality in detail, then please let me know.</p> <p><img alt="" data-entity-type="file" data-entity-uuid="b1a6a418-712e-4133-b1db-1659b25e277c" height="729" src="/sites/www.wavemetrics.com/files/users/user1029/Super_Quick_Fit_ver1.01.png" width="621" /></p> <h3>More settings:</h3> <ul><li><strong>Offset: Force to Zero</strong> - The 'offset value' of the fit function (most often the baseline value y0) is held at zero.</li> <li><strong>Offset: Force to Minimum</strong> - The 'offset value' held at a minimum. The minimum is either determined by the minimum value from placed cursors or the minimum of the data (depending on the fit function this could be either a x or y minimum).</li> <li><strong>Fit: Between Cursors</strong> - Same as for Quick Fit. The fit range is constrained by the cursors.</li> <li><strong>Fit: Within Axis Range</strong> - The fit range is constrained to the current top / bottom (and for images left / right) axis scale of the graph.</li> <li><strong>Weight from Error Bar Wave</strong> - Same as for Quick Fit. The weight wave is taken from the error-bar wave of the trace.</li> <li><strong>Clean up Output Waves + Variables </strong>- Deletes output waves (other than the 'fit_' wave), strings and variables after the fit. Use this if you are only interested in values printed in the history (and the graph's text box) and otherwise want to keep folders from accumulating W_coef, W_sigma waves etc..</li> <li><strong>Result: Plot Full Range</strong> - The fit is plotted over the full axis range of the graph.</li> <li><strong>Result: Add TextBox</strong> - Adds a standard text box with results to the graph</li> <li><strong>Textbox Preferences</strong> - Same as for Quick Fit. Choose what you would like to have printed into the result textbox.</li> </ul><p>Settings are saved in the current experiment (as the string root:QuickFitMenu_settings) to keep used settings consistent for each experiment file. But the last-used settings are also persistent and are loaded for each new Igor session, which makes it possible to set up your favorite settings and keep using them.</p> <h3>Additional Fit Functions:</h3> <p>(All functions other than EMG are also usable in the Curve-Fit dialog)</p> <ul><li><strong>FermiEdge_Line</strong> - Fermi–Dirac distribution combined with a linear slope.<br /><em>Equation:</em> f(E) = y0 + (m*E+A) / (exp((E-Ef)/kT)+1)<br />  </li> <li><strong>LineX</strong> - A line defined with the x-intercept (x0) as direct coefficient. Use this function if you want to determine x-intercepts with a low uncertainty, especially of lines with steep slope. The normal Line function is instead based on y-intercepts and bad at finding x-intercepts.<br /><em>Equation:</em> f(x) = m*(x-x0)<br />  </li> <li><strong>PAD_Beta</strong> - Angular distribution function, e.g., for analyzing photoemission experiments.<br /><em>Equation:</em> f(theta) = Scale*(1+Beta*legendreA(2,0,cos((theta-theta_0)*(Pi/180))))<br />  </li> <li><strong>DoubleGauss</strong> - A combination of two Gaussian peaks to fit doublets etc. This fit will likely not work well if your data range does not contain two clear 'peak' features.<br /><em>Equation:</em> f(x) = y0 + Area1 * Gauss(x,Loc1,Width1) + Area2 * Gauss(x,Loc2,Width2)<br />  </li> <li><strong>ExpModGauss</strong> - Exponentially Modified Gaussian (EMG) peak shape. A often-used asymmetric peak shape. Equal to the same function offered in the Multipeak Fit package.</li> </ul><h3>Output of Derived Values:</h3> <p>Additional parameters such as FWHM, area, height etc. (where applicable) are printed in history and the graph's text box. Currently, the following functions output derived parameters: LineX, DoubleGauss, ExpModGauss, Line, Gauss, Lor(entz), and Voigt. You can also set up your own function to output additional derived values after a fit (see below).</p> <p> </p> <h3>Adding Your Own Fit Function:</h3> <p>Adding functions is easy. You only need a normal (such as created with the curve fit dialog) or all-at-once fit function and a second function which calculates the initial guesses. Let's look at a simple example, such as the LineX function included in the package:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Function</span> LineX<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">Wave</span> w, <span style="color: #0000ff;">Variable</span> <span style="color: #c34e00;">x</span><span style="color: #000000;">&#41;</span> : FitFunc<br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">//CurveFitDialog/ Equation:</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">//CurveFitDialog/ f(x) = m*(x-x0)</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">//CurveFitDialog/ End of Equation</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">//CurveFitDialog/ Independent Variables 1</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">//CurveFitDialog/ x</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">//CurveFitDialog/ Coefficients 2</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">//CurveFitDialog/ w[0] = x0</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">//CurveFitDialog/ w[1] = m</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">return</span> w<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">*</span><span style="color: #000000;">&#40;</span>x-w<span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span><br /> <span style="color: #0000ff;">End</span></div></div> <p>To create initial guesses and at the same time make this function appear in the Super Quick Fit menu, you need to provide a second function which has the name YourFitFuncName+"_prepareCoef", which has a special structure SuperQuickFitStruct as input. In our example the function needs to be called LineX_prepareCoef, like this:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Function</span> LineX_prepareCoef<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">STRUCT</span> SuperQuickFitStruct <span style="color: #000000;">&amp;</span><span style="color: #c34e00;">s</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #007575;">Make</span><span style="color: #000000;">/</span>D<span style="color: #000000;">/</span>O<span style="color: #000000;">/</span>N=<span style="color: #000000;">2</span> W_coef = <span style="color: #000000;">&#123;</span><span style="color: #000000;">0</span>,<span style="color: #000000;">1</span><span style="color: #000000;">&#125;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> <span style="color: #c34e00;">s</span>.cw = W_coef<br /> &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #000000;">0</span><br /> <span style="color: #0000ff;">End</span></div></div> <p>The function needs to create a wave with the correct number of coefficients (2 in the example) and initial guesses which are likely make the fit succeed. The created coefficient wave then needs to be fed into the wave assignment s.cw. By the way, you don't have to call this wave W_coef. But if you choose this standard name, the coefficient wave will be properly deleted if you have the 'clean-up' setting active. Now you can select the function from the Super Quick Fit menu. </p> <p>So far, the initial guesses are simply x0 = 0 and m = 1. This may be too simple for a good guess. You could, for example, access the input data to calculate more reasonable guesses. The full function for LineX looks like this:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Function</span> LineX_prepareCoef<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">STRUCT</span> SuperQuickFitStruct <span style="color: #000000;">&amp;</span><span style="color: #c34e00;">s</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #007575;">Duplicate</span><span style="color: #000000;">/</span>free <span style="color: #c34e00;">s</span>.data, dif<br /> &nbsp; &nbsp; <span style="color: #007575;">Differentiate</span> dif<span style="color: #000000;">/</span>D=dif<br /> &nbsp; &nbsp; <span style="color: #007575;">WaveStats</span><span style="color: #000000;">/</span><span style="color: #c34e00;">Q</span><span style="color: #000000;">/</span><span style="color: #c34e00;">R</span>=<span style="color: #000000;">&#91;</span><span style="color: #c34e00;">s</span>.pntMin,<span style="color: #c34e00;">s</span>.pntMax<span style="color: #000000;">&#93;</span> dif<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> slope = <span style="color: #000000;">&#40;</span><span style="color: #c34e00;">WaveMax</span><span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span>.data<span style="color: #000000;">&#41;</span> - <span style="color: #c34e00;">WaveMin</span><span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span>.data<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&gt;</span> <span style="color: #000000;">0</span> ? V_max : V_min<br /> &nbsp; &nbsp; <span style="color: #007575;">Make</span><span style="color: #000000;">/</span>D<span style="color: #000000;">/</span>O<span style="color: #000000;">/</span>N=<span style="color: #000000;">2</span> W_coef = <span style="color: #000000;">&#123;</span><span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span>.holdMode == <span style="color: #000000;">1</span> ? <span style="color: #000000;">0</span> : <span style="color: #c34e00;">s</span>.xBase<span style="color: #000000;">&#41;</span>,slope<span style="color: #000000;">&#125;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> <span style="color: #c34e00;">s</span>.cw = W_coef<br /> &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #000000;">0</span><br /> <span style="color: #0000ff;">End</span></div></div> <p>Here, the slope m is taken from the derivative of the input data (=&gt; wave s.data). Also, the offset x0 is calculated from the data provided by the fit kernel. Here, s.holdMode is the current offset setting (1 means offsets are forced to zero) and s.xBase is the current x minimum (either from the cursor or the minimum of the input data). This makes sure that the x0 coefficient is properly set to fix the line to the cursor or to zero.</p> <p>By the way, the 'force offset' setting is by default applied to the first coefficient. If you want to hold other coefficients, you need to provide an appropriate hold string to s.holdStr (e.g., s.holdStr = "00001" fixes the fifth coefficient). The full structure definition looks like this:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Structure</span> SuperQuickFitStruct<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> cw &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// coef wave</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> sw &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// covariance matrix (M_Covar)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> data &nbsp; <span style="color: #ff0000; font-style: italic;">// data wave (1D or 2D)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> xw &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// x wave</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> yw &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// y wave (for images; not supported yet)</span><br /> &nbsp; &nbsp; int32 pntMin&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// start point of fit range</span><br /> &nbsp; &nbsp; int32 pntMax&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// end point of fit range</span><br /> &nbsp; &nbsp; int32 pntMinY &nbsp; <span style="color: #ff0000; font-style: italic;">// start point in y direction (for images)</span><br /> &nbsp; &nbsp; int32 pntMaxY &nbsp; <span style="color: #ff0000; font-style: italic;">// end point &nbsp;in y direction (for images)</span><br /> &nbsp; &nbsp; double xBase&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// x baseline / start offset</span><br /> &nbsp; &nbsp; double yBase&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// y baseline / start offset</span><br /> &nbsp; &nbsp; int16 holdMode&nbsp; <span style="color: #ff0000; font-style: italic;">// current hold setting: [0] = no hold, [1] = force o zero, [2] = force to min</span><br /> &nbsp; &nbsp; int16 plotFull&nbsp; <span style="color: #ff0000; font-style: italic;">// setting for plot over full range</span><br /> &nbsp; &nbsp; int16 doTextbox <span style="color: #ff0000; font-style: italic;">// setting for text-box drawing</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> holdStr&nbsp; <span style="color: #ff0000; font-style: italic;">// hold string for the fit</span><br /> <span style="color: #0000ff;">EndStructure</span></div></div> <h3> </h3> <h3>Adding Your Own Derived Values Function:</h3> <p>Super Quick Fit supports additional data processing after the fit is done, such as calculating derived values from the fit results. For this, create a function named YourFitFuncName+"_derivedVals". In principle, you can do anything in this function, but the main purpose was intended to return a string to print into the history. Let's again look at an example (from LineX):</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Function</span><span style="color: #000000;">/</span><span style="color: #c34e00;">S</span> LineX_derivedVals<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">STRUCT</span> SuperQuickFitStruct <span style="color: #000000;">&amp;</span><span style="color: #c34e00;">s</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> yCross = -<span style="color: #c34e00;">s</span>.cw<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">*</span><span style="color: #c34e00;">s</span>.cw<span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> yCross_err = yCross <span style="color: #000000;">*</span> <span style="color: #c34e00;">sqrt</span><span style="color: #000000;">&#40;</span> <span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span>.sw<span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">/</span><span style="color: #c34e00;">s</span>.cw<span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span>^<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span> + <span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span>.sw<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">/</span><span style="color: #c34e00;">s</span>.cw<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span>^<span style="color: #000000;">2</span><span style="color: #000000;">&#41;</span> + <span style="color: #000000;">2</span><span style="color: #000000;">*</span><span style="color: #c34e00;">s</span>.sw<span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">/</span><span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span>.cw<span style="color: #000000;">&#91;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">*</span><span style="color: #c34e00;">s</span>.cw<span style="color: #000000;">&#91;</span><span style="color: #000000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> printStr = <span style="color: #009c00;">&quot;&quot;</span><br /> &nbsp; &nbsp; <span style="color: #007575;">sPrintf</span> printStr, <span style="color: #009c00;">&quot;Derived values:<span style="color: #009c00;">\r</span><span style="color: #009c00;">\t</span>Y-intercept<span style="color: #009c00;">\t</span>= %g ± %g<span style="color: #009c00;">\r</span>&quot;</span>, yCross, <span style="color: #000000;">&#40;</span><span style="color: #c34e00;">numtype</span><span style="color: #000000;">&#40;</span>yCross_err<span style="color: #000000;">&#41;</span> <span style="color: #000000;">!</span>= <span style="color: #000000;">0</span> ? <span style="color: #000000;">0</span> : yCross_err<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span>.doTextbox<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007575;">AppendText</span> <span style="color: #009c00;">&quot;<span style="color: #009c00;">\t</span>&quot;</span>+printStr<br /> &nbsp; &nbsp; <span style="color: #0000ff;">endif</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">return</span> printStr<br /> <span style="color: #0000ff;">End</span></div></div> <p>This function calculates the y-intercept for the line from the fit coefficients (s.cw) and the covariance matrix (s.sw) and then prepares an output string printStr with the result. Here, the result is also added to the default text box, but you can of course omit this step. All available data is again received from the same SuperQuickFitStruct. You can also add code for a follow-up analysis of the result, saving of the data to disk or whatever you like here. Basically, you can add anything you want to have done after invoking the fit from the menu.</p></span> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">9.00.x</span> <span class="entity-reference">8.00.x</span> </span> <section class="comment-section"> <article data-comment-user-id="8" id="comment-22954" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/8"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> <img class="employee-badge" src="/profiles/wavemetrics/themes/wavemetrics/images/icons/employee-icon.png" /> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">johnweeks</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1652286183"></mark> <span class="comment-body"><p>This looks really cool, chozo!</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22954&amp;1=default&amp;2=en&amp;3=" token="oSfhSlTvWLN0pZ4ZzOAYHKrsggy5wA09QMQgZc-lIvc"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">May 11, 2022 at 09:23 am - <a href="/comment/22954#comment-22954" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-22955" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1652340919"></mark> <span class="comment-body"><p>John, thank you for your comment. I am happy that you found this interesting. At first, I just wanted to add in some functions to the Quick Fit menu, but it was not possible to modify the official menu structure. The I started my own submenu, which quickly grew into this full 'replacement'. :) Would be great if some features would find their way into the official Quick Fit at some point. I think not many people will find this package after all.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22955&amp;1=default&amp;2=en&amp;3=" token="DajN9EE27RpvqaZ5ItAl59E_kWbFHMQDzyi8uxuEErw"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">May 12, 2022 at 12:35 am - <a href="/comment/22955#comment-22955" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="8" id="comment-22956" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/8"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> <img class="employee-badge" src="/profiles/wavemetrics/themes/wavemetrics/images/icons/employee-icon.png" /> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">johnweeks</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1652372254"></mark> <span class="comment-body"><p>Looking at the screen shots, and reading some of the description, it is clear you have added user-define fit functions. You must also have some auto-guessing code for those functions. The reason the built-in Quick Fit menu doesn't list any user-defined functions is the lack of a way to provide auto-guessing. So I guess that would be a necessary enhancement to make that a possibility.</p> <p>What does Offset: Force to Minimum do?</p> <p>You have also organized the fit functions into similar groups, instead of simply listing them in the order that appears in Igor, which is simply the order of an internal table. That includes interpolating some user functions between built-in functions. That is only possible because you know which user-defined fit functions are there, and where they go!</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22956&amp;1=default&amp;2=en&amp;3=" token="oDu2knSTbcxiDmUg4wxiyzTep9J4j6XhDEQrVuRAThM"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">May 12, 2022 at 09:17 am - <a href="/comment/22956#comment-22956" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-22957" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1652413470"></mark> <span class="comment-body"><p>Yes, the user-defined fit functions need an additional function which provides the initial guesses. I have chosen the special name FitFuncName+"_prepareCoef" for this. I could imagine that - should you think about implementing something like this into Quick Fit - as soon as users provide such a specially named function in the right format the fit function will appear in the quick-fit menu. That's how I do it here. The code simply scans for functions with this ending and then adds these fits to the menu automatically.</p> <p>And no, while I have organized the Igor-own fit functions into categories, user-functions all appear at the top of the list and not in-between official functions. All fit functions after the first break are Igor's fit functions. For this, I have also an internal list of all official functions. But user functions are simply automatically added to the top of the list if a function ending with "_prepareCoef" is present.</p> <p>Force to Minimum sets and holds the offset coefficient (mostly Y0, or X0 in some cases) to either the minimum of the data (within the fit range) or, if cursors are present, to the minimum cursor value. This can for example be used to fix the Line's 'a' coefficient to the data's first point. The name is a bit ambiguous, because I thought users can choose themselves what is meant by 'offset' and prepare their guessing function accordingly. Also, this is of course problematic when cursors are also used to define the fit range. But it is just a first proposal, and may be refined in the future.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22957&amp;1=default&amp;2=en&amp;3=" token="X3OzZeOG2d65ZFvmaMSdAQr0a_f7XFa6iYPJ-dBSlTU"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">May 12, 2022 at 08:44 pm - <a href="/comment/22957#comment-22957" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="8" id="comment-22959" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/8"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> <img class="employee-badge" src="/profiles/wavemetrics/themes/wavemetrics/images/icons/employee-icon.png" /> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">johnweeks</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1652458964"></mark> <span class="comment-body"><p>I was thinking about the possibility of adding a line to the special comments in a fit function that names a guessing function.</p> <p>You must have developed a standard guess function format?</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22959&amp;1=default&amp;2=en&amp;3=" token="5Q7Buk3fSAoe6QCyrHwheEigPjmC3hugHWcAIps_Wb4"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">May 13, 2022 at 09:22 am - <a href="/comment/22959#comment-22959" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-22965" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1652488271"></mark> <span class="comment-body"><p>That's right. The function has the format:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Function</span> MyFit_prepareCoef<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">STRUCT</span> SuperQuickFitStruct <span style="color: #000000;">&amp;</span><span style="color: #c34e00;">s</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// create coef wave with your guesses here ...</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> <span style="color: #c34e00;">s</span>.cw = coefWave<br /> <span style="color: #0000ff;">End</span></div></div> <p>SuperQuickFitStruct provides all kinds of parameters like the current settings, waves and fit range which can be used to find a good guess. The minimal output is to pass a created coef wave with the correct number of points to s.cw at the end.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22965&amp;1=default&amp;2=en&amp;3=" token="cNqVAzxye2ORxWldjioYM3_96mmJ2S9d1yhgF8R12nk"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">May 13, 2022 at 05:31 pm - <a href="/comment/22965#comment-22965" hreflang="en">Permalink</a></p> </article> </section> Thu, 07 Apr 2022 14:48:00 +0000 chozo 21866 at https://www.wavemetrics.com Demo Setup Tools https://www.wavemetrics.com/node/21825 Demo Setup Tools <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/jjweimer" lang="" about="/user/jjweimer" typeof="schema:Person" property="schema:name" datatype="">jjweimer</a></span> <span>Sat, 02/12/2022 - 09:35 am</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><h3>Background</h3> <p>This procedure file is designed to help package developers create minimalistic, self-contained demonstrations from their experiments.</p> <p>A demonstration is an experiment that has at most one graph and at most one panel. It should run with no Igor Pro menus. It should provide users with a way to layout the graph + panel or capture the graph + panel to a notebook.</p> <p>This procedure file provides function calls to Send to Notebook or Send to Layout. It provides function calls to make a demonstration that hides all Igor Pro menus and shows only a Demo menu with Send to Notebook, Send to Layout, and Quit. Developers can add other menus as desired.</p> <p>See the ReadMe in the release ZIP archive for guidelines and instructions.</p> <h3>Hidden Features</h3> <p>The graph is protected from tampering by using a ModifyGraph ... UIControl=uic command, with uic = 4095. Put a variable at the root folder level called uic and give it the value that you would prefer (uic = 0 means no protection).</p> <p>The page size for layout is letter sized landscape. The settings use values pgwidth, pgheight, and pgmargin in set up. Put these values variables at the root folder level to overwrite the defaults for letter page size.</p> <p>The fraction of the page that is used for the graph in layout mode when the layout has both a graph and panel is set by a value gfrac. Put this as a value at the root folder level to over the default (gfrac = 0.75).</p> <p>When demomode does not exist, the demo mode will never become activated. To switch on demo mode, use demomode = 1. To switch off demo mode (and recover all Igor menus), set demomode = 0 and force Igor Pro to recompile. </p> <p>--</p> <p>I extend my gratitude for support from WaveMetrics to help deconstruct the commands needed to make this package work as it does.</p></span> <a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/projects/DemoImage.png"><img src="/sites/www.wavemetrics.com/files/styles/content_body/public/projects/DemoImage.png" width="490" height="300" alt="Example Demo Package" typeof="foaf:Image" class="content_body" /> </a> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">8.00.x</span> </span> <section class="comment-section"> </section> Sat, 12 Feb 2022 17:35:44 +0000 jjweimer 21825 at https://www.wavemetrics.com Window Notes https://www.wavemetrics.com/node/21657 Window Notes <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/jjweimer" lang="" about="/user/jjweimer" typeof="schema:Person" property="schema:name" datatype="">jjweimer</a></span> <span>Wed, 07/07/2021 - 07:20 am</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>This package is designed to allow a user to attach, display, and remove notes on windows.</p> <h3>Installation</h3> <p>Put the procedure file in the Igor Procedures or User Procedures folder according to standard rules.</p> <h3>Operation</h3> <p>The panel is accessed from the Windows-&gt;Packages-&gt;Window Notes sub-menu option. When the panel is activated (front-most), it will display the name of the most recent front-most window. The note field will contain the notes attached to that window. For optimal use in appending notes, add new notes ABOVE any current notes before re-attaching them. A date|time stamp will be added at any operation to attach the notes.</p> <h3>Details</h3> <p>Notes are stored in the note field for the window.</p></span> <a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/projects/Example%20WindowNotes.png"><img src="/sites/www.wavemetrics.com/files/styles/content_body/public/projects/Example%20WindowNotes.png" width="265" height="300" alt="Example of Window Notes in use." typeof="foaf:Image" class="content_body" /> </a> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">8.00.x</span> </span> <section class="comment-section"> </section> Wed, 07 Jul 2021 14:20:39 +0000 jjweimer 21657 at https://www.wavemetrics.com netCDF utilities https://www.wavemetrics.com/node/21590 netCDF utilities <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/cpr" lang="" about="/user/cpr" typeof="schema:Person" property="schema:name" datatype="">cpr</a></span> <span>Thu, 04/01/2021 - 06:40 am</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/44" hreflang="en">File Input/Output</a></span> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>New features in Igor 9 now allow the correct reading and writing of netCDF-4 files directly from within Igor. Igor 8 already added native netCDF-3 loading ability and Igor 7 added support for the extended data-types of netCDF-4 e.g. uint64 etc. Here are two sets of utilities to do both reading and writing using all in-built operations and user defined functions.</p> <h4>QLA netCDF reader</h4> <ul><li>Loads netCDF-3 and netCDF-4 files such that the original type is transparent to the user </li> <li>Parse all netCDF metadata nicely into CDL syntax attached to the WaveNote (c.f. ncdump or Panoply) or text dump</li> <li>Set the units and dimension names of the dataset</li> <li>Optionally apply scale factor, offset, fill value, valid range to data</li> <li>Functions to list, get, or set the attributes of a dataset</li> <li>Function to determine the type of netCDF file</li> <li>Menu is provided for convenience, inline is also perfectly fine </li> </ul><h4>QLA netCDF4 library</h4> <ul><li>Functions to create netCDF-4 or netCDF-4 'classic model' files directly from Igor</li> <li>Switch between types easily without changing any code</li> <li>Keeps track of dimension information</li> <li>Keeps track of _Netcdf4Dimid and _Netcdf4Coordinates required hidden attributes</li> <li>Keeps track of unlimited dimensions, layout, and chunking</li> <li>Keeps track of the hierarchy, duplicate names, dimensions size matching etc.</li> <li>Provides some basic help for keeping CF compliance</li> <li>Provides some hopefully helpful error/information messages in the history area</li> <li>Compression and shuffling is available</li> <li>Functions follow similar syntax to netCDF C library functions</li> <li>Functions vaguely named after netCDF functions e.g. NC_def_var becomes QLA_def_var</li> </ul><p>A sample .ipf is included which uses almost all the functions available that you can use to make your own netCDF-4 / netCDF-4 classic and figure out how it all works, test the files using ncdump, nccopy, or the included loader etc.</p> <h5>Limitations:</h5> <ul><li>Only HDF5 based netCDF-4 files can be created directly. To create a netCDF-3 use the netCDF API nccopy.exe to  convert your netCDF-4 classic model into a netCDF-3 i.e.</li> </ul> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">// convert a netCDF-4 classic into a netCDF-3</span><br /> <span style="color: #007575;">ExecuteScriptText</span> <span style="color: #000000;">/</span>B <span style="color: #000000;">/</span><span style="color: #c34e00;">Z</span> <span style="color: #009c00;">&quot;cmd.exe /C nccopy -3 myNC4classic.nc myNC3.nc</span></div></div> <ul><li>More exotic datatypes like ENUM are probably possible but aren't currently included in the library </li> </ul><p>All credit goes to Howard Rodstein for all his effort with changes and additions to the HDF5 operations within Igor. These include but are probably not limited to:</p> <ol><li>New HDF5DimensionScale operation - this is what makes creating netCDF-4 dimensions possible</li> <li>HDF5 attribute creation order tracking and indexing</li> <li>Fixed length HDF5 string attributes</li> <li>Loading of VLEN type data needed for reading netCDF-4 dimensions </li> <li>HDF5SaveData /STRF flag for explicit control of text formatting</li> <li>HDF5SaveData /OPTS flag for controlling the type of dataspace; required for scalar variables</li> </ol></span> <a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/projects/global_attributes.png"><img src="/sites/www.wavemetrics.com/files/styles/content_body/public/projects/global_attributes.png" width="397" height="300" alt="Global attributesinformation" typeof="foaf:Image" class="content_body" /> </a> <a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/projects/variable_attributes.png"><img src="/sites/www.wavemetrics.com/files/styles/content_body/public/projects/variable_attributes.png" width="306" height="300" alt="Variable attribute information" typeof="foaf:Image" class="content_body" /> </a> <a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/projects/dimension_attributes_0.png"><img src="/sites/www.wavemetrics.com/files/styles/content_body/public/projects/dimension_attributes_0.png" width="349" height="300" alt="Dimension information" typeof="foaf:Image" class="content_body" /> </a> <a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/projects/dump.png"><img src="/sites/www.wavemetrics.com/files/styles/content_body/public/projects/dump.png" width="326" height="300" alt="Header dump" typeof="foaf:Image" class="content_body" /> </a> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">9.00.x</span> </span> <section class="comment-section"> </section> Thu, 01 Apr 2021 13:40:55 +0000 cpr 21590 at https://www.wavemetrics.com Astronomical Algorithms https://www.wavemetrics.com/node/21581 Astronomical Algorithms <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/cpr" lang="" about="/user/cpr" typeof="schema:Person" property="schema:name" datatype="">cpr</a></span> <span>Mon, 03/22/2021 - 10:21 am</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>A simple utility to get information on solar and lunar position relative to any geographic location or time. Accurate to within ~seconds for rise-set times, and ~1/2 minute for the solstices/equinoxes. A host of other solar and lunar trivia are presented plus an inordinate number of different types of 'time'.</p> <p>A 'Tools' menu will be added to Igor, from which you can choose 'Astronomical data' at which point a dialogue where you can enter your location, time zone, altitude etc. will be presented </p> <p>By default the current time zone and location of your machine are looked up by a web service - this only gets the position of your local exchange which could be quite far from your actual location but doesn't reveal or require any personal information and uses your public facing IP address for this purpose. This can be disabled by commenting the following line at the top of the AtsronomicalData.ipf:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;">#define webApps &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// comment this to disable web applications which can be slow</span><br /> <br /> <span style="color: #ff0000; font-style: italic;">// some defaults for latitude and longitude </span><br /> <span style="color: #0000ff;">Static</span> <span style="color: #0000ff;">Constant</span> defaultlatVar = &nbsp;-<span style="color: #000000;">7.9286077</span> &nbsp;<span style="color: #ff0000; font-style: italic;">// Obsidian Hotel, Georgetown</span><br /> <span style="color: #0000ff;">Static</span> <span style="color: #0000ff;">Constant</span> defaultlonVar = &nbsp;-<span style="color: #000000;">14.4106611</span> <span style="color: #ff0000; font-style: italic;">// Obsidian Hotel, Georgetown</span></div></div> <p>A set of static default lat/lon locations can be set - currently to the sadly closed Obsidian Hotel, Georgetown, Ascension Island which will be used. Two other web features will also be disabled which are slow - these look up the current modelled location of the geomagnetic North and South poles from NOAA.</p> <p>Originally written to get the sunset time from the POV of an aircraft flying over the North Atlantic for one specific case to prove a point, hence corrections for observer altitude are included as this affects rise and set times, away from the horizon the effect is minimal. The default altitude is 0 m which should be reasonable for most purposes. </p> <p>Library of functions translated from <a href="https://futureboy.us/fsp/colorize.fsp?f=sun.frink">this</a> excellent resource from <a href="mailto:eliasen@mindspring.com">Alan Eliasen</a>, itself an implementation of the comprehensive book "Astronomical Algorithms" <em>Second Edition (1998)</em> by Jean Meeus. There are some unused functions provided for completeness. The GUI output is not a requirement and is provided for convenience as a fun distraction. Igor 9 is required due to the heavy use of the in-line multiple return syntax - no other requirements exist.  </p> <p>All credit to Alan Eliasen and Jean Meeus. Further credit to Alan Eliasen for his kind help with <em>ephemeris time. </em></p> <p>Limitations:</p> <p>1) When retrieving information across a daylight saving boundary times will likely be off by an hour. i.e. daylight saving is ignored. Hopefully daylight saving will be scrapped soon as it hasn't made sense since the invention of the electric lightbulb. </p> <p>2) Leap seconds are looked up and will have to be updated manually as there is no way to know when or if one will be added (they are observed, not calculated). There is a possibility that leap seconds will be scrapped as they don't make sense when considering true time drifts by a quarter of a day each year.   </p></span> <a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/projects/InputDialogue.png"><img src="/sites/www.wavemetrics.com/files/styles/content_body/public/projects/InputDialogue.png" width="477" height="300" alt="Input of position and date/time parameters" typeof="foaf:Image" class="content_body" /> </a> <a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/projects/OutputPannel.png"><img src="/sites/www.wavemetrics.com/files/styles/content_body/public/projects/OutputPannel.png" width="424" height="300" alt="Output of solar and lunar data" typeof="foaf:Image" class="content_body" /> </a> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">9.00.x</span> </span> <section class="comment-section"> </section> Mon, 22 Mar 2021 17:21:49 +0000 cpr 21581 at https://www.wavemetrics.com Batch Renamer https://www.wavemetrics.com/node/21571 Batch Renamer <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/tony" lang="" about="/user/tony" typeof="schema:Person" property="schema:name" datatype="">tony</a></span> <span>Tue, 03/09/2021 - 11:54 am</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/41" hreflang="en">User Interface</a></span> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>A GUI for renaming objects en masse. Looks a bit like the Rename dialog.</p> <p>See also the <a href="https://www.wavemetrics.com/code-snippet/batch-rename-selected-wave-and-folder-names">code snippet</a> by <a href="https://www.wavemetrics.com/user/chozo">chozo</a>.</p> <p><img alt="" data-entity-type="file" data-entity-uuid="730b233f-aabc-4bf0-a7a8-39d39a8e83f7" height="406" src="/sites/www.wavemetrics.com/files/users/user69/Batch%20Renamer%20Panel.png" width="512" /></p> <p>When 'Wildcards' is checked, ? matches one character and * matches one or more characters. In the 'prefix', 'suffix' and 'replace with' fields, # represents a number. Use multiple # characters to set minimum number of digits. To insert a string by key from a wavenote, use the syntax {key[,keySepStr[,listSepStr[,matchCase]]]}, where the optional parameters correspond to those used in StringByKey. String parameters do not have to be quoted. DisplayHelpTopic "StringByKey" for details.</p> <p>Clicking the column title for current names resorts the names alphanumerically, and you can click in the leftmost column and drag to reorder names.</p></span> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">9.00.x</span> <span class="entity-reference">8.00.x</span> </span> <section class="comment-section"> <article data-comment-user-id="1029" id="comment-21337" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615430721"></mark> <span class="comment-body"><p>Wow, you have done it already! Excellent job, and with much better code than I could ever write. Here are some features I would find useful:</p> <ul><li>A (don't) match case (for replacement) checkbox</li> <li>A way to reorder the rename list (should template renaming be possible)</li> <li>A template option to give waves consecutive names (e.g., "data###" will give data001, data002 ... etc.)</li> </ul><p>Really awesome would be to have the option to name waves by some information from the wave's notes, but I have no idea how to implement this. Maybe have a field to give information for a StringByKey search inside the notes?</p> <p>I also should look more into saving package preferences for my projects...</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21337&amp;1=default&amp;2=en&amp;3=" token="XIhUOts5anP-UFJP-oKpx8EKYe-Fgwg6k3xgC6YWFQY"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 10, 2021 at 06:45 pm - <a href="/comment/21337#comment-21337" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21340" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615450717"></mark> <span class="comment-body"><p>Thanks, chozo, though I don't believe for a second that the code is any nicer than yours.</p> <p>This was mostly cobbled together from bits of code I had written for other projects. The tricksy thing is list filtering. The WM wave selector widget has filtering built in, so it's easy to add a setvar to filter the list, but that only fires after you hit enter. If you want the list to respond as you type it gets significantly more complex.</p> <p>The panel allows you to rename folders and objects within those folders in one action, so reordering the rename list has to be done with care. Maybe I could add column sorting in the listbox. I have code for that - it took me a while to figure out how to do it properly.</p> <p>I have a feeling that colored text doesn't play nicely with listboxes on Windows, right? Windows uses a really dark blue for selected cells, and changes the text color only for default colored text.</p> <p>I wonder whether case sensitivity might lead to confusion for users, since Igor is ambivalent about case in object names.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21340&amp;1=default&amp;2=en&amp;3=" token="1Gc4z9GhglCJp7dy2LGn3C9qkLfwARVfbUa0nIWMahM"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 11, 2021 at 12:18 am - <a href="/comment/21340#comment-21340" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21342" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615454808"></mark> <span class="comment-body"><p>Even if cobbled together, it looks really nice already. Right, case-sensitivity is not so important in Igor, but I thought when replacing parts of names it might be useful to target the letter case to, for example, just replace the second 'd' in "Data_d20" or something. This is how the list-box looks on Win:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="9ed9adc1-d332-4b79-83da-cb7841c7bd66" height="283" src="/sites/www.wavemetrics.com/files/users/user1029/Renamer_v1.6_Win.png" width="380" /></p> <p>The colors are not super pretty (especially with the sub-pixel 'halo' around curved numbers thanks to sub-pixel dithering here on Win10), but everything is readable enough. Also you see that the Prefix and 1 time checkboxes may need a bit of alignment (the prefix controls about 10 units to the left and the time checkbox about 5 units to the right seems good).</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21342&amp;1=default&amp;2=en&amp;3=" token="lQmnfG_g_6UmvnCue2G_68UZvfUbwZJMzQE5UOvAFKk"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 11, 2021 at 01:26 am - <a href="/comment/21342#comment-21342" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21358" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615811339"></mark> <span class="comment-body"><p>you want more options? i give you regex...</p> <p>:)</p></span> <div class="comment-file-wrapper"> <label>Attachments</label> <span class="field-comment-file"> <label>Attachment</label> <span class="file"><span class="file file--mime-application-zip file--package-x-generic"><a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/2021-03/Batch%20Renamer175dev.zip" type="application/zip; length=11879">Batch Renamer175dev.zip</a></span> </span> </span> </div> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21358&amp;1=default&amp;2=en&amp;3=" token="S0m9HvkJpMZLWsXOmskulp6W0yjv9kYosAl7nkzs83g"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 15, 2021 at 05:28 am - <a href="/comment/21358#comment-21358" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21359" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615816038"></mark> <span class="comment-body"><p>Damn, that removes the possibility to complain about missing features in one fell swoop. Excellent work! This is more than most other GUIs are able to provide other than hardcore batch rename utilities. Now the only thing that I have left is to nitpick about the UI. ;) Two things: I noticed that copy-paste always pastes into the filter bar and never into other fields and: The entry fields are quite a bit too tiny to go all out on regEx. :)</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21359&amp;1=default&amp;2=en&amp;3=" token="-D5mVFR5YnAWjxLeN9ynEI-2uatJQxcmig6iT90ndTU"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 15, 2021 at 06:47 am - <a href="/comment/21359#comment-21359" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21361" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615834620"></mark> <span class="comment-body"><p>I forgot to mention that clicking the column heading for current names resorts the names alphanumerically, and you can click in the first column and drag to reorder. I haven't checked on a pc yet, but I can well imagine that the control layout is ugly. The copy paste bug is fixed.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21361&amp;1=default&amp;2=en&amp;3=" token="HToo3O32dqPWaVVtUwnlQ_0QmuCZJPUKRiQ8Bz5e0-4"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 15, 2021 at 11:57 am - <a href="/comment/21361#comment-21361" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="25" id="comment-21362" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/25"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/jjweimer/profile-images/2018-12/meimage.jpg" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">jjweimer</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615936979"></mark> <span class="comment-body"><p>&gt;  I haven't checked on a pc yet, but I can well imagine that the control layout is ugly.</p> <p>Yes. This could be taken as but one in the host of examples to demonstrate why Windows needs to fix its UI to copy the elegance in macOS or WaveMetrics needs to use electron to re-code Igor for consistency in UI design on all platforms. :-)</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21362&amp;1=default&amp;2=en&amp;3=" token="Z69jX4wH1-9OFShTfg8OThHy00GLkxC5YCrCAVD1-oI"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 15, 2021 at 02:23 pm - <a href="/comment/21362#comment-21362" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21434" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616379191"></mark> <span class="comment-body"><p>Hi Tony, thank you for the great update! Now the controls look very nice on windows. However, there is still a bug left: The panel keeps inflating when closed and reopened on Windows. Obviously, there is a problem when translating points to pixels (96 dpi on windows), i.e., all panel coordinates get inflated by 1.3333 each time. I get the same problem all the time in the reverse direction (i.e., my tools tend to get too small on Mac). Often a MoveWindow command is the culprit (I really watch out for this command now). Anyway, here is the fix which prevents this:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #ff0000; font-style: italic;">// resize to restore window size</span><br /> <span style="color: #0000ff;">Variable</span> factor = <span style="color: #c34e00;">PanelResolution</span><span style="color: #000000;">&#40;</span><span style="color: #009c00;">&quot;BatchRenamerPanel&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">/</span><span style="color: #c34e00;">ScreenResolution</span><br /> <span style="color: #007575;">MoveWindow</span> <span style="color: #000000;">/</span>W=BatchRenamerPanel prefs.win.left<span style="color: #000000;">*</span>factor,prefs.win.top<span style="color: #000000;">*</span>factor,prefs.win.right<span style="color: #000000;">*</span>factor,prefs.win.bottom<span style="color: #000000;">*</span>factor</div></div> <p>I think there is a mismatch somewhere in the manual. I suspect the notion that the /W=(left,top,right,bottom) in the NewPanel command is in 'points' is just wrong. If I count the pixels I find that this rather sets the size in pixels, which explains the discrepancy to MoveWindow, which set the size really in 'points'. Note that the /W=(left,top,right,bottom) flag for Display seems to be really in points as stated in the manual. Talk about confusing units!</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21434&amp;1=default&amp;2=en&amp;3=" token="s4xOiPCUamCuYac2r2dPHwb9AeSQ1_br7k2HJmHoxe8"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 21, 2021 at 07:13 pm - <a href="/comment/21434#comment-21434" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21436" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616398466"></mark> <span class="comment-body"><p>Does this fix it? turns out that MoveWindow isn't needed, ResizeControls takes care of positioning the controls regardless of the coordinates used in NewPanel.</p> <p> </p></span> <div class="comment-file-wrapper"> <label>Attachments</label> <span class="field-comment-file"> <label>Attachment</label> <span class="file"><span class="file file--mime-application-zip file--package-x-generic"><a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/2021-03/Batch%20Renamer191.zip" type="application/zip; length=11925">Batch Renamer191.zip</a></span> </span> </span> </div> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21436&amp;1=default&amp;2=en&amp;3=" token="Med8aOVpDdJA4Tix1luKIBBgMLndB1Jveo9knZWOiM4"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 22, 2021 at 12:34 am - <a href="/comment/21436#comment-21436" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21437" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616404566"></mark> <span class="comment-body"><p>Yes this very version works equally well.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21437&amp;1=default&amp;2=en&amp;3=" token="1skjDSNlsUAfPEkcx1DOcYglEnqsMrT9g0myu2-0sOs"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 22, 2021 at 02:16 am - <a href="/comment/21437#comment-21437" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21438" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <p class="visually-hidden">In reply to <a href="/comment/21434#comment-21434" class="permalink" rel="bookmark" hreflang="en">Hi Tony, thank you for the…</a> by <a title="View user profile." href="/user/chozo" lang="" about="/user/chozo" typeof="schema:Person" property="schema:name" datatype="">chozo</a></p> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616405981"></mark> <span class="comment-body"><p>&gt;Now the controls look very nice on windows.</p> <p>by luck rather than design. keeping setvars and checkboxes on separate lines helps.</p> <p>I've come across the movewindow madness somewhere before, but forgot all about it.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21438&amp;1=default&amp;2=en&amp;3=" token="jUZ_VcedFtg06h8qMxvVX8610HRLlYOD6isM-WuXUXQ"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 22, 2021 at 02:39 am - <a href="/comment/21438#comment-21438" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21439" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616406659"></mark> <span class="comment-body"><p>In the end, the only real solution is to test everything on both Windows and Mac. I now tend to test everything on both win/mac and in both Igor 9 and Igor 6.3 if I change something in panels. Quite tedious, but there is often some small detail which is off.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21439&amp;1=default&amp;2=en&amp;3=" token="p78PVXNdjqNwj-0GxseHVXoCxyKeY9cMPgBYcvSbJqk"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 22, 2021 at 02:50 am - <a href="/comment/21439#comment-21439" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21543" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1618648154"></mark> <span class="comment-body"><p>Tony, I am very happy with the Batch Renamer. I would find it convenient, though, if there was a way to switch off printing to the history (besides commenting out the one line with the print command, of course).</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21543&amp;1=default&amp;2=en&amp;3=" token="_hxRG7_21YuX8zyBjLhlj7f2NC5FwaS6LOiqU98PABQ"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">April 17, 2021 at 01:29 am - <a href="/comment/21543#comment-21543" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21544" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1618650879"></mark> <span class="comment-body"><p>Perhaps I should remove the line with print, use execute /P as default and execute /P/Q as a quiet option. I'll add that as a preference in an update, but for now it sounds like you have a solution. I've been finding it quite useful myself - almost enough to justify the time spent fiddling with control positions.</p> <p>Does anyone need to be able to toggle output to history on the fly, or can this be a set-and-forget option?</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21544&amp;1=default&amp;2=en&amp;3=" token="Q1IKGp4wU87S_ONo77-PG_UeYnkYhYejS5UsDlEzfkc"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">April 17, 2021 at 02:14 am - <a href="/comment/21544#comment-21544" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21545" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1618654036"></mark> <span class="comment-body"><p>Lately, I think tools should have an optional print output, if only for the purpose of documenting what has been done (e.g., logging the analysis process for an archive). My tools are obviously lacking here, but I have it on my list to fix that in the future. I think a checkbox with preferences would be the best option. You already have the preferences stuff nicely in place, so if you can bear to add a checkbox in some corner, this might be most convenient. Or you have a toggle function which could be called once to set the desired behavior (e.g., BatchRenameVerbose(0)). I personally would be more than happy with the latter option.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21545&amp;1=default&amp;2=en&amp;3=" token="8LbkBCTjPGpD_Zun9LCIlUjcLn_xbE1GBTJGNDC0-70"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">April 17, 2021 at 03:07 am - <a href="/comment/21545#comment-21545" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21546" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1618674455"></mark> <span class="comment-body"><p>The history is often the only way to keep track of objects. That's especially true for renamed objects! It would be easy to make a mistake with a batch renaming scheme, perhaps a couple of waves out of order, leading to switched names for data. For that reason I think the default should be to keep a history record of all renaming. My own spectroscopic waves usually have a wavenote that contains metadata describing the data acquisition, together with a trail of other manipulations to the data (baseline correction parameters and so on), which makes it easy for me to identify naming errors. I suspect that you use a similar scheme. Incidentally, I use nested keys in the wavenote, with the outer key using colon and return as key and list separator, and the inner using = and ;</p> <p>So I might have something like</p> <p>Optical Parameters:APT=1;VEL=2;TIM=12:02:03;</p> <p>Baseline Parameters:type=line;coef={1,2};</p> <p>and so on.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21546&amp;1=default&amp;2=en&amp;3=" token="GdTa9fdZylkYY7LU3AEYu1qKqkDEMRreFvdSCgOGxj4"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">April 17, 2021 at 08:47 am - <a href="/comment/21546#comment-21546" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21549" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1618832427"></mark> <span class="comment-body"><p>That's a valid point. Indeed, I handle only data which has the original data name in the wave note anyway, so I use renaming usually rather casually. Especially when renaming several waves takes two or more steps I find that the history is quickly "cluttered". But this is really a personal preference. Of course, the safest way is to print every step. It would be great if there would be way to filter the display of the history depending on specific search terms (just like the wave name feature of the data browser). Then one could get a list of specific steps easily, and it would be not problem if there are hundreds of lines of unrelated stuff. Yes, there is the find feature, but I find it somewhat lacking. Anyway, if you rather want to keep printing on in the Batch Renamer all the time, that fine with me as well.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21549&amp;1=default&amp;2=en&amp;3=" token="avDzlj4QdohYuVIheymhj-Tery3DKERJqAPddJlrCOo"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">April 19, 2021 at 04:40 am - <a href="/comment/21549#comment-21549" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21550" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <p class="visually-hidden">In reply to <a href="/comment/21549#comment-21549" class="permalink" rel="bookmark" hreflang="en">That&#039;s a valid point. Indeed…</a> by <a title="View user profile." href="/user/chozo" lang="" about="/user/chozo" typeof="schema:Person" property="schema:name" datatype="">chozo</a></p> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1618838914"></mark> <span class="comment-body"><p>If you have installed the latest version, executing BatchRename(history=0) turns off output to history. The setting is retained.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21550&amp;1=default&amp;2=en&amp;3=" token="xHK08zql7HpP3APLOk7RTziG4Hhq-nVGmcI0aYr0UPo"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">April 19, 2021 at 06:28 am - <a href="/comment/21550#comment-21550" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21552" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1618879402"></mark> <span class="comment-body"><p>Great! Thanks a lot for kindly working this in.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21552&amp;1=default&amp;2=en&amp;3=" token="q4ilFc1YBSfMXGmppbcIrJQlEqY9xaMbrcx8lvznBgU"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">April 19, 2021 at 05:43 pm - <a href="/comment/21552#comment-21552" hreflang="en">Permalink</a></p> </article> </section> Tue, 09 Mar 2021 19:54:13 +0000 tony 21571 at https://www.wavemetrics.com Spectra Trace Offset and Graph Size Tools - Quick-access to common graph and trace modify commands https://www.wavemetrics.com/node/21562 Spectra Trace Offset and Graph Size Tools - Quick-access to common graph and trace modify commands <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/chozo" lang="" about="/user/chozo" typeof="schema:Person" property="schema:name" datatype="">chozo</a></span> <span>Sun, 02/28/2021 - 11:07 pm</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/45" hreflang="en">Graphing</a></span> <span class="entity-reference"><a href="/taxonomy/term/41" hreflang="en">User Interface</a></span> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>This project provides three panels and menu functions for quickly and conveniently changing traces and common graphs style options. <strong>The panels always operate on the topmost graph.</strong> You can select another graph and then switch back to the panel, which updates all settings automatically. The panels do not modify the underlying data unless explicitly told to do so (other than the Quick-Scale panel which always works directly on the data; see below).</p> <p>The original code and the idea for the Offset Traces right-click menu has been kindly provided by Tony (<a href="https://www.wavemetrics.com/user/tony">https://www.wavemetrics.com/user/tony</a>) from his StackTraces toolset. I tried my best to test everything thoroughly, but sometimes bugs slip through. Bug reports and suggestions for new features are always welcome.</p> <h3> </h3> <h3>The Graph Size panel</h3> <p>Use this panel to change the graph size, margins or axis labels and to apply style macros quickly. All changes are live. Settings can also be copied and applied to other graphs. Start the panel by selecting <strong>'Spectra Tools' -&gt; 'Graph Size Panel ...'</strong> from menu bar or executing:</p> <span class="geshifilter"><code class="igor geshifilter-igor">BuildGraphSizePanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></code></span> <p>Here is a quick overview of all functions:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="978ed63c-3c03-4cd7-846b-a097a971b96a" height="360" src="/sites/www.wavemetrics.com/files/users/user1029/GrTools_size_manual_ver1.5.png" width="626" /></p> <p>In the top area you can set margins, plot area and graph sizes. In short, most settings of the Modify Graph dialog are recreated here for quick access. This panel shows the current dimensions even when the graph scaling is in 'auto' mode, which is convenient for checking all sizes. Furthermore, the total graph size (plot area + margins) can be set directly (green arrows), which is not possible from the Modify Graph dialog.</p> <p>Numbers rendered in <strong>bold font</strong> show that these properties are locked to a specific value (fixed mode). In other words, these values will not change/cannot be changed dynamically, for example, by scaling the graph with the mouse. <strong>Insert 0 (zero) into the respective field to unlock the value</strong> (revert back to 'Auto' mode). If 'Keep Auto Mode' is checked, then changing the graph or plot area sizes will not lock these values. Margin sizes will get always locked upon changing the value, since margin sizes are predefined in Auto mode and cannot be modified.</p> <p>The <strong>font</strong> control will change the global graph font size (as found in the Modify Graph dialog), <em>or alternatively</em><strong> when holding the shift key</strong> the global axes font size (as found in the Modify Axis dialog). Font sizes specified for individual axes etc. override the global graph font size. The global graph font size will scale all fonts and adjusts margins etc. accordingly.</p> <p>Activate the <strong>print checkbox</strong> and most changes (other than Format or Copy/Paste actions) will be printed to the history.</p> <p>The <strong>exp.</strong> control changes the magnification setting of the graph, which is useful to enlarge / shrink graphs without changing their (physical) size.</p> <p>The <strong>Aspect Ratio</strong> setting, as the name implies, locks the aspect ratio of the plot area (without the margins) to certain common presets, such as 3:2 or 16:9.</p> <p>The <strong>Format </strong>drop-down menu allows to quickly set the graph to common formats (useful for copy-pasting or graphics export):</p> <ul><li>Paper Half / Full: Publication size figures of one column (3.25 inch) or double-column (7 inch) width.</li> <li>PPT 4:3 / 16:9: Power-point size plots for 4:3 or 16:9 format slides (full and half each).</li> </ul><p>The <strong>Copy </strong>and <strong>Paste </strong>buttons are for copying margin and graph size settings to another graph. Press Copy to save the current settings, then bring another graph to the top and press Paste.</p> <p>The bottom-most area is for applying graph style macros. Select the desired style in the drop-down box and press <strong>Apply</strong>. The style can be reverted to the previous style for the current graph by pressing <strong>Revert</strong>. This function only saves the state of the current graph when pressing Apply. Undo states for multiple graphs are not saved.</p> <p>The <strong>Copy Style</strong> button saves the current style of the top graph to apply the same style to another graph later. If the 'w/ Axis Scaling' checkbox is active then the current X and Y axis range limits are copied and applied as well. A 'Copied Style' will appear in the list after pressing the button, which can be applied to other graphs with the Apply button just as a regular style macro.</p> <p>The project includes a standard style, named 'BoxStyle', and several label style macros, which apply labels from a few spectroscopic techniques to the graph. Holding 'ctrl' (Win) / 'command' (Mac) will suppress the ticks and labels on the left axis while applying the BoxStyle style, and will label the x axis with 'Binding energy' instead of 'Kinetic energy' while applying the PKE_Label style.</p> <p> </p> <h3>Graph and Traces Right-click Menus</h3> <p>New functionality has been added to the graph's right-click menu (which appears when you right-click on an empty area of the graph):</p> <p><img alt="" data-entity-type="file" data-entity-uuid="430fb8e5-807a-4dd2-b2fa-f972dad2a6f6" height="210" src="/sites/www.wavemetrics.com/files/users/user1029/GrTools_right_click_ver1.8.png" width="574" /></p> <ul><li><strong>Add Annotation with Live Offset ...:</strong> This will add a standard legend with extra information about trace offsets (x/y offset or x/y scale). A small prompt will appear, which lets you choose the desired information, numerical precision and placement of the legend within the graph. The offset information is live, which means that the displayed values get updated whenever any change happens. (<strong><em>Note:</em> </strong>This feature adds a function named GT_LiveOff() to the current experiment to achieve the effect. Don't delete the function or the display will not work.)</li> </ul><ul><li><strong>Left Axis: Autoscale Only Visible</strong> - Sets 'Zero isn't special' scaling mode for the y axis.</li> <li><strong>Left Axis: Autoscale From Zero</strong> - Sets 'Autoscale from zero' scaling mode for the y axis.</li> </ul><p>The <strong>Traces: Normalize </strong>submenu contains the following options. This submenu can be used to normalize traces to a common value via y-scaling and y-offsets.</p> <ul><li><strong>at Maximum</strong> - Normalize to the maximum y-value.</li> <li><strong>at Cursor</strong> - Normalize to the y-value at the cursor position.</li> <li><strong>around Cursor</strong> - The maximum y-value is searched in a range of 3 % of the data's full x-scale around the cursor position. <ul><li><strong>to One</strong> - Normalize to y = 1.</li> <li><strong>to Area</strong> - Normalize to yield area = 1.</li> <li><strong>to Global Maximum</strong> - Traces are normalized to match the highest y value of all traces, i.e., the trace with the highest value stays unmodified.</li> </ul></li> </ul><p>The options are:</p> <ul><li><strong>Select Cursor</strong> - Set the used cursor for above menu options.</li> <li><strong>Keep y-Offset at Zero</strong> - If activated, each y-offset will be set to 0. Otherwise the y-Offset will be adjusted to bring the trace's baseline to zero.</li> <li><strong>Keep Current y-Offset</strong> - If activated then the current y-offset of each trace will not be altered.</li> <li><strong>Undo All Scaling</strong> - y-scaling of all traces will be reset to 0. </li> <li><strong>Undo All Offsets</strong> - y-offsets of all traces will be reset to 0.</li> </ul><p>The <strong>Traces: Offset and Sort</strong> submenu contains the following options. All these options work with the current y-axis range of the graph. You may want to increase the y-range before applying these options for maximum effect.</p> <ul><li><strong>y-Order Traces Alphanumerically</strong> - Traces are rearranged according to their name in alphabetical order</li> </ul><ul><li><strong>Spread Traces Across y Range</strong> - Adds offsets to each trace to distribute traces across the current y-range (initial offsets are preserved).</li> <li><strong>Spread Traces: Equal Offset</strong> - Adds equal offset steps to each trace to distribute traces across the current y-range.</li> <li><strong>Spread Traces: Equal Gap</strong> - Adds offsets to each trace to distribute traces across the current y-range in a way which keeps the gap between traces (= maximum of previous trace to minimum of next trace) constant.</li> </ul><ul><li><strong>Undo All Scaling</strong> - Removes multipliers from all traces.</li> <li><strong>Undo All Offsets</strong> - Removes offsets from all traces.</li> </ul><p>Furthermore, the traces right-click menu (when you right-click on a trace) contains the following additional functions:</p> <ul><li><strong>y-Offset: Align Traces Here</strong> - Sets the offset of all traces so that they align at the cursor position. Hold <strong>ctrl / command</strong> to align all traces to y = 0.</li> <li><strong>y-Scale: Match Traces Here</strong> - Sets the multiplicator of all traces so that they align at the cursor position. Hold <strong>ctrl / command</strong> to scale all traces to y = 1.</li> <li><strong>y-Order Traces Here</strong> - Sorts the traces (trace display order in the graph) so that the y-value at the cursor position is in ascending order. Hold <strong>ctrl / command</strong> to sort in descending order.</li> </ul><p> </p> <h3>Waterfall plots and the Modify Traces panel</h3> <p>The main purpose of the Modify Traces panel is to work with (pseudo) waterfall plots. First, note that Igor Pro also provides an official package for creating waterfall plots (See: Windows -&gt; New -&gt; Packages -&gt; Waterfall Plot). The current project instead creates (pseudo-)waterfall plots by offsetting traces in a graph, and is not compatible with the official Waterfall Plot package.</p> <p>The provided menu entries inside the Spectra Tools menu are:</p> <ul><li><strong>Waterfall Plot of 2D Data or Folder</strong> - Creates a pseudo-waterfall plot from a 2D wave or a folder of 1D waves selected in the Data Browser (select one 1D wave inside the folder for the latter).</li> <li><strong>Normalize Traces to 1</strong> - Scales all traces in the top graph to y = 1. The baseline is set to 0 unless 'shift' is pressed while selecting this entry.</li> <li><strong>Normalize Traces to 1 at Cursor A</strong> - Scales all traces in the top graph to y = 1 at cursor A (if set on the graph). The baseline is set to 0 unless 'shift' is pressed.</li> <li><strong>Normalize Traces to Area</strong> - Scales all traces to unit area.</li> <li><strong>Quick Colorize Traces</strong> - Applies up to 13 different colors to the traces in the top graph.</li> </ul><ul></ul><p>Start the Modify Traces panel by going to <strong>'Spectra Tools' -&gt; 'Trace Offset Panel ...'</strong> or execute:</p> <span class="geshifilter"><code class="igor geshifilter-igor">BuildTraceOffsetPanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></code></span> <p>The panel has two tabs for modifying all traces at once and for modifying individual traces. A quick overview of both tabs is found below:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="ca0197b4-bcdf-49e5-a0e3-2e01eb31b9b1" height="456" src="/sites/www.wavemetrics.com/files/users/user1029/GrTools_trace_manual_ver1.5.png" width="777" /></p> <h4>All Traces tab</h4> <p>Here all traces are modified together. Traces can be omitted from modifications by hiding the traces (uncheck Include Hidden Traces in this case) or by a name filter (see below). The top part is used to set the trace offsets in Y and X directions. There are two modes: The offsets are either <strong>set</strong> (= the relative offset between traces will be exactly the inserted value) or <strong>added </strong>(the relative offset is added to the already set trace offsets).</p> <p>When to use the <strong>Scale Offset</strong> function: If you have offset the traces in the graph with uneven spacing (e.g., to represent some sort of relation between the traces) and only want to bring the traces closer together / space them further apart, then use this functionality, which preserves the relative offset. </p> <p>The <strong>Reverse Sorting</strong> button reverses the trace sorting in the graph, so that the bottom-most trace will be the topmost etc. afterwards.</p> <p>The <strong>Colorize </strong>button colors the traces according to the selected range successively. This button works on images as well but otherwise the panel is not very useful for image plots.</p> <p>The <strong>Filter</strong> region can be used to limit the range of traces for which changes are made. If you enter, for example, 'atrace_*' (note the use of the asterisk wildcard here) then only traces which begin with 'atrace_' will be modified by the controls. If you check Filter Excludes Traces then instead traces with this name will be omitted.</p> <p>The <strong>Profile</strong> drop-down list can be used to append an 1D wave vertically. This is useful to show a certain trend or integrated data which is representative of the traces shown in the graph, and at the same time serves as the (third) waterfall axis. The axis of this profile is scaled together with the top trace when Y-offsetting traces. A waterfall with an attached profile looks, for example, like this:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="41d5b331-56b8-4366-8af3-89be19ff7f6c" height="303" src="/sites/www.wavemetrics.com/files/users/user1029/GrTools_profile_example.png" width="312" /></p> <h4>Individual Trace tab</h4> <p>The trace to work on is selected with a cursor (A-D), so you need to set at least one of these cursors onto the graph. The active cursor can be switched between traces with the <strong>Prev Trace</strong> and <strong>Next Trace</strong> buttons. New in version 1.3: Press the <strong>Cursor </strong>button to add a new cursor to the current graph until all four cursors are set.</p> <p>The <strong>Go to Max</strong> and <strong>Go to Min</strong> buttons will set the cursor to the minimum / maximum Y-value of the current trace. The cursor works also as a position indicator. With the <strong>Reposition at Cursor</strong> controls you can set the which X and Y value the point of the cursor should have. The whole trace is then repositioned to reflect this. The trace can also be <strong>normalized</strong> to a certain Y value at the cursor position (which scales the trace accordingly).</p> <p>The <strong>Apply All to Data</strong> (All Traces tab) and <strong>Apply to This Data</strong> (Individual Trace tab) buttons will (try to) apply the offsets and scaling to the data (and then reset the graph offsets). <em>This will overwrite the original data, so be careful!</em> The applied offsets and multipliers are saved in the wave's note, which makes it in principle possible to reverse this action (this is not provided at the moment, but can be easily added if there is demand). Note that applying x-offsets to XY-data where all traces have the same x wave will likely give undesired results: Since the x wave is modified, all traces will shift over by the set x offset. These buttons do not work for graphs displaying 2D data sets at the moment.</p> <h3>Keyboard shortcuts (Individual Traces tab):</h3> <p>Some aspects of the Individual Traces controls (right side of the panel) can be controlled with the keyboard <em>when the panel is in focus</em>:</p> <ul><li>The <strong>a</strong>, <strong>b</strong>, <strong>c</strong> or <strong>d</strong> keys select cursor A, B, C or D.</li> <li><strong>h</strong> sets the active cursor to the maximum (high point) of the currently selected trace.</li> <li><strong>l </strong>(small L) sets the cursor to the minimum (low point) of the trace.</li> <li><strong>page up</strong> / <strong>page down</strong> moves the cursor to the next / previous trace in the graph.</li> <li>The <strong>left </strong>/ <strong>right arrow keys</strong> shifts the trace left / right in x direction</li> <li>The <strong>up </strong>/ <strong>down arrow keys</strong> shifts the trace up / down in y direction</li> <li>Press the <strong>left </strong>/ <strong>right arrow keys while holding the ctrl / command key</strong> to scale the trace in x direction</li> <li>Press the <strong>up </strong>/ <strong>down arrow keys while holding the ctrl / command key</strong> to scale the trace in y direction</li> </ul><h3>The dx/dy fields and user-provided update functions</h3> <p>The dx/dy fields at the bottom of the Individual Traces area are used to add (+) or subtract (-) constant values to the x / y offset of the selected trace using the respective buttons. Inserting a <strong>negative value</strong> will additionally invert the respective axis (the trace is flipped). The main use is to add or subtract pre-defined offsets such as the photon energy of a measured spectrum (in this case, addition/subtraction will remove or include the photon energy value to the energy axis).</p> <p>These fields can be pre-filled with information from the data using the <em>TraceTool_FetchXShift()</em> and <em>TraceTool_FetchYShift()</em> functions, which are called upon selecting a different trace or graph. You can modify these two functions directly at the beginning of the procedure file, but it is more convenient to provide your own code in a separate file or inside the experiment environment. Use the <strong>Override</strong> keyword in front of the Function statement to override the standard definitions inside the package. The following code shows the current implementation inside the project’s procedure, which is used to extract the used photon energy value from measurement data:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Static</span> <span style="color: #0000ff;">Function</span> TraceTool_FetchXShift<span style="color: #000000;">&#40;</span>input, unit<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> input<br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> <span style="color: #000000;">&amp;</span>unit&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// optional unit string</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> xShift = <span style="color: #c34e00;">NaN</span> &nbsp; <span style="color: #ff0000; font-style: italic;">// the shift value</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> neg = <span style="color: #000000;">1</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> notes = <span style="color: #c34e00;">note</span><span style="color: #000000;">&#40;</span>input<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> energy = <span style="color: #c34e00;">StringByKey</span><span style="color: #000000;">&#40;</span><span style="color: #009c00;">&quot;Xray energy&quot;</span>, notes, <span style="color: #009c00;">&quot;=&quot;</span>,<span style="color: #009c00;">&quot;<span style="color: #009c00;">\r</span>&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0000; font-style: italic;">// find the photon energy</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">!</span><span style="color: #c34e00;">strlen</span><span style="color: #000000;">&#40;</span>energy<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; energy = <span style="color: #c34e00;">StringByKey</span><span style="color: #000000;">&#40;</span><span style="color: #009c00;">&quot;photon energy &quot;</span>, notes, <span style="color: #009c00;">&quot;=&quot;</span>,<span style="color: #009c00;">&quot;<span style="color: #009c00;">\r</span>&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0000; font-style: italic;">// try a different key</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">endif</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">!</span><span style="color: #c34e00;">strlen</span><span style="color: #000000;">&#40;</span>energy<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; energy = <span style="color: #c34e00;">StringByKey</span><span style="color: #000000;">&#40;</span><span style="color: #009c00;">&quot;Excitation Energy&quot;</span>, notes, <span style="color: #009c00;">&quot;=&quot;</span>,<span style="color: #009c00;">&quot;<span style="color: #009c00;">\r</span>&quot;</span><span style="color: #000000;">&#41;</span>&nbsp; <span style="color: #ff0000; font-style: italic;">// try yet a different key</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; neg = -<span style="color: #000000;">1</span>&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// this data requires flipping</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">endif</span><br /> &nbsp; &nbsp; unit = <span style="color: #009c00;">&quot;eV&quot;</span><br /> &nbsp; &nbsp; xShift = <span style="color: #c34e00;">str2num</span><span style="color: #000000;">&#40;</span>energy<span style="color: #000000;">&#41;</span><span style="color: #000000;">*</span>neg<br /> &nbsp; &nbsp; <span style="color: #0000ff;">return</span> xShift &nbsp; <span style="color: #ff0000; font-style: italic;">// return NaN for no change and return negative values for flipping the trace</span><br /> <span style="color: #0000ff;">End</span><br /> <br /> <span style="color: #0000ff;">Static</span> <span style="color: #0000ff;">Function</span> TraceTool_FetchYShift<span style="color: #000000;">&#40;</span>input,unit<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> input<br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> <span style="color: #000000;">&amp;</span>unit<br /> &nbsp; &nbsp; <span style="color: #0000ff;">return</span> <span style="color: #c34e00;">NaN</span><br /> <span style="color: #0000ff;">End</span></div></div> <h3> </h3> <h3>The Quick-Scale panel</h3> <p>This panel attaches directly to the top graph and provides a sub-set of the functionality of the Trace Offset panel. <u><strong>The difference is that all changes are immediately applied to the data (i.e., the wave is directly modified)</strong></u> and that images can be worked on as well. Attach the panel to a graph by choosing <strong>'Spectra Tools' -&gt; 'Attach Quick-Scale Panel ...'</strong> or executing the following in the command line:</p> <span class="geshifilter"><code class="igor geshifilter-igor">AttachQuickScalePanel<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></code></span> <p>This is a quick overview over the controls of the attached panel:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="e99750db-bdfd-4180-8a38-5d607cf143b0" height="350" src="/sites/www.wavemetrics.com/files/users/user1029/QuickScale_manual_ver1.65.png" width="283" /></p> <p>The panel works with the current cursor (the cursor which was moved / placed on the graph last) to select the trace or image point to work on. If there is not cursor yet then you can add a new cursor to the graph by pressing the <strong>'+' button</strong> in the panel. The cursor can be moved to the previous or next trace in the graph by using the <strong>Prev and Next buttons</strong>. The <strong>Min and Max buttons</strong> move the cursor to the position of the minimal or maximal data value (either of the current trace or image).</p> <p>The <strong>Normalize field</strong> shows the intensity at the cursor location. Dial in a value here and the data will be multiplied the cursor position will reflect this value. The <strong>Revert Norm. button</strong> reverts this change.</p> <p>The data scaling can be changed by modifying the <strong>X pos. field</strong>, which changes the x-scaling so that the cursor ends up at this new position. The <strong>do Y checkbox</strong> switches the controls to y-scaling for images (2D data). You can also adjust the <strong>Relative Shift</strong> from the initial position.</p> <p>The <strong>KE &lt;&gt; BE button</strong> is used to switch between kinetic / binding energy scales for photoelectron spectra or emission energy / energy loss scales for (X-ray) emission spectra. For this, you need to first provide the correct <strong>Photon Energy</strong>. The photon energy value is read automatically (if available) from the data by utilizing the <em>TraceTool_FetchXShift()</em> function above.</p> <p>The <strong>Arithmetic Op. field</strong> provides functionality to add, subtract, multiply or divide the data by a value or simple function. The expression should start with the +, -, * or / character. Otherwise it works the same as if you would write the expression into the command line (e.g., entering '/3' is the same as executing 'mydata /= 3' in the command line). The operation will only work on the current trace or selected column (for an image). If you uncheck <strong>One Column</strong> then the operation will be applied to the whole image / 2D data.</p></span> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">9.00.x</span> <span class="entity-reference">8.00.x</span> <span class="entity-reference">7.00.x</span> <span class="entity-reference">6.30.x</span> </span> <section class="comment-section"> <article data-comment-user-id="69" id="comment-21317" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615288801"></mark> <span class="comment-body"><p>nice project.</p> <p>a little bug: if cursor is on an image in the top graph an error occurs when the panel is built.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21317&amp;1=default&amp;2=en&amp;3=" token="JD3TioOA6byoYF6L3Ir6_HDOaUq9uH_SMJhaY8XjECM"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 9, 2021 at 03:20 am - <a href="/comment/21317#comment-21317" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21336" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615436043"></mark> <span class="comment-body"><p>Tony, thanks! Oops, I have fixed this now. Somehow I had checking for images in place but commented out. I will look into working your StackTraces functions into this package, so that everything is neatly in one place. Thank you for your manual in the other thread.</p> <p>EDIT: Now I know why I had commented this out: Because it was not working properly. The current version should work fine with image plots (i.e., no error message). Of course the panel is not that useful for images yet. I have another small panel which can shift image data around, but this involves changing the wave's scaling, since there is no offset option for images. I could implement this in the future. Would you find shifting and scaling images useful?</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21336&amp;1=default&amp;2=en&amp;3=" token="v8bKS0BoVCS-Df40esvbYOyoeIdjvU_MRs4y-qtJL5Y"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 10, 2021 at 06:32 pm - <a href="/comment/21336#comment-21336" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21356" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615568017"></mark> <span class="comment-body"><p>Hi Tony,</p> <p>I went now through your StackTraces code. I found it very useful and have modified (reinterpreted) it with some new functionality. I would like to put this into the next GraphTools update, but first I would like to hear your opinion. Does the new version still work well with your workflow and data? If you look at the code you will see that I have rewritten a lot of details. This is my way of translating the functionality so that I understand what is going on (this included renaming menu entries a bit... I couldn't really wrap my head around the word 'stack' for most of the options). Also, I want to keep Igor 6.3 compatibility as much as possible for now.</p> <p>The code is now useable with 2D waterfall plots and honors x-offsets as well as y-scaling (I don't have x-scaling awareness in yet, but this will hopefully not be a problem). Now it is also possible to scale all traces (set a multiplier) to the same value at the cursor position. I have taken out addOffsets(), since this is probably already covered with the panel (if you find this more convenient this tool could go back in, of course).</p> <p>I have added alternative functionality when ctrl / command is pressed:</p> <ul><li>'y-Offset: Align Traces' will align to zero instead of the cursors y value</li> <li>'y-Scale: Match Traces' will scale to 1 instead of the cursors y value</li> <li>'y-Order Traces' will sort in descending order</li> </ul><p>Please let me know if you have any comments or suggestions for improvements. </p></span> <div class="comment-file-wrapper"> <label>Attachments</label> <span class="field-comment-file"> <label>Attachment</label> <span class="file"><span class="file file--mime-application-zip file--package-x-generic"><a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/2021-03/newStackTraces.zip" type="application/zip; length=3488">newStackTraces.zip</a></span> </span> </span> </div> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21356&amp;1=default&amp;2=en&amp;3=" token="MAkPYme6jgM8XcSsigqC1PXVBlucOUJEERF4phe2CuU"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 12, 2021 at 08:53 am - <a href="/comment/21356#comment-21356" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21365" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615885548"></mark> <span class="comment-body"><p>@Tony: I went ahead and merged the right-click menus into the project. I hope you like it. :)</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21365&amp;1=default&amp;2=en&amp;3=" token="LYQJLCEDBApaymNwEJOe_InKHX03f6p1PCXydaTF4dc"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 16, 2021 at 02:05 am - <a href="/comment/21365#comment-21365" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21367" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615894437"></mark> <span class="comment-body"><p>I do like it!</p> <p>The thing I still look for in the panel is 'shift offset per trace', the equivalent to the equivalent of my 'add offsets per trace' graph menu.</p> <p>Something that will add an additional offset of value*i to each trace. Is there a way to do that? Perhaps I'm missing something.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21367&amp;1=default&amp;2=en&amp;3=" token="YdFW6_2fjP49rc2w-RRlxr_1dLb809QRm6_dcqrDZE4"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 16, 2021 at 04:33 am - <a href="/comment/21367#comment-21367" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21368" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615897393"></mark> <span class="comment-body"><p>Great! Let me know if I should add something else.</p> <p>The 'add offsets per trace' functionality is implemented in the panel as 'Set Offset per Trace' in the top right corner for both x and y directions. Just dial in a number or user the up/down arrows. This will add the inserted number as value*i to the traces. Also, 'Shift Offset of All Traces' will add the same offset to all traces, i.e., shift the whole bunch.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21368&amp;1=default&amp;2=en&amp;3=" token="-R5m_LJq2U4c5h6TI4Ey54zt9fz6xF2416esxqkepVI"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 16, 2021 at 05:23 am - <a href="/comment/21368#comment-21368" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21374" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615907585"></mark> <span class="comment-body"><p>I was trying to add rather than set the offsets. So the result is current offset + i*value.</p> <p>The idea is to able to quickly 'align' the traces by setting variable offsets, then add something to each offset to spread the traces apart from one another, with the possibility of adding or subtracting a bit more to spread them further or closer to one another.</p> <p>It looks like 'set offset per trace' discards the current offsets, ie it does what it says!</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21374&amp;1=default&amp;2=en&amp;3=" token="ecyKm_w4AjENqnr3UcoGUv4H39LbepzGP-C8mcWN75I"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 16, 2021 at 08:13 am - <a href="/comment/21374#comment-21374" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21377" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615909877"></mark> <span class="comment-body"><p>Ah I see! Yes, the initial offsets and any alignment are not preserved. It should be no problem and make no difference for me to convert this into an add offset function. I'll think about it.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21377&amp;1=default&amp;2=en&amp;3=" token="M8Q0hTlZJjpXJxigi6N06bqsAq3T2n8PWYsAi6OTOhg"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 16, 2021 at 08:51 am - <a href="/comment/21377#comment-21377" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21382" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615915037"></mark> <span class="comment-body"><p>Here is a version where I have added checkboxes to toggle between Set (the current behavior) and Add modes (this should recreate the 'add offsets per trace'). :) Let me know how well this works for you. If everything is fine then I will submit an update after doing a few more tests tomorrow.</p> <p>As a somewhat related side note, you may be shocked to hear that I have opened the All Traces Popup menu for the first time today. One learns something new every day. ;-p</p></span> <div class="comment-file-wrapper"> <label>Attachments</label> <span class="field-comment-file"> <label>Attachment</label> <span class="file"><span class="file file--mime-application-zip file--package-x-generic"><a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/2021-03/Graph%20Tools_v1.21-dev.zip" type="application/zip; length=19904">Graph Tools_v1.21-dev.zip</a></span> </span> </span> </div> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21382&amp;1=default&amp;2=en&amp;3=" token="BaxByjA5bucVKDUJcEBYZZW6bKWB3EmqhMqdxqWNTHQ"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 16, 2021 at 10:17 am - <a href="/comment/21382#comment-21382" hreflang="en">Permalink</a></p> </article> </section> Mon, 01 Mar 2021 07:07:33 +0000 chozo 21562 at https://www.wavemetrics.com Spectra Image Profile - Create profiles from, normalize and edit 2D / 3D spectral data https://www.wavemetrics.com/node/21549 Spectra Image Profile - Create profiles from, normalize and edit 2D / 3D spectral data <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/chozo" lang="" about="/user/chozo" typeof="schema:Person" property="schema:name" datatype="">chozo</a></span> <span>Mon, 02/15/2021 - 07:44 pm</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/49" hreflang="en">Analysis</a></span> <span class="entity-reference"><a href="/taxonomy/term/46" hreflang="en">Image Processing</a></span> <span class="entity-reference"><a href="/taxonomy/term/41" hreflang="en">User Interface</a></span> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>This project provides tools for working on 2D spectral data or layers of 3D data, and was inspired by the WaveMetrics Image Line Profile procedure (now replaced by the internal Line Profile tool). The basic functionality is similar to the official tool at first glance, but this project has many convenient features tailored for spectroscopic data such as detector images, two-dimensional scans or intensity maps. The main functionality is the horizontal or vertical data integration between two region-of-interest (ROI) lines to create a profile, which can be saved, compared or even used to modify the data itself. Other functions (such as normalization) are applied directly to the 2D data or layer. <strong>The tool works directly on the input data, but a backup is saved upon start.</strong> Several quick-tools to work on 1D-3D data are included as well.</p> <p>I tried my best to test everything thoroughly, but users should verify the correct behavior for critical applications. Bug reports and suggestions for new features are always welcome.</p> <h2>User Interface controls</h2> <p>To start, select a 2D or 3D wave in the Data Browser and then go to <strong>‘Spectra Tools’ -&gt; ‘Image Profile …’</strong> in the top menu. Or use the command line:</p> <span class="geshifilter"><code class="igor geshifilter-igor">SpectraProfile<span style="color: #000000;">&#40;</span>inputWave<span style="color: #000000;">&#41;</span></code></span> <p>A quick overview of all controls can be found below:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="1069fe16-0c2f-4662-91c1-7894c43655f4" height="478" src="/sites/www.wavemetrics.com/files/users/user1029/ImagePr_manual_ver3.8.png" width="800" /></p> <h3>Line profile controls</h3> <ul><li>The profile can be calculated in <strong>horizontal (h key) or vertical (v key) direction</strong>. Diagonal or free-form modes (like in the Line Profile tool) are not available.</li> <li>The Region-of-Interest (ROI) lines can be modified via the control variables, by dragging the lines directly with the mouse on the image or by using the cursor keys on the keyboard (holding the <strong>shift key</strong> speeds up movements by 4x and the <strong>ctrl / command key</strong> slows down movement by 1/2).</li> <li>To instantly go to the <strong>full (minimal) ROI </strong>width use the respective check boxes or use the <strong>page up / page down keys</strong>.</li> <li><strong>Normalize Profile:</strong> The profile (not the image) will be normalized to fall between 0 and 1.</li> <li><strong>Mouse Csr Profile:</strong> An additional profile appears for comparison, which shows the current row or column under the mouse cursor<strong> </strong>(toggle with the m key). This profile is not saved.</li> <li><strong>Snap Lines to Grid:</strong> The ROI line positions are constrained to include only full rows / columns.</li> </ul><h3>Undoing changes to the 2D / 3D data</h3> <ul><li><strong>Undo All Changes:</strong> Resets all changes made to the 2D/3D data and returns to the condition at start.</li> <li><strong>Undo Last Change:</strong> Reverts the last change made to the 2D/3D data by invoking a function. This will only work once and will not undo multiple steps.</li> </ul><h3>Normalization buttons</h3> <p>These functions work on the current layer. Currently, three normalization functions are implemented:</p> <ul><li><strong>Div. by Profile:</strong> This divides the 2D image by the current profile (each column in horizontal mode and each row in vertical mode, respectively). The profile is slightly smoothed before the division to avoid amplifying noise. Holding the <strong>ctrl / command</strong> key while pressing the button prevents this smoothing step. See further below how to modify the smoothing parameter.</li> <li><strong>Each Maximum:</strong> Finds the maximum of each row (horizontal mode) or each column (vertical mode) and divides the row / column by this value. This is useful, for example, to equalize the data in one direction (use the Keep avg. Int. checkbox to prevent downscaling of the data to 1)</li> <li><strong>A user-defined button (here labeled ‘Ring Currrent’):</strong> Normalize by user provided information. This can be any data parameter or wave saved in the current experiment. Examples are normalization by a secondary readout, time, concentration etc. See the last section on how to define your own functionality here.</li> <li><strong>Keep average Int. checkbox:</strong> This will preserve the average intensity when normalizing the 2D data. Normalization involves division by some normalization term, which reduces the intensity. This checkbox will rescale the data back to the intensity level before normalization.</li> </ul><h3>The Save Profile and Snapshot buttons</h3> <p>The Save profile button saves the current profile next to the input data using a name ending which depends on the selected range. The ending is of the format “_H(xxx-xxx)” (horizontal mode) or “_V(xxx-xxx)” (vertical mode), where xxx give the start and end of the current range, e.g., “mydata_H(16.7-19.3)”. If the full image is selected the ending will be just “_prH” or “_prV”, respectively. Holding the shift key while pressing the button will lock the ending to “_prH” / “_prV” regardless of the selected range. The range and width is always saved inside the output wave’s note.</p> <p>The Snapshot button will instead create and display a backup of the current profile for comparison. Each button press updates this snapshot to the current one. This profile will not be saved.</p> <h3>The Delete ROI Section button</h3> <p>This button removes the columns (horizontal) or rows (vertical) inside the Region Of Interest. If the data at the beginning of the wave is removed, the scaling is adjusted to account for the deleted points. However, if data in the center is removed the scaling cannot be adjusted, since a waves scaling must be always linear and continuous. Be aware that this may lead to a mismatch between the image data and the scaling. If the scaling is important (e.g., a continuous energy scale), either refrain from using this feature or take care to only remove sections at the edges. If 3D data is edited, this will delete the selected columns or rows on all layers.</p> <h3>The Subtract Profile button</h3> <p>The current profile will be subtracted from each column (horizontal mode) or row (vertical mode) of the 2D image or current layer of 3D data. This can be used, for example, to remove constant features from a measurement which appear undisturbed in part of the data and thus can be selected with the ROI lines.</p> <p>This button has an additional functionality <em>only in horizontal mode</em>: The spectrum can be shifted each column step according to the Y-axis delta. In other words, each increasing column the Y-scale delta value is added to (or subtracted from) the profile’s x scaling, which subtracts the profile in <em>diagonal</em> direction. This is useful to subtract features which change with the parameter on the Y scale like, for example, spectral features moving with increasing photon energy.</p> <ul><li>Hold <strong>ctrl / command</strong> to subtract the profile along <strong>increasing Y delta values</strong>.</li> <li>Hold <strong>alt / option</strong> to subtract the profile along <strong>decreasing Y delta values</strong>.</li> </ul><p>Below example shows the diagonal subtraction result:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="102b1734-043e-4c42-b537-5790251a2352" height="282" src="/sites/www.wavemetrics.com/files/users/user1029/ImagePr_diagonal%20example.jpg" width="578" /></p> <h3>The Shift +/- buttons</h3> <p>These two buttons only work horizontally (regardless of the selected mode) and are used to add or subtract the Y-axis scale from the X-axis. All layers of 3D data are processed. In other words, the X-scaling of each column is adjusted by its respective Y-scaling value; the data is recalculated into a parallelogram. This will straighten features in the data which were changing with increasing Y values. An example would be a photon-energy (Y) scan of a spectrum where certain spectral features increase in their (X) emission energy. Subtracting the photon energy scale from a photoelectron spectrum in a kinetic energy scale would give binding energy, while adding the photon energy scale reverts back to kinetic energy. The effect is illustrated again with above example data:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="232e657b-94d0-475a-86b8-fe40301c1291" height="280" src="/sites/www.wavemetrics.com/files/users/user1029/ImagePr_shift%20example.jpg" width="500" /></p> <p>Hold <strong>ctrl / command</strong> to cut partial data after the shift has been applied (the parallelogram is cut back into a rectangle). Note that this might fail if there is not even one complete row of data left (the skew of the parallelogram is too large to fit a rectangle inside).</p> <h3>Align Features functionality</h3> <p>This algorithm looks for similar features of each column (horizontal mode) or row (vertical mode) of the 2D image or current layer of 3D data and tries to align these features for maximum overlap by shifting each column / row by a certain amount. The algorithm uses wave correlation and shifts the data in whole point steps (no interpolation) or sub-steps (interpolated) when the <strong>Sub-steps</strong> checkbox is enabled. This can be used, for example, to correct slight shifts of peaks in a spectrum or to estimate the shift of a peak versus some other parameter like time or position:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="f96bb5b8-6b97-4ff5-986b-7dff870bd4b5" height="273" src="/sites/www.wavemetrics.com/files/users/user1029/ImagePr_align%20example.jpg" width="571" /></p> <p>The algorithm uses the first column (bottom to top in horizontal mode) or row (left to right in vertical mode) of the data as reference and tries to align all other columns / rows to this reference. Hold <strong>shift</strong> to use the last row / column instead (top to bottom in horizontal mode and right to left in vertical mode).</p> <p>Often, it is not desired to align to the full data with lots of different features. Setting the A and/or B cursors onto the image will limit the range from which the reference is selected to maximize overlap with only one selected feature. This might still fail if many similar features are present.</p> <p>Activate <strong>Smooth </strong>to smooth the data before aligning. This can improve the results for noisy data.</p> <p>Activate <strong>Align Edges</strong> to search for maximum overlap of edge features instead of peak features. The derivative of the data is used for this purpose.</p> <p>The <strong>Substeps feature</strong> is activated by default, which aligns features in steps smaller than the distance of data points, <em>i.e.</em>, by using interpolation. Deactivating this feature by unchecking the checkbox will instead move data in integer steps.</p> <p>Activate <strong>Output Shift Result</strong> to write the shift values into a wave with the name ending "_shft". The output is scaled by the 2D data’s wave scaling.</p> <p>Note that the algorithm is ‘dumb’ in a sense that it only looks for the maximum correlation and not if peak features really match etc. In the worst case this just aligns artifacts such as noise.</p> <h3>Image contrast and color controls</h3> <p>You can choose the used color table and adjust the contrast of the image or currently selected layer by using the drop-down menu and the adjustment sliders. Select the desired color table and slide the Min and Max controls until the contrast is as desired. The sliders only have a range between the maximum and minimum data value of the image or currently selected layer, so the contrast cannot be reduced further, only increased. If you reverse the position of the Min and Max sliders then the colors of the image will be inverted.</p> <h3>Layer and Merge controls (only 3D data)</h3> <p>The <strong>Layer</strong> setting set the currently displayed layer of a 3D data set. The profile will only be created from this layer and most functions will for editing data will only act on this one layer (there are exceptions like Delete ROI Section and Shift).</p> <p>The <strong>Delete </strong>button will delete the currently shown layer.</p> <p>The <strong>Merge All </strong>button will merge all (remaining) layers into a single 2D image which can then be worked on further. This can be reverted by using the Undo buttons.</p> <h2>Quick access functions in the menu</h2> <p>Some useful functions are available in the Spectra Tools menu:</p> <ul><li><strong>Append 1D,2D Datasets into 2D Data:</strong> Combines the columns (Y dimension) of multiple datasets (e.g., multiple measurements) into one consecutive 2D data wave. The X dimension is extended to cover the full X range of all datasets if needed.</li> <li><strong>Stack 2D Datasets into 3D Data:</strong> Stacks multiple 2D spectra (e.g., MCP images) on top of each other to produce a 3D array.</li> <li><strong>Profile of 2D\3D Data:</strong> Same as creating a profile over the full data in horizontal or vertical mode using the profile panel. This will give 1D data for a 2D input, or 2D data or a 3D input.</li> <li><strong>2D Image from 3D Data:</strong> Sums 3D data in the layer (array) direction to give a 2D image (e.g., gives a sum of all MCP images of a 3D array).</li> <li><strong>Split Up 2D\3D Data:</strong> Separates 2D / 3D data into individual waves holding columns, rows or layers. The individual waves are saved in a folder with the name of the input.</li> </ul><h2>Procedure settings and user button code</h2> <p>The procedure header has two global constants which control the smoothing factor of …</p> <ul><li><strong>kNormProfileSmooth:</strong> Sets the smoothing factor as an integer for profile normalization. The profile is smoothed by this factor before used for division with the 2D data.</li> <li><strong>kAlignSmooth:</strong> The initial smoothing factor applied to each row / column before the correlation is calculated. Useful to suppress noise. The factor can be adjusted at any time inside the panel.</li> </ul><h3>The user-defined (normalization) button</h3> <p>Two functions and one global variable are used to provide the functionality for the user button:</p> <ul><li><strong>kUserInfoBtnName:</strong> Defines the button’s label and can be changed to reflect the purpose of the button. This name should be short to fit inside the button.</li> <li><strong>Profile_ActivateUserInfoButton(inputWave):</strong> A function for checking whether the conditions for using the button are fulfilled. A return value of 1 activates, any other value disables the button. One could for example check here if the required information is contained in the 2D data or loaded in the current experiment.</li> <li><strong>Profile_ExecuteUserInfoButton(inputWave)</strong>: This function is called to do the normalization (or whatever you like to do here). Return a scaling factor for scaling the intensity to its average after the normalization step should the Keep average Int. checkbox be activated (returning 0 skips this step).</li> </ul><p>You can modify the constant and the two functions directly at the beginning of the procedure file, but it is more convenient to provide your own code in a separate file or inside the experiment environment. Use the <strong>Override</strong> keyword in front of the Function / StrConstant statement to override the standard definitions inside the package. Have a look at the example implementation inside the project’s procedure, which is used to normalize the ring current of synchrotron experiments saved inside the 2D data itself.</p> <p>While the user button is intended for normalization, it is really a free-for-all button for any modification to the 2D data you may want. You could instead write a function which, for example, splits the image in half or applies an interpolation or does something completely different in each experiment file.</p> <p>The following code shows the current implementation of the user-definable normalization button:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Static</span> <span style="color: #0000ff;">StrConstant</span> kUserInfoBtnName = <span style="color: #009c00;">&quot;Ring Current&quot;</span>&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// the title of the user button</span><br /> <br /> <span style="color: #0000ff;">Static</span> <span style="color: #0000ff;">Function</span> Profile_ActivateUserInfoButton<span style="color: #000000;">&#40;</span>inwave<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> inwave<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> activate = <span style="color: #000000;">0</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// +++ conditions for activation +++</span><br /> &nbsp; &nbsp; activate = <span style="color: #c34e00;">StringMatch</span><span style="color: #000000;">&#40;</span><span style="color: #c34e00;">GetDimLabel</span><span style="color: #000000;">&#40;</span>inwave,<span style="color: #000000;">1</span>,<span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span>,<span style="color: #009c00;">&quot;*mA*&quot;</span><span style="color: #000000;">&#41;</span>&nbsp; <span style="color: #ff0000; font-style: italic;">// check if dim-labels contain &quot;mA&quot; values</span><br /> &nbsp; &nbsp; activate = <span style="color: #c34e00;">StringMatch</span><span style="color: #000000;">&#40;</span><span style="color: #c34e00;">note</span><span style="color: #000000;">&#40;</span>inwave<span style="color: #000000;">&#41;</span>,<span style="color: #009c00;">&quot;*ring current normalized*&quot;</span><span style="color: #000000;">&#41;</span>? <span style="color: #000000;">0</span> : activate&nbsp; <span style="color: #ff0000; font-style: italic;">// already normalized?</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// +++</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">return</span> activate <span style="color: #ff0000; font-style: italic;">// return 1 to activate button</span><br /> <span style="color: #0000ff;">End</span><br /> <br /> <span style="color: #0000ff;">Static</span> <span style="color: #0000ff;">Function</span> Profile_ExecuteUserInfoButton<span style="color: #000000;">&#40;</span>inwave<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> inwave<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> valAvg = <span style="color: #000000;">0</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// +++ ring current normalization procedure +++</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> <span style="color: #c34e00;">i</span>, value<br /> &nbsp; &nbsp; <span style="color: #0000ff;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #c34e00;">i</span> = <span style="color: #000000;">0</span>; <span style="color: #c34e00;">i</span> <span style="color: #000000;">&lt;</span> <span style="color: #c34e00;">DimSize</span><span style="color: #000000;">&#40;</span>inwave,<span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span>; <span style="color: #c34e00;">i</span> += <span style="color: #000000;">1</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">String</span> Currlabel = <span style="color: #c34e00;">GetDimLabel</span><span style="color: #000000;">&#40;</span>inwave,<span style="color: #000000;">1</span>,<span style="color: #c34e00;">i</span><span style="color: #000000;">&#41;</span>&nbsp; <span style="color: #ff0000; font-style: italic;">// get the information from the column label</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #007575;">sscanf</span> Currlabel, <span style="color: #009c00;">&quot;%s (%f mA)&quot;</span>, Currlabel, value&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// search for ring current info in the form &quot;time (XXX mA)&quot;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">if</span> <span style="color: #000000;">&#40;</span>value <span style="color: #000000;">!</span>= <span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; inwave<span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#91;</span><span style="color: #c34e00;">i</span><span style="color: #000000;">&#93;</span> <span style="color: #000000;">/</span>= value<br /> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">endif</span><br /> &nbsp; &nbsp; &nbsp; &nbsp; valAvg += value <span style="color: #ff0000; font-style: italic;">// add the values for intensity re-normalization later</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">endfor</span><br /> &nbsp; &nbsp; valAvg <span style="color: #000000;">/</span>= <span style="color: #c34e00;">i</span>+<span style="color: #000000;">1</span><br /> &nbsp; &nbsp; <span style="color: #c34e00;">Note</span> inwave, <span style="color: #009c00;">&quot;ring current normalized&quot;</span>&nbsp; <span style="color: #ff0000; font-style: italic;">// write into note that the normalization has been done</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// +++</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">return</span> valAvg &nbsp; <span style="color: #ff0000; font-style: italic;">// return the intensity normalization factor</span><br /> <span style="color: #0000ff;">End</span></div></div> <p> </p></span> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">9.00.x</span> <span class="entity-reference">8.00.x</span> <span class="entity-reference">7.00.x</span> <span class="entity-reference">6.30.x</span> </span> <section class="comment-section"> <article data-comment-user-id="15087" id="comment-21200" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/15087"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">Rob</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1613643573"></mark> <span class="comment-body"><p>Wow. That single handily replaces 90% of the scripts I use every day with one convenient panel!</p> <p>Thank you for sharing 😊</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21200&amp;1=default&amp;2=en&amp;3=" token="iDtWkgu4FFxLGU4Pw4omGPiVkLyH1VC2tS-FVC8EKaU"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 18, 2021 at 02:19 am - <a href="/comment/21200#comment-21200" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21216" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1613698229"></mark> <span class="comment-body"><p>Great to hear. Thank you for your comment! I think this tool saves me the most time as well (others are graph-related tools which I haven't put up here yet ;). I guess the other 10 % are specialized scripts only related to your field? Please let me know if there is a feature which would make your (and others) life easier.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21216&amp;1=default&amp;2=en&amp;3=" token="WI7FVmYKRcLuj-w7HHTD5icdHNHWFNF7mM4Wd5TWi10"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 18, 2021 at 05:30 pm - <a href="/comment/21216#comment-21216" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="10776" id="comment-22789" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/10776"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">olelytken</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1648026981"></mark> <span class="comment-body"><p>I couldn't help noticing the images for the Subtract Profile and Shift +/- sections. Those images look very similar to the Auger-yield NEXAFS data that we were battling with for a long time. In the end we used an iterative process to split up the data into vertical NECAFS and diagonal XPS contributions. If you are working with the same problems you might be interested in the paper.</p> <p>"Removing photoemission features from Auger-yield NEXAFS spectra" <a href="https://doi.org/10.1016/j.elspec.2017.05.012">https://doi.org/10.1016/j.elspec.2017.05.012</a></p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22789&amp;1=default&amp;2=en&amp;3=" token="8HhS1WAdQaDJYsN4p1WDQT1ySc-jx8RWNCd4idecPzU"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 23, 2022 at 02:16 am - <a href="/comment/22789#comment-22789" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-22790" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1648035501"></mark> <span class="comment-body"><p>Thank you for your comment and the link to the paper. I will take a look. Yes, this was exactly the reason for this functionality. The Subtract function relies on the fact that the XPS signal is present undisturbed in part of the scan and thus can be subtracted from the mixed image. We achieved this by simply measuring a sufficiently large range below the edge in question. This is of course complicated by second-order signal contributions, which are however often sufficiently small in our spectra. It might be interesting to add your approach to this package. What do you think?</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22790&amp;1=default&amp;2=en&amp;3=" token="2Sc35gFiHuV_Kw4Q4veKXzs2i46Uz_BNpi7I1A8q4NY"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 23, 2022 at 04:38 am - <a href="/comment/22790#comment-22790" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="10776" id="comment-22792" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/10776"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">olelytken</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1648058268"></mark> <span class="comment-body"><p>I did notice you expanded the kinetic energies far enough to where the Auger peaks are gone. I guess there are still some secondary electrons left, but it's good enough to where you can extract a reasonable XPS spectrum and subtract it.</p> <p>If you want to try my approach out you can find it here <a href="http://www.wavemetrics.com/project/EccentricXPS">www.wavemetrics.com/project/EccentricXPS</a><br /><br /> There is a pretty good help file and an example .pxp file you can test the cleanup procedure on. If you think it would fit into your package I would be happy to help you add it, but it's probably best if you test it first and see if you think it will fit.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22792&amp;1=default&amp;2=en&amp;3=" token="SotJdwDdi0bR7uV6M7EFCAF4_QFnu-qbSEDjxzPpTJA"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 23, 2022 at 10:57 am - <a href="/comment/22792#comment-22792" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="10776" id="comment-22793" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/10776"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">olelytken</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1648059517"></mark> <span class="comment-body"><p>Load the examples file and run Photoemission Cleanup from the top menu</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=22793&amp;1=default&amp;2=en&amp;3=" token="LCwMluNe7Hpj6_QcsW8DVUCRBONtLK2HbC5XZK5nwcY"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 23, 2022 at 11:18 am - <a href="/comment/22793#comment-22793" hreflang="en">Permalink</a></p> </article> </section> Tue, 16 Feb 2021 03:44:27 +0000 chozo 21549 at https://www.wavemetrics.com Spectra Difference Generator - Subtract, add, divide or multiply two spectra with precise control https://www.wavemetrics.com/node/21539 Spectra Difference Generator - Subtract, add, divide or multiply two spectra with precise control <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/chozo" lang="" about="/user/chozo" typeof="schema:Person" property="schema:name" datatype="">chozo</a></span> <span>Thu, 02/04/2021 - 04:48 am</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/49" hreflang="en">Analysis</a></span> <span class="entity-reference"><a href="/taxonomy/term/41" hreflang="en">User Interface</a></span> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>This is a tool for conveniently aligning and comparing two (1D) data waves and calculate their difference, sum, product or quotient on the fly. The first input data is modified via controls while second input data acts as the reference to compare against. The former can be shifted, offset and scaled manually with respect to the reference to find the optimal overlap or to extract certain spectral features from the difference etc. The the original purpose was to calculate differences only (hence the name Difference Generator), but support for addition, multiplication, division and percent difference has been added. The <strong>percent (%) difference</strong> mode calculates the difference normalized by the average in %, <em>i.e.</em>, (A-B)/(A+B) * 200.</p> <p><strong>The underlying original data of both the edited wave and reference wave is never modified in any way.</strong> The comparison is handled with temporary data, and modifications (default wave ending "_mod") as well as the arithmetic result are always saved as new output waves. The default wave ending for the output is "_dif" for subtraction, "_sum" for addition, "_mul" for multiplication, "_div" for division and "_pdif" for % difference. All settings are saved in the output wave's notes and will be reloaded automatically upon restarting the tool with the same input. The program is fully folder aware.</p> <p>I tried my best to test everything thoroughly, but you should verify the correct behavior yourself to be sure. Bug reports and suggestions for new features are always welcome.</p> <h3>Graphical User Interface (GUI) controls</h3> <p>To start the user interface, select one or two (1D) waves in the Data Browser and then go to <strong>'Spectra Tools' -&gt; 'Compare and Modify Spectra ....'</strong> in the top menu. Or use the command line:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;">SpectraDifferenceGenerator<span style="color: #000000;">&#40;</span>EditWave<span style="color: #000000;">&#41;</span><br /> or<br /> SpectraDifferenceGenerator<span style="color: #000000;">&#40;</span>EditWave,refwave=ReferenceWave<span style="color: #000000;">&#41;</span></div></div> <p>The second wave selected in the Data Browser (or the wave provided by the optional 'refwave' parameter) comes preselected as reference when starting the GUI. A quick overview of all controls can be found below:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="024cddf1-bd8d-4713-90fb-0fd24cacd33e" height="434" src="/sites/www.wavemetrics.com/files/users/user1029/DiffGen_manual_ver4.4.png" width="1024" /></p> <ul><li>The wave to modify and the reference wave are selected from the current folder. The current folder can be changed in the Data Browser during operation (while the GUI is open) to use waves from a different folder. The list of waves in the drop-down menu will reflect always the available 1D waves in the currently active folder.</li> <li>Both waves can be <strong>smoothed (Gaussian broadened)</strong>. The smoothing is saved in the modified output (ending '_mod'). The smoothing of the reference wave is only for display and to calculate the result, but is, of course, not actually applied to the original reference data. However, the smoothing setting is saved with the output and will be reapplied upon reloading. Use the <strong>home / end</strong> keyboard shortcuts to increase / decrease smoothing (holding alt/option will smooth the reference data).</li> <li>Chose the mode of operation in the drop-down menu: <strong>A-B subtraction (- keyboard key), A+B addition (+ key), A*B multiplication (* key) or A/B division (/ key)</strong>.</li> <li>The result can be inverted (flipped in Y direction) with the <strong>Invert</strong> checkbox (<strong>i key</strong>). The state of all checkboxes is saved with the output and will be reapplied upon reloading.</li> <li>The wave to modify can be moved in X / horizontal and Y / vertical directions using the <strong>arrow buttons</strong> (<strong>cursor keys</strong> on the keyboard).</li> <li>Scaling is done with the <strong>stretch (page up key)</strong> and <strong>shrink (page down key)</strong> controls.</li> <li>The delta step of each modification can be set using the variable controls to the left.</li> <li>Or use the controls for <strong>absolute changes</strong> to dial in the desired shift and scaling directly.</li> <li>Next to the controls for absolute changes are <strong>reset buttons</strong> for all modifications or individual changes of the X/Y shift or scaling.</li> <li><strong>Discard &amp; Quit</strong> will just close the interface without saving anything.</li> <li><strong>Save &amp; Quit</strong> will save the current state as output waves (edited wave name + "_mod" and "_dif" etc.) and then closes the interface. Optionally, the result is displayed in a new graph afterwards if the relevant checkbox is active. At the same time, all previous graphs with the same data set displayed are updated as well to reflect the new modification settings.</li> </ul><h4><strong>Additional keyboard shortcuts:</strong> </h4> <ul><li>Hold <strong>Command (Mac) / Ctrl (Win)</strong> for changes in steps of <strong>0.5</strong> times the current delta value.</li> <li>Hold <strong>Shift</strong> for changes in steps of <strong>10</strong> times the current delta value.</li> <li>Hold <strong>both Shift + Command / Ctrl</strong> for changes in steps of <strong>0.1</strong> times the current delta value.</li> <li><strong>r key</strong> to ‘Reset All'</li> <li><strong>p key</strong> to toggle ‘Pin Background’</li> <li>Hold <strong>Command (Mac)/ Ctrl (Win) while pressing ‘Reset All’</strong> and the reference wave will be set to none.</li> <li>Hold <strong>Command (Mac)/ Ctrl (Win) while pressing ‘Save &amp; Quit’</strong> to override quitting (save only, and the windows stays open). This can be used to compare many waves in quick succession, e.g., by selecting the next wave from the drop-down menu.</li> <li>Hold <strong>Option (Mac) / Alt (Win) while pressing ‘Save &amp; Quit’</strong> to force 'Use Ref. Name' for saving (this has the same function as the respective checkbox).</li> </ul><h3>How the result is saved</h3> <p>The result is saved next to the input wave (the data to edit) as 'wavename +  "_mod"' for the modified data and  'wavename +  "_dif"' (or "_sum", "_mul", "_div", "_pdif" depending on the mode) for the (inverted) result. All modification settings are saved inside the wave note of both of these output waves. Here is an example where 'first spectrum' was edited and 'second spectrum' was the reference:</p> <p><img alt="" data-entity-type="file" data-entity-uuid="619be378-1e96-4ef1-8d3b-457bb783c7d2" height="535" src="/sites/www.wavemetrics.com/files/users/user1029/DiffGen_save_example.png" width="318" /></p> <p>Loading the tool with the same initial data ('first spectrum' in this case) will reload the last session from the '_mod' or '_dif' wave (if '_mod' does not exist). Note that loading a '_dif' or '_mod' wave directly will just start a new session with this data (this makes it possible to create differences of differences etc.).The wave to edit and the reference wave can be in different folders. If neither a 'dif' (or 'sum', 'mul', 'div') or 'mod' wave with the same name is found in the input wave's folder, then the default settings are loaded. It is thus recommended to move the result and modified waves together with the original wave to a new folder to be able to reload the settings later. Then what will be reloaded if you have mixed result waves from summing, multiplying etc.? The loading hierarchy is 'mod' &gt; 'dif' &gt; 'sum' &gt; 'mul' &gt; 'div' &gt; 'pdif', and thus deleting the 'mod' and 'dif' waves will load the settings from the 'sum' wave if present. </p> <h4>What is the purpose of the 'Use Ref. Name' setting?</h4> <p>Imagine the following scenario: A 'baseline' data and then several spectra have been measured in succession like this:</p> <ol><li>baseline</li> <li>spectrum1</li> <li>spectrum2</li> <li>spectrum3</li> <li>...</li> </ol><p>Lets assume you want to remove the baseline wave from all the spectra, but the spectra should not be modified (for example, to preserve their relative shift or intensity). This is achieved by modifying (shifting, scaling etc.) the baseline for each spectrum individually and then saving the calculation result next to each spectrum. Load the baseline as wave to modify and one spectrum as reference, then do the modification (since the roles of edited wave and reference are reversed here, this usually means 'Invert' needs to be activated). Before saving check 'Use Ref. Name' to save the result next to each spectrum. This will give:</p> <ol><li>baseline</li> <li>baseline_mod</li> <li>spectrum1</li> <li>spectrum1_dif</li> <li>spectrum2</li> <li>spectrum2_dif</li> <li>spectrum3</li> <li>spectrum3_dif</li> <li>...</li> </ol><p>What if you reload spectrum1 but have conflicting settings in waves spectrum1_mod <em>and </em>spectrum1_dif? In this case spectrum1_mod is loaded according to the hierarchy 'mod' &gt; 'dif' &gt; 'sum' &gt; 'mul' &gt; 'div' &gt; 'pdif'.</p> <ul></ul><h3>Running your own code:</h3> <p>You can generate comparisons of two waves using the function: </p> <span class="geshifilter"><code class="igor geshifilter-igor">WaveArithmeticKernel<span style="color: #000000;">&#40;</span>WaveArithmeticStruct <span style="color: #c34e00;">s</span><span style="color: #000000;">&#41;</span></code></span> <p>The WaveArithmeticStruct structure looks like this:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Structure</span> WaveArithmeticStruct<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> mode &nbsp; <span style="color: #ff0000; font-style: italic;">// mode: 1: Subtract (A-B) 2: Add (A+B) 3: Multiply (A*B) 4: Divide (A/B)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> orgWave&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// [mandatory] wave to compare 1 - will NOT be modified</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> refWave&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// [mandatory] wave to compare 2 - will NOT be modified</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> cmpWave&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// [mandatory] result of comparison between orgWave and refWave</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> modWave&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// [optional] modified wave - saves modifed version of orgWave</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> modRefWave <span style="color: #ff0000; font-style: italic;">// [optional] modified ref. wave - saves smoothed version of refWave</span><br /> <span style="color: #ff0000; font-style: italic;">// optional input parameters:</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> orgSmooth&nbsp; <span style="color: #ff0000; font-style: italic;">// amount of smoothing for wave 1 (default 0)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> refSmooth&nbsp; <span style="color: #ff0000; font-style: italic;">// amount of smoothing for wave 2 (default 0)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> baselineYval &nbsp; <span style="color: #ff0000; font-style: italic;">// y value of the baseline (default 0)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> baselineXval &nbsp; <span style="color: #ff0000; font-style: italic;">// x position of the baseline (default NaN)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> baselineFixed&nbsp; <span style="color: #ff0000; font-style: italic;">// baseline is omitted from Y scaling if set to 1 (default 0)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> invert <span style="color: #ff0000; font-style: italic;">// invert the output in Y (default 0)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> xShift <span style="color: #ff0000; font-style: italic;">// modify wave 1: x displacement (in wave's units)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> yShift <span style="color: #ff0000; font-style: italic;">// modify wave 1: y displacement (offset)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> yScale <span style="color: #ff0000; font-style: italic;">// modify wave 1: y scaling (default 1)</span><br /> <span style="color: #0000ff;">EndStructure</span></div></div> <p>In your code, use the structure to pass the input waves and desired parameters to the function. You need to pass at least the two input (orgWave and refWave) and one output wav (cmpWave; this one will be overwritten). A simple example code could look like this:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Function</span> CompareTest<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">Wave</span> wave1, <span style="color: #0000ff;">Wave</span> wave2<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">STRUCT</span> WaveArithmeticStruct <span style="color: #c34e00;">s</span><br /> &nbsp; &nbsp; WaveArithmeticInitialize<span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span><span style="color: #000000;">&#41;</span> <span style="color: #ff0000; font-style: italic;">// initialize structure parameters with defaults</span><br /> &nbsp; &nbsp; <span style="color: #007575;">Duplicate</span><span style="color: #000000;">/</span>O wave1, $<span style="color: #000000;">&#40;</span><span style="color: #c34e00;">NameOfWave</span><span style="color: #000000;">&#40;</span>wave1<span style="color: #000000;">&#41;</span>+<span style="color: #009c00;">&quot;_dif&quot;</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> <span style="color: #c34e00;">s</span>.cmpWave = $<span style="color: #000000;">&#40;</span><span style="color: #c34e00;">NameOfWave</span><span style="color: #000000;">&#40;</span>wave1<span style="color: #000000;">&#41;</span>+<span style="color: #009c00;">&quot;_dif&quot;</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> <span style="color: #c34e00;">s</span>.orgWave = wave1<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Wave</span> <span style="color: #c34e00;">s</span>.refWave = wave2<br /> &nbsp; &nbsp; <span style="color: #c34e00;">s</span>.refSmooth = <span style="color: #000000;">0.5</span> &nbsp; <span style="color: #ff0000; font-style: italic;">// smooth wave2 (optional; data will not be altered)</span><br /> &nbsp; &nbsp; <span style="color: #c34e00;">s</span>.xshift = -<span style="color: #000000;">0.02</span>&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// shift wave1 (optional; data will not be altered)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> statusmsg = WaveArithmeticKernel<span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span><span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #007575;">Print</span> statusmsg<br /> <span style="color: #0000ff;">End</span></div></div> <p>If the same wave endings (e.g., "_dif") are used then the output is fully compatible with the user interface, i.e., the same settings will be loaded when starting the interface with the same input waves.</p> <h3>Settings inside the procedure header</h3> <p>The procedure header contains several settings as static constants which are used by the user interface, and can be edited to your liking (but you should not mess with these unless really necessary):</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kModEnd&nbsp; = <span style="color: #009c00;">&quot;_mod&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kOutEnd&nbsp; = <span style="color: #009c00;">&quot;_dif;_sum;_mul;_div;_pdif;&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kAuxEnd&nbsp; = <span style="color: #009c00;">&quot;_smt;_int;_der;&quot;</span><br /> <span style="color: #ff0000; font-style: italic;">// the following constants define the string keys for saving and loading parameters from wave notes</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kScaleKey&nbsp; &nbsp; = <span style="color: #009c00;">&quot;Mod Scale&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kShiftKey&nbsp; &nbsp; = <span style="color: #009c00;">&quot;Mod Shift&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kOffsetKey &nbsp; = <span style="color: #009c00;">&quot;Mod Offset&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kModSmthKey&nbsp; = <span style="color: #009c00;">&quot;Mod Smooth&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kRefSmthKey&nbsp; = <span style="color: #009c00;">&quot;Ref Smooth&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kXCsrSetKey&nbsp; = <span style="color: #009c00;">&quot;Cursor Set&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kSetModeKey&nbsp; = <span style="color: #009c00;">&quot;Data difference;Data summed;Data multiplied;Data divided;Data percent-difference;&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kModeInvKey&nbsp; = <span style="color: #009c00;">&quot;Result inverted&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kPinBaseKey&nbsp; = <span style="color: #009c00;">&quot;Baseline scaled&quot;</span><br /> <span style="color: #0000ff;">static</span> <span style="color: #0000ff;">StrConstant</span> kRefNameKey&nbsp; = <span style="color: #009c00;">&quot;Reference name used&quot;</span></div></div> <ul><li>The name endings ("_dif", "_mod" etc.) for saving the result waves can be modified here, should there be a conflict with other names in your experiment (in fact, Igor's own Differentiate function will also use 'dif' as name ending).</li> <li>The string keys for saving the settings into the result wave's note are editable as well, but altering these keys might make saved results incompatible for reloading later (if these keys are changed again).</li> </ul></span> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">9.00.x</span> <span class="entity-reference">8.00.x</span> <span class="entity-reference">7.00.x</span> <span class="entity-reference">6.30.x</span> </span> <section class="comment-section"> <article data-comment-user-id="8" id="comment-21150" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/8"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> <img class="employee-badge" src="/profiles/wavemetrics/themes/wavemetrics/images/icons/employee-icon.png" /> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">johnweeks</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1612461523"></mark> <span class="comment-body"><p>Nice looking, chozo! It has a lot of features that aren't in the Wave Arithmetic panel.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21150&amp;1=default&amp;2=en&amp;3=" token="WJBezdbLiP0PN3FDyUpabqgj4GQjZB4QOA7hP2JcrMw"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 4, 2021 at 09:58 am - <a href="/comment/21150#comment-21150" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21153" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1612506259"></mark> <span class="comment-body"><p>Thank you John! As the name suggests, this project started to make it possible to create differences with manual control and instant feedback for extracting even minute differences between measurements. But now that you mention it, it has indeed some things in common with the Wave Arithmetic package. This actually gives me the idea to add division and multiplication to the package for completeness.</p> <p>EDIT: I have now updated the project to include four modes: Difference, sum, multiplication, and division.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21153&amp;1=default&amp;2=en&amp;3=" token="MAc9wLL3BofO9TppYCNwiPBdrzC-G2JJ1wHU6wXHsdM"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 4, 2021 at 06:14 pm - <a href="/comment/21153#comment-21153" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21394" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616053165"></mark> <span class="comment-body"><p>I am seeing a pattern here: it seems that spectroscopists keep toolbags of useful packages that do similar things. I have a procedure ("wave scale and subtract") that does some of the things your panel can do, but as usual your panel is more sophisticated and does a lot more.</p> <p>I will attach my little procedure here, just in case you are curious, but it doesn't do anything other than a small subset of what you do here.</p></span> <div class="comment-file-wrapper"> <label>Attachments</label> <span class="field-comment-file"> <label>Attachment</label> <span class="file"><span class="file file--mime-application-zip file--package-x-generic"><a href="https://www.wavemetrics.com/sites/www.wavemetrics.com/files/2021-03/ScaleSub106.zip" type="application/zip; length=4220">ScaleSub106.zip</a></span> </span> </span> </div> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21394&amp;1=default&amp;2=en&amp;3=" token="9XWk9f2DhDI9L_8yu-WUQc4glrklLpii2gG-V5HKV9I"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 17, 2021 at 05:17 am - <a href="/comment/21394#comment-21394" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="25" id="comment-21395" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/25"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/jjweimer/profile-images/2018-12/meimage.jpg" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">jjweimer</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615986486"></mark> <span class="comment-body"><p>At one point in the mid- to late 90's (Igor 3 to 4), the toolbox was collected under the package <a href="https://www.wavemetrics.com/project/SpXZeigR">SpXZeigR</a>. I had an entire suite of features, help files, and tutorials. You won't find the original anymore (I have it somewhere on an archived CD). You will find a scattering of references to it, including a doi article that I did not even know about until just now.</p> <p>I always wished to have had the time (and/or co-developers) to sustain the package.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21395&amp;1=default&amp;2=en&amp;3=" token="XsgDvTdDRu1BUZXVTVjgFOkjk8SqyVrf82Gz7fy5np0"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 17, 2021 at 06:08 am - <a href="/comment/21395#comment-21395" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21396" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615987546"></mark> <span class="comment-body"><p>Yes, I remember SpXZeigR, and I had that and other packages in mind when I wrote the comment. I had already developed a set of tools more specific to the techniques I was using at that time, so SpXZeigR never really entered my workflow.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21396&amp;1=default&amp;2=en&amp;3=" token="QgVzjOn-4e42j8viRyUXQ4tTu6oeQuLpZ76u5d7Dwgc"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 17, 2021 at 06:25 am - <a href="/comment/21396#comment-21396" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="25" id="comment-21397" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/25"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/jjweimer/profile-images/2018-12/meimage.jpg" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">jjweimer</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1615988324"></mark> <span class="comment-body"><p>RE SpXZeigR ... Sad as I am to see the package fade into the historical records, I am also glad to see a plethora of well-designed packages being provided to take its place.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21397&amp;1=default&amp;2=en&amp;3=" token="zrbP07NDWPoqJgshURDjPpu6CC77qIv1KugT1EwVK8Q"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 17, 2021 at 06:38 am - <a href="/comment/21397#comment-21397" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="8" id="comment-21401" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/8"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> <img class="employee-badge" src="/profiles/wavemetrics/themes/wavemetrics/images/icons/employee-icon.png" /> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">johnweeks</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616002989"></mark> <span class="comment-body"><p>I remember SpXZeigR. If tech support queries reflects popularity, it was fairly popular :)</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21401&amp;1=default&amp;2=en&amp;3=" token="tWZ-PX5TCIbltyXzvjqlw-Oy7j1c8E0wIUSOjDsOMZA"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 17, 2021 at 10:43 am - <a href="/comment/21401#comment-21401" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="25" id="comment-21402" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/25"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/jjweimer/profile-images/2018-12/meimage.jpg" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">jjweimer</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616008115"></mark> <span class="comment-body"><p>John: The support that WaveMetrics provided to sustain SpXZeigR was greatly appreciated.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21402&amp;1=default&amp;2=en&amp;3=" token="yG0aCOtHpUxvFZ1Ik99v2vmZKyWwFNONXGVrE-1LiJc"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 17, 2021 at 12:08 pm - <a href="/comment/21402#comment-21402" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="8" id="comment-21403" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/8"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> <img class="employee-badge" src="/profiles/wavemetrics/themes/wavemetrics/images/icons/employee-icon.png" /> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">johnweeks</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616022726"></mark> <span class="comment-body"><p>I didn't mean that it had lots of problems! No matter how well designed your package is, people will get into trouble. So any package that gets used a lot will generate some number of queries, regardless of its quality.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21403&amp;1=default&amp;2=en&amp;3=" token="YpXcuIS69I70fEVY8rQhT_d8GLiiRq_EnY8zZ5ZfE6A"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 17, 2021 at 04:12 pm - <a href="/comment/21403#comment-21403" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21404" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616036918"></mark> <span class="comment-body"><p>Tony, thank you for sharing your solution for this problem. It looks very nice and sufficient for the task (I would miss the shift in x, though). I hope the DiffGen project will be of use for you (and others) then. Yes, the problems and solutions of people in the community seem to be similar. Good thing, that there is a place to share. I am happy that I didn't have to come up with the ~10 projects I am using from the site (mostly your stuff, Tony). :)</p> <p>By the way, I didn't know or use SpXZeigR. Must have been before my time. ;)</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21404&amp;1=default&amp;2=en&amp;3=" token="d-WVmc8tu7o7bnTBp-8AUImTvpKeh6PgQBlok6wALsQ"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 17, 2021 at 08:08 pm - <a href="/comment/21404#comment-21404" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21406" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616052882"></mark> <span class="comment-body"><p>And before SpXZeigR there was technical note 020...</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21406&amp;1=default&amp;2=en&amp;3=" token="uF0I3dWHxNerQ6OdWYdNQmxfm-6u8Z1iBHRz1X-hAmQ"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 18, 2021 at 12:34 am - <a href="/comment/21406#comment-21406" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="8" id="comment-21408" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/8"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> <img class="employee-badge" src="/profiles/wavemetrics/themes/wavemetrics/images/icons/employee-icon.png" /> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">johnweeks</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1616088764"></mark> <span class="comment-body"><p>Tech Note 20 still exists in all its variants. And it still works!!! But the tools you folks have been making available are far superior.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21408&amp;1=default&amp;2=en&amp;3=" token="lVMFo4o8gb38bkvB0G9nNkyy2RlWCkDAPV8h3xzZKYA"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">March 18, 2021 at 10:32 am - <a href="/comment/21408#comment-21408" hreflang="en">Permalink</a></p> </article> </section> Thu, 04 Feb 2021 12:48:06 +0000 chozo 21539 at https://www.wavemetrics.com Spectra Background Remover - Subtract common spectroscopic background functions https://www.wavemetrics.com/node/21532 Spectra Background Remover - Subtract common spectroscopic background functions <span class="field-os-compatibility"> <span class="entity-reference"><a href="/taxonomy/term/27" hreflang="en">Windows</a></span> <span class="entity-reference"><a href="/taxonomy/term/26" hreflang="en">Mac-Intel</a></span> </span> <span><a title="View user profile." href="/user/chozo" lang="" about="/user/chozo" typeof="schema:Person" property="schema:name" datatype="">chozo</a></span> <span>Fri, 01/22/2021 - 08:49 pm</span> <span class="field-project-type"> <span class="entity-reference"><a href="/taxonomy/term/49" hreflang="en">Analysis</a></span> <span class="entity-reference"><a href="/taxonomy/term/41" hreflang="en">User Interface</a></span> <span class="entity-reference"><a href="/taxonomy/term/40" hreflang="en">Utilities</a></span> </span> <span class="body"><p>This project provides functionality for calculating and removing (subtracting) backgrounds from (1D) data. The main purpose is to correct inelastic scattering backgrounds from photoemission spectra, but some general background types for other purposes are included as well. Both an user interface for interactively subtracting backgrounds as well as a function for calculating backgrounds from input data is provided.</p> <p>Note that it is always better, if possible, to directly include the correct background function into curve fitting directly instead of subtracting data 'by hand' for analysis. Most of the background types provided in this tool are also found as fit functions in the Multipeak-fit package (version 3) for Igor 9.</p> <p>I tried my best to test everything thoroughly, but you should verify the correct behavior yourself for critical applications. Bug reports and suggestions for new features are welcome.</p> <ul></ul><h3>Basic controls in the user interface:</h3> <p>To start the user interface, select a (1D) wave in the Data Browser and then select  'Spectra Tools' -&gt; 'Background Subtraction ...' in the top menu. Or use the command line:</p> <span class="geshifilter"><code class="igor geshifilter-igor">BackgroundSubtractGUI<span style="color: #000000;">&#40;</span>mydata<span style="color: #000000;">&#41;</span></code></span> <p><img alt="" data-entity-type="file" data-entity-uuid="b5bcd9d5-55f8-4426-aad9-0388173ecd83" height="451" src="/sites/www.wavemetrics.com/files/users/user1029/BackRem_screenshot_ver1.50.png" width="759" /></p> <ul><li><strong>Subtract:</strong> Subtracts the current background (blue trace) from the data and then works with the subtracted data. This can be used to successively subtract multiple types of backgrounds one after another.</li> <li><strong>Undo All:</strong> Reverts to the initial data.</li> <li><strong>Type:</strong> Select the desired background function here.</li> <li><strong>Fuzzy Range:</strong> The range is marked with the cursors and the Y height of the current data is used as start- and endpoints. The data is averaged over a certain range to smooth out noise. Set to zero if the range should end at the exact cursor location</li> <li><strong>Left &amp; Right Cursor:</strong> Shows and modifies the cursor positions, which mark the effective range for the background calculation. The cursors can be dragged directly in the graph as well.</li> <li><strong>Export Background:</strong> Saves the current background (blue trace; name ending "_bck") and current preview of the subtracted data (green trace; ending "_net") next to the input data.</li> <li><strong>Plot After Export:</strong> Activate to create a separate plot of the exported data when pressing the Export Background button.</li> <li><strong>Overwrite &amp; Quit:</strong> Overwrites the original data with the current spectrum (red trace). This will not have any effect on the original data if no background was subtracted in the first place.</li> <li><strong>Background-specific controls</strong> will appear for each background function, which are explained in tooltips.</li> </ul><h3>Included background types:</h3> <ul><li><strong>Constant:</strong> Subtract a constant value.</li> <li><strong>Step:</strong> Smooth step function which connects the two endpoints (using tanh()).</li> <li><strong>Linear:</strong> Linear function through the two endpoints.</li> <li><strong>Exponential:</strong> Normalized exponential function connecting the two endpoints.</li> <li><strong>Polynomial:</strong> Polynomial function fitted within the selected range.</li> <li><strong>Total Sum:</strong> The total sum inelastic scattering background after X. Li et al., J.Electron Spectrosc. Relat. Phenom. 63 (1993) 253-265</li> <li><strong>Shirley:</strong> The iterative Shirley inelastic scattering background after A. Proctor and P. A. Sherwood, Anal. Chem. 54, 13-19 (1982)</li> <li><strong>Tougaard:</strong> Three- and four-parameter universal scattering background after S. Tougaard, Surf. Interface Anal. 25: 137-154 (1997)</li> <li><strong>Tougaard Data:</strong> Scattering background using scattering cross-section data after S. Tougaard, Surf. Interface Anal. 25: 137-154 (1997).<br /> This data should have a positive X scale starting from zero and at least the same total energy range as the input spectrum, like this one:<br /><em>(data not starting from x = 0 will be padded with zeros, and data which is too short may give the wrong result)</em><br /><br /><img alt="" data-entity-type="file" data-entity-uuid="368c1f8d-88ce-4d2c-938c-943f27f4db4c" height="208" src="/sites/www.wavemetrics.com/files/users/user1029/BackRem_CSdata_example.png" width="334" /></li> </ul><h3>Running your own code:</h3> <p>You can generate backgrounds using the function:</p> <span class="geshifilter"><code class="igor geshifilter-igor">GenerateBackground<span style="color: #000000;">&#40;</span>backstruct, datawave, backwave, <span style="color: #000000;">&#91;</span>from, to<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span></code></span> <p>Populate the BackRemoveStruct structure with the desired parameters and provide both the original data (datawave) and a wave which the background will be written to (backwave). Both datawave and backwave need to have the same size and scaling. The 'from' and 'to' optional parameters are for setting the start and end positions of the background calculation in the wave's x scaling. If these parameters are omitted then the first and last points of the input data are used. Here is an example:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Function</span> backgroundtest<span style="color: #000000;">&#40;</span><span style="color: #0000ff;">Wave</span> inwave<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">STRUCT</span> BackRemoveStruct <span style="color: #c34e00;">s</span> &nbsp; &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// the structure contains all relevant parameters </span><br /> &nbsp; &nbsp; BackRemoveInitialize<span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span><span style="color: #000000;">&#41;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// initialize</span><br /> &nbsp; &nbsp; <span style="color: #c34e00;">s</span>.Functype=<span style="color: #009c00;">&quot;Shirley&quot;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// we use the Shriley background</span><br /> &nbsp; &nbsp; <span style="color: #007575;">Duplicate</span><span style="color: #000000;">/</span>O inwave, $<span style="color: #000000;">&#40;</span><span style="color: #c34e00;">NameOfWave</span><span style="color: #000000;">&#40;</span>inwave<span style="color: #000000;">&#41;</span>+<span style="color: #009c00;">&quot;_bck&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">/</span><span style="color: #0000ff;">Wave</span>=backwave<br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> statusmsg = GenerateBackground<span style="color: #000000;">&#40;</span><span style="color: #c34e00;">s</span>, inwave, backwave<span style="color: #000000;">&#41;</span><br /> &nbsp; &nbsp; <span style="color: #007575;">Print</span> statusmsg<br /> <span style="color: #0000ff;">End</span></div></div> <p>The BackRemoveStruct structure looks like this:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Structure</span> BackRemoveStruct<br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> FuncType &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// Constant, Step, Linear, Exponential, Polynomial, Total Sum, Shirley, Tougaard, Tougaard Data</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> avgPercent <span style="color: #ff0000; font-style: italic;">// y Values around range ends positions get averaged</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// function specific:</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> expScale &nbsp; <span style="color: #ff0000; font-style: italic;">// Exponential</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> polyDegree <span style="color: #ff0000; font-style: italic;">// Poly</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> fullLinear <span style="color: #ff0000; font-style: italic;">// Line</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// for Step</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> stepPos&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// x center position</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> stepSmooth <span style="color: #ff0000; font-style: italic;">// smoothing value</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// for Tougaard (universal CS parameters)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> TouB<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> TouC<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> TouD<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> TouT<br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> TouSmooth&nbsp; <span style="color: #ff0000; font-style: italic;">// how much the insulator step for parameter T0 will be smoothed (should not be 0)</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// Tougaard Data</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> CSscale&nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// scaling (default 1)</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">String</span> CSdata &nbsp; &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// name of CS wave in current folder</span><br /> &nbsp; &nbsp; <span style="color: #ff0000; font-style: italic;">// Shirley and Total Sum</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> followData <span style="color: #ff0000; font-style: italic;">// follow data outside range</span><br /> &nbsp; &nbsp; <span style="color: #0000ff;">Variable</span> smoothData <span style="color: #ff0000; font-style: italic;">// integer between 3 and 20</span><br /> <span style="color: #0000ff;">EndStructure</span></div></div> <p> </p></span> <span class="field-supported-version"> <label>Supported Igor Version</label> <span class="entity-reference">9.00.x</span> <span class="entity-reference">8.00.x</span> <span class="entity-reference">7.00.x</span> <span class="entity-reference">6.30.x</span> </span> <section class="comment-section"> <article data-comment-user-id="69" id="comment-21105" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1611397141"></mark> <span class="comment-body"><p>Very nice, Stephan. For years I have been meaning to add Shirley and Tougaard to the baselines package, but the only inelastic scattering stuff I do is Raman, no XPS or anything like that, so I never got around to it. This is great.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21105&amp;1=default&amp;2=en&amp;3=" token="8JKn6b2ceCfv7qYJzfxZ_Z_u_rkkydOFMbpaZwHV3tI"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">January 23, 2021 at 02:19 am - <a href="/comment/21105#comment-21105" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21106" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1611398396"></mark> <span class="comment-body"><p>This would make a more graceful exit if the data browser window is closed:</p> <div class="geshifilter"><div class="igor geshifilter-igor" style="font-family:monospace;"><span style="color: #0000ff;">Menu</span> <span style="color: #009c00;">&quot;Spectra Tools&quot;</span><br /> &nbsp; &nbsp; <span style="color: #009c00;">&quot;Background Subtraction ...&quot;</span>,<span style="color: #000000;">/</span><span style="color: #c34e00;">Q</span>, <span style="color: #007575;">CreateBrowser</span>;BackgroundSubtractGUI<span style="color: #000000;">&#40;</span><span style="color: #000000;">$GetBrowserSelection</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /> <span style="color: #0000ff;">End</span></div></div> <p> </p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21106&amp;1=default&amp;2=en&amp;3=" token="PcS_n9rqIGJw5L2hJGshPV54K8q6uAF2wuCQvLIIDU8"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">January 23, 2021 at 02:39 am - <a href="/comment/21106#comment-21106" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21107" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1611487250"></mark> <span class="comment-body"><p>For the buttons in the top left corner of the window to display properly on a mac, without text clipping, the minimum widths are about 63 and 114. Mac uses a larger font than windows for buttons (and doesn't allow you any say in the matter).</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21107&amp;1=default&amp;2=en&amp;3=" token="T3ChXywPvdp2JAC8qNFzOPFiDv0XjmV0bm5hbhuoxwA"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">January 24, 2021 at 03:20 am - <a href="/comment/21107#comment-21107" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21110" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1611540912"></mark> <span class="comment-body"><p>Tony, thank you very much for your kind comments. Getting useful comments like this is one of the reasons to finally release this tool here! In fact, I did not realize the problem with the data browser, since I cannot imagine running Igor without. ;) Also, thanks for the size check on Mac. I know about the size mismatch between the two OSs too well, but unfortunately don't have easy access to a Mac. I can 'lend' one from time to time, and will try to test my GUI design. I uploaded a small patch to address these points.</p> <p>I was using your baseline package in the past and found it very useful. Feel free to take any code from here if you find it useful to add to your package.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21110&amp;1=default&amp;2=en&amp;3=" token="ak0ElQt1u9nBZtC1uZ6Lgs1xB0xTjjUXroO4vXAl2SA"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">January 24, 2021 at 06:15 pm - <a href="/comment/21110#comment-21110" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="15087" id="comment-21162" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/15087"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">Rob</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1612880738"></mark> <span class="comment-body"><p>Hi Chozo</p> <p>I just thought I would say that this, along with your spectra difference script, will be extremely useful for so many people using Igor in the spectroscopy community. The work you have done on the multipeak package is equally awesome. It is all much appreciated, and it makes it much easier to recommend Igor as a solution that just works "out the box" for this type of analysis.</p> <p>All the best,</p> <p>Rob</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21162&amp;1=default&amp;2=en&amp;3=" token="rAB-5kH-dyDKbnmMXLeMEeP_b_NLQPwbu71fzmgwYfw"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 9, 2021 at 06:25 am - <a href="/comment/21162#comment-21162" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21168" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1612954233"></mark> <span class="comment-body"><p>Hi Robert,</p> <p>Thank you very much for your kind comment! I am super happy that these tools are of use for others. Did you already had the chance to test the new Multipeak Fit package? Just let me know if you find any bugs or have suggestions for improvements. I am currently polishing up a third project for release, which is inspired by the Image Profile code to work on 2D images (ARPES data, MCP images, energy scans etc.). I hope to get it out next week.</p> <p>Best wishes,</p> <p>Stephan</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21168&amp;1=default&amp;2=en&amp;3=" token="wrZMH9w_VIvvNtCr8thOZ-tlA1Labyme_dFfQp3CAYg"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 10, 2021 at 02:50 am - <a href="/comment/21168#comment-21168" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="15087" id="comment-21198" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/15087"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/default_images/Artboard%201_1.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">Rob</span> </div> <div class="clearit"></div> </a></span> <p class="visually-hidden">In reply to <a href="/comment/21168#comment-21168" class="permalink" rel="bookmark" hreflang="en">Hi Robert, Thank you very…</a> by <a title="View user profile." href="/user/chozo" lang="" about="/user/chozo" typeof="schema:Person" property="schema:name" datatype="">chozo</a></p> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1613644403"></mark> <span class="comment-body"><p>No problem. I have been using the new multipeak fit package. It is great and has already found it's way into my workflow and replacing my notably worse scripts for fitting voigt profiles. An easy way of fitting multiple Voigt functions with the two widths defined (rather than a shape parameter) is critical for so many of us and has really been lacking in Igor until now.</p> <p>I have not come across any bugs yet... but I will let you know! My only long-term comment would be setting advanced constraints is still somewhat unintuitive. Even adding some more check boxes to quikcly allow coefficients above K1 to all be set the same would be a time saver.</p> <p>Sorry for taking this thread off-topic! To bring it back on-topic, in case you didn't know, there is a problem installing the background remover project using the Project Updater. You get the error message: "Could not find packages at <a href="https://www.wavemetrics.com/project-releases/21532">https://www.wavemetrics.com/project-releases/21532</a>."</p> <p>Thanks again</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21198&amp;1=default&amp;2=en&amp;3=" token="gZHDMMPf1J_EyfnpHL4wr1QN1bxJwp7HOlts3Cf14v0"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 18, 2021 at 02:13 am - <a href="/comment/21198#comment-21198" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21215" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1613697854"></mark> <span class="comment-body"><p>Thank you for the report. I have fixed the project page now and the Updater should happily accept the package.</p> <p>OK, I will go a bit off-topic as well: If you have ideas or requests for the new Multipeak Fit then you should definitely write an email to the support. The WaveMetrics staff can otherwise not imagine what people want exactly, and I too have often just proposed / implemented what I need or what was on the request-list anyway. I think it would be a matter of half an hour to implement a checkbox for the height / area coefficient K2. For higher coefficients it may be a bit trickier, since not all peaks have them. Anyway, just let your wish-list be heard. :)</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21215&amp;1=default&amp;2=en&amp;3=" token="K7oD97pxILEQw_BBfYOGZydSxHnW0juyzai_TTXJej8"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 18, 2021 at 05:24 pm - <a href="/comment/21215#comment-21215" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="69" id="comment-21219" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/69"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/tony/profile-images/2018-12/tpic.jpeg" width="100" height="94" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">tony</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1613721074"></mark> <span class="comment-body"><p>What was it that prevented updater from installing the file? I worry that the code that parses the 'all releases' web page is a bit fragile. In fact, I'm tempted to change the installer and updater to use the latest release info from the main project page and ignore the all-releases page.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21219&amp;1=default&amp;2=en&amp;3=" token="sLebwCMRXfOs0UWdHHOD-nPM-_A0ldDxG5cxacC9cnc"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 18, 2021 at 11:51 pm - <a href="/comment/21219#comment-21219" hreflang="en">Permalink</a></p> </article> <article data-comment-user-id="1029" id="comment-21221" class="js-comment"> <span class="teaser-flag"><a class="user-profile-compact-wrapper" href="/user/1029"> <div class="user-compact-image-wrapper"> <span class="field-profile-picture"> <img src="/sites/www.wavemetrics.com/files/styles/thumbnail/public/chozo/profile-images/2022-03/WM%20Logo3.png" width="100" height="100" alt="" typeof="foaf:Image" class="thumbnail" /> </span> </div> <div class="user-compact-info-wrapper"> <span class="username-wrapper">chozo</span> </div> <div class="clearit"></div> </a></span> <div class="comment-body-wrapper"> <mark class="hidden" data-comment-timestamp="1613724776"></mark> <span class="comment-body"><p>Tony, I forgot to set the 'Version' field, which apparently makes the Updater think there is no release. I also found a small bug with the right-click menu, but I post that below the Updater project.</p></span> <div class="clearit"></div> <drupal-render-placeholder callback="comment.lazy_builders:renderLinks" arguments="0=21221&amp;1=default&amp;2=en&amp;3=" token="tGWH-tvYr5iCzfrtpKMqn66yJQjo8s4XG8RV660FL3Q"></drupal-render-placeholder> </div> <div class="clearit"></div> <p class="comment-post-date">February 19, 2021 at 12:52 am - <a href="/comment/21221#comment-21221" hreflang="en">Permalink</a></p> </article> </section> Sat, 23 Jan 2021 04:49:56 +0000 chozo 21532 at https://www.wavemetrics.com