spherical_kde
0.1.2
Diese Pakete ermöglichen es Ihnen, die Schätzung der Kerneldichte auf einer Kugel abzuschätzen. Vorschläge für Verbesserungen/Erweiterungen willkommen.
Das Grundprinzip besteht darin, die traditionelle Gaußsche Funktion zu ersetzen, die bei der Schätzung der Kernendichte durch die von Mises-Fisher-Verteilung verwendet wird.
Die Bandbreitenschätzung ist immer noch rau.
Importieren Sie Numpyfrom Spherical_kde import SphericalkDeimerport Matplotlib.PyPlot As Pltimport Cartopopie (10, 10)) gs_vert = gridSpec (3, 1) gs_lower = gridspecfromsuBLotSpec (1, 2, subplot_spec = gs_vert [1]) Abb.Add_sublot (gs_vert [0], projection = cartopy.mollweide ()) Abb. add_subplot (gs_lower [0], projection = cartopy.crs.orthographic ()) Abb.Add_subplot (gs_lower [1], projection = cartopy.crs.orthographic (-10, 45)) Abb.Add_sublot (GS_VERT [2], Proviant = Cartopy.crs.PlateCarree ())# Wählen Sie Parameter für ProbensAmples = 100pi = numph.pi# Erzeugen Sie einige Proben, die auf (1,1) +/- 0.3 radiansheta_samples = numpy.random.normal (loc = 1, Skala = 0,3) erzeugt werden. , size = nsamples) phi_samples = numpy.random.normal (loc = 1, scale = 0,3, size = nsamples) phi_samples = numpy.mod (phi_samples, pi*2) kde_green = sphericalkde (Phi_Samples, theta_samples)# auf (-1,1) +/- 0.4 radiansheta_samples = numph.random.normal (loc = 1, scale = 0,4, size = nsamples) phi_samples = numpy.random.normal (loc = -1, scale = 0,4, size = nsamples) phi_samples = numpy.mod (phi_samples, pi*2) kde_red = sphericalkde (phi_samples, theta_samples)# Erzeugen Sie eine Verbreitung von Proben entlang der Breitengrad 2, Höhe 0,1theta_samples = numpy.random.norm.norm (local = 2, scale = 0,1). size = nsamples) phi_samples = numpy.random.uniform (niedrig = -pi/2, hoch = pi/2, size = nsamples) phi_samples = numpy.mod (phi_samples, pi*2) kde_blue = sphericalkde (phi_Ssamples, theta_samples, bandwidthththththththththththththththththththththththththththththththththththththththththththththththththththththththththththththetheththetheththethethethethethththethethethethethethethethetapl. = 0,1) für AX in Abb. AXES: AX.SET_Global () ax.Gridlines () ax.coastlines (linewidth = 0.1) kde_green.plot (ax, 'g') kde_green.plot_samples (ax) kde_red.plot (axa, ax (axe 'r') kde_blue.plot (ax, 'b')# speichern auf plotFig.tight_layout () Abb.SaveFig ('plot.png'))