UserWarnings differ for identical initializations when run several times
Posted: 02 Aug 2022, 09:27
I have a frequent issue with
When run for the 1st time (i.e. with a freshly restarted python kernel), the last info by
However, running the code between '-- snip --' and '-- snap --' repeatedly, and starting with the 2nd run the info by
Why does
UserWarnings regarding unused options in as such that they differ for identical(?) code, run several times. Typically this happens when initializing some tenpy algorithm. E.g.:
Python: Select all
import logging
logging.basicConfig(level=logging.INFO) # allow for some UserWarnings
# Next, prepare some MPS 'psi' and have some model 'h'. Now do
# --------------------------- snip ---------------------
dt = 0.01
dtmes = 0.05
EMEopt = {
'compression_method': 'SVD',
'dt': dt,
'N_steps': int(np.ceil(dtmes/dt)),
'preserve_norm': True,
'trunc_params': {
'chi_max': 50,
'svd_min': 1.e-10,
'trunc_cut': None
}
}
# set e.g. an evolution engine
eng = ExpMPOEvolution(psi,h,EMEopt)
# --------------------------- snap ---------------------
tenpy is
Python: Select all
INFO:tenpy.tools.params:ExpMPOEvolution: subconfig 'trunc_params'=Config(<3 options>, 'trunc_params')tenpy changes into
Python: Select all
INFO:tenpy.tools.params:ExpMPOEvolution: subconfig 'trunc_params'=Config(<3 options>, 'trunc_params')
/home/xaver/.anaconda3/envs/py/lib/python3.9/site-packages/tenpy/tools/params.py:233: UserWarning: unused options for config ExpMPOEvolution:
['N_steps', 'compression_method', 'dt', 'preserve_norm']
warnings.warn(msg.format(keys=sorted(unused), name=self.name))
/home/xaver/.anaconda3/envs/py/lib/python3.9/site-packages/tenpy/tools/params.py:233: UserWarning: unused options for config trunc_params:
['chi_max', 'svd_min', 'trunc_cut']
warnings.warn(msg.format(keys=sorted(unused), name=self.name))
-
ExpMPOEvolutionnot use its options? -
ExpMPOEvolutiononly complain about this starting with the 2nd run?