IBW read-only
ukos
I like to keep my measurement data as IBW and process those files for analysis.
It is very convenient to laod waves with symbolic linking to the original destination and it also saves a lot of disk space. I don't want to use Duplicate after the LoadWave operation as it will double the size of my experiments.
In order to not modify the measurement data within Igor Pro, I would like to write-protect it against changes. Is something like this possible or will I need to protect the files at the file-system level?
You can lock the wave using the SetWaveLock operation. This won't completely prevent the wave from being modified, but in most cases it does.
February 5, 2019 at 06:38 am - Permalink
That is indeed a nice functionality that I was not aware of. Thank you.
follow-up: Is it possible to check whether the IBW is a reference or if it was copied to the experiment?
February 5, 2019 at 07:37 am - Permalink
Sure, you can use WaveInfo and inspect the value of the PATH keyword. If that's an empty string, then the wave isn't a shared wave.
February 5, 2019 at 08:35 am - Permalink
In reply to That is indeed a nice… by ukos
I believe that you can use the IsSharedWave in the following code for this purpose but I am not sure that it is foolproof. It relies on the following behaviors:
1. Igor automatically creates a symbolic path when you load a wave as a shared wave
2. Igor does not allow you to kill a symbolic path that points to a disk folder containing a shared wave
3. If you overwrite a symbolic path pointing to a shared wave's disk folder, WaveInfo returns "_none_" for PATH, not "".
Make sure to read the comments in the code below carefully so that you understand what "shared wave" means.
Wave w
String info = WaveInfo(w, 0)
String pathStr = StringByKey("PATH", info)
return pathStr
End
// IsSharedWave(w)
// ******* NOTE: I believe this function is correct but I am not sure that that it is foolproof *******
// A "shared" wave is one that is stored outside of the current experiment.
// If the current experiment is packed, then a wave is shared if it is stored
// outside of the packed experiment file, i.e., in a standalone file.
// If the current experiment is unpacked, then a wave is shared if it is stored
// outside of its default disk folder. The default disk folder for a wave in
// the root data folder is the experiment folder. The default disk folder for
// a wave in a sub-data folder is the disk folder corresponding to that data folder.
Function IsSharedWave(w)
Wave w
String pathStr = GetWavesSymbolicPath(w)
if (strlen(pathStr) == 0)
return 0 // Packed wave or new wave not yet saved to disk
endif
if (CmpStr(pathStr,"home") == 0)
return 0 // Wave is stored in its default disk folder
endif
return 1
End
// IsHomeWave(w)
// A "home" wave is a wave that is stored in its default location.
// A home wave is a wave that is not shared. See IsSharedWave for details.
Function IsHomeWave(w)
Wave w
return !IsSharedWave(w)
End
February 5, 2019 at 08:48 am - Permalink
Thank you!!
February 5, 2019 at 09:59 am - Permalink