Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tttr.intensity_trace() crashes kernel #25

Closed
NicolaasvanderVoort opened this issue Feb 1, 2022 · 3 comments
Closed

tttr.intensity_trace() crashes kernel #25

NicolaasvanderVoort opened this issue Feb 1, 2022 · 3 comments

Comments

@NicolaasvanderVoort
Copy link

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.

@NicolaasvanderVoort
Copy link
Author

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.

@Jhsmit
Copy link

Jhsmit commented Jul 31, 2024

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"

@tpeulen
Copy link
Member

tpeulen commented Sep 17, 2024

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: #43)

@tpeulen tpeulen closed this as completed Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants