关闭配置项

Turning off ConfigurationItems

我正在做一些涉及不确定性传播的计算,并且我不断收到很多关于相关不确定性不受支持的无用信息日志。我已经知道了,我不在乎,我想停止它打印这些消息。

根据文档,它可以“通过 WARN_UNSUPPORTED_CORRELATED 配置项

我不知道该怎么做。我怎样才能停止打印这些无用的消息?

http://astropy.readthedocs.org/en/latest/config/index.html

从那里您可以在 astropy.cfg:

中禁用
[nddata]

## Whether to issue a warning if NDData arithmetic is performed with
## uncertainties and the uncertainties do not support the propagation of
## correlated uncertainties.
warn_unsupported_correlated = False

或通过代码:

>>> import astropy.nddata
>>> astropy.nddata.conf.warn_unsupported_correlated = False