Magnification bias in galaxy surveys with complex sample selection functions | Synapse