solarwindpy.plotting.spiral
Spiral mesh plots and associated binning utilities.
Functions
|
|
|
Classes
|
|
|
|
|
|
|
|
|
2D spiral plotting with adaptive mesh refinement. |
- class InitialSpiralEdges(x, y)
Bases:
tuple- count(value, /)
Return number of occurrences of value.
- index(value, start=0, stop=sys.maxsize, /)
Return first index of value.
Raises ValueError if the value is not present.
- x
Alias for field number 0
- y
Alias for field number 1
- class SpiralMeshBinID(id, fill, visited)
Bases:
tuple- count(value, /)
Return number of occurrences of value.
- fill
Alias for field number 1
- id
Alias for field number 0
- index(value, start=0, stop=sys.maxsize, /)
Return first index of value.
Raises ValueError if the value is not present.
- visited
Alias for field number 2
- class SpiralFilterThresholds(density, size)
Bases:
tuple- count(value, /)
Return number of occurrences of value.
- density
Alias for field number 0
- index(value, start=0, stop=sys.maxsize, /)
Return first index of value.
Raises ValueError if the value is not present.
- size
Alias for field number 1
- get_counts_per_bin(bins, x, y)[source]
- calculate_bin_number_with_numba(mesh, x, y)[source]
- class SpiralMesh(x, y, initial_xedges, initial_yedges, min_per_bin=250)[source]
Bases:
object- __init__(x, y, initial_xedges, initial_yedges, min_per_bin=250)[source]
- property bin_id
- property cat
pd.Categoricalversion of bin_id, with fill bin removed.
- property data
- property initial_edges
- property mesh
- property min_per_bin
- property cell_filter_thresholds
- property cell_filter
Boolean
Seriesidentifying properly filled mesh cells.Series selects mesh cells that meet density and area criteria specified by
mesh_cell_filter_thresholds().Notes
Neither density nor size convert log-scale edges into linear scale. Doing so would overweight the area of mesh cells at larger values on a given axis.
- set_cell_filter_thresholds(**kwargs)[source]
Set or update the
mesh_cell_filter_thresholds().- Parameters:
density (scalar) – The density quantile above which we want to select bins, e.g. above the 0.01 quantile. This ensures that each bin meets some sufficient fill factor.
size (scalar) – The size quantile below which we want to select bins, e.g. below the 0.99 quantile. This ensures that the bin isn’t so large that it will appear as an outlier.
- set_initial_edges(xedges, yedges)[source]
- set_data(x, y)[source]
- set_min_per_bin(new)[source]
- initialize_bins()[source]
- static process_one_spiral_step(bins, x, y, min_per_bin)[source]
- generate_mesh()[source]
- calculate_bin_number()[source]
- place_spectra_in_mesh()[source]
- build_cat()[source]
- class SpiralPlot2D(x, y, z=None, logx=False, logy=False, initial_bins=5, clip_data=False)[source]
Bases:
PlotWithZdata,CbarMaker2D spiral plotting with adaptive mesh refinement.
Examples
splot = SpiralPlot2D(…) splot.initialize_mesh()
- __init__(x, y, z=None, logx=False, logy=False, initial_bins=5, clip_data=False)[source]
- property clim
- property initial_bins
- property grouped
- property mesh
- agg(fcn=None)[source]
Aggregate the z-values into their bins.
- build_grouped()[source]
- calc_initial_bins(nbins)[source]
- initialize_mesh(**kwargs)[source]
- set_clim(lower=None, upper=None)[source]
Set the min (lower) and max (upper) counts per bin.
This limit is applied after the
groupby.agg()is run.
- set_data(x, y, z, clip)[source]
- make_plot(ax=None, cbar=True, limit_color_norm=False, cbar_kwargs=None, fcn=None, alpha_fcn=None, **kwargs)[source]
- plot_contours(ax=None, label_levels=True, cbar=True, limit_color_norm=False, cbar_kwargs=None, fcn=None, plot_edges=False, edges_kwargs=None, clabel_kwargs=None, skip_max_clbl=True, use_contourf=False, **kwargs)[source]
Make a contour plot on ax using ax.contour.
- Parameters:
ax (mpl.axes.Axes, None) – If None, create an Axes instance from plt.subplots.
label_levels (bool) – If True, add labels to contours with ax.clabel.
cbar (bool) – If True, create color bar with labels.z.
limit_color_norm (bool) – If True, limit the color range to 0.001 and 0.999 percentile range of the z-value, count or otherwise.
cbar_kwargs (dict, None) – If not None, kwargs passed to self._make_cbar.
fcn (FunctionType, None) – Aggregation function. If None, automatically select in
agg().plot_edges (bool) – If True, plot the smoothed, extreme edges of the 2D histogram.
clabel_kwargs (None, dict) – If not None, dictionary of kwargs passed to ax.clabel.
skip_max_clbl (bool) – If True, don’t label the maximum contour. Primarily used when the maximum contour is, effectively, a point.
maximum_color – The color for the maximum of the PDF.
use_contourf (bool) – If True, use ax.contourf. Else use ax.contour.
gaussian_filter_std (int) – If > 0, apply scipy.ndimage.gaussian_filter to the z-values using the standard deviation specified by gaussian_filter_std.
gaussian_filter_kwargs (None, dict) – If not None and gaussian_filter_std > 0, passed to
scipy.ndimage.gaussian_filter()kwargs – Passed to
ax.pcolormesh(). If row or column normalized data, norm defaults to mpl.colors.Normalize(0, 1).
- property clip
- property data
- property labels
- property log
- property logger
- property path
Path for saving figure.
- set_labels(**kwargs)
Set or update x, y, or z labels. Any label not specified in kwargs.
is propagated from self.labels.<x, y, or z>.
- set_log(x=None, y=None)
- set_path(new, add_scale=True)
Build the plot save path.