Storing the history of how a wave has been manipulated?
jjweimer
By storing and retrieving the scaling factor using the highest significant digits I can, it eliminates this error and returns the scaled wave to its original values (or at least with a significance so precise that Igor does not show a difference even when using print/D to sample the stored values in the wave).
This got me thinking ...
What might be the different ways to store a history about how a specific wave has been manipulated? Is there a best way to do this? Is there any sense of a standard way to do it?
WAVE wavenm
string notekey
string newValueStr
if(stringmatch(newValueStr,""))
note/k wavenm, removebykey(notekey,Note(wavenm),":","\r")
else
note/k wavenm, replacestringbykey(notekey,Note(wavenm)," "+newValueStr,":","\r")
endif
end
Function/S GetNote(wavenm,notekey)
WAVE wavenm
string notekey
return stringbykey(notekey,note(wavenm),":","\r")[1,inf]
end
For example, if I baseline a wave in a procedure, then I'll tack on this command:
SetNote(wavenm,"Baseline",num2str(baselineValue))
This will create a note entry of "Baseline: baselineValue" in the wave, that can then be retrieved with the following command:
baselineValue=str2num(GetNote(wavenm,"Baseline"))
To remove an entry, you simply have to set its value to an empty string, such as the following:
SetNote(wavenm,"Baseline","")
With this you can create a full construct of changes made to waves so they can be retrieved or undone, etc. Unfortunately you have to do this manually and keep track of the changes you make. However, you might be able to use this approach in a similar manner to append a revolving "recent history" of manipulations to the wave.
April 11, 2013 at 09:01 am - Permalink
I have used a similar approach to write to a wave note with XML Note Tools http://www.igorexchange.com/project/XMLNoteTools.
I wonder if a better approach exists than writing to the wave note? I think in particular of an interferometer system that I used that generated images in stages. One could go to any image, change the parameters associated with that image, and have the changes propagate throughout the entire steps afterward. This system clearly had a robust means to store history.
--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
April 11, 2013 at 09:33 am - Permalink
I agree it would be very nice to be able to augment some objects (particularly waves) with additional metadata besides notes, or create global user-defined objects that can include multiple waves, variables, and method code. To an extent folders can do this, but I've found dealing with them can be a bit of a burden. I think being able to create a simple structure pointer to a custom globally defined object would be far more straightforward.
April 11, 2013 at 10:10 am - Permalink