qens.config

Configuration dataclass - runtime parameters for the QENS analysis pipeline.

Holds every tunable knob in one place: file lists, Q range, energy window, binning, MCMC settings and output directory.

Save/restore as JSON for reuse.

class qens.config.Config(files_to_fit=<factory>, primary_file='', resolution_file=None, frozen_temp_threshold=270, q_min=0.3, q_max=2.5, energy_window=1.25, n_q_bins=12, n_walkers=32, n_warmup=500, n_keep=2000, thin=5, n_map_starts=30, random_seed=42, save_dir='qens_results')[source]

Bases: object

Runtime parameters for the analysis pipeline.

Parameters:
files_to_fit

Filenames to load (relative to data_dir passed to qens.io.load_dataset()).

Type:

list[str]

primary_file

Which of the loaded files is the target spectrum to fit.

Type:

str

resolution_file

Frozen-sample file used as resolution function. If None, the loader auto-picks any T ≤ frozen_temp_threshold incoherent file.

Type:

str | None

frozen_temp_threshold

Files at T ≤ this temperature (K) are treated as resolution refs.

Type:

int

q_min, q_max

Q range in Å⁻¹ over which the fit is performed.

Type:

float

energy_window

Half-width of the ω window in meV used for the joint fit (paper found ±1.25 meV needed for benzene anisotropy).

Type:

float

n_q_bins

Number of Q-bins for the joint S(Q,ω) fit.

Type:

int

n_walkers

Number of emcee walkers (must be even, ≥ 2 × n_dim).

Type:

int

n_warmup, n_keep

Burn-in and production steps per walker.

Type:

int

thin

Chain thinning factor.

Type:

int

n_map_starts

Random starts for the MAP search.

Type:

int

random_seed

Master seed for reproducibility.

Type:

int

save_dir

Output directory for figures, samples, summaries.

Type:

str

files_to_fit: List[str]
primary_file: str = ''
resolution_file: str | None = None
frozen_temp_threshold: int = 270
q_min: float = 0.3
q_max: float = 2.5
energy_window: float = 1.25
n_q_bins: int = 12
n_walkers: int = 32
n_warmup: int = 500
n_keep: int = 2000
thin: int = 5
n_map_starts: int = 30
random_seed: int = 42
save_dir: str = 'qens_results'
to_dict()[source]
Return type:

dict

to_json(path)[source]
Return type:

None

Parameters:

path (str)

classmethod from_json(path)[source]
Return type:

Config

Parameters:

path (str)