Cheetah - SKA - PSS - Prototype Time Domain Search Pipeline
BeamFormerDataTraits.cpp
1 /*
2  * The MIT License (MIT)
3  *
4  * Copyright (c) 2016 The SKA organisation
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #include "cheetah/rcpt/BeamFormerDataTraits.h"
25 #include "cheetah/rcpt/BeamFormerPacket.h"
26 #include <iostream>
27 #include <cstdlib>
28 #include <type_traits>
29 
30 
31 namespace ska {
32 namespace cheetah {
33 namespace rcpt {
34 
35 
36 BeamFormerDataTraits::BeamFormerDataTraits()
37 {
38 }
39 
40 BeamFormerDataTraits::~BeamFormerDataTraits()
41 {
42 }
43 
45 {
46  return packet.packet().packet_count(); // * _scale_factor;
47 }
48 
49 std::size_t BeamFormerDataTraits::chunk_size(DataType const& chunk)
50 {
51  return chunk.number_of_spectra() * chunk.number_of_channels();
52 }
53 
55 {
57 }
58 
60 {
61  return inspector.packet().first_channel_number() == 0;
62 }
63 
64 void BeamFormerDataTraits::packet_stats(uint64_t packets_missing, uint64_t packets_expected)
65 {
66  if(packets_missing > 0)
67  {
68  PANDA_LOG_WARN << "missing packets: " << packets_missing << " in " << packets_expected;
69  }
70 }
71 
72 } // namespace rcpt
73 } // namespace cheetah
74 } // namespace ska
static std::size_t chunk_size(DataType const &data)
return the total number of samples (time_samples * channels) in the data
uint16_t first_channel_number() const
the number of the fitst channel in the packet
static std::size_t packet_size()
return the number of signal samples in a packet
BeamFormerPacket inspection and data extraction.
Some limits and constants for FLDO.
Definition: Brdz.h:35
std::size_t number_of_channels() const
void packet_count(uint64_t)
set the counter in the header
static constexpr std::size_t number_of_samples()
the total number of samples in the rcpt payload
static bool align_packet(PacketInspector const &packet)
ignore all packets other than the StokesI
static uint64_t sequence_number(PacketInspector const &packet)
returns the sequential number of the chunk that the packet belongs to
std::size_t number_of_spectra() const