File MIES_MiesUtilities_BackupWaves.ipf

This file holds MIES utility functions for wave backup.

Functions

variable RestoreFromBackupWavesForAll(dfref dfr)

Looks for backup waves in the datafolder and recreates the original waves from them. The original waves do not need to be present. If present they are overwritten. This is different to RestoreFromBackupWavesForAll, where the original waves need to be existing.

variable CreateBackupWavesForAll(dfref dfr)

Create backup waves for all waves in the datafolder.

static string GetBackupNameOfWave(wave wv)
wave GetBackupWave_TS(wave wv)
wave CreateBackupWave(wave wv, variable forceCreation = defaultValue)

Create a backup of the wave wv if it does not already exist or if forceCreation is true.

The backup wave will be located in the same data folder and its name will be the original name with WAVE_BACKUP_SUFFIX appended. If the backup wave exists and the main type of the backup wave can be overridden by Duplicate/O then the wave reference of the backup wave is kept. Otherwise the main type is changed and the wave reference is not kept (e.g. backup wave is numerical, original wave is text)

wave GetBackupWave(wave wv)

Return a wave reference to the possibly not existing backup wave.

variable ReplaceWaveWithBackupForAll(dfref dfr)

Replace all waves from the datafolder with their backup.

wave ReplaceWaveWithBackup(wave wv, variable nonExistingBackupIsFatal = defaultValue, variable keepBackup = defaultValue)

Replace the wave wv with its backup. If possible the backup wave will be killed afterwards. If the backup wave exists then the wave reference of the restored wave stays the same. Thus the returned wave reference equals the wv wave reference.

Parameters:
  • wv – wave to replace by its backup

  • nonExistingBackupIsFatal – [optional, defaults to true] behaviour for the case that there is no backup. Passing a non-zero value will abort if the backup wave does not exist, with zero it will just do nothing.

  • keepBackup – [optional, defaults to false] don’t delete the backup after restoring from it

Returns:

wave reference to the restored data, in case of no backup an invalid wave reference