los

package
v0.0.0-...-e3578a0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

package los computes line of sight densities oriented in rings around a point.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadDensities

func LoadDensities(
	hs []HaloProfiles, hds []io.SheetHeader,
	files []string, buf *Buffers,
)

func LoadPtrDensities

func LoadPtrDensities(
	hs []*HaloProfiles, hds []io.SheetHeader,
	files []string, buf *Buffers,
)

func ParallelClearHaloProfiles

func ParallelClearHaloProfiles(hs []HaloProfiles)

func WrapHalo

func WrapHalo(hps []*HaloProfiles, hd *io.SheetHeader)

WrapHalo updates the coordinates of a slice of HaloProfiles so that they as close to the given sheet as periodic boundary conditions will allow.

Types

type Buffers

type Buffers struct {
	// contains filtered or unexported fields
}

func NewBuffers

func NewBuffers(file string, hd *io.SheetHeader, subsampleLength int) *Buffers

func (*Buffers) ParallelDensity

func (buf *Buffers) ParallelDensity(h *HaloProfiles)

func (*Buffers) ParallelRead

func (buf *Buffers) ParallelRead(file string, hd *io.SheetHeader)

func (*Buffers) Read

func (buf *Buffers) Read(file string, hd *io.SheetHeader)

type Halo

type Halo interface {
	GetRs(buf []float64)
	GetRhos(ring, losIdx int, buf []float64)
	MeanProfile() []float64
	MedianProfile() []float64
	Phi(i int) float64
	LineSegment(ring, losIdx int, out *geom.LineSegment)
	SheetIntersect(hd *io.SheetHeader) bool
	PlaneToVolume(ring int, px, py float64) (x, y, z float64)
	RMax() float64
}

Halo is a _very leaky_ abstraction around the different types of halos. Mainly provided as a convenience for the already terrible gtet_shell.go file.

type HaloProfiles

type HaloProfiles struct {
	geom.Sphere

	IsValid bool
	// contains filtered or unexported fields
}

HaloProfiles is a terribly-named struct which represents a halo and all its LoS profiles.

func (*HaloProfiles) Add

func (hp1 *HaloProfiles) Add(hp2 *HaloProfiles)

Add adds the contents of hp2 to hp1.

func (*HaloProfiles) Bins

func (hp *HaloProfiles) Bins() int

func (*HaloProfiles) ChangeCenter

func (hp *HaloProfiles) ChangeCenter(v *geom.Vec)

ChangeCenter updates the center of the halo to a new position. This includes updating several pieces of internal state.

func (*HaloProfiles) Clear

func (hp *HaloProfiles) Clear()

Clear resets the conents of the HaloProfiles.

func (*HaloProfiles) Count

func (hp *HaloProfiles) Count(t *geom.Tetra)

Count inserts the given tetrahedron such that the resulting profiles give tetrahedron overlap counts.

func (*HaloProfiles) Density

func (hp *HaloProfiles) Density(t *geom.Tetra, rho float64)

Density inserts a tetrahedron such that the resulting profiles give densities.

func (*HaloProfiles) GetRhos

func (hp *HaloProfiles) GetRhos(ring, prof int, out []float64)

func (*HaloProfiles) GetRs

func (hp *HaloProfiles) GetRs(out []float64)

func (*HaloProfiles) ID

func (hp *HaloProfiles) ID() int

func (*HaloProfiles) Init

func (hp *HaloProfiles) Init(
	id, rings int, origin *geom.Vec, rMin, rMax float64,
	bins, n int, boxWidth float64, opts ...Option,
) *HaloProfiles

Init initializes a HaloProfiles struct with the given parameters.

func (*HaloProfiles) LineSegment

func (hr *HaloProfiles) LineSegment(ring, prof int, out *geom.LineSegment)

func (*HaloProfiles) Mass

func (hp *HaloProfiles) Mass(rhoM float64) float64

Mass returns the mass of the halo as estimated by averaging the halo's profiles.

func (*HaloProfiles) MeanProfile

func (hp *HaloProfiles) MeanProfile() []float64

func (*HaloProfiles) MedianProfile

func (h *HaloProfiles) MedianProfile() []float64

func (*HaloProfiles) Phi

func (hp *HaloProfiles) Phi(prof int) float64

func (*HaloProfiles) PlaneToVolume

func (hp *HaloProfiles) PlaneToVolume(
	ring int, px, py float64,
) (x, y, z float64)

func (*HaloProfiles) Profiles

func (hp *HaloProfiles) Profiles() int

func (*HaloProfiles) RMax

func (hp *HaloProfiles) RMax() float64

func (*HaloProfiles) Reuse

func (hp *HaloProfiles) Reuse(id int, origin *geom.Vec, rMin, rMax float64)

func (*HaloProfiles) Rho

func (hp *HaloProfiles) Rho() float64

rho returns the total enclosed density of the halo as estimate by averaging the halo's profiles.

func (*HaloProfiles) Rings

func (hp *HaloProfiles) Rings() int

func (*HaloProfiles) SheetIntersect

func (hp *HaloProfiles) SheetIntersect(hd *io.SheetHeader) bool

SheetIntersect returns true if the given halo and sheet intersect one another and false otherwise.

func (*HaloProfiles) SphereIntersect

func (hp *HaloProfiles) SphereIntersect(s *geom.Sphere) bool

SphereIntersect returns true if the given halo and sphere intersect and false otherwise.

func (*HaloProfiles) TetraIntersect

func (hp *HaloProfiles) TetraIntersect(t *geom.Tetra) bool

TetraIntersect returns true if the given vector and tetrahedron overlap.

func (*HaloProfiles) VecIntersect

func (hp *HaloProfiles) VecIntersect(v *geom.Vec) bool

VecIntersect returns true if the given vector is contained in the given halo and false otherwise.

func (*HaloProfiles) VolumeToPlane

func (hp *HaloProfiles) VolumeToPlane(
	ring int, x, y, z float64,
) (px, py float64)

type Option

type Option internalOption

func Log

func Log(log bool) Option

func Rotate

func Rotate(phi, theta, psi float32) Option

type ProfileRing

type ProfileRing struct {
	Lines []geom.Line
	// contains filtered or unexported fields
}

ProfileRing is a ring of uniformly spaced profiles. The reported profiles are the average densities at each radial bin in the profile.

The saved format of the profiles is not neccessarily the same as the output format of the profiles, so they must be accessed with the Retreive method.

func (*ProfileRing) Angle

func (p *ProfileRing) Angle(i int) float64

Angle returns the angle that the line with the specified index points in.

func (*ProfileRing) Init

func (p *ProfileRing) Init(lowR, highR float64, bins, n int)

Init initializes a profile ring made up of n profiles each of which consist of the given number of radial bins and extend between the two specified radii.

func (*ProfileRing) Insert

func (p *ProfileRing) Insert(start, end, rho float64, i int)

Insert inserts a plateau with the given radial extent and density to the profile.

func (*ProfileRing) Join

func (p1 *ProfileRing) Join(p2 *ProfileRing)

func (*ProfileRing) Retrieve

func (p *ProfileRing) Retrieve(i int, out []float64)

Retrieve does any neccessary post-processing on the specified profile and writes in to an out buffer.

func (*ProfileRing) Reuse

func (p *ProfileRing) Reuse(lowR, highR float64)

func (*ProfileRing) Split

func (p1 *ProfileRing) Split(p2 *ProfileRing)

Directories

Path Synopsis
package geom contains routines for computing geometric quantities.
package geom contains routines for computing geometric quantities.
package sphere_halo is essentially a redo of the implementation of HaloProfiles found in the los package but with a different internal geometry kernel.
package sphere_halo is essentially a redo of the implementation of HaloProfiles found in the los package but with a different internal geometry kernel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL