Update CFSimpleIndexer authored by Martin Pokorny's avatar Martin Pokorny
......@@ -100,7 +100,7 @@ We next must define mappings from indexes in the space defined by `subset_indexe
unsigned mueller_map[]{0, 5, 10, 15};
```
Finally we define the CF values through a `CFArray` sub-class instance with the appropriate element indexing operator (taking some liberties with C++ and CASA syntax):
We next define the CF values through a `CFArray` sub-class instance with the appropriate element indexing operator (taking some liberties with C++ and CASA syntax):
```c++
class MyCFArray : public hpg::CFArray {
unsigned m_w_map[1];
......@@ -117,7 +117,7 @@ class MyCFArray : public hpg::CFArray {
operator()(unsigned x, unsigned y, unsigned mueller, unsigned cube, unsigned group)
const override {
hpg::CellIndex ci = m_subset_indexer({mueller, cube, group});
hpg::CellIndex ci = m_subset_indexer.cell_index({mueller, cube, group});
assert(ci.m_w_plane == 0);
assert(ci.m_mueller < 4);
return m_store(ci.m_baseline_class, ci.m_time, m_w_map[ci.m_w_plane], ci.m_frequency, m_mueller_map[ci.m_mueller], x, y);
......@@ -126,3 +126,17 @@ class MyCFArray : public hpg::CFArray {
//...
};
```
Finally, the values of `hpg::VisData<N>::m_cf_index` may be computed as in the following
```c++
hpg::VisData<N> vis;
hpg::CellIndex cell_index;
// initialize fields of cell_index using visibility metadata
cell_index.m_baseline_type = 0;
cell_index.m_time = /*... from visibility time */;
cell_index.m_w_plane = W_0;
cell_index.m_frequency = /*... from visibility frequency */
cell_index.m_mueller = 0; // not significant, 0 is always valid
auto [mueller, cube, group] = subset_indexer.cf_index(cell_index);
vis.m_cf_index = {cube, group};
```
\ No newline at end of file