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
        /gpfs/current/raw/au_00456.fio
      the MCA files:
        /gpfs/current/raw/au_00456/au_00456_mca_s1.fio
        /gpfs/current/raw/au_00456/au_00456_mca_s2.fio
        ...
      the images
        /gpfs/current/raw/au_00456/pilatus300k/au_00456_00001.cbf
        /gpfs/current/raw/au_00456/pilatus300k/au_00456_00002.cbf
       ...
        /gpfs/current/raw/au_00456/pilatus1M/au_00456_00001.cbf
        /gpfs/current/raw/au_00456/pilatus1M/au_00456_00002.cbf
       ...

    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)']]



2019-11-13