new file:   optictools.py