joferkington / mplstereonet

Stereonets for matplotlib
MIT License
189 stars 66 forks source link

Update stereonet_math.py #40

Open JNDanielson opened 3 years ago

JNDanielson commented 3 years ago

Currently, the find_fisher_stats, fisher_stats, and mean_vector functions don't calculate Fisher k (kappa) or the mean vector of a group of poles correctly where the group of poles includes orientations which cross a dip=90° (e.g., subvertical joints with steeply north and south dipping orientations will have a flat mean orientation instead of a subvertical one - see example image). This is because the mean vector calc assumes that orientations have directions (i.e. are vector data), which is not true for most data plotted on stereonets, e.g. rock joints, which are really axial data. For axial data, the vectors x and -x are indistinguishable. See Issue joferkington#39 for an example of undesired results. image

This update uses the scatter matrix approach from Directional Statistics (Jupp and Mardia, 2000, pp.165) to estimate mean orientation and dispersion. This fixes the issue described above.

I suppose if the current behaviour is intended, we could add my tweaked functions as new functions or an option in the existing functions. Could modify the functions so that they include a data_type keyword and for data_type = 'axial', it uses the scatter matrix approach, for data_type = 'vector' is uses the current approach.