openworm / open-worm-analysis-toolbox

A testing pipeline that allows us to run a behavioural phenotyping of our virtual worm running the same test statistics the Schafer Lab used on their worm data.
Other
48 stars 27 forks source link

Error calculating skeleton from contour #185

Open MichaelCurrie opened 8 years ago

MichaelCurrie commented 8 years ago

Line 52 of WCON demo.py:

'skeleton': bw.h_dorsal_contour}  # DEBUG

... uses the dorsal contour in place of the skeleton, because of an error in calculating the skeleton from the contour. If we replace the above with:

'skeleton': bw.h_skeleton}  # DEBUG

We get this error:

RUNNING TEST WCON demo.py:
Traceback (most recent call last):
  File "../open_worm_analysis_toolbox/prefeatures/basic_worm.py", line 447, in h_skeleton
    return self._h_skeleton
AttributeError: 'BasicWorm' object has no attribute '_h_skeleton'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "WCON demo.py", line 83, in <module>
    w = schafer_to_WCON(schafer_bw_file_path)
  File "WCON demo.py", line 52, in schafer_to_WCON
    'skeleton': bw.h_skeleton}  # DEBUG
  File "../open_worm_analysis_toolbox/prefeatures/basic_worm.py", line 452, in h_skeleton
    self.h_ventral_contour, self.h_dorsal_contour)[1]
  File "../open_worm_analysis_toolbox/prefeatures/pre_features.py", line 96, in compute_skeleton_and_widths
    frames_to_plot=[])
  File "../open_worm_analysis_toolbox/prefeatures/skeleton_calculator1.py", line 124, in compute_skeleton_and_widths
    polyorder=SMOOTHING_ORDER)
  File "/home/ubuntu/miniconda3/lib/python3.5/site-packages/scipy/signal/_savitzky_golay.py", line 344, in savgol_filter
    _fit_edges_polyfit(x, window_length, polyorder, deriv, delta, axis, y)
  File "/home/ubuntu/miniconda3/lib/python3.5/site-packages/scipy/signal/_savitzky_golay.py", line 222, in _fit_edges_polyfit
    polyorder, deriv, delta, y)
  File "/home/ubuntu/miniconda3/lib/python3.5/site-packages/scipy/signal/_savitzky_golay.py", line 180, in _fit_edge
    x_edge = axis_slice(x, start=window_start, stop=window_stop, axis=axis)
  File "/home/ubuntu/miniconda3/lib/python3.5/site-packages/scipy/signal/_arraytools.py", line 45, in axis_slice
    b = a[a_slice]
IndexError: invalid slice

@JimHokanson does this error ring any bells for you? Otherwise I will investigate. Thanks