31 namespace astrotypes {
35 TimeFrequencyTest::TimeFrequencyTest()
57 ASSERT_EQ(time_size, tf1.
size<
Time>());
61 ASSERT_EQ(time_size, tf2.
size<
Time>());
71 for(
unsigned spectrum_num =0; spectrum_num < (std::size_t)time_size; ++spectrum_num)
75 std::for_each(s.
begin(), s.
end(), [&](uint8_t& v) { v = ++n; } );
76 ASSERT_EQ(n, (
unsigned)(freq_size));
96 for(
unsigned spectrum_num =0; spectrum_num < (std::size_t)time_size; ++spectrum_num)
100 std::for_each(s.cbegin(), s.cend(), [&](uint8_t) { ++n; } );
101 ASSERT_EQ(n, (
unsigned)(freq_size * spectrum_num));
104 ASSERT_EQ(s2.data_size(), (unsigned)(freq_size));
114 decltype(s) slice_copy = s;
115 ASSERT_TRUE(slice_copy.parent() == s.parent());
124 std::generate(tf1.
begin(), tf1.
end(), [&]() {
return val++; });
127 for(
unsigned channel_num=0; channel_num < (std::size_t)freq_size; ++ channel_num) {
128 SCOPED_TRACE(channel_num);
129 SCOPED_TRACE(
"channel_num:");
130 Channel c = tf1.
channel(channel_num);
132 ASSERT_EQ(&*c.begin(), &*c_copy.begin());
135 ASSERT_EQ(c[num], (
int)((
unsigned)num * freq_size) + channel_num) << num;
140 ASSERT_EQ(c.size<
Time>(), time_size);
144 ASSERT_EQ(it, it_const);
146 while(it != c.end()) {
147 ASSERT_EQ(count * (std::size_t)freq_size + channel_num, *it) <<
" count=" << count;
151 ASSERT_EQ(count, (
unsigned)(time_size));
153 std::for_each(c.cbegin(), c.cend(), [&](
int const& val)
155 ASSERT_EQ(count2 * (std::size_t)freq_size + channel_num, val) <<
" count=" << count2;
158 ASSERT_EQ(count, (
unsigned)(time_size));
164 ASSERT_EQ(c2.
size<
Time>(), time_size);
173 std::fill(channel.
begin(), channel.
end(), 0);
181 ASSERT_EQ(time_size, tf1.
size<
Time>());
185 ASSERT_EQ(time_size, tf2.
size<
Time>());
197 std::for_each(s.
cbegin(), s.
cend(), [&](uint8_t) { ++n; } );
198 ASSERT_EQ(n, (
unsigned)(freq_size));
207 auto const& const_spectra =
const_cast<decltype(slice) const&
>(slice).spectrum(2);
220 ASSERT_EQ(c.
size<
Time>(), time_size);
226 ASSERT_EQ(c2.
size<
Time>(), time_size);
231 auto channel = slice.
channel(2);
232 auto const& const_channel =
const_cast<decltype(slice) const&
>(slice).channel(2);
233 ASSERT_EQ((std::size_t)channel.size<
Time>(), 10U);
234 ASSERT_EQ((std::size_t)const_channel.size<
Time>(), 10U);
243 std::generate(tf.
begin(), tf.
end(), [&]() {
return val++; });
256 ASSERT_EQ(tf[ti][fi], ft[fi][ti]);
267 std::generate(ft1.
begin(), ft1.
end(), [&]() {
return val++; });
272 ASSERT_EQ(tf1.dimension<
Time>(), time_size);
273 ASSERT_EQ(tf1.dimension<
Frequency>(), freq_size);
278 ASSERT_EQ(tf1[ti][fi], ft1[fi][ti]);
const_iterator cend() const
A tagged dimensionIndex variable.
Defines a contiguous range over dimension in index.
std::enable_if< std::is_same< Dim, units::Time >::value, DimensionSize< units::Time > >::type size() const
return a slice of the specified dimension spanning the index_range provided
boost::units::time_dimension Time
BaseT::ConstChannel ConstChannel
TEST_F(MultiArrayTest, test_single_dimension_size)
const_iterator cbegin() const
BaseT::ConstChannel ConstChannel
BaseT::ConstSpectra ConstSpectra
return true if the Dimensions provided match exactly those of the structure T (including order) ...
BaseT::ConstSpectra ConstSpectra
A template class representing values associated with a time and frequecny such as Stokes values or vo...
A compile time dimesion tagging of size_t.
A template class representing values associated with a time and frequecny such as Stokes values or vo...
return true if the all Dimensions provided are represented in the structure
iterator begin()
iterators acting over he entire data structure
Channel channel(std::size_t channel_number)
retrun a single channel across all time samples
return true if the Dimension is represented in the structure
std::enable_if< std::is_same< Dim, units::Frequency >::value, DimensionSize< units::Frequency > >::type dimension() const
Spectra spectrum(std::size_t offset)
return a single spectrum from the specified offset
boost::units::frequency_dimension Frequency