Python photometric routine for fits files