path = os.getcwd()
    exprs = ["/????atoms.manta", "/????atoms.fits", "/????atoms_andor2.fits"]

    last = monitordir.get_last_shot(path, exprs)
    # print last
    current = monitordir.get_all_shots(path, exprs)
    # print current
    analyze_shot(last, args)

    from multiprocessing import Pool

    def a(x):
        return analyze_shot(x, args)

    def parallel_analyze(new):
        pool = Pool(4)
        ret = pool.map(a, new)
        pool.close()
        pool.join()
        return ret

    while 1:
        new = monitordir.waitforit_list(path, exprs, current=current)
        print
        print "List of shots to analyze:", new
        current = monitordir.get_all_shots(path, exprs)
        time.sleep(1)
        # parallel_analyze( new )
        for e in new:
            analyze_shot(e, args)