Restructure into src/ layout under pygui package
Move all application source under src/pygui/ and rewire imports, build config, and QML module path to match. - Relocate backend/, serialcomm/, and the ISC QML module into src/pygui/; convert main.py into pygui/__main__.py with a main() entry point (run via `python -m pygui` or the new `isc` script) - Rewrite absolute imports: backend.* -> pygui.backend.*, serialcomm.* -> pygui.serialcomm.* (source + tests) - Move app icons (isc.ico/icns) into packaging/ - Update README and ISC.qmlproject to the new paths
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
|
||||
# ===== Time-Indexed Data Segment =====
|
||||
class DataSegment:
|
||||
# ===== Lifecycle =====
|
||||
def __init__(
|
||||
self,
|
||||
full_data: list[float],
|
||||
start_time: datetime,
|
||||
start_index: int,
|
||||
end_index: int,
|
||||
):
|
||||
if not isinstance(start_index, int):
|
||||
raise TypeError("start_index must be an integer")
|
||||
if not isinstance(end_index, int):
|
||||
raise TypeError("end_index must be an integer")
|
||||
"""
|
||||
full_data: The complete list of sensor readings.
|
||||
start_time: The timestamp of the very first reading in full_data.
|
||||
start_index: The offset (in seconds) from start_time to the beginning of this segment.
|
||||
end_index: The offset (in seconds) from start_time to the end of this segment.
|
||||
"""
|
||||
self.full_data = full_data
|
||||
self._base_start_time = start_time
|
||||
self._start_index = start_index
|
||||
self._end_index = end_index
|
||||
self.chamber = ""
|
||||
self.notes = ""
|
||||
|
||||
# ===== Index Properties =====
|
||||
@property
|
||||
def start_index(self) -> int:
|
||||
return self._start_index
|
||||
|
||||
@start_index.setter
|
||||
def start_index(self, value: int):
|
||||
self._start_index = value
|
||||
|
||||
@property
|
||||
def end_index(self) -> int:
|
||||
return self._end_index
|
||||
|
||||
@end_index.setter
|
||||
def end_index(self, value: int):
|
||||
self._end_index = value
|
||||
|
||||
# ===== Derived Time Properties =====
|
||||
@property
|
||||
def start_time(self) -> datetime:
|
||||
return self._base_start_time + timedelta(seconds=self.start_index)
|
||||
|
||||
@property
|
||||
def end_time(self) -> datetime:
|
||||
return self._base_start_time + timedelta(seconds=self.end_index)
|
||||
Reference in New Issue
Block a user