MPBA / pyphysio

GNU General Public License v3.0
47 stars 13 forks source link

fmap: errors and syntax #39

Closed andbiz closed 7 years ago

andbiz commented 7 years ago
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-f8c2fba97632> in <module>()
      1 # compute indicators over the segments
----> 2 result = ph.fmap(fixed_length, indicators, ibi)

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/__init__.pyc in fmap(segments, algorithms, alt_signal)
    136     from numpy import asarray as _asarray
    137     values = _asarray([[seg.get_begin_time(), seg.get_end_time()] + [alg(seg(alt_signal)) for alg in algorithms]
--> 138                        for seg in segments])
    139     labels = _asarray([seg.get_label() for seg in segments])
    140     col_names = ["begin", "end"] + map(lambda x: x.__repr__(), algorithms)

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/BaseSegmentation.pyc in __call__(self, data)
     48         if data is None:
     49             data = self._signal
---> 50         return data.segment_time(self.get_begin_time(), self.get_end_time())
     51 
     52     def __repr__(self):

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/Signal.pyc in segment_time(self, t_start, t_stop)
    425 
    426         return self.segment_idx(self.get_idx(t_start) if t_start is not None else None,
--> 427                                 self.get_idx(t_stop) if t_stop is not None else None)
    428 
    429     def segment_idx(self, idx_start, idx_stop=None):

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/Signal.pyc in segment_idx(self, idx_start, idx_stop)
    448             idx_start = 0
    449 
--> 450         iidx_start = int(self.get_iidx_from_idx(idx_start))
    451         iidx_stop = int(self.get_iidx_from_idx(idx_stop))
    452 

TypeError: int() argument must be a string or a number, not 'NoneType'

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-33-f8c2fba97632> in <module>()
      1 # compute indicators over the segments
----> 2 result = ph.fmap(fixed_length, indicators, ibi)

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/__init__.pyc in fmap(segments, algorithms, alt_signal)
    136     from numpy import asarray as _asarray
    137     values = _asarray([[seg.get_begin_time(), seg.get_end_time()] + [alg(seg(alt_signal)) for alg in algorithms]
--> 138                        for seg in segments])
    139     labels = _asarray([seg.get_label() for seg in segments])
    140     col_names = ["begin", "end"] + map(lambda x: x.__repr__(), algorithms)

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/BaseSegmentation.pyc in __iter__(self)
     87 
     88     def __iter__(self):
---> 89         return SegmentationIterator(self)
     90 
     91     @classmethod

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/BaseSegmentation.pyc in __init__(self, win)
    118         assert isinstance(win, SegmentsGenerator)
    119         self._win = _cpy(win)
--> 120         self._win.init_segmentation()
    121 
    122     def next(self):

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/segmentation/SegmentsGenerators.pyc in init_segmentation(self)
    133         self._labsig = self._params["labels"]
    134         s = self._params["start"]
--> 135         self._t = s if s is not None else self._signal.get_start_time()
    136 
    137     def next_times(self):

AttributeError: 'NoneType' object has no attribute 'get_start_time'
Alebat commented 7 years ago

Notes

Error 2: manage the absence of a signal Error 1: manage out of bound indexes in segmentation

andbiz commented 7 years ago
New error:
#label based windowing

label_based = ph.LabelSegments(labels = label)
result, labels, col_names = ph.fmap(label_based(ibi), indicators)

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-45-5b39f6669d82> in <module>()
      2 label_based = ph.LabelSegments(labels = label)
      3 
----> 4 result, labels, col_names = ph.fmap(label_based(ibi), indicators)

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/__init__.pyc in fmap(segments, algorithms, alt_signal)
    136     from numpy import asarray as _asarray
    137     values = _asarray([[seg.get_begin_time(), seg.get_end_time()] + [alg(seg(alt_signal)) for alg in algorithms]
--> 138                        for seg in segments])
    139     labels = _asarray([seg.get_label() for seg in segments])
    140     col_names = ["begin", "end"] + map(lambda x: x.__repr__(), algorithms)

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/BaseSegmentation.pyc in next(self)
    121 
    122     def next(self):
--> 123         return self._win.next_segment()
    124 
    125 

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/segmentation/SegmentsGenerators.py in next_segment(self)
     27             raise StopIteration()
     28 
---> 29         b, e, label = self.next_segment_mix_labels()
     30         s = Segment(b, e, label, self._signal)
     31         return s

/home/andrea/Trento/CODICE/workspaces/pyHRV/pyHRV/pyphysio/segmentation/SegmentsGenerators.py in next_segment_mix_labels(self)
     90                 # Check if classically mixed
     91                 # compare with first each label in [b+1, e)
---> 92                 for i in range(first + 1, last):
     93                     if label != self._labsig[i]:
     94                         # This is a mixed segment

TypeError: range() integer end argument expected, got float.
Alebat commented 7 years ago