-
Notifications
You must be signed in to change notification settings - Fork 36
/
autopick.go
53 lines (44 loc) · 969 Bytes
/
autopick.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"fmt"
"path/filepath"
)
const DefaultFilter = "RMHP(10)>>BW(4,2,15)>>STALTA(0.5,20)"
const DefaultCorrection = -0.05
const autopickTemplate = `###
### Delivered by puppet
###
# Defines the filter to be used for picking.
detecFilter = "{{.Filter}}"
# The time correction applied to a detected pick.
timeCorr = {{.Correction}}
# Defines whether or not the streams are picked or not
detecEnable = {{.Enable}}
`
type AutoPick struct {
Style string
Filter string
Correction float64
Location string
SamplingRate float64
}
func (s AutoPick) Enable() bool {
switch s.Style {
case "broadband", "weak":
return true
default:
return false
}
}
func (s AutoPick) Id() string {
return "scautopick"
}
func (s AutoPick) Key() string {
return s.Style
}
func (s AutoPick) Template() string {
return autopickTemplate
}
func (s AutoPick) Path() string {
return filepath.Join(s.Id(), fmt.Sprintf("profile_%s", s.Key()))
}