Self-constrained inversion of potential fields