-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathspec.go
88 lines (76 loc) · 2.11 KB
/
spec.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package edf
/**************
* EDF STRUCT *
**************/
// Edf is the definition of the EDF structure to be used by this library.
type Edf struct {
// The variable to hold the EDF's header information.
Header map[string]string
// The records will be stored in its raw form, each one of them stored in
// an array of int16.
Records [][]int16
// additionally all records will be stored in its physical form
PhysicalRecords [][]float64
}
// NewEdf returns a new Edf struct
func NewEdf(header map[string]string, records [][]int16, physicalRecords [][]float64) Edf {
return Edf{
Header: header,
Records: records,
PhysicalRecords: physicalRecords,
}
}
/****************
* SPECS LENGTH *
****************/
// GetSpecsLength gets the length in bytes of every specified field in the EDF file's header.
func GetSpecsLength() map[string]int {
spec := make(map[string]int)
spec["version"] = 8
spec["patient"] = 80
spec["recording"] = 80
spec["startdate"] = 8
spec["starttime"] = 8
spec["bytesheader"] = 8
spec["reserved"] = 44
spec["datarecords"] = 8
spec["duration"] = 8
spec["numbersignals"] = 4
spec["label"] = 16
spec["transducer"] = 80
spec["physicaldimension"] = 8
spec["physicalminimum"] = 8
spec["physicalmaximum"] = 8
spec["digitalminimum"] = 8
spec["digitalmaximum"] = 8
spec["prefiltering"] = 80
spec["samplesrecord"] = 8
spec["chanreserved"] = 32
return spec
}
// GetSpecsList gets the a list with codes for every field specified in the EDF file's
// header. They will appear in the order they are needed.
func GetSpecsList() []string {
spec := make([]string, 20)
spec[0] = "version"
spec[1] = "patient"
spec[2] = "recording"
spec[3] = "startdate"
spec[4] = "starttime"
spec[5] = "bytesheader"
spec[6] = "reserved"
spec[7] = "datarecords"
spec[8] = "duration"
spec[9] = "numbersignals"
spec[10] = "label"
spec[11] = "transducer"
spec[12] = "physicaldimension"
spec[13] = "physicalminimum"
spec[14] = "physicalmaximum"
spec[15] = "digitalminimum"
spec[16] = "digitalmaximum"
spec[17] = "prefiltering"
spec[18] = "samplesrecord"
spec[19] = "chanreserved"
return spec
}