contents

purge_pha

Called by:   main after convergence has been reached.

Includes:   iscloc.h

External:   purge_resid set in read_config.

Input arguments:
Pointer to event structure.
Pointer to solution structure.
Array of phase structures.

Calls: print_pha if diagnostic is on.

Structure members updated:
purged in phase structure.
phases_purged in solution structure.
converged in solution structure.

Return:   0/1 for success/failure.

This function will do nothing unless phases_purged in the solution structure is set to 0.  phases_purged may be 1 for two reasons - either the operator gave the no_purge_phase instruction, in which case purge_phase in the event structure will be 0 and  phases_purged is set to 1 by init_sol, or phase purging has already been carried out.  Once this function has been called once it will set phases_purged to 1 so that it will not do anything if it is called again.

Phases are purged, i.e. the value of purged in a phase structure is set to 1, if they have a residual and its absolute value is greater than purge_resid, a threshold set in config.txt.  In addition phases without a residual will be purged if another phase from their reading has been purged and no phases form that reading are being used.  This is done to allow whole readings to be unassociated if all the phases with residuals have been purged.  If every phase form a reading has been purged then purged is set to 2 for all of them - this is used to exclude these phases during data output so that they can potentially be reused in another event.

If any phases have been purged by this function it will set converged in the solution structure to 0 so that the iteration process will restart with the most recent solution as a starting point and without the purged phases.  Note that the iteration process may be restarted after the first convergence regardless of whether any phases have been purged or not because weighting_type may have been changed in function change_weighting, which also updates converged in the  solution structure if it does anything.