GeezerVison is showing github.com — #28 Update dims module · sdarray/sdarray@da8311d
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: sdarray/dims.py +9-6Lines changed: 9 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
|
6 | 6 |
|
7 | 7 |
|
8 | 8 | # dependencies |
| 9 | +import numpy as np |
9 | 10 | from typing_extensions import Literal |
10 | 11 | from xarray_dataclasses import Attr, Data |
11 | 12 |
|
12 | 13 |
|
13 | 14 | # constants |
14 | 15 | time = Literal["time"] |
| 16 | +"""Type hint for the time axis.""" |
15 | 17 | chan = Literal["chan"] |
| 18 | +"""Type hint for the channel axis.""" |
16 | 19 |
|
17 | 20 |
|
18 | 21 | # dataclasses |
19 | 22 | @dataclass |
20 | 23 | class Time: |
21 | | - """Time in UTC.""" |
| 24 | + """Start time in UTC.""" |
22 | 25 |
|
23 | | - data: Data[time, Literal["M8[ns]"]] |
24 | | - long_name: Attr[str] = "Time in UTC" |
| 26 | + data: Data[time, np.datetime64] |
| 27 | + long_name: Attr[str] = "Start time in UTC" |
25 | 28 | short_name: Attr[str] = "time" |
26 | 29 |
|
27 | 30 |
|
28 | 31 | @dataclass |
29 | 32 | class Chan: |
30 | | - """Channel ID.""" |
| 33 | + """Channel number.""" |
31 | 34 |
|
32 | | - data: Data[chan, Literal["i8"]] |
33 | | - long_name: Attr[str] = "Channel ID" |
| 35 | + data: Data[chan, np.int64] |
| 36 | + long_name: Attr[str] = "Channel number" |
34 | 37 | short_name: Attr[str] = "chan" |