Documentation ¶
Index ¶
- Constants
- Variables
- func List() ([]string, error)
- func ListBase(base string) ([]string, error)
- func ListDir(path string) ([]string, error)
- func ListFS(fsys fs.FS) ([]string, error)
- func Lookup(response string) ([]byte, error)
- func LookupBase(base string, response string) ([]byte, error)
- func LookupDir(path string, response string) ([]byte, error)
- func LookupFS(fsys fs.FS, response string) ([]byte, error)
- type ApproximationBound
- type CoefficientDenominator
- type CoefficientNumerator
- type CoefficientsType
- type DecimationType
- type FirType
- type Float
- type InstrumentPolynomial
- type InstrumentResponse
- func (r *InstrumentResponse) Coeffs() []PolynomialCoefficient
- func (r *InstrumentResponse) Config(opts ...InstrumentResponseOpt)
- func (r *InstrumentResponse) Derived(data []byte) (*ResponseType, error)
- func (r *InstrumentResponse) Marshal() ([]byte, error)
- func (r *InstrumentResponse) Normalise() error
- func (r *InstrumentResponse) Polynomial() *PolynomialType
- func (r *InstrumentResponse) ResponseType() (*ResponseType, error)
- func (r *InstrumentResponse) Scale() float64
- func (r *InstrumentResponse) SetCalibration(scale, bias, absolute float64)
- func (r *InstrumentResponse) SetDatalogger(data []byte) error
- func (r *InstrumentResponse) SetFrequency(frequency float64)
- func (r *InstrumentResponse) SetGain(scale, bias, absolute float64)
- func (r *InstrumentResponse) SetPreamp(preamp float64)
- func (r *InstrumentResponse) SetPrefix(prefix string)
- func (r *InstrumentResponse) SetSensor(data []byte) error
- func (r *InstrumentResponse) SetSerial(serial string)
- func (r *InstrumentResponse) SetTelemetry(gain float64)
- type InstrumentResponseOpt
- func Calibration(factor, bias, absolute float64) InstrumentResponseOpt
- func Frequency(frequency float64) InstrumentResponseOpt
- func Gain(factor, bias, absolute float64) InstrumentResponseOpt
- func Preamp(preamp float64) InstrumentResponseOpt
- func Prefix(prefix string) InstrumentResponseOpt
- func Serial(serial string) InstrumentResponseOpt
- func Telemetry(gain float64) InstrumentResponseOpt
- type InstrumentSensitivity
- type NumeratorCoefficient
- type PoleZero
- type PolesZerosType
- type PolynomialCoefficient
- type PolynomialType
- type Resp
- type ResponseInfo
- type ResponseStageType
- type ResponseType
- func (r *ResponseType) Frequency() float64
- func (r ResponseType) Marshal() ([]byte, error)
- func (r *ResponseType) PolynomialCoefficients() []PolynomialCoefficient
- func (r *ResponseType) PolynomialType() *PolynomialType
- func (r *ResponseType) Scale() float64
- func (r *ResponseType) SetFrequency(freq float64)
- func (r *ResponseType) Unmarshal(data []byte) error
- type StageGain
- type Units
Constants ¶
const LaplaceRadiansSecondPzTransferFunction = "LAPLACE (RADIANS/SECOND)"
Variables ¶
var ErrInvalidResponse = errors.New("attempt to correct the wrong type of response, biases require a polynomial response")
Functions ¶
func ListBase ¶
ListBase returns a list of generic stationxml responses in the embedded files if no base directory given.
func ListDir ¶
ListDir returns a slice of generic stationxml responses stored in the given directory.
func ListFS ¶
ListFS returns a slice representation of generic stationxml responses in the given file system.
func Lookup ¶
Lookup returns a byte slice representation of a generic embeded stationxml Response if present.
func LookupBase ¶
LookupBase returns a byte slice representation of a generic stationxml Response either stored in a given directory or in the embedded files if no base directory given.
Types ¶
type ApproximationBound ¶
type ApproximationBound struct {
Value float64 `xml:",chardata"`
}
type CoefficientDenominator ¶
type CoefficientNumerator ¶
type CoefficientsType ¶
type CoefficientsType struct { ResourceId string `xml:"resourceId,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Description string `xml:"description,attr,omitempty"` InputUnits Units `xml:"InputUnits"` OutputUnits Units `xml:"OutputUnits"` CfTransferFunctionType string `xml:"CfTransferFunctionType"` Numerators []CoefficientNumerator `xml:"Numerator,omitempty"` Denominators []CoefficientDenominator `xml:"Denominator,omitempty"` }
type DecimationType ¶
type FirType ¶
type FirType struct { ResourceId string `xml:"resourceId,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Description string `xml:"description,attr,omitempty"` InputUnits Units `xml:"InputUnits"` OutputUnits Units `xml:"OutputUnits"` Symmetry string `xml:"Symmetry"` NumeratorCoefficients []NumeratorCoefficient `xml:"NumeratorCoefficient"` }
type InstrumentPolynomial ¶
type InstrumentPolynomial struct { ResourceId string `xml:"resourceId,attr,omitempty"` Name string `xml:"name,attr"` Description string `xml:"description,attr,omitempty"` InputUnits Units `xml:"InputUnits"` OutputUnits Units `xml:"OutputUnits"` ApproximationType string `xml:"ApproximationType"` FrequencyLowerBound float64 `xml:"FrequencyLowerBound"` FrequencyUpperBound float64 `xml:"FrequencyUpperBound"` ApproximationLowerBound ApproximationBound `xml:"ApproximationLowerBound"` ApproximationUpperBound ApproximationBound `xml:"ApproximationUpperBound"` MaximumError float64 `xml:"MaximumError"` Coefficients []PolynomialCoefficient `xml:"Coefficient,omitempty"` }
type InstrumentResponse ¶
type InstrumentResponse struct { Prefix string Serial string Frequency float64 ScaleFactor float64 ScaleBias float64 ScaleAbsolute float64 GainFactor float64 GainBias float64 GainAbsolute float64 Telemetry float64 Preamp float64 // contains filtered or unexported fields }
InstrumentResponse is used for building an instrument response based on sensor and datalogger pairs. It makes no assumption about the StationXML version, ideally it should encompass all required elements. The conversion from a base Response to a particular version is done via encoding interfaces.
func NewInstrumentResponse ¶
func NewInstrumentResponse(opts ...InstrumentResponseOpt) *InstrumentResponse
NewInstrumentResponse builds a Response with the given options.
func (*InstrumentResponse) Coeffs ¶
func (r *InstrumentResponse) Coeffs() []PolynomialCoefficient
Coeffs returns a slice of PolynomialCoeffiencent values present in the Response.
func (*InstrumentResponse) Config ¶
func (r *InstrumentResponse) Config(opts ...InstrumentResponseOpt)
Config can be used to set extra Response options.
func (*InstrumentResponse) Derived ¶
func (r *InstrumentResponse) Derived(data []byte) (*ResponseType, error)
Derived returns a ResponseType when there is only a single set of derived Response stages.
func (*InstrumentResponse) Marshal ¶
func (r *InstrumentResponse) Marshal() ([]byte, error)
Marshal generates an XML encoded version of the Response as a ResponseType.
func (*InstrumentResponse) Normalise ¶
func (r *InstrumentResponse) Normalise() error
Normalise adjusts the labels and stage gains of a Response.
func (*InstrumentResponse) Polynomial ¶
func (r *InstrumentResponse) Polynomial() *PolynomialType
Polynomial finds the PolynomialType in the Response if one is present.
func (*InstrumentResponse) ResponseType ¶
func (r *InstrumentResponse) ResponseType() (*ResponseType, error)
ResponseType builds a combined ResponseType from a Response.
func (*InstrumentResponse) Scale ¶
func (r *InstrumentResponse) Scale() float64
Scale calculates the overall response scale factor.
func (*InstrumentResponse) SetCalibration ¶
func (r *InstrumentResponse) SetCalibration(scale, bias, absolute float64)
SetCalibration is used to set a initial sensor reference gain, this overrides the default values.
func (*InstrumentResponse) SetDatalogger ¶
func (r *InstrumentResponse) SetDatalogger(data []byte) error
SetDatalogger takes an XML encoded ResponseType that represents a Datalogger and adds it to the Response.
func (*InstrumentResponse) SetFrequency ¶
func (r *InstrumentResponse) SetFrequency(frequency float64)
SetFrequency is used to set the overall reference frequency for the Response.
func (*InstrumentResponse) SetGain ¶
func (r *InstrumentResponse) SetGain(scale, bias, absolute float64)
SetGain is used to adjusts the installed sensor gains, this is in addition to the default values.
func (*InstrumentResponse) SetPreamp ¶
func (r *InstrumentResponse) SetPreamp(preamp float64)
SetPreamp is used to adjusts the datalogger gains, this is in addition to the default values.
func (*InstrumentResponse) SetPrefix ¶
func (r *InstrumentResponse) SetPrefix(prefix string)
SetPrefix sets the label used to prefix Response element names.
func (*InstrumentResponse) SetSensor ¶
func (r *InstrumentResponse) SetSensor(data []byte) error
SetSensor takes an XML encoded ResponseType that represents a Sensor and adds it to the Response.
func (*InstrumentResponse) SetSerial ¶
func (r *InstrumentResponse) SetSerial(serial string)
SetSerial sets the label used to prefix Response equipment labels.
func (*InstrumentResponse) SetTelemetry ¶
func (r *InstrumentResponse) SetTelemetry(gain float64)
SetTelemetry is used to adjusts the datalogger gains, this is in addition to the default values.
type InstrumentResponseOpt ¶
type InstrumentResponseOpt func(*InstrumentResponse)
func Calibration ¶
func Calibration(factor, bias, absolute float64) InstrumentResponseOpt
Calibration is used to set a initial sensor reference gain, this overrides the default values.
func Frequency ¶
func Frequency(frequency float64) InstrumentResponseOpt
Frequency is used to set the overall reference frequency for the Response.
func Gain ¶
func Gain(factor, bias, absolute float64) InstrumentResponseOpt
Gain is used to adjusts the installed sensor gains, this is in addition to the default values.
func Preamp ¶
func Preamp(preamp float64) InstrumentResponseOpt
Preamp is used to adjusts the datalogger gains, this is in addition to the default values.
func Prefix ¶
func Prefix(prefix string) InstrumentResponseOpt
Prefix sets the label used to prefix Response element names.
func Serial ¶
func Serial(serial string) InstrumentResponseOpt
Serial sets the label used to prefix Response equipment labels.
func Telemetry ¶
func Telemetry(gain float64) InstrumentResponseOpt
Telemetry is used to adjusts the sensor and datalogger connection gain, this is in addition to the default values.
type InstrumentSensitivity ¶
type NumeratorCoefficient ¶
type PolesZerosType ¶
type PolesZerosType struct { ResourceId string `xml:"resourceId,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Description string `xml:"description,attr,omitempty"` InputUnits Units `xml:"InputUnits"` OutputUnits Units `xml:"OutputUnits"` PzTransferFunctionType string `xml:"PzTransferFunctionType"` NormalizationFactor float64 `xml:"NormalizationFactor"` NormalizationFrequency float64 `xml:"NormalizationFrequency"` Zeros []PoleZero `xml:"Zero"` Poles []PoleZero `xml:"Pole"` }
func (PolesZerosType) Gain ¶
func (pz PolesZerosType) Gain(freq float64) float64
Gain ccalculates the poles and zeros response gain at a given frequency
type PolynomialCoefficient ¶
type PolynomialType ¶
type PolynomialType struct { ResourceId string `xml:"resourceId,attr,omitempty"` Name string `xml:"name,attr,omitempty"` Description string `xml:"description,attr,omitempty"` InputUnits Units `xml:"InputUnits"` OutputUnits Units `xml:"OutputUnits"` ApproximationType string `xml:"ApproximationType"` FrequencyLowerBound float64 `xml:"FrequencyLowerBound"` FrequencyUpperBound float64 `xml:"FrequencyUpperBound"` ApproximationLowerBound ApproximationBound `xml:"ApproximationLowerBound"` ApproximationUpperBound ApproximationBound `xml:"ApproximationUpperBound"` MaximumError float64 `xml:"MaximumError"` Coefficients []PolynomialCoefficient `xml:"Coefficient,omitempty"` }
func (PolynomialType) Value ¶
func (p PolynomialType) Value(input float64) float64
type Resp ¶
type Resp struct {
// contains filtered or unexported fields
}
type ResponseInfo ¶
type ResponseInfo struct { Sensitivity float64 Gain float64 Bias float64 Input string Output string }
ResponseInfo is used to store simplified conversion details.
type ResponseStageType ¶
type ResponseStageType struct { Number int `xml:"number,attr"` ResourceId string `xml:"resourceId,attr,omitempty"` Coefficients *CoefficientsType `xml:"Coefficients,omitempty"` Decimation *DecimationType `xml:"Decimation,omitempty"` FIR *FirType `xml:"FIR,omitempty"` PolesZeros *PolesZerosType `xml:"PolesZeros,omitempty"` Polynomial *PolynomialType `xml:"Polynomial,omitempty"` StageGain *StageGain `xml:"StageGain,omitempty"` }
func (*ResponseStageType) Clone ¶
func (r *ResponseStageType) Clone() (ResponseStageType, error)
clone two responses to avoid shared backing arrays
type ResponseType ¶
type ResponseType struct { XMLName xml.Name `xml:"Response"` ResourceId string `xml:"resourceId,attr,omitempty"` InstrumentSensitivity *InstrumentSensitivity `xml:"InstrumentSensitivity,omitempty"` InstrumentPolynomial *InstrumentPolynomial `xml:"InstrumentPolynomial,omitempty"` Stages []ResponseStageType `xml:"Stage,omitempty"` // contains filtered or unexported fields }
ResponseType is a struct that mimics the StationXML ResponseType element, but is not constrained to a particular version.
func NewResponseType ¶
func NewResponseType(data []byte) (*ResponseType, error)
func (*ResponseType) Frequency ¶
func (r *ResponseType) Frequency() float64
func (ResponseType) Marshal ¶
func (r ResponseType) Marshal() ([]byte, error)
func (*ResponseType) PolynomialCoefficients ¶
func (r *ResponseType) PolynomialCoefficients() []PolynomialCoefficient
func (*ResponseType) PolynomialType ¶
func (r *ResponseType) PolynomialType() *PolynomialType
func (*ResponseType) Scale ¶
func (r *ResponseType) Scale() float64
func (*ResponseType) SetFrequency ¶
func (r *ResponseType) SetFrequency(freq float64)
func (*ResponseType) Unmarshal ¶
func (r *ResponseType) Unmarshal(data []byte) error