pixprob

package
v0.0.0-...-26dca7e Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: BSD-2-Clause Imports: 10 Imported by: 12

Documentation

Overview

Package pixprob associates a pixelation raster value with a probability for a pixel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pixel

type Pixel map[int]prob

Pixel is the prior probability of a pixel given a raster value.

Each pixel is assumed to be independent of all other pixels.

func New

func New() Pixel

New creates a new Pixel object to store prior probabilities from pixel types.

By default, the ID 0 is defined with probability 0.

func ReadTSV

func ReadTSV(r io.Reader) (Pixel, error)

ReadTSV reads a TSV file used to define the prior probability values for a given set of pixels values in a pixelation.

The pixel prior file is a tab-delimited file with the following columns:

-key	the value used as identifier
-prior	the prior probability for a pixel with that value

Any other columns, will be ignored. Here is an example of a pixel prior file:

key	prior	comment
0	0.000000	deep ocean
1	0.010000	oceanic plateaus
2	0.050000	continental shelf
3	0.950000	lowlands
4	1.000000	highlands
5	0.001000	ice sheets

func (Pixel) LogPrior

func (px Pixel) LogPrior(v int) float64

LogPrior returns the log prior probability of a pixel for a given raster value.

func (Pixel) Prior

func (px Pixel) Prior(v int) float64

Prior returns the prior probability of a pixel for a given raster value.

func (Pixel) Set

func (px Pixel) Set(v int, p float64) error

Set set a pixel probability for a given raster value.

func (Pixel) TSV

func (px Pixel) TSV(w io.Writer) error

TSV encodes a pixel prior as a TSV file.

func (Pixel) Values

func (px Pixel) Values() []int

Values return the raster values that have a defined prior.

Jump to

Keyboard shortcuts

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