Rename WaveConfig to _WaveConfig, don't expose via YAML

pull/357/head
nyanpasu64 2018-07-26 05:33:38 -07:00
rodzic 7f0e1ccaba
commit 201b05cc30
2 zmienionych plików z 9 dodań i 14 usunięć

Wyświetl plik

@ -11,7 +11,7 @@ from ovgenpy import outputs
from ovgenpy.config import register_config, yaml from ovgenpy.config import register_config, yaml
from ovgenpy.renderer import MatplotlibRenderer, RendererConfig from ovgenpy.renderer import MatplotlibRenderer, RendererConfig
from ovgenpy.triggers import ITriggerConfig, CorrelationTriggerConfig from ovgenpy.triggers import ITriggerConfig, CorrelationTriggerConfig
from ovgenpy.wave import WaveConfig, Wave from ovgenpy.wave import _WaveConfig, Wave
RENDER_PROFILING = True RENDER_PROFILING = True
@ -98,7 +98,7 @@ class Ovgen:
waves = sorted(wave_dir.glob('*.wav')) waves = sorted(wave_dir.glob('*.wav'))
for idx, path in enumerate(waves): for idx, path in enumerate(waves):
wcfg = WaveConfig( wcfg = _WaveConfig(
amplification=self.cfg.amplification amplification=self.cfg.amplification
) )

Wyświetl plik

@ -1,27 +1,22 @@
from typing import TYPE_CHECKING, Optional from typing import Optional
import numpy as np import numpy as np
from dataclasses import dataclass
from scipy.io import wavfile from scipy.io import wavfile
from ovgenpy.config import register_config
if TYPE_CHECKING: # Internal class, not exposed via YAML (TODO replace with ChannelConfig?)
from ovgenpy.triggers import Trigger @dataclass
class _WaveConfig:
@register_config
class WaveConfig:
amplification: float = 1 amplification: float = 1
def dummy_wave_config() -> WaveConfig:
return WaveConfig(amplification=1)
FLOAT = np.single FLOAT = np.single
class Wave: class Wave:
def __init__(self, wcfg: Optional[WaveConfig], wave_path: str): def __init__(self, wcfg: Optional[_WaveConfig], wave_path: str):
self.cfg = wcfg or WaveConfig() self.cfg = wcfg or _WaveConfig()
self.smp_s, self.data = wavfile.read(wave_path, mmap=True) # type: int, np.ndarray self.smp_s, self.data = wavfile.read(wave_path, mmap=True) # type: int, np.ndarray
dtype = self.data.dtype dtype = self.data.dtype