File: constants.py

package info (click to toggle)
python-sigima 1.1.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 25,608 kB
  • sloc: python: 35,251; makefile: 3
file content (27 lines) | stat: -rw-r--r-- 912 bytes parent folder | download
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
# Copyright (c) DataLab Platform Developers, BSD 3-Clause license, see LICENSE file.

"""
Signal I/O constants - especially for datetime metadata handling
"""

# Datetime metadata keys
# These keys are used to store datetime-related information in SignalObj.metadata
DATETIME_X_KEY = "x_datetime"  # Boolean: True if x represents datetime data
DATETIME_X_FORMAT_KEY = "x_datetime_format"  # String: format for display

# Time unit conversion factors (to seconds)
# Used to convert datetime values to float timestamps
TIME_UNIT_FACTORS = {
    "ns": 1e-9,  # nanoseconds
    "us": 1e-6,  # microseconds
    "ms": 1e-3,  # milliseconds
    "s": 1.0,  # seconds (base unit)
    "min": 60.0,  # minutes
    "h": 3600.0,  # hours
}

# Valid time units (ordered from smallest to largest)
VALID_TIME_UNITS = list(TIME_UNIT_FACTORS.keys())

# Default datetime format string
DEFAULT_DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S"