From 50188b8e7220bc4c56d2fe3db47cbd5b9b4ef00e Mon Sep 17 00:00:00 2001 From: Andrea Orlati <aorlati@users.noreply.github.com> Date: Mon, 17 Mar 2025 16:06:30 +0100 Subject: [PATCH] fix issue #895: the request to have the indication of the rest frequency without to wait for the summar to be created lead to a new (#914) Fitszilla version (1.23), the rest freqncy is now also reported in the header of the section table. This should also be tracked in the Fitszilla document. --- CHANGELOG.md | 1 + Common/Servers/FitsWriter/include/Version.h | 5 ++- .../Servers/FitsWriter/src/EngineThread.cpp | 35 ++++++++++++++++++- Common/Servers/FitsWriter/src/FitsWriter.cpp | 3 +- .../Servers/FitsWriter/src/SummaryWriter.cpp | 1 + 5 files changed, 42 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e1ed874..78a63fce3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -111,3 +111,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/ issue #689 - The dataset provided by weather station has been enlarged by the wind direction. The correctponding RAL 'wx' command will noe provided wind direction readout, as well issue #621 - The maximum number of chars of the schedule file name is now 37 (extension included). This is done for fits file and archive issue with the lenght of the schedule name. issue #853 - The setSection command can now accept a wildcard (*) as section identifier. This will allow to configure all backend sections with a single command + issue #895 - FitZilla version 1.23 released, the rest frequency is also added in the header of the Section table \ No newline at end of file diff --git a/Common/Servers/FitsWriter/include/Version.h b/Common/Servers/FitsWriter/include/Version.h index cb1621ae0..cb266e16b 100644 --- a/Common/Servers/FitsWriter/include/Version.h +++ b/Common/Servers/FitsWriter/include/Version.h @@ -23,9 +23,10 @@ #define FITS_VERSION11 "V.1.2" #define FITS_VERSION12 "V.1.21" #define FITS_VERSION13 "V.1.22" +#define FITS_VERSION14 "V.1.23" -#define CURRENT_VERSION FITS_VERSION13 +#define CURRENT_VERSION FITS_VERSION14 #define DEFAULT_COMMENT CURRENT_VERSION" Created by S. Righini, M. Bartolini & A. Orlati" @@ -42,6 +43,8 @@ #define HISTORY11 FITS_VERSION11" Frequency and bandwidth columns added to Section table reporting backend sampled band" #define HISTORY12 FITS_VERSION12" SubScan offsets added to the primary header" #define HISTORY13 FITS_VERSION13" Summary file aligned to reference document" +#define HISTORY14 FITS_VERSION14" Rest frequency information also added in the header of section table" + #define CREDITS1 " " #define CREDITS2 "These data are property of:" diff --git a/Common/Servers/FitsWriter/src/EngineThread.cpp b/Common/Servers/FitsWriter/src/EngineThread.cpp index 0008d1dbb..9ed3691f7 100644 --- a/Common/Servers/FitsWriter/src/EngineThread.cpp +++ b/Common/Servers/FitsWriter/src/EngineThread.cpp @@ -629,7 +629,7 @@ void CEngineThread::runLoop() ACS::doubleSeq fluxes; ACS::longSeq feedsID; ACS::longSeq ifsID; - ACS::doubleSeq atts; + ACS::doubleSeq atts,restFreqs; ACS::longSeq sectionsID; ACS::stringSeq axisName,axisUnit; @@ -889,6 +889,39 @@ void CEngineThread::runLoop() impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately m_data->setStatus(Management::MNG_FAILURE); } + m_info.getRestFreq(restFreqs); + if (restFreqs.length()==1) { + double rfValue; + IRA::CString keyName; + for (long j=0;j<m_data->getSectionsNumber();j++) { + if (restFreqs[0]>0.0) rfValue=restFreqs[0]; + else rfValue=DOUBLE_DUMMY_VALUE; + keyName.Format("RESTFREQ%d",j+1); + if (!m_file->setSectionHeaderKey(keyName,rfValue,"Frequency resolution of the Nth section (MHz)")) { + _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); + impl.setFileName((const char *)m_data->getFileName()); + impl.setError(m_file->getLastError()); + impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately + m_data->setStatus(Management::MNG_FAILURE); + } + } + } + else { + double rfValue; + IRA::CString keyName; + for (long j=0;j<restFreqs.length();j++) { + if (restFreqs[j]>0.0) rfValue=restFreqs[j]; + else rfValue=DOUBLE_DUMMY_VALUE; + keyName.Format("RESTFREQ%d",j+1); + if (!m_file->setSectionHeaderKey(keyName,rfValue,"Frequency resolution of the Nth section (MHz)")) { + _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); + impl.setFileName((const char *)m_data->getFileName()); + impl.setError(m_file->getLastError()); + impl.log(LM_ERROR); // not filtered, because the user need to know about the problem immediately + m_data->setStatus(Management::MNG_FAILURE); + } + } + } CFitsWriter::TFeedHeader *feedH=m_info.getFeedHeader(); if (!m_file->addFeedTable("FEED TABLE")) { _EXCPT(ManagementErrors::FitsCreationErrorExImpl,impl,"CEngineThread::runLoop()"); diff --git a/Common/Servers/FitsWriter/src/FitsWriter.cpp b/Common/Servers/FitsWriter/src/FitsWriter.cpp index b7dafd5df..57a1a3a68 100644 --- a/Common/Servers/FitsWriter/src/FitsWriter.cpp +++ b/Common/Servers/FitsWriter/src/FitsWriter.cpp @@ -234,7 +234,8 @@ bool CFitsWriter::create() if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY10,m_lastError)) return false; if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY11,m_lastError)) return false; if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY12,m_lastError)) return false; - if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY13,m_lastError)) return false; + if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY13,m_lastError)) return false; + if (!CFitsTools::primaryHeaderHistory(pFits,HISTORY14,m_lastError)) return false; if (!CFitsTools::primaryHeaderComment(pFits,CREDITS1,m_lastError)) return false; if (!CFitsTools::primaryHeaderComment(pFits,CREDITS2,m_lastError)) return false; diff --git a/Common/Servers/FitsWriter/src/SummaryWriter.cpp b/Common/Servers/FitsWriter/src/SummaryWriter.cpp index 81fc021f0..b516e783b 100644 --- a/Common/Servers/FitsWriter/src/SummaryWriter.cpp +++ b/Common/Servers/FitsWriter/src/SummaryWriter.cpp @@ -63,6 +63,7 @@ bool CSummaryWriter::create() if (!CFitsTools::primaryHeaderHistory(m_pFits,HISTORY11,m_lastError)) return false; if (!CFitsTools::primaryHeaderHistory(m_pFits,HISTORY12,m_lastError)) return false; if (!CFitsTools::primaryHeaderHistory(m_pFits,HISTORY13,m_lastError)) return false; + if (!CFitsTools::primaryHeaderHistory(m_pFits,HISTORY14,m_lastError)) return false; if (!CFitsTools::primaryHeaderComment(m_pFits,CREDITS1,m_lastError)) return false; if (!CFitsTools::primaryHeaderComment(m_pFits,CREDITS2,m_lastError)) return false; -- GitLab