Commit 6e221005 authored by payno's avatar payno

[core][process] add debug log in processes with the Spectrum position in Spectra

parent 7e6f6cce
......@@ -56,6 +56,7 @@ def process_spectr_autobk(spectrum, configuration, overwrite=True,
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start autobk on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
assert isinstance(spectrum, Spectrum)
if spectrum.energy is None or spectrum.mu is None:
_logger.error('Energy and or Mu is/are not specified, unable to '
......
......@@ -56,6 +56,7 @@ def process_spectr_mback(spectrum, configuration, overwrite=True, callbacks=None
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start mback on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
assert isinstance(spectrum, Spectrum)
if spectrum.energy is None or spectrum.mu is None:
_logger.error('Energy and or Mu is/are not specified, unable to '
......
......@@ -56,6 +56,7 @@ def process_spectr_mback_norm(spectrum, configuration, overwrite=True,
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start mback_norm on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
assert isinstance(spectrum, Spectrum)
if not hasattr(spectrum, 'norm'):
_logger.error('spectrum doesn\'t have norm. Maybe you meed to compute '
......
......@@ -56,6 +56,7 @@ def process_spectr_pre_edge(spectrum, configuration, overwrite=True, callbacks=N
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start pre_edge on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
assert isinstance(spectrum, Spectrum)
if spectrum.energy is None or spectrum.mu is None:
_logger.error('Energy and or Mu is/are not specified, unable to '
......
......@@ -56,6 +56,7 @@ def process_spectr_xftf(spectrum, configuration, overwrite=True, callbacks=None,
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start xftf on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
assert isinstance(spectrum, Spectrum)
if (not hasattr(spectrum, 'k') or not hasattr(spectrum, 'chi')
or spectrum.k is None or spectrum.chi is None):
......
......@@ -60,6 +60,7 @@ def process_spectr_exafs(spectrum, configuration, overwrite=True, callbacks=None
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start exafs on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
if spectrum.energy is None or spectrum.mu is None:
_logger.error('Energy and or Mu is/are not specified, unable to '
'compute exafs')
......
......@@ -59,6 +59,7 @@ def process_spectr_ft(spectrum, configuration, overwrite=True, callbacks=None,
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start fourier transform on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
pymca_xas = XASClass()
if spectrum.energy is None or spectrum.mu is None:
_logger.error('Energy and or Mu is/are not specified, unable to '
......
......@@ -59,6 +59,7 @@ def process_spectr_k(spectrum, configuration, overwrite=True, callbacks=None,
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start k weight definition on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
assert spectrum is not None
pymca_xas = XASClass()
......@@ -82,7 +83,10 @@ def process_spectr_k(spectrum, configuration, overwrite=True, callbacks=None,
cf, exafs_res = process_spectr_exafs(spectrum=spectrum_,
configuration=configuration)
if exafs_res is None:
raise ValueError('Failed to process exafs')
err = 'Failed to process exafs.'
if spectrum.x is not None or spectrum.y is not None:
err = err + 'Spectrum (x, y) coords: ' + ','.join((str(spectrum.x), str(spectrum.y)))
raise ValueError(err)
# update EXAFSNormalized
e0 = pymca_xas.calculateE0()
......
......@@ -59,6 +59,7 @@ def process_spectr_norm(spectrum, configuration, overwrite=True, callbacks=None,
:return: processed spectrum
:rtype: tuple (configuration, spectrum)
"""
_logger.debug('start normalization on spectrum (%s, %s)' % (spectrum.x, spectrum.y))
if spectrum.energy is None or spectrum.mu is None:
_logger.error('Energy and or Mu is/are not specified, unable to '
'compute exafs')
......
......@@ -234,7 +234,7 @@ class NormalizationOW(_ProcessForOrangeMixIn, OWWidget):
def process(self, xas_obj):
if xas_obj is None:
return
print('xas obj received x is %s' % xas_obj.spectra[0].x)
if not self._canProcess():
_logger.warning('There is some processing on going already, will'
'not process the new dataset')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment