Documentation ¶
Index ¶
- func MaterializeAll(ins []Promise, maxThreads int, forget bool) (outs []*fits.Image, err error)
- func RemoveNils(lights []*fits.Image) []*fits.Image
- func SetOperatorFactory(f OperatorFactory)
- type Context
- type OpBase
- type OpLoad
- type OpLoadMany
- type OpSave
- type OpSequence
- type OpUnaryBase
- type Operator
- type OperatorFactory
- type OperatorUnary
- type Promise
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MaterializeAll ¶
Materializes all promises with given concurrency limit
func RemoveNils ¶
Remove nils from an array of fits.Images, editing the underlying array in place
func SetOperatorFactory ¶
func SetOperatorFactory(f OperatorFactory)
Registers a given type string for a given type of UnaryOperator, identified via an exemplar generator
Types ¶
type Context ¶
type Context struct { Log io.Writer LSEstimatorMode stats.LSEstimatorMode MemoryMB int // memory.TotalMemory()/1024/1024 StackMemoryMB int // MemoryMB*7/10 MaxThreads int `json:"maxThreads"` DarkFrame *fits.Image FlatFrame *fits.Image RefFrame *fits.Image RefFrameError error LumFrame *fits.Image }
An execution context for operators
func NewContext ¶
func NewContext(log io.Writer, lsEstimatorMode stats.LSEstimatorMode) *Context
type OpBase ¶
type OpBase struct {
Type string `json:"type"`
}
Base type for operators, including type information for JSON serializing/deserializing
type OpLoad ¶
Load a single FITS image from a single filename. Takes zero inputs, produces one output
func NewOpLoadDefault ¶
func NewOpLoadDefault() *OpLoad
func (*OpLoad) MakePromises ¶
Load image from a file. Ignores any f argument provided
func (*OpLoad) UnmarshalJSON ¶
Unmarshal the type from JSON with default values for missing entries
type OpLoadMany ¶
Load many FITS images from a slice of filename patterns with wildcards. Takes zero inputs, produces n outputs
func NewOpLoadMany ¶
func NewOpLoadMany(filePatterns []string) *OpLoadMany
func NewOpLoadManyDefault ¶
func NewOpLoadManyDefault() *OpLoadMany
func (*OpLoadMany) MakePromises ¶
func (op *OpLoadMany) MakePromises(ins []Promise, c *Context) (outs []Promise, err error)
Turn filename wildcards into list of file load operators
func (*OpLoadMany) UnmarshalJSON ¶
func (op *OpLoadMany) UnmarshalJSON(data []byte) error
Unmarshal the type from JSON with default values for missing entries
type OpSave ¶
type OpSave struct { OpUnaryBase FilePattern string `json:"filePattern"` }
Saves given promise under a given filename, with pattern expansion for %d based on the image id. Takes one input, produces one output (the materialized but unchanged input)
func NewOpSaveDefault ¶
func NewOpSaveDefault() *OpSave
func (*OpSave) UnmarshalJSON ¶
Unmarshal the type from JSON with default values for missing entries
type OpSequence ¶
type OpSequence struct { OpBase Steps []Operator `json:"-"` // the actual steps StepsRaw []json.RawMessage `json:"steps"` // helper for unmarshaling }
Applies a sequence of operators to a promise. Number of inputs, outputs as per the chained steps
func NewOpSequence ¶
func NewOpSequence(steps ...Operator) *OpSequence
func NewOpSequenceDefault ¶
func NewOpSequenceDefault() *OpSequence
func (*OpSequence) Append ¶
func (op *OpSequence) Append(steps ...Operator)
Appends one or more operators to the existing sequence
func (*OpSequence) MakePromises ¶
func (op *OpSequence) MakePromises(ins []Promise, c *Context) (outs []Promise, err error)
func (*OpSequence) MarshalJSON ¶
func (op *OpSequence) MarshalJSON() (bs []byte, err error)
Marshals a sequence with polymorphic operators to JSON. Uses the actual op.Steps with label "steps", and ignores op.StepsRaw
func (*OpSequence) UnmarshalJSON ¶
func (op *OpSequence) UnmarshalJSON(b []byte) error
Unmarshals a sequence of polymorphic operators from JSON. Uses temporary op.StepsRaw inspired by https://alexkappa.medium.com/json-polymorphism-in-go-4cade1e58ed1
type OpUnaryBase ¶
type OpUnaryBase struct { OpBase Apply func(f *fits.Image, c *Context) (fOut *fits.Image, err error) `json:"-"` }
Abstract base type for unary operators. Uses golang workaround for abstract classes from https://golangbyexample.com/go-abstract-class/
func (*OpUnaryBase) MakePromise ¶
func (op *OpUnaryBase) MakePromise(in Promise, c *Context) (out Promise)
func (*OpUnaryBase) MakePromises ¶
func (op *OpUnaryBase) MakePromises(ins []Promise, c *Context) (outs []Promise, err error)
type Operator ¶
type Operator interface { GetType() string MakePromises(ins []Promise, c *Context) (outs []Promise, err error) }
An general image processing operator: takes n promises as inputs, and produces m promises as output or an error
type OperatorFactory ¶
type OperatorFactory func() Operator
Factory method for subclasses of unary operators. For JSON serializing/deserializing
func GetOperatorFactory ¶
func GetOperatorFactory(t string) OperatorFactory
Returns the operator factory for a given type string