Main Page | Class List | Directories | File List | Class Members | File Members

ObitSkyModel.c File Reference

ObitSkyModel class function definitions. More...

#include <math.h>
#include "ObitTableCCUtil.h"
#include "ObitSkyModel.h"
#include "ObitFFT.h"
#include "ObitUVUtil.h"
#include "ObitImageUtil.h"
#include "ObitPBUtil.h"
#include "ObitMem.h"

Defines

#define HWIDTH   12
 Half width of gridded subtraction interpolation kernal.

Functions

void ObitSkyModelInit (gpointer in)
 Private: Initialize newly instantiated object.
void ObitSkyModelClear (gpointer in)
 Private: Deallocate members.
gboolean ObitSkyModelLoadPoint (ObitSkyModel *in, ObitUV *uvdata, ObitErr *err)
 Private: Load point model, may be overridden in derived class.
gboolean ObitSkyModelLoadComps (ObitSkyModel *in, gint n, ObitUV *uvdata, ObitErr *err)
 Private: Load Components model, may be overridden in derived class.
ObitSkyModelnewObitSkyModel (gchar *name)
 Public: Default Constructor.
gconstpointer ObitSkyModelGetClass (void)
 Public: ClassInfo pointer.
ObitSkyModelObitSkyModelCopy (ObitSkyModel *in, ObitSkyModel *out, ObitErr *err)
 Public: Copy (deep) constructor.
void ObitSkyModelClone (ObitSkyModel *in, ObitSkyModel *out, ObitErr *err)
 Public: Copy structure.
ObitSkyModelObitSkyModelCreate (gchar *name, ObitImageMosaic *mosaic)
 Public: Create/initialize ObitSkyModel structures.
void ObitSkyModelInitMod (ObitSkyModel *in, ObitUV *uvdata, ObitErr *err)
 Public: initialize ObitSkyModel structures.
void ObitSkyModelShutDownMod (ObitSkyModel *in, ObitUV *uvdata, ObitErr *err)
 Public: shutdown ObitSkyModel processes.
void ObitSkyModelInitModel (ObitSkyModel *in, ObitErr *err)
 Public: initialize model for pass in time through data.
ObitIOCode ObitSkyModelSubUV (ObitSkyModel *in, ObitUV *indata, ObitUV *outdata, ObitErr *err)
 Public: Subtract model from an ObitUV.
ObitIOCode ObitSkyModelDivUV (ObitSkyModel *in, ObitUV *indata, ObitUV *outdata, ObitErr *err)
 Public: Divide model into an ObitUV.
gboolean ObitSkyModelLoad (ObitSkyModel *in, gint image, ObitUV *uvdata, ObitErr *err)
 Public: Load specified image and plane.
void ObitSkyModelFT (ObitSkyModel *in, gint field, ObitUV *uvdata, ObitErr *err)
 Public: Calculate Fourier transform of model for current buffer in an ObitUV.
gboolean ObitSkyModelGridComps (ObitSkyModel *in, gint n, ObitUV *uvdata, ObitErr *err)
 Public: Grid Components model, may be overridden in derived class.
gboolean ObitSkyModelLoadImage (ObitSkyModel *in, gint n, ObitUV *uvdata, ObitErr *err)
 Public: Load/FT image model, may be overridden in derived class.
void ObitSkyModelFTDFT (ObitSkyModel *in, gint field, ObitUV *uvdata, ObitErr *err)
 Public: FT by DFT, may be overridden in derived class.
void ObitSkyModelFTGrid (ObitSkyModel *in, gint field, ObitUV *uvdata, ObitErr *err)
 Public: FT by Gridding, may be overridden in derived class.
gfloat ObitSkyModelSum (ObitSkyModel *in, ObitErr *err)
 Public: Sum flux in Clean Model.
void ObitSkyModelCompressCC (ObitSkyModel *in, ObitErr *err)
 Public: Compress CC Tables.
void ObitSkyModelGetInput (ObitSkyModel *in, ObitErr *err)
 Public: Get input parameters from info.
void ObitSkyModelChose (ObitSkyModel *in, ObitUV *uvdata)
 Public: Decide model method.
void ObitSkyModelSetSelect (ObitSkyModel *in, ObitUV *uvdata, ObitErr *err)
 Public: Fill in data selection values.
gboolean ObitSkyModelsetPBChans (ObitSkyModel *in, ObitUV *uvdata, ObitErr *err)
 Public: Decide next block of channels if doing PB correction.
ObitTableCCObitSkyModelgetPBCCTab (ObitSkyModel *in, ObitUV *uvdata, gint field, glong *inCCVer, glong *outCCver, glong *startCC, glong *endCC, gfloat range[2], ObitErr *err)
 Public: return ObitTableCC with possible PB corrections.
void ObitSkyModelgetPBImage (ObitSkyModel *in, ObitUV *uvdata, gint field, ObitErr *err)
 Public: fill in->plane with image and possibly PB corrected.
gboolean ObitSkyModelGridFTComps (ObitSkyModel *in, gint field, ObitUV *uvdata, ObitErr *err)
 Public: Grid/FT components.
void ObitSkyModelLoadGridComps (ObitSkyModel *in, gint field, ObitUV *uvdata, gfloat gparm[3], glong *ncomp, ObitErr *err)
 Public: Load Grid components.
void ObitSkyModelFTImage (ObitSkyModel *in, ObitFArray *inArray, ObitCArray *outArray)
 Public: FT image array in in->plane.
void ObitSkyModelAddField (ObitSkyModel *in, ObitErr *err)
 Public: Add field to mosaic.
void ObitSkyModelClassInit (void)
 Public: Class initializer.

Variables

glong OverSample = 2
 Over sampling factor in uv plane.


Detailed Description

ObitSkyModel class function definitions.

This class represents sky models and their Fourier transforms and is derived from the Obit base class.


Define Documentation

#define HWIDTH   12
 

Half width of gridded subtraction interpolation kernal.


Function Documentation

ObitSkyModel* newObitSkyModel gchar *  name  ) 
 

Public: Default Constructor.

Initializes class if needed on first call.

Parameters:
name An optional name for the object.
Returns:
the new object.

void ObitSkyModelAddField ObitSkyModel in,
ObitErr err
 

Public: Add field to mosaic.

Parameters:
in the ObitSkyModel .
err Obit error stack object.

void ObitSkyModelChose ObitSkyModel in,
ObitUV uvdata
 

Public: Decide model method.

Parameters:
in Pointer to theObitSkyModel .
uvdata UV data set

void ObitSkyModelClassInit void   ) 
 

Public: Class initializer.

void ObitSkyModelClear gpointer  inn  ) 
 

Private: Deallocate members.

Does (recursive) deallocation of parent class members. For some reason this wasn't build into the GType class.

Parameters:
inn Pointer to the object to deallocate. Actually it should be an ObitSkyModel* cast to an Obit*.

void ObitSkyModelClone ObitSkyModel in,
ObitSkyModel out,
ObitErr err
 

Public: Copy structure.

Parameters:
in The object to copy
out An existing object pointer for output, must be defined.
err Obit error stack object.

void ObitSkyModelCompressCC ObitSkyModel in,
ObitErr err
 

Public: Compress CC Tables.

Parameters:
in SkyModel
err Obit error stack object.
Returns:
Sum of Clean components

ObitSkyModel* ObitSkyModelCopy ObitSkyModel in,
ObitSkyModel out,
ObitErr err
 

Public: Copy (deep) constructor.

Parameters:
in The object to copy
out An existing object pointer for output or NULL if none exists.
err Obit error stack object.
Returns:
pointer to the new object.

ObitSkyModel* ObitSkyModelCreate gchar *  name,
ObitImageMosaic mosaic
 

Public: Create/initialize ObitSkyModel structures.

Parameters:
name An optional name for the object.
mosaic ObitImageMosaic giving one or more images/CC tables
Returns:
the new object.

ObitIOCode ObitSkyModelDivUV ObitSkyModel in,
ObitUV indata,
ObitUV outdata,
ObitErr err
 

Public: Divide model into an ObitUV.

Parameters:
in SkyModel to Fourier transform
indata UV data set to subtract model from
outdata UV data set to write to
err Obit error stack object.
Returns:
return code, OBIT_IO_OK=> OK

void ObitSkyModelFT ObitSkyModel in,
gint  field,
ObitUV uvdata,
ObitErr err
 

Public: Calculate Fourier transform of model for current buffer in an ObitUV.

If doDivide member is true then FT of model is divided into the data, If doReplace member is true then FT of model replaces the data, else, it is subtracted. If doFlip member is true the Fourier transform is multiplied by sqrt(-1) (for Stokes RL and LR) Processes all data selected.

Parameters:
in SkyModel to Fourier transform
field Field number being processed (-1 => all)
uvdata UV data set to subtract model from
err Obit error stack object.

void ObitSkyModelFTDFT ObitSkyModel in,
gint  field,
ObitUV uvdata,
ObitErr err
 

Public: FT by DFT, may be overridden in derived class.

If doDivide member is true then FT of model is divided into the data, If doReplace member is true then FT of model replaces the data, else, it is subtracted. If doFlip member is true the Fourier transform is multiplied by sqrt(-1) (for Stokes RL and LR) After the AIPSish QXXPTS, QPTDIV and friends This function may be overridden in a derived class and should always be called by its function pointer.

Parameters:
in SkyModel with model components loaded (ObitSkyModelLoad)
field Field number being processed (-1 => all)
uvdata UV data set to model and subtract from current buffer
err Obit error stack object.
Returns:
return code, OBIT_IO_OK=> OK

void ObitSkyModelFTGrid ObitSkyModel in,
gint  field,
ObitUV uvdata,
ObitErr err
 

Public: FT by Gridding, may be overridden in derived class.

If doDivide member is true then FT of model is divided into the data, If doReplace member is true then FT of model replaces the data, else, it is subtracted. This function may be overridden in a derived class and should always be called by its function pointer. Adapted from the AIPSish ALGSTB, QUVINT, QINTP Note: Unlike AIPS, FFTw produces nontransposed images with half the first (U) axis.

Parameters:
in SkyModel with model components loaded (ObitSkyModelLoad)
field Field number being processed (-1 => all)
uvdata UV data set to model and subtract, current buffer.
err Obit error stack object.

void ObitSkyModelFTImage ObitSkyModel in,
ObitFArray inArray,
ObitCArray outArray
 

Public: FT image array in in->plane.

Parameters:
in the ObitSkyModel .
inArray Array to be Transformed.
outArray Output of FFT, half plane complex

gconstpointer ObitSkyModelGetClass void   ) 
 

Public: ClassInfo pointer.

Returns:
pointer to the class structure.

void ObitSkyModelGetInput ObitSkyModel in,
ObitErr err
 

Public: Get input parameters from info.

Parameters:
in Pointer to the ObitSkyModel .
err Obit error stack object.

ObitTableCC* ObitSkyModelgetPBCCTab ObitSkyModel in,
ObitUV uvdata,
gint  field,
glong *  inCCVer,
glong *  outCCver,
glong *  startCC,
glong *  endCC,
gfloat  range[2],
ObitErr err
 

Public: return ObitTableCC with possible PB corrections.

In the latter case, the table should be Zapped when use is finished. If not making relative Primary Beam correctsions then all selected, else the next block for which the primary beam correction varies by less than 1% at the edge of the FOV. If in->currentMode=OBIT_SkyModel_Mixed then the output table will be merged and only contain entries with abs. flux densities in the range range. If there are no components selected to process, the input table is always returned.

Parameters:
in SkyModel
uvdata UV data
field Field number in in->mosaic
inCCVer input CC table version
outCCver output CC table version number, 0=> create new in which case the actual value is returned
startCC [in] the desired first CC number (1-rel) [out] the actual first CC number in returned table
endCC [in] the desired highest CC number, 0=> to end of table [out] the actual highest CC number in returned table
range Range of allowed, merged CC fluxes.
err Obit error stack object.
Returns:
ObitCCTable to use, this should be Unref when done and Zapped if outCCver != 0.

void ObitSkyModelgetPBImage ObitSkyModel in,
ObitUV uvdata,
gint  field,
ObitErr err
 

Public: fill in->plane with image and possibly PB corrected.

Parameters:
in SkyModel
uvdata UV data
field Field number in in->mosaic
err Obit error stack object.
Returns:
ObitCCTable to use, this should be Unref when done and Zapped if outCCver != 0

gboolean ObitSkyModelGridComps ObitSkyModel in,
gint  n,
ObitUV uvdata,
ObitErr err
 

Public: Grid Components model, may be overridden in derived class.

Multiplies by factor member. This function may be overridden in a derived class and should always be called by its function pointer. Due to the difference with the FFT ordering for half plane complex in AIPS and using FFTW, the method here is different. Components are added to a grid which is then FFTed.

Parameters:
in SkyModel
n Image number on mosaic, 0-rel
uvdata UV data set to model
err Obit error stack object.
Returns:
TRUE iff this image produced a valid model (i.e. had some CCs).

gboolean ObitSkyModelGridFTComps ObitSkyModel in,
gint  field,
ObitUV uvdata,
ObitErr err
 

Public: Grid/FT components.

Scaling of components and any tapering is applied. Grid is double size for increased accuracy. For convenience in interpolation, HWIDTH columns are added by copying from the positive half plane. Due to the difference with the FFT ordering for half plane complex in AIPS and using FFTW, the method here is different. Components are added to a grid which is then FFTed.

Parameters:
in Pointer to theObitSkyModel .
field field number (0-rel) in in->mosaic->images
uvdata UV data set to model
err Obit error stack object.
Returns:
TRUE iff this image produced a valid model (i.e. had some CCs).

void ObitSkyModelInit gpointer  inn  ) 
 

Private: Initialize newly instantiated object.

Parent classes portions are (recursively) initialized first

Parameters:
inn Pointer to the object to initialize.

void ObitSkyModelInitMod ObitSkyModel in,
ObitUV uvdata,
ObitErr err
 

Public: initialize ObitSkyModel structures.

Parameters:
in SkyModel to initialize
uvdata uv data being modeled.
err Obit error stack object.

void ObitSkyModelInitModel ObitSkyModel in,
ObitErr err
 

Public: initialize model for pass in time through data.

Parameters:
in SkyModel to initialize
err Obit error stack object.

gboolean ObitSkyModelLoad ObitSkyModel in,
gint  image,
ObitUV uvdata,
ObitErr err
 

Public: Load specified image and plane.

Parameters:
in SkyModel to Fourier transform
image Image number in mosaic member to load model, 0-rel If <0 , load all
uvdata UV data set to model
err Obit error stack object.
Returns:
TRUE iff this image produced a valid model (i.e. had some CCs).

gboolean ObitSkyModelLoadComps ObitSkyModel in,
gint  n,
ObitUV uvdata,
ObitErr err
 

Private: Load Components model, may be overridden in derived class.

Multiplies by factor member. This function may be overridden in a derived class and should always be called by its function pointer. Adapted from the AIPSish QNOT:VISDFT

Parameters:
in SkyModel
n Image number on mosaic, if -1 load all images
uvdata UV data set to model
err Obit error stack object.
Returns:
TRUE iff this image produced a valid model (i.e. had some CCs).

void ObitSkyModelLoadGridComps ObitSkyModel in,
gint  field,
ObitUV uvdata,
gfloat  gparm[3],
glong *  ncomp,
ObitErr err
 

Public: Load Grid components.

Grid is oversize for increased accuracy. Due to the difference with the FFT ordering for half plane complex in AIPS and using FFTW, the method here is different. Components are added to a grid which is then FFTed.

Parameters:
in Pointer to theObitSkyModel .
field field number (0-rel) in in->mosaic->images
uvdata UV data set to model
gparm [out] the parameters of the Gaussians in the table [-1,-1,-1] => not Gaussian.
ncomp Actual number of components in in->comps
err Obit error stack object.

gboolean ObitSkyModelLoadImage ObitSkyModel in,
gint  n,
ObitUV uvdata,
ObitErr err
 

Public: Load/FT image model, may be overridden in derived class.

Multiplies by factor member. This function may be overridden in a derived class and should always be called by its function pointer.

Parameters:
in SkyModel
n Image number on mosaic
uvdata UV data set to model
err Obit error stack object.
Returns:
TRUE iff this image produced a valid model (generally true here).

gboolean ObitSkyModelLoadPoint ObitSkyModel in,
ObitUV uvdata,
ObitErr err
 

Private: Load point model, may be overridden in derived class.

Multiplies by factor member. This function may be overridden in a derived class and should always be called by its function pointer. Adapted from the AIPSish QNOT:VISDFT Output is in member comps with a single row, the entries are

  • Amplitude (Jy)
  • -2*pi*x (radians)
  • -2*pi*y (radians)
  • -2*pi*z (radians)
    Parameters:
    in SkyModel
    uvdata UV data set to model
    err Obit error stack object.
    Returns:
    TRUE iff this image produced a valid model (i.e. had some CCs).

gboolean ObitSkyModelsetPBChans ObitSkyModel in,
ObitUV uvdata,
ObitErr err
 

Public: Decide next block of channels if doing PB correction.

Works by modifying the followint ObitSkyModel members:

  • startIFPB First IF selected in current pass, if this is initally -1 then initialize.
  • numberIFPB Number of IFs selected in current pass
  • startChannelPB First channel selected in current pass
  • numberChannelPB Number of channels selected in current pass
    Parameters:
    in SkyModel
    uvdata UV data
    err Obit error stack object.
    Returns:
    TRUE if there are more channels to do, else FALSE

void ObitSkyModelSetSelect ObitSkyModel in,
ObitUV uvdata,
ObitErr err
 

Public: Fill in data selection values.

Especially the polarization controls are difficult. All channel, IF, Stokes axis values are 1-rel. Does a number of consistency checks. Looks up the numbers of Clean components in each image. Recognize the following Stokes'

  • " " use I, RR, LL, RR+LL as given in data
  • "RR " use RR only
  • "LL " use LL only
  • "RL " use RL only
  • "LR " use LR only
  • "RLLR" use RL and LR
  • "I???" use I, RR, LL, RR+LL as given in data
  • "Q???" use Q, or RL&LR
  • "U???" use U, or RL&LR
  • "V???" use V, or RR&LL Default action is equivalent to Stokes=" "; Also sets doFlip as necessary for requested combination of Stokes and uv data.
    Parameters:
    in Pointer to theObitSkyModel .
    uvdata UV data set
    err Obit error stack object.

void ObitSkyModelShutDownMod ObitSkyModel in,
ObitUV uvdata,
ObitErr err
 

Public: shutdown ObitSkyModel processes.

Parameters:
in SkyModel to initialize
uvdata uv data being modeled.
err Obit error stack object.

ObitIOCode ObitSkyModelSubUV ObitSkyModel in,
ObitUV indata,
ObitUV outdata,
ObitErr err
 

Public: Subtract model from an ObitUV.

Parameters:
in SkyModel to Fourier transform
indata UV data set to subtract model from
outdata UV data set to write to
err Obit error stack object.
Returns:
return code, OBIT_IO_OK=> OK

gfloat ObitSkyModelSum ObitSkyModel in,
ObitErr err
 

Public: Sum flux in Clean Model.

Parameters:
in SkyModel Checks InfoList member noNeg
err Obit error stack object.
Returns:
Sum of Clean components


Variable Documentation

glong OverSample = 2
 

Over sampling factor in uv plane.


Generated on Fri Aug 31 22:13:07 2007 for Obit by  doxygen 1.3.9.1