diff --git a/Docker/lofar-base/Dockerfile.tmpl b/Docker/lofar-base/Dockerfile.tmpl index 8d7b582138cd58d3dfe7f898e5776628d7104d3b..dc835250b30e73ffd9534f0641a92c96e8f5b823 100644 --- a/Docker/lofar-base/Dockerfile.tmpl +++ b/Docker/lofar-base/Dockerfile.tmpl @@ -137,7 +137,7 @@ RUN apt-get update && apt-get install -y subversion swig ruby ruby-dev python-de # RUN apt-get update && apt-get install -y git cmake g++ swig python-dev libhdf5-dev && \ mkdir ${INSTALLDIR}/DAL && \ - cd ${INSTALLDIR}/DAL && git clone --branch v3.3.0 https://github.com/nextgen-astrodata/DAL.git src && \ + cd ${INSTALLDIR}/DAL && git clone --branch master https://github.com/nextgen-astrodata/DAL.git src && \ mkdir ${INSTALLDIR}/DAL/build && cd ${INSTALLDIR}/DAL/build && cmake -DCMAKE_INSTALL_PREFIX=${INSTALLDIR}/DAL ../src && \ make -j ${J} && \ make install && \ diff --git a/RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc b/RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc index 591c1d98237bcaf28d0cb8e42490bbfb6cb73570..0af65eda3abc5493747d063ec00a9be16c8ab8fa 100644 --- a/RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc +++ b/RTCP/Cobalt/OutputProc/src/TBB_Dipole.cc @@ -141,6 +141,7 @@ namespace LOFAR dal::TBB_Station& station, Mutex& h5Mutex) { itsH5Filename = h5Filename; + subbandSizeInSamples = _subbandSize; /** * We get a std::size_t but need in the checks later an int64_t. * Obviously the std::size_t is the proper type for a size. @@ -532,8 +533,11 @@ namespace LOFAR */ itsLastSubbandDataset.reset(new dal::TBB_SubbandDataset( itsDipoleGroup()->subband(bandNr))); - itsLastSubbandDataset->create1D( - 0, -1, itsH5Filename, itsLastSubbandDataset->LITTLE); +// itsLastSubbandDataset->create1D( +// 0, -1, itsH5Filename, itsLastSubbandDataset->LITTLE); + // Store the data in the hdf5 file. Do not provide a file name! + itsLastSubbandDataset->create1D(subbandSizeInSamples, + subbandSizeInSamples, "", itsLastSubbandDataset->LITTLE); itsLastSubbandDataset->groupType().value = "SubbandDataset"; LOG_INFO_STR("TBB: Created HDF5 SubbandDataset " @@ -589,9 +593,18 @@ namespace LOFAR << ", offset in bytes casted for pwrite = " << offsetInFileInBytes); - pwrite(itsDumpInfo.itsRawFile->fd, frame.payload.data, - numberOfBytesToWrite, offsetInFileInBytes); - +// pwrite(itsDumpInfo.itsRawFile->fd, frame.payload.data, +// numberOfBytesToWrite, offsetInFileInBytes); + /** + * I know, I know. These two casts are not good. I tried to use a + * union for a std::complex< int16_t > type but C++ would not let me. + * Next best thing is a union of int16_t[] and int16_t[][2]. And hence + * the weird casting. + */ + itsLastSubbandDataset->set1D(offset, + reinterpret_cast< std::complex< int16_t > * >( + const_cast< int16_t * >(&(frame.payload.spectralData[0][0]))), + frame.header.nOfSamplesPerFrame, 0); // in (complex) values itsDumpInfo.itsDatasetLen = offset + frame.header.nOfSamplesPerFrame; diff --git a/RTCP/Cobalt/OutputProc/src/TBB_Dipole.h b/RTCP/Cobalt/OutputProc/src/TBB_Dipole.h index c13182480a65a680a9f498fd927b1bb4f46e4d85..adf201122859c823ab44eb70d2c9279a901cb513 100644 --- a/RTCP/Cobalt/OutputProc/src/TBB_Dipole.h +++ b/RTCP/Cobalt/OutputProc/src/TBB_Dipole.h @@ -121,6 +121,7 @@ namespace LOFAR std::vector< unsigned int > remainingSubbandsToBeStored; off_t subbandOffset; int64_t subbandSizeInBytes; + int64_t subbandSizeInSamples; std::vector< int64_t > currentSubbandSizeInBytes; }; diff --git a/RTCP/Cobalt/OutputProc/src/TBB_Frame.cc b/RTCP/Cobalt/OutputProc/src/TBB_Frame.cc index c2ea0697bb6b25aa8d87527e504b56fc3d3209a5..0f592b2be2fe1eeadd663405d351f5fb0f7998ca 100644 --- a/RTCP/Cobalt/OutputProc/src/TBB_Frame.cc +++ b/RTCP/Cobalt/OutputProc/src/TBB_Frame.cc @@ -21,6 +21,8 @@ #include <lofar_config.h> #include "TBB_Frame.h" +#include <cstdint> +#include <complex> #include <climits> // CHAR_BIT #include <strings.h> // ffs() #include <boost/format.hpp> @@ -48,7 +50,7 @@ namespace LOFAR const unsigned TBB_Frame::transientFrameSize = sizeof(TBB_Header) + DEFAULT_TBB_TRANSIENT_NSAMPLES * sizeof(int16_t) + /*crc32:*/sizeof(uint32_t); const unsigned TBB_Frame::spectralFrameSize = sizeof(TBB_Header) + - MAX_TBB_SPECTRAL_NSAMPLES * 2 * sizeof(int16_t) + /*crc32:*/sizeof(uint32_t); + MAX_TBB_SPECTRAL_NSAMPLES * sizeof(std::complex< int16_t >) + /*crc32:*/sizeof(uint32_t); unsigned TBB_Header::getFirstBandSelNr() const { diff --git a/RTCP/Cobalt/OutputProc/src/TBB_Frame.h b/RTCP/Cobalt/OutputProc/src/TBB_Frame.h index fe42f9b589b6c0fb6369cd21cba4b8ac65618974..6866262e6832821311f3848aebb8109f310d408c 100644 --- a/RTCP/Cobalt/OutputProc/src/TBB_Frame.h +++ b/RTCP/Cobalt/OutputProc/src/TBB_Frame.h @@ -21,7 +21,8 @@ #ifndef LOFAR_COBALT_OUTPUTPROC_TBBFRAME_H #define LOFAR_COBALT_OUTPUTPROC_TBBFRAME_H 1 -#include <stdint.h> +#include <cstdint> +#include <complex> #include <ctime> #include <string> #include <vector> @@ -99,10 +100,11 @@ namespace LOFAR // Unpacked, sign-extended (for transient) samples without padding, i.e. as received. // Frames might not be full; the doc says the crc32 is always sent right after (no padding), // so we include the crc32 in 'data', but note that the crc32 is a little endian uint32_t, hence ' + 2'. -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - int16_t data[MAX(MAX_TBB_TRANSIENT_NSAMPLES, 2 * MAX_TBB_SPECTRAL_NSAMPLES) + 2]; + union + { + int16_t data[MAX_TBB_TRANSIENT_NSAMPLES]; + int16_t spectralData[MAX_TBB_SPECTRAL_NSAMPLES + 2][2]; + }; // For transient, TBB always sends sends 1024 samples per frame (from the spec and seen in data). // For spectral, it depends on the nr of subbands (max is equal to MAX_TBB_SPECTRAL_NSAMPLES).