contents

Outline of Program Flow

Main program
Read filenames, options, and constants from configuration file. [read_config]
Open output stream for log of actions. Open output stream for ISF events. (optional)
Event loop - repeated for each line of instructions received
Read instruction line. [read_instruction]
Read in data for next event from database or ISF file. [get_data or read_isf_event]
Use instructions to update event structure. [init_event]
Rank hypocentres for use as seeds. [rank_hyp]
Option loop - repeated for each option or until convergence
Set number of unknowns for this option.

Seed loop - repeated for each hypocentre or until convergence
Reset solution structure for new seed. [init_sol]
Reset purged flag in phase structures.

Solution loop - repeated until convergence/divergence
Calculate delta and azimuth for each phase. [calc_delaz]
Calculate depth phase depth [calc_depdp] if required to fix solution.
Choose ISC phase code for each phase. [id_pha]
Set weight_factor for each phase. [get_weight_factor]
Recognise duplicate phases and flag them accordingly. [mark_duplicates]
Obtain residual and derivatives for suitable phases. [calc_resid]
Set weight for each phase. [calc_weight]
Solve equations and update solution structure. [solve]

If first convergence
Change weighting scheme (optional) [change_weighting]
Remove phases with large residuals (optional) [purge_pha]
Continue in solution loop if either of the above carried out.
Exit solution loop if convergence or diverging or max_iter reached
Exit seed loop if convergence or all seeds tried
Exit option loop if convergence or all options tried

If convergence
Calculate delta and azimuth for each phase. [calc_delaz]
Choose ISC phase code for each phase. [id_pha]
Obtain final residual for all phases. [calc_resid]
Calculate errors for solution. [calc_error]
Calculate magnitudes. [calc_netmag]
Calculate depth phase depth [calc_depdp]
Write solution to database (optional) [put_data]
Write solution to ISF file (optional) [write_isf_event]
Exit event loop