Low-level analysis functions#
Analysis routines.
- class py_alf.ana.Parameters(directory, obs_name=None)#
Object representing the “parameters” file.
- Parameters:
- directorypath-like object
Directory of “parameters” file.
- obs_namestr, optional
Observable name. If this is set, the object tries to get a parameters not from the namelist ‘var_errors’, but from a namelist called obs_name, while ‘var_errors’ is the fallback options. Parameters will be written to namelist obs_name.
- N_min()#
Get minimal number of bins, given the parameters in this object.
- N_rebin()#
Get N_rebin.
- N_skip()#
Get N_skip.
- set_N_rebin(parameter)#
Update N_rebin.
- set_N_skip(parameter)#
Update N_skip.
- write_nml()#
Write namelist to file. Preseves comments.
- class py_alf.ana.ReadObs(directory, obs_name, bare_bins=False, substract_back=True)#
Read, skip, rebin and jackknife scalar-type bins.
Bins get skipped and rebinned according to N_skip an N_rebin retrieved through
Parameters
, then jackknife resampling is applied. Saves jackknife bins.Cf.
read_scal()
,read_latt()
,read_hist()
.- Parameters:
- directorypath-like object
Directory containing the observable.
- obs_namestr
Name of observable.
- bare_binsbool, default=False
Do not perform skipping, rebinning, or jackknife resampling.
- substract_backbool, default=True
Substract background. Applies to correlation functions.
- all()#
Return all bins.
- jack(N_rebin)#
Return jackknife bins. Object has to be created with bare_bins=True.
- Parameters:
- N_rebinint
Overwrite N_rebin from parameters.
- slice(n)#
Return n-th bin.
- py_alf.ana.ana_eq(directory, obs_name, sym=None)#
Analyze given equal-time correlators.
If sym is given, it symmetrizes the bins prior to calculating the error. Cf.
symmetrize()
.
- py_alf.ana.ana_hist(directory, obs_name)#
Analyze given histogram observables.
- py_alf.ana.ana_scal(directory, obs_name)#
Analyze given scalar observables.
- Parameters:
- directorypath-like object
Directory containing the observable.
- obs_namestr
Name of the observable.
- py_alf.ana.ana_tau(directory, obs_name, sym=None)#
Analyze given time-displaced correlators.
If sym is given, it symmetrizes the bins prior to calculating the error. Cf.
symmetrize()
.
- py_alf.ana.error(jacks, imag=False)#
Calculate expectation values and errors of given jackknife bins.
- Parameters:
- jacksarray-like object
Jackknife bins.
- imagbool, default=False
Output with imaginary part.
- Returns:
- tuple of numpy arrays
(expectation values, errors).
- py_alf.ana.jack(X, par, N_skip=None, N_rebin=None)#
Create jackknife bins out of input bins after skipping and rebinning.
- Parameters:
- Xarray-like object
Input bins. Bins run over first index.
- par
Parameters
Parameters object.
- N_skipint, default=par.N_skip()
Number of bins to skip.
- N_rebinint, default=par.N_rebin()
Number of bins to recombine into one.
- Returns:
- numpy array
Jackknife bins after skipping and rebinning.
- py_alf.ana.load_res(directories)#
Read analysis results from multiple simulations.
Read from pickled dictionaries ‘res.pkl’ and return everything in a single pandas DataFrame with one row per simulation.
- Parameters:
- directorieslist of path-like objects
Directories containing analyzed simulation results.
- Returns:
- dfpandas.DataFrame
Contains analysis results and Hamiltonian parameters. One row per simulation.
- py_alf.ana.read_hist(directory, obs_name, bare_bins=False)#
Read, skip, rebin and jackknife histogram-type bins.
Bins get skipped and rebinned according to N_skip an N_rebin retrieved through
Parameters
, then jackknife resampling is applied.- Parameters:
- directorypath-like object
Directory containing the observable.
- obs_namestr
Name of the observable.
- bare_binsbool, default=False
Do not perform skipping, rebinning, or jackknife resampling.
- Returns:
- array
Observables. shape: (N_bins, N_classes).
- array
Sign. shape: (N_bins,).
- array
Proportion of observations above upper bound. shape: (N_bins,).
- array
Proportion of observations below lower bound. shape: (N_bins,).
- N_classesint
Number of classes between upper and lower bound.
- upperfloat
Upper bound.
- lowerfloat
Lower bound.
- py_alf.ana.read_latt(directory, obs_name, bare_bins=False, substract_back=True)#
Read, skip, rebin and jackknife lattice-type bins (_eq and _tau).
Bins get skipped and rebinned according to N_skip an N_rebin retrieved through
Parameters
, then jackknife resampling is applied.- Parameters:
- directorypath-like object
Directory containing the observable.
- obs_namestr
Name of the observable.
- bare_binsbool, default=False
Do not perform skipping, rebinning, or jackknife resampling.
- substract_backbool, default=True
Substract background from correlation functions.
- Returns:
- array
Observables. shape: (N_bins, N_orb, N_orb, N_tau, latt.N).
- array
Background. shape: (N_bins, N_orb)
- array
Sign. shape: (N_bins,).
- N_orbint
Number of orbitals.
- N_tauint
Number of imaginary time steps.
- dtaufloat
Imaginary time step length.
- lattLattice
See
py_alf.Lattice
.
- py_alf.ana.read_scal(directory, obs_name, bare_bins=False)#
Read, skip, rebin and jackknife scalar-type bins.
Bins get skipped and rebinned according to N_skip an N_rebin retrieved through
Parameters
, then jackknife resampling is applied.- Parameters:
- directorypath-like object
Directory containing the observable.
- obs_namestr
Name of the observable.
- bare_binsbool, default=False
Do not perform skipping, rebinning, or jackknife resampling.
- Returns:
- array
Observables. shape: (N_bins, N_obs).
- array
Sign. shape: (N_bins,).
- N_obsint
Number of observables.
- py_alf.ana.rebin(X, N_rebin)#
Combine each N_rebin bins into one bin.
If the number of bins (=N0) is not an integer multiple of N_rebin, the last N0 modulo N_rebin bins are discarded.
- py_alf.ana.symmetrize(latt, syms, dat)#
Symmetrize a dataset.
- Parameters:
- lattLattice
See
py_alf.Lattice
.- symslist
List of symmetry operations, including the identity of the form sym(latt, i) -> i_tranformed
- datarray-like object
Data to symmetrize. The symmetrization is with respect to the last index of dat.
- Returns:
- dat_symnumpy array
Symmetrized data.
\(\phantom{\xi}\)