An optimal extraction algorithm for CCD spectroscopy | Synapse