kopia lustrzana https://github.com/corrscope/corrscope
Fix subsampling
rodzic
8466b9ab93
commit
2a23dedc55
|
@ -22,25 +22,36 @@ class ChannelConfig:
|
||||||
|
|
||||||
|
|
||||||
class Channel:
|
class Channel:
|
||||||
|
# Shared between trigger and renderer.
|
||||||
|
nsamp: int
|
||||||
|
|
||||||
|
# Product of ovgen_cfg.subsampling and trigger/render_width_ratio.
|
||||||
|
trigger_subsampling: int
|
||||||
|
render_subsampling: int
|
||||||
|
|
||||||
def __init__(self, cfg: ChannelConfig, ovgen_cfg: 'Config'):
|
def __init__(self, cfg: ChannelConfig, ovgen_cfg: 'Config'):
|
||||||
self.cfg = cfg
|
self.cfg = cfg
|
||||||
|
subsampling = ovgen_cfg.subsampling
|
||||||
|
|
||||||
# Compute subsampling factors.
|
# Create a Wave object.
|
||||||
self.trigger_subsampling = ovgen_cfg.subsampling * cfg.trigger_width_ratio
|
|
||||||
self.render_subsampling = ovgen_cfg.subsampling * cfg.render_width_ratio
|
|
||||||
|
|
||||||
# Create a Wave object. (TODO maybe create in Ovgenpy()?)
|
|
||||||
wcfg = _WaveConfig(amplification=ovgen_cfg.amplification * cfg.ampl_ratio)
|
wcfg = _WaveConfig(amplification=ovgen_cfg.amplification * cfg.ampl_ratio)
|
||||||
self.wave = Wave(wcfg, cfg.wav_path)
|
self.wave = Wave(wcfg, cfg.wav_path)
|
||||||
|
|
||||||
|
# Compute nsamp.
|
||||||
|
nsamp = ovgen_cfg.render_width_s * self.wave.smp_s / subsampling
|
||||||
|
self.nsamp = round(nsamp)
|
||||||
|
del nsamp
|
||||||
|
|
||||||
|
# Compute subsampling (array stride).
|
||||||
|
self.trigger_subsampling = subsampling * cfg.trigger_width_ratio
|
||||||
|
self.render_subsampling = subsampling * cfg.render_width_ratio
|
||||||
|
del subsampling
|
||||||
|
|
||||||
# Create a Trigger object.
|
# Create a Trigger object.
|
||||||
tcfg = cfg.trigger or ovgen_cfg.trigger
|
tcfg = cfg.trigger or ovgen_cfg.trigger
|
||||||
trigger_nsamp = round(
|
|
||||||
ovgen_cfg.render_width_s * cfg.trigger_width_ratio * self.wave.smp_s
|
|
||||||
)
|
|
||||||
self.trigger = tcfg(
|
self.trigger = tcfg(
|
||||||
wave=self.wave,
|
wave=self.wave,
|
||||||
nsamp=trigger_nsamp,
|
nsamp=self.nsamp,
|
||||||
subsampling=ovgen_cfg.subsampling * self.trigger_subsampling
|
subsampling=self.trigger_subsampling
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue