Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Source/Data/Time/KTTimeSeriesFFTW.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,20 @@ namespace Katydid
return hist;
}

TH1D* KTTimeSeriesFFTW::CreateHistogramImag(const std::string& name) const
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the previous function be changed to CreateHistogramReal to maintain consistency?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would provide consistency, but would require more changes upstream in the KTDAC class. So the benefit to the present approach is that it is a minimal addition that applies to one configuration. Another possibility would be to add a new function called CreateHistogramReal(), but without deleting the CreateHistogram() function that is in use by other classes.

{
unsigned nBins = GetNBins();
TH1D* hist = new TH1D(name.c_str(), "Time Series Imag", (int)nBins, GetRangeMin(), GetRangeMax());
for (unsigned iBin=0; iBin<nBins; ++iBin)
{
hist->SetBinContent((int)iBin+1, (*this)(iBin).imag());
}
hist->SetXTitle("Time (s)");
hist->SetYTitle("Voltage (V)");
return hist;
}


TH1D* KTTimeSeriesFFTW::CreateAmplitudeDistributionHistogram(const std::string& name) const
{
double tMaxMag = -1.;
Expand Down
2 changes: 2 additions & 0 deletions Source/Data/Time/KTTimeSeriesFFTW.hh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ namespace Katydid
public:
virtual TH1D* CreateHistogram(const std::string& name = "hTimeSeries") const;

virtual TH1D* CreateHistogramImag(const std::string& name = "hTimeSeriesImag") const;

virtual TH1D* CreateAmplitudeDistributionHistogram(const std::string& name = "hTimeSeriesDist") const;
#endif
};
Expand Down
4 changes: 2 additions & 2 deletions Source/IO/BasicROOTFileWriter/KTBasicROOTTypeWriterTime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ namespace Katydid
convReal << "histTSReal_" << sliceNumber << "_" << iComponent;
string histNameReal;
convReal >> histNameReal;
TH1D* tsHistReal = ts->CreateHistogram(histNameReal);
TH1D* tsHistReal = tsFFTW->CreateHistogram(histNameReal);
tsHistReal->SetDirectory(fWriter->GetFile());
tsHistReal->Write();
KTDEBUG(publog, "Histogram <" << histNameReal << "> written to ROOT file");
Expand All @@ -269,7 +269,7 @@ namespace Katydid
convImag << "histTSImag_" << sliceNumber << "_" << iComponent;
string histNameImag;
convImag >> histNameImag;
TH1D* tsHistImag = ts->CreateHistogram(histNameImag);
TH1D* tsHistImag = tsFFTW->CreateHistogramImag(histNameImag);
tsHistImag->SetDirectory(fWriter->GetFile());
tsHistImag->Write();
KTDEBUG(publog, "Histogram <" << histNameImag << "> written to ROOT file");
Expand Down