|
6 | 6 | import numpy as np |
7 | 7 | import pandas as pd |
8 | 8 |
|
9 | | -"""The reference epoch for UTC harp time.""" |
10 | 9 | REFERENCE_EPOCH = datetime(1904, 1, 1) |
| 10 | +"""The reference epoch for UTC harp time.""" |
11 | 11 |
|
12 | 12 |
|
13 | 13 | class MessageType(IntEnum): |
| 14 | + """Specifies the type of a Harp message.""" |
| 15 | + |
14 | 16 | NA = 0 |
15 | 17 | READ = 1 |
16 | 18 | WRITE = 2 |
@@ -41,22 +43,33 @@ def read( |
41 | 43 | epoch: Optional[datetime] = None, |
42 | 44 | keep_type: bool = False, |
43 | 45 | ): |
44 | | - """ |
45 | | - Read single-register Harp data from the specified file. |
46 | | -
|
47 | | - :param file: Open file object or filename containing binary data from |
48 | | - a single device register. |
49 | | - :param address: Expected register address. If specified, the address of |
50 | | - the first message in the file is used for validation. |
51 | | - :param dtype: Expected data type of the register payload. If specified, the |
52 | | - payload type of the first message in the file is used for validation. |
53 | | - :param length: Expected number of elements in register payload. If specified, |
54 | | - the payload length of the first message in the file is used for validation. |
55 | | - :param columns: The optional column labels to use for the data values. |
56 | | - :param epoch: Reference datetime at which time zero begins. If specified, |
57 | | - the result data frame will have a datetime index. |
58 | | - :param keep_type: Specifies whether to include a column with the message type. |
59 | | - :return: A pandas data frame containing message data, sorted by time. |
| 46 | + """Read single-register Harp data from the specified file. |
| 47 | +
|
| 48 | + Parameters |
| 49 | + ---------- |
| 50 | + file |
| 51 | + Open file object or filename containing binary data from |
| 52 | + a single device register. |
| 53 | + address |
| 54 | + Expected register address. If specified, the address of |
| 55 | + the first message in the file is used for validation. |
| 56 | + dtype |
| 57 | + Expected data type of the register payload. If specified, the |
| 58 | + payload type of the first message in the file is used for validation. |
| 59 | + length |
| 60 | + Expected number of elements in register payload. If specified, the |
| 61 | + payload length of the first message in the file is used for validation. |
| 62 | + columns |
| 63 | + The optional column labels to use for the data values. |
| 64 | + epoch |
| 65 | + Reference datetime at which time zero begins. If specified, |
| 66 | + the result data frame will have a datetime index. |
| 67 | + keep_type |
| 68 | + Specifies whether to include a column with the message type. |
| 69 | +
|
| 70 | + Returns |
| 71 | + ------- |
| 72 | + A pandas data frame containing message data, sorted by time. |
60 | 73 | """ |
61 | 74 | data = np.fromfile(file, dtype=np.uint8) |
62 | 75 | if len(data) == 0: |
|
0 commit comments