chaotic_pfc.config¶
config.py¶
Centralised configuration for all experiments.
The module exposes a single DEFAULT_CONFIG object of type
ExperimentConfig that aggregates the per-subsystem settings
(comm, channel, lyapunov, sweep, …). Every experiment
script imports it to obtain its default parameters, and CLI flags
selectively override individual fields without having to thread a full
config through the call chain.
All configs are plain dataclasses, so they can be cheaply copied,
mutated in tests, or serialised with dataclasses.asdict().
Module Attributes
The project-wide singleton. |
Classes
|
External FIR-channel parameters ( |
|
Top-level parameters of the communication pipeline. |
|
Aggregate configuration used by every experiment script. |
|
Parameters of the base Hénon map. |
|
FIR filter used inside the N-th order Hénon oscillator. |
|
Parameters for Lyapunov exponent computation. |
|
Global plotting defaults used by the experiment scripts. |
|
Defaults for |
|
Parameters for the 2-D (order, cutoff) Lyapunov sweep. |
- class chaotic_pfc.config.HenonConfig(a=1.4, b=0.3)[source]¶
Bases:
objectParameters of the base Hénon map.
The default
(a, b) = (1.4, 0.3)is the canonical chaotic regime. Deviating from these requires care — the communication pipeline assumes a strange attractor.
- class chaotic_pfc.config.CommConfig(N=1000000, mu=0.01, message_period=20, transient=200, henon=<factory>)[source]¶
Bases:
objectTop-level parameters of the communication pipeline.
- Parameters:
N (int)
mu (float)
message_period (int)
transient (int)
henon (HenonConfig)
- transient¶
Number of samples discarded at the start of each run before computing the MSE metric. Lets the local oscillator lock into synchronisation.
- Type:
- henon¶
Nested Hénon parameters (a, b).
- henon: HenonConfig¶
- class chaotic_pfc.config.ChannelConfig(cutoff=0.99, num_taps=201)[source]¶
Bases:
objectExternal FIR-channel parameters (
fir_channel()).
- class chaotic_pfc.config.InternalFIRConfig(cutoff=0.5, num_taps=9)[source]¶
Bases:
objectFIR filter used inside the N-th order Hénon oscillator.
Differs from
ChannelConfigin that this filter sits inside the chaos generator (it shapes the feedback loop), not on the transmission path. Used primarily by the order-N transmitter/receiver pair.
- class chaotic_pfc.config.SpectralConfig(nfft=4096, window_length=1024, fs=1.0, window='hamming', kaiser_beta=5.0)[source]¶
Bases:
objectDefaults for
psd_normalised().- nfft, window_length, fs
Standard Welch parameters.
- window¶
FIR window applied to each Welch segment. Currently
"hamming"(the historical default) and"kaiser"are supported.- Type:
- kaiser_beta¶
Shape parameter of the Kaiser window. Ignored unless
window == "kaiser". Larger values give higher stop-band attenuation at the cost of a wider main lobe; β ≈ 5 is a common ~50 dB compromise.- Type:
- class chaotic_pfc.config.LyapunovConfig(Nitera=2000, Ndiscard=1000, perturbation=0.1, n_ci=20, data_dir='data/lyapunov', Gz=1.0, pole_radius=0.975, w0=0.0)[source]¶
Bases:
objectParameters for Lyapunov exponent computation.
- Parameters:
- Nitera, Ndiscard
Iterations used for the estimate and the transient to discard before starting to accumulate.
- perturbation¶
Half-width of the IC sampling box around the fixed point, as a fraction of the coordinate (±10% by default).
- Type:
- pole_radius¶
Pole radius
r ∈ (0, 1). Larger values make the filter sharper and the dynamics more dissipative.- Type:
- class chaotic_pfc.config.PlotConfig(time_window_start=0, time_window_end=300, dpi=150, figures_dir='figures', fmt='svg')[source]¶
Bases:
objectGlobal plotting defaults used by the experiment scripts.
- class chaotic_pfc.config.SweepConfig(Nitera=500, Nmap=3000, n_initial=25, order_lo=2, order_hi=42, n_cutoffs=100, default_window='hamming', default_filter_type='lowpass', bandwidth=0.05, data_dir='data/sweeps', figures_dir='figures/sweeps', fig_fmts=('svg',))[source]¶
Bases:
objectParameters for the 2-D (order, cutoff) Lyapunov sweep.
Used by
chaotic_pfc.sweep. The full grid islen(orders) × n_cutoffspoints; at the defaults this is 4 000.- Parameters:
- order_lo, order_hi
Filter-order range,
order_hiexclusive. Defaults torange(2, 42)→ 40 orders.
- default_window, default_filter_type
Default selections when no CLI override is given.
- data_dir, figures_dir
Output locations. The
.npzcheckpoints live underdata/sweepsand are versioned; the figures underfigures/sweepsare derived from those checkpoints.
- fig_fmts¶
Output formats produced by the plot script. Tuple because both PNG (quick preview, GitHub render) and SVG (paper-grade) are useful to have in parallel.
- bandwidth¶
Pass-band width as a fraction of the Nyquist frequency (used for bandpass/bandstop filter types).
- Type:
- class chaotic_pfc.config.ExperimentConfig(comm=<factory>, channel=<factory>, internal_fir=<factory>, spectral=<factory>, lyapunov=<factory>, plot=<factory>, sweep=<factory>, seed=42, lang='pt')[source]¶
Bases:
objectAggregate configuration used by every experiment script.
Composing the individual subsystem configs into a single object keeps the CLI scripts simple: they import
DEFAULT_CONFIG, pick out the branches they need (e.g.cfg.comm,cfg.lyapunov) and only expose flags for the handful of fields that actually vary across experiments.- Parameters:
comm (CommConfig)
channel (ChannelConfig)
internal_fir (InternalFIRConfig)
spectral (SpectralConfig)
lyapunov (LyapunovConfig)
plot (PlotConfig)
sweep (SweepConfig)
seed (int)
lang (str)
- comm: CommConfig¶
- channel: ChannelConfig¶
- internal_fir: InternalFIRConfig¶
- spectral: SpectralConfig¶
- lyapunov: LyapunovConfig¶
- plot: PlotConfig¶
- sweep: SweepConfig¶
- to_namespace()[source]¶
Build an
argparse.Namespacewith defaults for every CLI subcommand.Useful for
run all, which forwards a single namespace to all sub-experiments.Note:
PlotConfig,SpectralConfig, andSweepConfigfields are intentionally omitted; CLI modules that need them read directly fromDEFAULT_CONFIG.- Return type:
- chaotic_pfc.config.DEFAULT_CONFIG = ExperimentConfig(comm=CommConfig(N=1000000, mu=0.01, message_period=20, transient=200, henon=HenonConfig(a=1.4, b=0.3)), channel=ChannelConfig(cutoff=0.99, num_taps=201), internal_fir=InternalFIRConfig(cutoff=0.5, num_taps=9), spectral=SpectralConfig(nfft=4096, window_length=1024, fs=1.0, window='hamming', kaiser_beta=5.0), lyapunov=LyapunovConfig(Nitera=2000, Ndiscard=1000, perturbation=0.1, n_ci=20, data_dir='data/lyapunov', Gz=1.0, pole_radius=0.975, w0=0.0), plot=PlotConfig(time_window_start=0, time_window_end=300, dpi=150, figures_dir='figures', fmt='svg'), sweep=SweepConfig(Nitera=500, Nmap=3000, n_initial=25, order_lo=2, order_hi=42, n_cutoffs=100, default_window='hamming', default_filter_type='lowpass', bandwidth=0.05, data_dir='data/sweeps', figures_dir='figures/sweeps', fig_fmts=('svg',)), seed=42, lang='pt')¶
The project-wide singleton.
Import this, do not instantiate a new one. Treat as read-only at runtime; mutating a sub-config field (e.g.
cfg.comm.N = 100) will affect all subsequent experiments in the same process. If a test needs a modified copy, usedataclasses.replace()on the relevant sub-dataclass.