gtet_util

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: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RockstarShortMemoNum = 10 * 1000
)

Variables

View Source
var (
	// FinderCells is the number of cells used by the subhalo finder.
	FinderCells = 150
	// OverlapMult is the multiplier applied to each halo's R200m to find
	// its subhalos.
	OverlapMult = 3.0
)

Functions

func DirContents

func DirContents(dir string) ([]string, error)

DirContetns returnspaths to all the files in a directory.

func Filter

func Filter(xs []int, oks []bool) []int

Filter applies a filtering operation to a slice of ints.

func GtetFmt

func GtetFmt() (string, error)

GtetFmt returns the environment variable $GTET_FMT_DIR and returns an error if it has not been set.

func MemoDir

func MemoDir() (string, error)

MemoDir returns the environment variable $GTET_MEMO_DIR and returns an error if it has not been set.

func ParseStdin

func ParseStdin() (ids, snaps []int, inVals [][]float64, err error)

ParseStdin parses a stdin which consists of a series of columns. The first two columns must be included in all non=empty rows and must be ints. The first will be parsed at halo IDs and the second as halo snapshots. Aside from these two columns, each line may have any number of additional columns, which will be parsed as floats and returned line-by-line as inVals.

An error is returned either on I/O errors or on parsing errors.

func PathExists

func PathExists(path string) bool

PathExists returns true if the given path exists.

func PrintCols

func PrintCols(ids, snaps []int, cols ...[]float64)

PrintCols prints out a sequence of columns to stdin such that each column has the same character width.

PrintCols panics if all the columns are not the same height.

func PrintRows

func PrintRows(ids, snaps []int, rows [][]float64)

PrintRows takes a seqeunce of variable-length rows, each associated with a halo ID and snapshot, and prints them out as uniformly-spaced columns to stdout.

PrintRows panics if the length of ids, snaps, and rows are not all the same.

func ReadHeaders

func ReadHeaders(snap int) ([]io.SheetHeader, []string, error)

func ReadRockstar

func ReadRockstar(
	snap int, ids []int, valFlags ...halo.Val,
) ([][]float64, error)

This function does fairly large heap allocations even when it doesn't need to. Consider passing it a buffer.

func ReadSnapHeader

func ReadSnapHeader(snap int) (*io.SheetHeader, error)

ReadSnapHeader reads a single snapshot header from the given snapshot.

func ReadSortedRockstarIDs

func ReadSortedRockstarIDs(snap, maxID int, flag halo.Val) ([]int, error)

func RockstarDir

func RockstarDir() (string, error)

RockstarDir returns the environment variable $GTET_ROCKSTAR_DIR and returns an error if it has not been set.

func SheetNum

func SheetNum(snap int) (int, error)

SheetNum returns the number of sheet segments used by given snapshot. An error is returned on an I/O error.

func SnapNum

func SnapNum() (int, error)

SnapNum returns the largest snapshot which can be indexed by $GTET_FMT. An error is returned on an I/O error.

func SnapOffset

func SnapOffset() (int, error)

SnapOffset returns difference between the number of snapshots in $GTET_FMT and the number of halo catalogs in GTET_TREE_DIR. Useful for when only the last couple of snapshots are the only ones converted into sheet segments. An error is returned on I/O error.

func SubIDs

func SubIDs(ids, snaps []int) (
	sIDs, sSnaps, hIDs []int, err error,
)

SubIDs returns the subhalos within OverlapMult * 3 of the given host halos, including

An error is

func TreeDir

func TreeDir() (string, error)

TreeDir returns the environment variable $GTET_TREE_DIR and returns an error if it has not been set.

Types

type IntFinder

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

A quick generic wrapper for doing those one-to-one mappings I need to do so often. Written like this so the backend can be swapped out easily.

func NewIntFinder

func NewIntFinder(rids []int) IntFinder

func (IntFinder) Find

func (f IntFinder) Find(rid int) (int, bool)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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