Commit 84a4f038 authored by Réza Ansari's avatar Réza Ansari
Browse files

Classes P4FreqBand et P4AVisiNumEncoder completees, Reza 18/9/2017

parent 4b5e7550
......@@ -24,6 +24,8 @@ const double P4FreqBand::freqstart_ = 1250.; // Bande de 1250-1500 MHz
//---------------------------------------------------------------------
std::map<std::string, sa_size_t> visname_num_;
std::vector<std::string> visnames_;
std::vector< pair<sa_size_t , sa_size_t> > vis_feedpair_;
const char* feedname_[8] = {"1H","2H","3H","4H","1V","2V","3V","4V"} ;
bool fg_visnames_done = false;
void P4AVisNumEncoder_toupper(std::string & name)
......@@ -39,15 +41,15 @@ void P4AVisNumEncoder_toupper(std::string & name)
static void P4AVisNumEncoder_Init()
{
if (fg_visnames_done) return;
const char * chnames[8]={"1H","2H","3H","4H","1V","2V","3V","4V"};
char buff[32];
sa_size_t cnt=0;
for(int i=0; i<8; i++)
for(int j=i; j<8; j++) {
sprintf(buff,"%s-%s",chnames[i],chnames[j]);
sprintf(buff,"%s-%s",feedname_[i],feedname_[j]);
string vn=buff;
visname_num_[vn]=cnt;
visnames_.push_back(vn);
vis_feedpair_.push_back( pair< sa_size_t , sa_size_t >( (sa_size_t)i, (sa_size_t)j) );
cnt++;
}
fg_visnames_done=true;
......@@ -118,6 +120,19 @@ std::string P4AVisiNumEncoder::Convert2VisiName(sa_size_t visnum)
return string("");
}
std::pair<sa_size_t , sa_size_t> P4AVisiNumEncoder::getFeedPair(sa_size_t visnum)
{
if (!fg_visnames_done) P4AVisNumEncoder_Init();
if ((visnum>=0)&&(visnum<vis_feedpair_.size())) return vis_feedpair_[visnum];
return pair<sa_size_t , sa_size_t>((sa_size_t)(-1), (sa_size_t)(-1));
}
std::string P4AVisiNumEncoder::getFeedName(sa_size_t fnum)
{
if ((fnum>=0)&&(fnum<8)) return std::string(feedname_[fnum]);
return std::string("");
}
std::vector<sa_size_t> P4AVisiNumEncoder::getAllAutoCor()
{
const char * acornm[8]={"1H-1H","2H-2H","3H-3H","4H-4H", "1V-1V","2V-2V","3V-3V","4V-4V" };
......
......@@ -88,6 +88,12 @@ inline ostream& operator << (ostream& os, P4FreqBand const& a)
class P4AVisiNumEncoder {
public:
P4AVisiNumEncoder();
//! return the total number of feeds (8 for PAON-4)
static inline sa_size_t getTotalNbFeeds() { return 8; }
//! return the total number of visibilities (36 for PAON-4)
static inline sa_size_t getTotalNbVisibilities() { return 36; }
/*! \brief return the row numbers in the Visibility matrix corresponding to the visibilities identified by their names
\warning The visibility names might be modified to convert lower case characters to upper case: 1h-3v is converted to 1H-3V
......@@ -101,6 +107,10 @@ public:
static sa_size_t Convert2VisiNumber(const char * name);
//! return the Visibility name corresponding to row number \b rnum
static std::string Convert2VisiName(sa_size_t visnum);
//! return a pair of numbers identifying the two feed signals combined to obtain the corresponding visibility
static std::pair<sa_size_t , sa_size_t> getFeedPair(sa_size_t visnum);
//! return the feed name ( 1H,2H ... 4H,1V ... 4V )
static std::string getFeedName(sa_size_t fnum);
//! return a vector with visibility number (VisiMatrix rows) for all auto-correlations (8 auto-corr)
static std::vector<sa_size_t> getAllAutoCor();
//! return a vector with visibility number (VisiMatrix rows) for all H-H type cross correlations ( 6 cx-corr)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment