Photon-HDF5 / phconvert

Convert Beker&Hickl, PicoQuant and other formats to Photon-HDF5
http://photon-hdf5.github.io/phconvert
Other
16 stars 14 forks source link

Unable to covert .ptu to hdf5 #56

Open Marioandnoddy opened 5 months ago

Marioandnoddy commented 5 months ago

I am unable to convert .ptu to hdf5 format using phconvert. While converting .ptu to hdf5 format it showed following error:(attached below).] Capture

I also tried converting .ptu files to text files and the keyerror type that it is showing here 66311, this is the TTResultFormat_TTRRecType variable

My TCSPC module is Multiharp150. Please help.

mayeshh commented 5 months ago

Hi Mario, my guess is that your file is formatted differently than phconvert requires. Can you share a truncated file?

Marioandnoddy commented 5 months ago

Thank you Mayeshh for replying. I am attaching the .ptu file that is been generated from our setup below. [luxa.org].zip

We have a home-built setup where we have a single donor excitation laser (520nm, pulsed laser) for exciting the sample, MultiHarp 150 (multi-channel event timer, PicoQuant) and SymPhoTime 64 software for data acquisition. We have choosen channel-2 as donor channel and channel-1 as acceptor channel and used a dual-labelled DNA ( Cyanine 3 and Cyanine 5 as our FRET-pair). If you need any other info please let me know.

jacrossley commented 5 months ago

Hey @Marioandnoddy,

The Multiharp 150 isnt supported in phconvert 0.9. I got around this in the past by adding the information for the Multiharp to pqreader.py. Firstly, add the Multiharp to the dict which holds the record types:

_ptu_rec_type = dict(
    rtPicoHarpT3     = 0x00010303,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $03 (T3), HW: $03 (PicoHarp)
    rtPicoHarpT2     = 0x00010203,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $02 (T2), HW: $03 (PicoHarp)
    rtHydraHarpT3    = 0x00010304,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $03 (T3), HW: $04 (HydraHarp)
    rtHydraHarpT2    = 0x00010204,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $02 (T2), HW: $04 (HydraHarp)
    rtHydraHarp2T3   = 0x01010304,  # (SubID = $01 ,RecFmt: $01) (V2), T-Mode: $03 (T3), HW: $04 (HydraHarp)
    rtHydraHarp2T2   = 0x01010204,  # (SubID = $01 ,RecFmt: $01) (V2), T-Mode: $02 (T2), HW: $04 (HydraHarp)
    rtTimeHarp260NT3 = 0x00010305,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $03 (T3), HW: $05 (TimeHarp260N)
    rtTimeHarp260NT2 = 0x00010205,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $02 (T2), HW: $05 (TimeHarp260N)
    rtTimeHarp260PT3 = 0x00010306,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $03 (T3), HW: $06 (TimeHarp260P)
    rtTimeHarp260PT2 = 0x00010206,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $02 (T2), HW: $06 (TimeHarp260P)
    rtMultiHarpNT3   = 0x00010307,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $02 (T3), HW: $07 (MultiHarp150N)
    rtMultiHarpNT2   = 0x00010207,  # (SubID = $00 ,RecFmt: $01) (V1), T-Mode: $02 (T2), HW: $07 (MultiHarp150N))

Looking back on my notes the example file from PQ i got this information from has gone, but i think this one contains whats needed - https://github.com/PicoQuant/PicoQuant-Time-Tagged-File-Format-Demos/blob/master/PTU/Python/Read_PTU.py. It looks like PQ are moving towards a 'GenericT3' file format, which contains the Multiharp. Then add the following to the load_ptu function to identify the record type in your file being converted:

elif record_type in ('rtHydraHarp2T3', 'rtTimeHarp260NT3','rtTimeHarp260PT3', 'rtMultiHarpNT3'):
detectors, timestamps, nanotimes = process_t3records(t3records, time_bit=10, dtime_bit=15, ch_bit=6,
special_bit=True,ovcfunc=_correct_overflow_nsync)

Let me know if that works for you, otherwise I can take a look and see what else needs doing. It would be good to push these updates to the master, but I'm not sure how this package is being maintained anymore.

Cheers, Joel

Marioandnoddy commented 4 months ago

Thankyou so much for your help, I was able to convert my .ptu to .hdf5 by changing pqreader.py as mentioned above.