Merge cands/noise files over all scans

def merge_scans(workdir, fileroot, scans, snrmin=0, snrmax=999):
    """ Merge cands/noise files over all scans """


    pkllist = [ff for ff in
               [os.path.join(workdir, 'cands_{0}_sc{1}.pkl'.format(fileroot, scan))
                for scan in scans] if os.path.exists(ff)]
    merge_cands(pkllist, outroot=fileroot, snrmin=snrmin, snrmax=snrmax)

    pkllist = [ff for ff in
               [os.path.join(workdir, 'noise_{0}_sc{1}.pkl'.format(fileroot, scan))
                for scan in scans] if os.path.exists(ff)]
    merge_noises(pkllist, fileroot)