tttrlib
tttrlib copied to clipboard
tttr.intensity_trace() crashes kernel
Dear Thomas,
ffile = r'path\to\some\file.ptu trace = tttrlib.TTTR(ffile) trace.intensity_trace()
causes a kernel crash (python 3.7).
Giving an argument to intensity_trace resolves this issue.
trace.intensity_trace(1)
According to the docs, the time_window_length argument is a keyword argument, so I was not expecting this issue.
It is mostly a problem because you can crash the kernel when you don't expect it. I can send you the .ptu file that goes with this.
Addendum:
I learned that for any non-legal function input the kernel crashed. E.g. when I try to write a .ptu file to disk but not giving the correct inputs. It would be great if an error gets thrown rather than the kernel crashing.
I'm having a similar issue where creating a TTTR object with a photon-hdf5 file as argument crashes the kernel.
~I didnt expect this to work, but~ as @NicolaasvanderVoort points out it would be nice if there would be an error.
For picoquant tttr files, I know you can check like this, not sure for other formats:
def is_pqtttr(fpath: PathLike) -> bool:
with open(fpath, "rb") as f:
magic = f.read(8).rstrip(b"\0")
return magic == b"PQTTTR"
I improved the checks for the supported data types. Not all file formats have "magic" identifiers. Hence, I try to infer the types by:
i) the file extension ii) the header information
(see: https://github.com/Fluorescence-Tools/tttrlib/pull/43)