soft-matter / trackpy

Python particle tracking toolkit
http://soft-matter.github.io/trackpy
Other
446 stars 131 forks source link

trackpy.batch only works with processes = 1 #771

Open ggomes-altos opened 2 months ago

ggomes-altos commented 2 months ago

Python 3.12.4 trackpy 0.6.4

The following runs without error: f = tp.batch(frames, 11, invert=False, minmass=500, processes=1)

whereas processes = 2 gives a long error message ultimately ending in TiffFileError: corrupted tag list at offset 254920375

and processes = 'auto' gives a warning ( ValueError: need at most 63 handles, got a sequence of length 66 ) which disappears and is replaced with the Frame number 1 and number of features, but the computation never ends.

Happy to include full error messages if necessary.

nkeim commented 2 months ago

Thanks for this report. Do you know what version of pims you have, and which package is installed for reading tiffs? (usually libtiff or tifffile)

On Aug 8, 2024, at 7:01 PM, ggomes-altos @.***> wrote:

Python 3.12.4 trackpy 0.6.4

The following runs without error: f = tp.batch(frames, 11, invert=False, minmass=500, processes=1)

whereas processes = 2 gives a long error message ultimately ending in TiffFileError: corrupted tag list at offset 254920375

and processes = 'auto' gives a warning ( ValueError: need at most 63 handles, got a sequence of length 66 ) which disappears and is replaced with the Frame number 1 and number of features, but the computation never ends.

Happy to include full error messages if necessary.

— Reply to this email directly, view it on GitHubhttps://github.com/soft-matter/trackpy/issues/771, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAWY23NWV4XON3CF3IULEZTZQP2DRAVCNFSM6AAAAABMHMNIRKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2TMNZYGE4DIOA. You are receiving this because you are subscribed to this thread.Message ID: @.***>

ggomes-altos commented 2 months ago

Hi sorry for the delayed response.

I have pims 0.7 libtiff 4.6.0 tifffile 2023.4.12

I think tiffffile is doing the tiff reading since in the lowest level of the error message it seems to be using the tifffile package:


ValueError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_18640\387384096.py in ?() ----> 1 f = tp.batch(frames, 11, invert=False, minmass=500, processes=2);

A_path\Lib\site-packages\trackpy\feature.py in ?(frames, diameter, output, meta, processes, after_locate, **kwargs) 577 output.put(features) 578 finally: 579 if pool: 580 # Ensure correct termination of Pool --> 581 pool.terminate() 582 583 if output is None: 584 if len(all_features) > 0:

A_path\Lib\site-packages\slicerator__init.py in ?(self, i) 183 def getitem__(self, i): 184 """Getitem supports repeated slicing via Slicerator objects.""" 185 indices, new_length = key_to_indices(i, len(self)) 186 if new_length is None: --> 187 return self._get(indices) 188 else: 189 return cls(self, indices, new_length, propagate_attrs)

A_path\Lib\site-packages\pims\base_frames.py in ?(self, key) 97 def getitem(self, key): 98 """getitem is handled by Slicerator. In all pims readers, the data 99 returning function is get_frame.""" --> 100 return self.get_frame(key)

A_path\Lib\site-packages\pims\tiff_stack.py in ?(self, j) 129 def get_frame(self, j): 130 t = self._tiff[j] --> 131 data = t.asarray() 132 return Frame(data, frame_no=j, metadata=self._read_metadata(t))

A_path\Lib\site-packages\tifffile\tifffile.py in ?(self, out, squeeze, lock, maxworkers) 8835 f'{self!r} reading array from closed file', UserWarning 8836 ) 8837 fh.open() 8838 fh.seek(self.dataoffsets[0]) -> 8839 result = fh.read_array( 8840 keyframe.parent.byteorder + keyframe._dtype.char, 8841 product(keyframe.shaped), 8842 out=out,

A_apth\Lib\site-packages\tifffile\tifffile.py in ?(self, dtype, count, offset, out) 14214 ) 14215 n = nbytes 14216 14217 if n != nbytes:

14218 raise ValueError(f'failed to read {nbytes} bytes, got {n}') 14219 14220 if not result.dtype.isnative: 14221 if not dtype.isnative: