Documentation ¶
Index ¶
- Constants
- Variables
- func DirContents(dir string) ([]string, error)
- func Filter(xs []int, oks []bool) []int
- func GtetFmt() (string, error)
- func MemoDir() (string, error)
- func ParseStdin() (ids, snaps []int, inVals [][]float64, err error)
- func PathExists(path string) bool
- func PrintCols(ids, snaps []int, cols ...[]float64)
- func PrintRows(ids, snaps []int, rows [][]float64)
- func ReadHeaders(snap int) ([]io.SheetHeader, []string, error)
- func ReadRockstar(snap int, ids []int, valFlags ...halo.Val) ([][]float64, error)
- func ReadSnapHeader(snap int) (*io.SheetHeader, error)
- func ReadSortedRockstarIDs(snap, maxID int, flag halo.Val) ([]int, error)
- func RockstarDir() (string, error)
- func SheetNum(snap int) (int, error)
- func SnapNum() (int, error)
- func SnapOffset() (int, error)
- func SubIDs(ids, snaps []int) (sIDs, sSnaps, hIDs []int, err error)
- func TreeDir() (string, error)
- type IntFinder
Constants ¶
const (
RockstarShortMemoNum = 10 * 1000
)
Variables ¶
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 ¶
DirContetns returnspaths to all the files in a directory.
func GtetFmt ¶
GtetFmt returns the environment variable $GTET_FMT_DIR and returns an error if it has not been set.
func MemoDir ¶
MemoDir returns the environment variable $GTET_MEMO_DIR and returns an error if it has not been set.
func ParseStdin ¶
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 ¶
PathExists returns true if the given path exists.
func PrintCols ¶
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 ¶
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 ¶
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 RockstarDir ¶
RockstarDir returns the environment variable $GTET_ROCKSTAR_DIR and returns an error if it has not been set.
func SheetNum ¶
SheetNum returns the number of sheet segments used by given snapshot. An error is returned on an I/O error.
func SnapNum ¶
SnapNum returns the largest snapshot which can be indexed by $GTET_FMT. An error is returned on an I/O error.
func SnapOffset ¶
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.
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.