project8 / katydid

Project 8 data analysis package
Other
5 stars 4 forks source link

Problems with writing raw spectrograms from triggered ROACH data #173

Open cclaessens opened 6 years ago

cclaessens commented 6 years ago

using ROOTSpectrogramWriter with this configuration:

writer:
    output-file: "KTOutput/raw_spectrogram.root"
    file-flag: recreate
    mode: sequential #single
    n-time-bins: 100
    #min-time: 0
    #max-time: 1
    min-freq: 25e6
    max-freq: 75e6

Issues: Katydid fails to create the output file. Instead there was this file at the location where I ran katydid: 7e3f-af33-819b-1ee4.root The file is 1.7GB big and does contain spectrograms. When I opened it with ROOT, I got warnings that the file is broken but the spectrograms could be recovered:

Info in <TFile::Recover>: 7e3f-af33-819b-1ee4.root, recovered key TH2D:FSFFTWSpectrogram_523_0 at address 1728812965

The time axis of the spectrograms is not correct. Every acquisition has the same x axis starting at the start time in run of the first acquisition in the file.

Elise forwarded me a fix from Yu-Hao:

I at least got sequential mode working. If you find the source file KTROOTSpectrogramWriter.cc in source files under IO, around line 170-180 there is an if statement

if (isNewAcq && dataBundle.fSpectrograms.size() != 0)

Change it into something like

if (isNewAcq && 1== 0)

So that the part below never run. I believe that is the most substantial change that made it working.

With this workaround katydid now creates a "healthy" root file. However now all the spectrograms are of the same length and the time axis is still the same for all of them. It seems that the acquisitions now get stitched together (which makes sense as the writer is no longer treating new acquisitions) and split once the TH2D reaches a certain size.

The file size with the workaround is 3.8GB. And changing n-time-bins in the configuration has no effect on the file size and content.

elisenovitski commented 6 years ago

Thanks, Christine. I think you summed it all up there. My apologies for not documenting my earlier difficulties properly.