Documentation ¶
Index ¶
- func FilterPoints(rs []RingBuffer, levels int, h float64) (pxs, pys [][]float64, ok bool)
- func GaussianKDE(xs []float64, h, low, high float64, n int) *intr.Spline
- func PennaCoeffs(xs, ys, zs []float64, I, J, K int) []float64
- func Smooth(xs, ys []float64, window int, opts ...SmoothOption) (vals, derivs []float64, ok bool)
- func SplashbackRadius(rs, rhos, derivs []float64, opts ...SplashbackRadiusOption) (r float64, ok bool)
- type KDETree
- func (kt *KDETree) FilterNearby(rs, ths []float64, level int, dr float64) (fRs, fThs []float64, idxs []int)
- func (kt *KDETree) GetConnMaxes(level int) (rs, ths []float64)
- func (kt *KDETree) GetRFunc(level int, rt RFuncType) func(float64) float64
- func (kt *KDETree) H() float64
- func (kt *KDETree) PlotLevel(level, spIdx int, opts ...interface{})
- type RFuncType
- type RingBuffer
- func (r *RingBuffer) Clear()
- func (r *RingBuffer) Init(n, bins int)
- func (r *RingBuffer) OkPlaneCoords(xs, ys []float64) (okXs, okYs []float64)
- func (r *RingBuffer) OkPolarCoords(rs, phis []float64) (okRs, okPhis []float64)
- func (r *RingBuffer) Splashback(h *los.Halo, ring int, window int, dLim float64)
- type Shell
- func (s Shell) AngularFractionProfile(samples, bins int, rMin, rMax float64) (rs, fs []float64)
- func (s Shell) Axes(samples int) (a, b, c float64, aVec [3]float64)
- func (s Shell) CartesianSampledVolume(samples int, rMax float64) float64
- func (s Shell) Contains(x, y, z float64) bool
- func (s1 Shell) DiffVolume(s2 Shell, samples int) float64
- func (s1 Shell) MaxDiff(s2 Shell, samples int) float64
- func (s Shell) MeanRadius(samples int) float64
- func (s Shell) MedianRadius(samples int) float64
- func (s Shell) RadialRange(samples int) (low, high float64)
- func (s Shell) RadiusHistogram(samples, bins int, rMin, rMax float64) (rs, ns []float64)
- func (s Shell) SurfaceArea(samples int) float64
- func (s Shell) Volume(samples int) float64
- type SmoothOption
- type SplashbackRadiusOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FilterPoints ¶
func FilterPoints( rs []RingBuffer, levels int, h float64, ) (pxs, pys [][]float64, ok bool)
FilterPoints applies the filtering algorithm from section 2.2.3 of Mansfield, Kravtsov, & Diemer (2016) to the points contained in each of a collection of RingBuffers.
This function is mostly just a wrapper around functions from kde.go.
func GaussianKDE ¶
GaussianKDE calculates a gaussian KDE from the points in the array xs, which kernel widths of h. This is done by evaluating the KDE at n uniformly-spaced points between low and high and then returning a cubic Spline fit through these points.
func PennaCoeffs ¶
PennaCoeffs calculates the Penna-Dines coefficients corresponding to the parameters I, J, and K for a set of input points.
func Smooth ¶
func Smooth( xs, ys []float64, window int, opts ...SmoothOption, ) (vals, derivs []float64, ok bool)
Smooth returns a smoothed 1D series as well as the derivative of that series using a Savitzky-Golay filter of the given size. It also takes optional arguments which allow the smoothing to be done in-place.
func SplashbackRadius ¶
func SplashbackRadius( rs, rhos, derivs []float64, opts ...SplashbackRadiusOption, ) (r float64, ok bool)
SplashbackRadius returns the point of steepest slope for a density profile. It also allows for optional callbacks.
Types ¶
type KDETree ¶
type KDETree struct {
// contains filtered or unexported fields
}
KDETree is a data structure that maintains all the state required for the recursive KDE-based filtering used by Shellfish.
func NewKDETree ¶
NewKDETree performs filtering fo points using the recursive KDE-based filtering described in section 2.2.3 of Mansfield, Kravtsov, Diemer (2016).
splits is the number of levels of recursion minus one.
func (*KDETree) FilterNearby ¶
func (kt *KDETree) FilterNearby( rs, ths []float64, level int, dr float64, ) (fRs, fThs []float64, idxs []int)
FilterNearby returns all the points which are within dr of the filtering curve at the specified level of recursion.
func (*KDETree) GetConnMaxes ¶
GetConMaxes returns the location of the anchor points at a given level of recursion.
type RFuncType ¶
type RFuncType int
Don't worry about this type, just always set it to Cartesian 100% of the time.
type RingBuffer ¶
type RingBuffer struct {
PlaneXs, PlaneYs []float64 // x and y coords in the plane of the ring.
Xs, Ys, Zs []float64 // Cartesian coords in the simulation box.
Rs, Phis []float64 // r and phi coords in the plane of the ring.
Oks []bool // Corresponds to a valid splashback point.
N, Bins int
// contains filtered or unexported fields
}
RingBuffer contains the locations of candidate splashback radii for a single ring of a LOS profiles. They are stored in multiple forms: x and y within the plane of the ring, x, y, and z in the coordinate system of the simulation, and r and phi within the plane of the ring. It also contains a bunch of buffers to prevent useless allocations in various operations.
func (*RingBuffer) Clear ¶
func (r *RingBuffer) Clear()
Clear clears all the values contained within a RingBuffer.
func (*RingBuffer) OkPlaneCoords ¶
func (r *RingBuffer) OkPlaneCoords(xs, ys []float64) (okXs, okYs []float64)
OkPlaneCoords returns the within-plane x and y coordinates where r.Oks is true.
func (*RingBuffer) OkPolarCoords ¶
func (r *RingBuffer) OkPolarCoords(rs, phis []float64) (okRs, okPhis []float64)
OkPlaneCoords returns the within-plane r and phi coordinates where r.Oks is true.
func (*RingBuffer) Splashback ¶
Splashback calculates the candidate splashback radius for a given line of sight and stores the relevant information in the RingBuffer.
type Shell ¶
Shell is a function that returns the radius of a shell at a given set of angles.
Unless otherwise specified, all quantities are calculated through Monte Carlo solid angle sampling.
func PennaFunc ¶
PennaFunc returns a shell function correpsonding to a particular set of Penna-Dines coefficients.
func PennaVolumeFit ¶
PennaVolumeFit fits a Penna-Dines shell to a set of points constrained to a collection of planes belong to an los.Halo object.
This function is essentially just a wrapper around PennaCoeffs.
func (Shell) AngularFractionProfile ¶
AngularFractionProfile the percentage of lines of sight at a given radius which are inside the shell. (Note: it doesn't just perform the brute force Monte Carlo calculation at every radius, so don't worry about the number of bins having an effect on the performance.)
func (Shell) Axes ¶
Axes calculates the moment of inertia-equivalent axes of a Shell as well as the direction of the major axis.
func (Shell) CartesianSampledVolume ¶
CartesianSampledVolume returns the volume of a Shell. The volume is calculated by Monte Carlo sampling of a sphere of radius rMax.
This is slower than Volume for most shell shapes.
func (Shell) Contains ¶
Contains returns true if a Shell contains a point and false otherwise. The point must be in a coordinate system in which the Shell is at (0, 0, 0).
func (Shell) DiffVolume ¶
DiffVolume returns the volume of the space between two Shells, s1 and s2.
func (Shell) MaxDiff ¶
MaxDiff returns the maximum radial distance between two Shells along any line of sight.
func (Shell) MeanRadius ¶
MeanRadius returns the angle-weighted mean radius of a Shell.
func (Shell) MedianRadius ¶
MedianRadius returns the angle-weighted median radius of a Shell.
func (Shell) RadialRange ¶
RadialRange returns the maximum and minimum radius of a Shell.
func (Shell) RadiusHistogram ¶
RadiusHistogram returns a normalized angle-weighted histogram of the radii of a Shell.
func (Shell) SurfaceArea ¶
SurfaceArea returns the surface area of a shell.
type SmoothOption ¶
type SmoothOption internalSmoothOption
SmoothOption is an abstract data type which allows for the customization of calls to Smooth without cluttering the call signature in the common case. This works similarly to kwargs in other languages.
func Derivs ¶
func Derivs(derivs []float64) SmoothOption
Derivs supplies Smooth with a slice which smoothed derivatives can be written to.
func Vals ¶
func Vals(vals []float64) SmoothOption
Vals supplies Smooth with a slice which smoothed values can be written to.
type SplashbackRadiusOption ¶
type SplashbackRadiusOption internalSplashbackRadiusOption
func DLim ¶
func DLim(dLim float64) SplashbackRadiusOption
DLim sets limit for d ln(rho) / d ln(r) above which point cannot be the splashback radius.