Object to provide MODEL_DATA visibilities on demand. More...
#include <VisModelData.h>
Public Member Functions | |
VisModelData () | |
empty constructor | |
virtual | ~VisModelData () |
From a FTMachine Record VisModelData(const Record& ftmachinerec, const Vector<Int>& validfieldids, const Vector<Int>& msIds);. | |
void | addFlatModel (const Vector< Double > &value, const Vector< Int > &validfieldids, const Vector< Int > &msIds) |
Add Image/FTMachine to generate visibilities for void addFTMachine(const Record& recordFTMachine, const Vector<Int>& validfieldids, const Vector<Int>& msIds); Add componentlist to generate visibilities for void addCompFTMachine(const ComponentList& cl, const Vector<Int>& validfieldids, const Vector<Int>& msIds); For simple model a special case for speed. | |
void | addModel (const RecordInterface &rec, const Vector< Int > &msids, const VisBuffer &vb) |
add componentlists or ftmachines | |
void | addModel (const RecordInterface &rec, const Vector< Int > &msids, const vi::VisBuffer2 &vb) |
VisModelDataI * | clone () |
Bool | getModelVis (VisBuffer &vb) |
put the model data for this VisBuffer in the modelVisCube | |
Bool | getModelVis (vi::VisBuffer2 &vb) |
void | putModelI (const MeasurementSet &thems, const RecordInterface &rec, const Vector< Int > &validfields, const Vector< Int > &spws, const Vector< Int > &starts, const Vector< Int > &nchan, const Vector< Int > &incr, Bool iscomponentlist=True, Bool incremental=False) |
this is a helper function that writes the model record to the ms | |
void | clearModelI (const MeasurementSet &thems) |
helper function to clear the keywordSet of the ms of the model for the fields in that ms | |
Bool | isModelDefinedI (const Int fieldId, const MeasurementSet &thems, String &key, Int &sourceRow) |
Functions to see if model is defined in the MS either in the SOURCE table or else in the MAIN. | |
Bool | getModelRecordI (const String &theKey, TableRecord &theRec, const MeasurementSet &theMs) |
Get a given model that is defined by key Forcing user to use a TableRecord rather than Generic RecordInterface ...just so as to avoid a copy. | |
Int | hasModel (Int msid, Int field, Int spw) |
check if an addFT or addCompFT is necessary Bool hasFT(Int msid, Int fieldid); Bool hasCL(Int msid, Int fieldid); returns a -1 if there is no model for this combination of ms,field,spw...but has not been // checked yet if there is one returns a -2 if it has been tested before but does have it. | |
Static Public Member Functions | |
static void | putModel (const MeasurementSet &thems, const RecordInterface &rec, const Vector< Int > &validfields, const Vector< Int > &spws, const Vector< Int > &starts, const Vector< Int > &nchan, const Vector< Int > &incr, Bool iscomponentlist=True, Bool incremental=False) |
static void | clearModel (const MeasurementSet &thems) |
static void | clearModel (const MeasurementSet &thems, const String field, const String spws=String("")) |
...with field selection and optionally spw | |
static Bool | isModelDefined (const Int fieldId, const MeasurementSet &thems, String &key, Int &sourceRow) |
static Bool | isModelDefined (const String &elkey, const MeasurementSet &thems) |
static Bool | getModelRecord (const String &theKey, TableRecord &theRec, const MeasurementSet &theMs) |
static void | listModel (const MeasurementSet &thems) |
List the fields. | |
static FTMachine * | NEW_FT (const Record &ftrec) |
Private Member Functions | |
void | initializeToVis () |
Vector< CountedPtr < ComponentList > > | getCL (const Int msId, const Int fieldId, Int spw) |
Vector< CountedPtr< FTMachine > > | getFT (const Int msId, const Int fieldId, Int spw) |
Static Private Member Functions | |
static Bool | addToRec (TableRecord &therec, const Vector< Int > &spws) |
static Bool | removeSpwFromMachineRec (RecordInterface &ftclrec, const Vector< Int > &spws) |
static Bool | removeFTFromRec (TableRecord &therec, const String &keyval, const Bool relabel=True) |
static Bool | removeSpw (TableRecord &therec, const Vector< Int > &spws, const Vector< Int > &fields=Vector< Int >(0)) |
static Bool | putModelRecord (const Vector< Int > &fieldIds, TableRecord &theRec, MeasurementSet &theMS) |
static void | removeRecordByKey (MeasurementSet &theMS, const String &theKey) |
Remove the Record which has the given key...will exterminate it from both the Source table or Main table. | |
static void | putRecordByKey (MeasurementSet &theMS, const String &theKey, const TableRecord &theRec, const Int sourceRowNum=-1) |
put the Record by key if sourcerownum=-1 then it is saved in the main table this default should only be used if the optional SOURCE table in non-existant | |
static void | deleteDiskImage (MeasurementSet &theMS, const String &theKey) |
static Int | firstSourceRowRecord (const Int field, const MeasurementSet &theMS, TableRecord &rec) |
static void | modifyDiskImagePath (Record &rec, const VisBuffer &vb) |
Private Attributes | |
Block< Vector< CountedPtr < ComponentList > > > | clholder_p |
Block< Vector< CountedPtr < FTMachine > > > | ftholder_p |
Block< Vector< Double > > | flatholder_p |
CountedPtr< ComponentFTMachine > | cft_p |
Cube< Int > | ftindex_p |
Cube< Int > | clindex_p |
Static Private Attributes | |
static Bool | initialize |
Object to provide MODEL_DATA visibilities on demand.
Vis for Visibility ModelData is self explanatory
This Class also offer a lot of helper functions to query add and delete/modify models To be noted the models that are supported are FTMachines and Componentlist A given FIELD_ID can have multiple models added to the same record (i.e for e.g multiple spw models or multiple outlier images or in the case of componentlist multiple component list models. A model may be valid for multiple fields e.g a mosaic To save storage in such cases multiple field id will point to the same model Look for the keyword "definedmodel_field_x" in the Source table keywords (or the main table if source is not present). This will point to another key which is going to point to the model. Thus multiple "definedmodel_field_x" may point to the same key. If there is no valid SOURCE table the key will hold a Record of the model to use in the main table Otherwise in the SOURCE table the key will hold the row of the SOURCE table in whose SOURCE_MODEL cell the Record of the model to use will be resident. Now a given model Record in a SOURCE_MODEL cell can hold multiple FTMachine's or Compnentlist (e.g multiple direction images or spw images associated with a given field) and they are all cumulative (while respecting spw selection conditions) when a request is made for the model visibility
MeasurementSet theMS(.....) VisibilityIterator vi(theMS,sort); VisBuffer vb(vi); MDirection myDir=vi.msColumns().field().phaseDirMeas(0); ComponentList cl; SkyComponent otherPoint(ComponentType::POINT); otherPoint.flux() = Flux<Double>(0.00001, 0.0, 0.0, 0.00000); otherPoint.shape().setRefDirection(myDir); cl.add(otherPoint); Record clrec; clrec.define("type", "componentlist"); clrec.define("fields", field); clrec.define("spws", Vector<Int>(1, 0)); clrec.defineRecord("container", container); Record outRec; outRec.define("numcl", 1); outRec.defineRecord("cl_0", clrec); Vector<Int>spws(1,0); Save model to the MS VisModelData.putModel(theMS, container, field, spws, Vector<Int>(1,0), Vector<Int>(1,63), Vector<Int>(1,1), True, False); vi.origin(); VisModelData vm; // String modelkey; Int snum; Bool hasmodkey=VisModelData::isModelDefined(vb.fieldId(), vi.ms(), modelkey, snum); Setup vm to serve the model for the fieldid() if( hasmodkey){ TableRecord modrec; VisModelData::getModelRecord(modelkey, modrec, visIter_p->ms()) vm.addModel(modrec, Vector<Int>(1, msId()), vb); } for (vi.originChunks();vi.moreChunks(); vi.nextChunk()){ for (vi.origin(); vi.more(); vi++){ This fills the vb.modelVisCube with the appropriate model visibility vm.getModelVis(vb); cerr << "field " << vb.fieldId() << " spw " << vb.spectralWindow() <<" max " << max(amplitude(vb.modelVisCube())) << endl; } }
Definition at line 143 of file VisModelData.h.
casa::VisModelData::VisModelData | ( | ) |
empty constructor
virtual casa::VisModelData::~VisModelData | ( | ) | [virtual] |
From a FTMachine Record VisModelData(const Record& ftmachinerec, const Vector<Int>& validfieldids, const Vector<Int>& msIds);.
void casa::VisModelData::addFlatModel | ( | const Vector< Double > & | value, | |
const Vector< Int > & | validfieldids, | |||
const Vector< Int > & | msIds | |||
) |
Add Image/FTMachine to generate visibilities for void addFTMachine(const Record& recordFTMachine, const Vector<Int>& validfieldids, const Vector<Int>& msIds); Add componentlist to generate visibilities for void addCompFTMachine(const ComponentList& cl, const Vector<Int>& validfieldids, const Vector<Int>& msIds); For simple model a special case for speed.
void casa::VisModelData::addModel | ( | const RecordInterface & | rec, | |
const Vector< Int > & | msids, | |||
const vi::VisBuffer2 & | vb | |||
) | [virtual] |
Implements casa::VisModelDataI.
void casa::VisModelData::addModel | ( | const RecordInterface & | rec, | |
const Vector< Int > & | msids, | |||
const VisBuffer & | vb | |||
) | [virtual] |
add componentlists or ftmachines
Implements casa::VisModelDataI.
static Bool casa::VisModelData::addToRec | ( | TableRecord & | therec, | |
const Vector< Int > & | spws | |||
) | [static, private] |
static void casa::VisModelData::clearModel | ( | const MeasurementSet & | thems, | |
const String | field, | |||
const String | spws = String("") | |||
) | [static] |
...with field selection and optionally spw
static void casa::VisModelData::clearModel | ( | const MeasurementSet & | thems | ) | [static] |
Referenced by clearModelI().
void casa::VisModelData::clearModelI | ( | const MeasurementSet & | thems | ) | [inline, virtual] |
helper function to clear the keywordSet of the ms of the model for the fields in that ms
Implements casa::VisModelDataI.
Definition at line 181 of file VisModelData.h.
References clearModel().
VisModelDataI* casa::VisModelData::clone | ( | ) | [virtual] |
Implements casa::VisModelDataI.
static void casa::VisModelData::deleteDiskImage | ( | MeasurementSet & | theMS, | |
const String & | theKey | |||
) | [static, private] |
static Int casa::VisModelData::firstSourceRowRecord | ( | const Int | field, | |
const MeasurementSet & | theMS, | |||
TableRecord & | rec | |||
) | [static, private] |
Vector<CountedPtr<ComponentList> > casa::VisModelData::getCL | ( | const Int | msId, | |
const Int | fieldId, | |||
Int | spw | |||
) | [private] |
Vector<CountedPtr<FTMachine> > casa::VisModelData::getFT | ( | const Int | msId, | |
const Int | fieldId, | |||
Int | spw | |||
) | [private] |
static Bool casa::VisModelData::getModelRecord | ( | const String & | theKey, | |
TableRecord & | theRec, | |||
const MeasurementSet & | theMs | |||
) | [static] |
Referenced by getModelRecordI().
Bool casa::VisModelData::getModelRecordI | ( | const String & | theKey, | |
TableRecord & | theRec, | |||
const MeasurementSet & | theMs | |||
) | [inline, virtual] |
Get a given model that is defined by key Forcing user to use a TableRecord rather than Generic RecordInterface ...just so as to avoid a copy.
Implements casa::VisModelDataI.
Definition at line 196 of file VisModelData.h.
References getModelRecord().
Bool casa::VisModelData::getModelVis | ( | vi::VisBuffer2 & | vb | ) | [virtual] |
Implements casa::VisModelDataI.
Bool casa::VisModelData::getModelVis | ( | VisBuffer & | vb | ) | [virtual] |
put the model data for this VisBuffer in the modelVisCube
Implements casa::VisModelDataI.
Int casa::VisModelData::hasModel | ( | Int | msid, | |
Int | field, | |||
Int | spw | |||
) | [virtual] |
check if an addFT or addCompFT is necessary Bool hasFT(Int msid, Int fieldid); Bool hasCL(Int msid, Int fieldid); returns a -1 if there is no model for this combination of ms,field,spw...but has not been // checked yet if there is one returns a -2 if it has been tested before but does have it.
returns a 1 if it has a model stored
Implements casa::VisModelDataI.
void casa::VisModelData::initializeToVis | ( | ) | [private] |
static Bool casa::VisModelData::isModelDefined | ( | const String & | elkey, | |
const MeasurementSet & | thems | |||
) | [static] |
static Bool casa::VisModelData::isModelDefined | ( | const Int | fieldId, | |
const MeasurementSet & | thems, | |||
String & | key, | |||
Int & | sourceRow | |||
) | [static] |
Referenced by isModelDefinedI().
Bool casa::VisModelData::isModelDefinedI | ( | const Int | fieldId, | |
const MeasurementSet & | thems, | |||
String & | key, | |||
Int & | sourceRow | |||
) | [inline, virtual] |
Functions to see if model is defined in the MS either in the SOURCE table or else in the MAIN.
Implements casa::VisModelDataI.
Definition at line 187 of file VisModelData.h.
References isModelDefined().
static void casa::VisModelData::listModel | ( | const MeasurementSet & | thems | ) | [static] |
List the fields.
static void casa::VisModelData::modifyDiskImagePath | ( | Record & | rec, | |
const VisBuffer & | vb | |||
) | [static, private] |
static FTMachine* casa::VisModelData::NEW_FT | ( | const Record & | ftrec | ) | [static] |
static void casa::VisModelData::putModel | ( | const MeasurementSet & | thems, | |
const RecordInterface & | rec, | |||
const Vector< Int > & | validfields, | |||
const Vector< Int > & | spws, | |||
const Vector< Int > & | starts, | |||
const Vector< Int > & | nchan, | |||
const Vector< Int > & | incr, | |||
Bool | iscomponentlist = True , |
|||
Bool | incremental = False | |||
) | [static] |
Referenced by putModelI().
void casa::VisModelData::putModelI | ( | const MeasurementSet & | thems, | |
const RecordInterface & | rec, | |||
const Vector< Int > & | validfields, | |||
const Vector< Int > & | spws, | |||
const Vector< Int > & | starts, | |||
const Vector< Int > & | nchan, | |||
const Vector< Int > & | incr, | |||
Bool | iscomponentlist = True , |
|||
Bool | incremental = False | |||
) | [inline, virtual] |
this is a helper function that writes the model record to the ms
Implements casa::VisModelDataI.
Definition at line 170 of file VisModelData.h.
References putModel().
static Bool casa::VisModelData::putModelRecord | ( | const Vector< Int > & | fieldIds, | |
TableRecord & | theRec, | |||
MeasurementSet & | theMS | |||
) | [static, private] |
static void casa::VisModelData::putRecordByKey | ( | MeasurementSet & | theMS, | |
const String & | theKey, | |||
const TableRecord & | theRec, | |||
const Int | sourceRowNum = -1 | |||
) | [static, private] |
put the Record by key if sourcerownum=-1 then it is saved in the main table this default should only be used if the optional SOURCE table in non-existant
static Bool casa::VisModelData::removeFTFromRec | ( | TableRecord & | therec, | |
const String & | keyval, | |||
const Bool | relabel = True | |||
) | [static, private] |
static void casa::VisModelData::removeRecordByKey | ( | MeasurementSet & | theMS, | |
const String & | theKey | |||
) | [static, private] |
Remove the Record which has the given key...will exterminate it from both the Source table or Main table.
static Bool casa::VisModelData::removeSpw | ( | TableRecord & | therec, | |
const Vector< Int > & | spws, | |||
const Vector< Int > & | fields = Vector< Int >(0) | |||
) | [static, private] |
static Bool casa::VisModelData::removeSpwFromMachineRec | ( | RecordInterface & | ftclrec, | |
const Vector< Int > & | spws | |||
) | [static, private] |
CountedPtr<ComponentFTMachine> casa::VisModelData::cft_p [private] |
Definition at line 234 of file VisModelData.h.
Block<Vector<CountedPtr<ComponentList> > > casa::VisModelData::clholder_p [private] |
Definition at line 231 of file VisModelData.h.
Cube<Int> casa::VisModelData::clindex_p [private] |
Definition at line 236 of file VisModelData.h.
Block<Vector<Double> > casa::VisModelData::flatholder_p [private] |
Definition at line 233 of file VisModelData.h.
Block<Vector<CountedPtr<FTMachine> > > casa::VisModelData::ftholder_p [private] |
Definition at line 232 of file VisModelData.h.
Cube<Int> casa::VisModelData::ftindex_p [private] |
Definition at line 235 of file VisModelData.h.
Bool casa::VisModelData::initialize [static, private] |
Definition at line 237 of file VisModelData.h.