本文整理汇总了Python中analyzer.Analyzer.clean方法的典型用法代码示例。如果您正苦于以下问题:Python Analyzer.clean方法的具体用法?Python Analyzer.clean怎么用?Python Analyzer.clean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类analyzer.Analyzer
的用法示例。
在下文中一共展示了Analyzer.clean方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clean
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import clean [as 别名]
def clean(self):
Analyzer.clean(self)
self._regre_ = None
gc.collect()
示例2: DualAnalyzer
# 需要导入模块: from analyzer import Analyzer [as 别名]
# 或者: from analyzer.Analyzer import clean [as 别名]
class DualAnalyzer(_BasicAnalyzer_, Logger):
_nsvd_max = 100
_nsvd_default = 10
_svd_params = ['nsvd']
_params = dict(svd=_svd_params)
_all_params = _svd_params
_int_params = ['nsvd']
def __init__(self, ldataset, rdataset, lweights=None, rweights=None, lnorms=None, rnorms=None,
lminvalid=None, rminvalid=None, logger=None, loglevel=None, zerofill=0, **kwargs):
# Loggers
Logger.__init__(self, logger=logger, loglevel=loglevel, **dict_filter(kwargs, 'log_'))
self._quiet=False
# Left and right Analyzer instances
if zerofill==2:
kwargs['zerofill'] = 2
kwleft, kwright = self._dict_filter_lr_(kwargs)
kwargs['logger'] = self.logger
self.lspan = Analyzer(ldataset, weights=lweights, norms=lnorms,
minvalid=lminvalid, **kwargs)
self.rspan = Analyzer(rdataset, weights=rweights, norms=rnorms,
minvalid=rminvalid, **kwargs)
# Init results
self.clean(pca=False)
# Check and save parameters
self.update_params(None, **kwargs)
def __getitem__(self, key):
return (self.lspan, self.rspan)[key]
def __len__(self):
return 2
@staticmethod
def _dict_filter_lr_(kwargs):
return dict_filter(kwargs, 'l'), dict_filter(kwargs, 'r')
def update_params(self, anatype=None, **kwargs):
"""Initialize, update and check statistical paremeters.
A value of ``None`` is converted to an optimal value.
Analyses are re-ran if needed by checking dependencies.
:Params:
- **anatype**, optional: current analysis type.
- ``None``: Simple initialization with ``None``
- ``"svd"``: Check SVD parameters.
If different from ``None``, analysis may be ran again
if parameters are changed.
- Other keywords are interpreted as analysis parameters.
:Output: A dictionary of (param name, change status) items.
"""
# Update left and right params first
kwleft, kwright = self._dict_filter_lr_(kwargs)
reran = (self.lspan.update_params(**kwleft),
self.rspan.update_params(**kwright))
# Initialize old values and defaults changed to False
old = {}
for param in self._all_params:
old[param] = getattr(self,'_'+param, None)
setattr(self, '_'+param, kwargs.pop(param, old[param]))
# Number of SVD modes
if self._nsvd is None: # Initialization
self._nsvd = self._nsvd_default # Default value
for iset in xrange(2): # Check values
if self[iset].prepca:
nchanmax = self[iset].prepca # Input channels are from pre-PCA
else:
nchanmax = self[iset].ns # Input channels are from real space
self._nsvd = npy.clip(self._nsvd, 1, min(self._nsvd_max, nchanmax)) # Max
# Re-run analyses when needed
rerun = dict(
svd = self._has_run_('svd') and (self._has_changed_(old, 'nsvd')>0 or \
(self[0].prepca and reran[0]['pca']) or \
(self[1].prepca and reran[1]['pca'])),
)
# - SVD
if rerun['svd']:
self.debug('Re-running SVD because some parameters changed')
self.svd()
# Inform what has reran
return rerun
def _has_run_(self, anatype=None, iset=0):
"""Check if an analysis has already run"""
if anatype is None: return False
getattr(self, '_%s_raw_eof'%anatype) is None
#.........这里部分代码省略.........