ppPurge, purges .fio data, MCA and image files

The ppPurge macro purges .fio data, MCA and detectors files that have been measured using the repeat-on-condition feature.

#!/usr/bin/env python
__all__ = ["ppPurge"]

from sardana.macroserver.macro import Macro, Type
import HasyUtils
import os, shutil

class ppPurge(Macro):
    post-processing-purge on data that have been taken with the
    repeat-on-condition feature. The .fio file is used to
    find the points with identical x-values. The invalid points
    are removed and also the invalid MCA files and images.
    - purges /<ScanDir>/prefix_01234.fio
    - purges MCA files /<ScanDir>/<scanName>
    - purges images in /<ScanDir>/<scanName>/<detector>
    - processes the most recent files, if scanID is not specified

    Environment variables: ScanDir, ScanFile, ScanID

    Here is an example for a directory structure that is ppPurge-compliant.

      the .fio file
      the MCA files:
      the images

    The names pilatus300k and pilatus1M are defined, e.g., by the
    vc_exectutor script (see the DESY Sardana/Spock/Taurus manual). 
    They can be chosen at will.


    result_def = [['result', Type.Boolean, None, 'ppPurge return status']]
    param_def = [['scanID', Type.Integer,  -1, 'Overrides the env-variable ScanID (optional)']]