Reorganize and cleanup code, remove unused class Coords

pull/357/head
nyanpasu64 2018-07-13 04:48:14 -07:00
rodzic beae6e8b2b
commit a19c02974f
1 zmienionych plików z 24 dodań i 21 usunięć

Wyświetl plik

@ -16,7 +16,10 @@ from ovgenpy.util import ceildiv
class Config(NamedTuple):
wave_dir: str # TODO remove, a function will expand wildcards and create List[WaveConfig]
wave_dir: str
# TODO: if wave_dir is present, it will overwrite List[WaveConfig].
# wave_dir will be commented out.
master_wave: Optional[str]
fps: int
@ -25,20 +28,6 @@ class Config(NamedTuple):
render: 'RendererCfg'
class RendererCfg(NamedTuple):
width: int
height: int
samples_visible: int
rows_first: bool
nrows: Optional[int] = None
ncols: Optional[int] = None
# TODO backend: FigureCanvasBase = FigureCanvasAgg
Folder = click.Path(exists=True, file_okay=False)
File = click.Path(exists=True, dir_okay=False)
@ -119,6 +108,7 @@ class Ovgen:
render_fps = nframes / dtime
print(f'FPS = {render_fps}')
class WaveConfig(NamedTuple):
wave_path: str
# TODO color
@ -131,7 +121,11 @@ class Wave:
# FIXME cfg
frames = 1
self.trigger = Trigger(self, self.smp_s // FPS * frames, 0.1)
self.trigger = Trigger(
wave=self,
scan_nsamp=self.smp_s // FPS * frames,
align_amount=0.1
)
def get_smp(self) -> int:
return len(self.data)
@ -168,6 +162,20 @@ class Trigger:
return offset # todo
class RendererCfg(NamedTuple):
width: int
height: int
samples_visible: int
rows_first: bool
nrows: Optional[int] = None
ncols: Optional[int] = None
# TODO backend: FigureCanvasBase = FigureCanvasAgg
class MatplotlibRenderer:
"""
If __init__ reads cfg, cfg cannot be hotswapped.
@ -297,8 +305,3 @@ class MatplotlibRenderer:
print()
self.fig.canvas.draw()
self.fig.canvas.flush_events()
class Coords(NamedTuple):
row: int
col: int