VIRCAM Pipeline 2.3.15
Source Extraction Modules
void imcore_apclust (ap_t *ap, int np, plstruct *plstr)
 Detect multiple objects from a given Plessey array.
 
void imcore_apinit (ap_t *ap)
 Initialise the ap structure.
 
void imcore_apreinit (ap_t *ap)
 Re-initialise the ap structure.
 
void imcore_apclose (ap_t *ap)
 Close ap structure.
 
void imcore_apline (ap_t *ap, float dat[], float conf[], float smoothed[], float smoothedc[], int j, unsigned char *bpm)
 Detect objects on a line of data.
 
void imcore_areals (ap_t *ap, int iareal[NAREAL])
 Work out the areal profiles for an object.
 
int imcore_classify (casu_tfits *catalogue, float minsize, int cattype)
 Do star/galaxy classification.
 
void imcore_tabinit (ap_t *ap, int *xcol, int *ycol, int cattype, cpl_table **tab)
 Initialise catalogues.
 
int imcore_do_seeing (ap_t *ap, int cattype, int nobjects, cpl_table *tab)
 Do seeing estimate.
 
int imcore_process_results (ap_t *ap, int cattype, float gain, int *nobjects, cpl_table *tab)
 Process results.
 
int imcore_tabclose (ap_t *ap, int cattype)
 Close the table structure.
 
void imcore_tabinit_gen (int ncols, const char *ttype[], const char *tunit[], cpl_type tform[], cpl_table **tab)
 Initialise tables (generic)
 
int imcore_do_seeing_gen (ap_t *ap, const char *col_ellipt, const char *col_pkht, char *col_areals[NAREAL], int nobjects, cpl_table *tab)
 Do seeing estimate (generic)
 
void imcore_tabinit_1 (int *imcore_xcol, int *imcore_ycol, cpl_table **tab)
 Initialise type 1 catalogue.
 
int imcore_do_seeing_1 (ap_t *ap, int nobjects, cpl_table *tab)
 Do seeing estimate for type 1 catalogue.
 
int imcore_process_results_1 (ap_t *ap, int *nobjects, cpl_table *tab)
 Process results for type 1 catalogue.
 
void imcore_tabinit_2 (int *imcore_xcol, int *imcore_ycol, cpl_table **tab)
 Initialise type 2 catalogue.
 
int imcore_do_seeing_2 (ap_t *ap, int nobjects, cpl_table *tab)
 Do seeing estimate for type 2 catalogue.
 
int imcore_process_results_2 (ap_t *ap, float gain, int *nobjects, cpl_table *tab)
 Process results for type 2 catalogue.
 
void imcore_tabinit_3 (int *imcore_xcol, int *imcore_ycol, cpl_table **tab)
 Initialise type 1 catalogue.
 
int imcore_do_seeing_3 (ap_t *ap, int nobjects, cpl_table *tab)
 Do seeing estimate for type 3 catalogue.
 
int imcore_process_results_3 (ap_t *ap, int *nobjects, cpl_table *tab)
 Process results for type 3 catalogue.
 
void imcore_tabinit_4 (ap_t *ap, int *imcore_xcol, int *imcore_ycol, cpl_table **tab)
 Initialise type 4 catalogue (object mask)
 
int imcore_do_seeing_4 (ap_t *ap)
 Dummy seeing routine for type 4 catalogue (object mask)
 
int imcore_process_results_4 (ap_t *ap)
 Process results for type 4 catalogue (object mask)
 
int imcore_tabclose_4 (ap_t *ap)
 Close object mask.
 
void imcore_tabinit_6 (int *imcore_xcol, int *imcore_ycol, cpl_table **tab)
 Initialise type 6 catalogue.
 
int imcore_do_seeing_6 (ap_t *ap, int nobjects, cpl_table *tab)
 Do seeing estimate for type 6 catalogue.
 
int imcore_process_results_6 (ap_t *ap, float gain, int *nobjects, cpl_table *tab)
 Process results for type 6 catalogue.
 
int imcore_background (ap_t *ap, int nbsize, float nullval)
 Model and create background map.
 
int imcore_backstats (ap_t *ap, float nullval, int satonly, float *skymed, float *skysig, float *sat)
 Work out robust background estimate over a whole input image.
 
void imcore_backest (ap_t *ap, float x, float y, float *skylev, float *skyrms)
 Work out estimated sky for a pixel position.
 
void imcore_medsig (int *shist, int nh, int ist, int itarg, float *med, float *sig)
 Analyse histogram to work out median and sigma.
 
int imcore_conf (casu_fits *infile, casu_fits *conf, int ipix, float threshold, int icrowd, float rcore, int nbsize, int cattype, float filtfwhm, float gain, casu_tfits **outcat)
 Do source extraction.
 
int imcore_extend (ap_t *ap, float xniso, float xbar, float ybar, float sxx, float sxy, float syy, float areal0, float tmax, float *ttotal)
 Do aperture integration.
 
void imcore_bfilt (float **xbuf, int nx, int ny)
 Do bilinear median and linear filtering on background values.
 
int imcore_opm (casu_fits *infile, casu_fits *conf, int ipix, float threshold, int nbsize, float filtfwhm, int niter)
 Create an object mask.
 
void imcore_overlp (ap_t *ap, float parm[IMNUM][NPAR], int *nbit, float xbar, float ybar, float total, int npix, float tmax)
 Deblend overlapping images.
 
void imcore_phopt (ap_t *ap, float parm[IMNUM][NPAR], int nbit, int naper, float apertures[], float cflux[], float badpix[], int nrcore, float avconf[])
 Do multiple profile fitting.
 
float imcore_halflight (float rcores[], float cflux[], float halflight, float peak, int naper)
 Work out the half-light radius for an object.
 
float imcore_exprad (float thresh, float peak, float areal0, float rcores[], int naper)
 Work out the exponential radius for an object.
 
float imcore_kronrad (float areal0, float rcores[], float cflux[], int naper)
 Work out the Kron radius for an object.
 
float imcore_petrad (float areal0, float rcores[], float cflux[], int naper)
 Work out the Petrosian.
 
void imcore_flux (ap_t *ap, float parm[IMNUM][NPAR], int nbit, float apers[], float fluxes[], int nr, float rcores[], float rfluxes[])
 Work out the fluxes for special radii.
 
void imcore_moments (ap_t *ap, float results[])
 Do moments analysis on an object.
 
void imcore_seeing (ap_t *ap, int nrows, float *ellipt, float *pkht, float **areal, float *work, float *fwhm)
 Work out the median seeing.
 
void imcore_restack (ap_t *ap, int ip)
 Free information for an object from the ap structure.
 
void imcore_terminate (ap_t *ap, int cattype, float gain, int *nobjects, cpl_table *tab)
 Check for objects that have terminated.
 
void imcore_apfu (ap_t *ap)
 Get rid of the largest contributor in an ap structure.
 
void imcore_extract_data (ap_t *ap, int ip)
 Put data into the Plessey array for an object.
 

Detailed Description

These are the routines that do the source extraction.

Function Documentation

◆ imcore_apclose()

void imcore_apclose ( ap_t *  ap)

Close ap structure.

Name:
imcore_apclose
Purpose:
Close the ap structre
Description:
The ap structure has all of its allocated memory freed.
Language:
C
Parameters
apThe input ap structure
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 186 of file apinit.c.

Referenced by imcore_overlp().

◆ imcore_apclust()

void imcore_apclust ( ap_t *  ap,
int  np,
plstruct *  plstr 
)

Detect multiple objects from a given Plessey array.

Name:
imcore_apclust
Purpose:
Detect multiple peaks in a plessey array and write to a new ap structure
Description:
The Plessey array is given from an ap structure for a single object. Given a second ap structure with a revised threshold this routine will attempt to detect multiple objects within that Plessey array.
Language:
C
Parameters
apThe new input ap structure
npThe number of pixels within the input Plessey array
plstrThe Plessey array from the original structure with the lower detection threshold.
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 71 of file apclust.c.

References imcore_apfu().

Referenced by imcore_overlp().

◆ imcore_apfu()

void imcore_apfu ( ap_t *  ap)

Get rid of the largest contributor in an ap structure.

Name:
imcore_apfu
Purpose:
Get rid of the largest contributor in an ap structure
Description:
The parents in the current ap structure are examined to see which has the largest number of pixels. That parent is junked.
Language:
C
Parameters
apThe current ap structure
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 194 of file terminate.c.

References imcore_restack().

Referenced by imcore_apclust(), imcore_conf(), and imcore_opm().

◆ imcore_apinit()

void imcore_apinit ( ap_t *  ap)

Initialise the ap structure.

Name:
imcore_apinit
Purpose:
Initialise the ap structure given some pre-existing information
Description:
The ap structure is initialised. In order for this to be done properly the value of ap->lsiz (the length of the image rows) must be set before calling this routine.
Language:
C
Parameters
apThe input ap structure
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 65 of file apinit.c.

Referenced by imcore_conf(), imcore_opm(), and imcore_overlp().

◆ imcore_apline()

void imcore_apline ( ap_t *  ap,
float  dat[],
float  conf[],
float  smoothed[],
float  smoothedc[],
int  j,
unsigned char *  bpm 
)

Detect objects on a line of data.

Name:
imcore_apline
Purpose:
Detect objects on a line of data
Description:
Pixels above the defined threshold are detected on a line of data. A search is done in the ap structure to see if the pixel forms part of an object that is already known or whether this is part of a new object. The information is stored in the ap structure linked list.
Language:
C
Parameters
apThe input ap structure
datThe line of data
confThe confidence map for the line of data
smoothedA smoothed version of the data line.
smoothedcA smoothed version of the confidence map line.
jA number that tells you which row this is in the image
bpmA bad pixel mask for that line
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 75 of file apline.c.

Referenced by imcore_conf(), and imcore_opm().

◆ imcore_apreinit()

void imcore_apreinit ( ap_t *  ap)

Re-initialise the ap structure.

Name:
imcore_apreinit
Purpose:
Re-initialise the ap structre
Description:
The ap structure is reinitialised to the state it was in before we started detecting objects in it. All information about detected objects is erased.
Language:
C
Parameters
apThe input ap structure
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 142 of file apinit.c.

Referenced by imcore_overlp().

◆ imcore_areals()

void imcore_areals ( ap_t *  ap,
int  iareal[NAREAL] 
)

Work out the areal profiles for an object.

Name:
imcore_areals
Purpose:
Work out the areal profiles for an object
Description:
The pixel list for an object is used to define the areal profiles for that object and a given detection threshold.
Language:
C
Parameters
apThe input ap structure
iarealThe output areal profile array
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 67 of file areals.c.

Referenced by imcore_process_results_1(), imcore_process_results_2(), imcore_process_results_3(), and imcore_process_results_6().

◆ imcore_backest()

void imcore_backest ( ap_t *  ap,
float  x,
float  y,
float *  skylev,
float *  skyrms 
)

Work out estimated sky for a pixel position.

Name:
imcore_backest
Purpose:
Work out estimated sky for a pixel position
Description:
Given the coarse background grid, calculate the background at a given image pixel position by doing a bi-linear interpolation of it's position within the grid.
Language:
C
Parameters
apThe current ap structure
xThe X position in question
yThe Y position in question
skylevOutput sky level at x,y
skyrmsOutput sky noise at x,y
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 443 of file imcore_background.c.

Referenced by imcore_process_results_1(), imcore_process_results_2(), and imcore_process_results_6().

◆ imcore_background()

int imcore_background ( ap_t *  ap,
int  nbsize,
float  nullval 
)

Model and create background map.

Name:
imcore_background
Purpose:
Model and create background map
Description:
The image data array is split into cells. In each cell a robust background estimate is obtained. The cell raster is gently smoothed and then used to create a full background map with a bi-linear interpolation scheme.
Language:
C
Parameters
apThe current ap structure
nbsizeThe size of the cells in pixels
nullvalA null value used to flag bad pixels
Return values
CASU_OKIf all went well. This is currently the only value.
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 81 of file imcore_background.c.

References imcore_bfilt(), and imcore_medsig().

Referenced by imcore_conf(), and imcore_opm().

◆ imcore_backstats()

int imcore_backstats ( ap_t *  ap,
float  nullval,
int  satonly,
float *  skymed,
float *  skysig,
float *  sat 
)

Work out robust background estimate over a whole input image.

Name:
imcore_backstats
Purpose:
Work out a robust background estimate over a whole input image
Description:
The image is analysed to work out a robust estimate of the background median, sigma and saturation level.
Language:
C
Parameters
apThe current ap structure
nullvalA null value used to flag bad pixels
satonlyIf set, then only the saturation level will be computed.
skymedOutput sky median
skysigOutput sky noise
satOutput saturation level
Return values
CASU_OKIf all went well.
CASU_WARNIf there aren't enough good values to do the calculation
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 295 of file imcore_background.c.

References imcore_medsig().

Referenced by imcore_conf(), and imcore_opm().

◆ imcore_bfilt()

void imcore_bfilt ( float **  xbuf,
int  nx,
int  ny 
)

Do bilinear median and linear filtering on background values.

Name:
imcore_bfilt
Purpose:
Do bilinear median and linear filtering on background values
Description:
A map is smoothed using sliding median and mean filters.
Language:
C
Parameters
xbufThe input map to be smoothed
nxThe X dimension of the map
nyThe Y dimension of the map
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 73 of file imcore_filter.c.

Referenced by imcore_background().

◆ imcore_classify()

int imcore_classify ( casu_tfits *  catalogue,
float  minsize,
int  cattype 
)

Do star/galaxy classification.

Name:
imcore_classify
Purpose:
Do star/galaxy classification from a imcore catalogue
Description:
The information in an imcore catalogue is scanned and each object is classified based on a number of shape criteria.
Language:
C
Parameters
catalogueThe input imcore catalogue
plistThe propertylist from the primary header of the input image
minsizeThe minimum size in pixels of objects to be used in the analysis
cattypeThe catalogue type
Return values
CASU_OKIf everything is OK
CASU_FATALIf the input catalogue is unrecognised.
QC headers:
The following QC parameters are read from the catalogue extension header propertylist
  • MEAN_SKY The mean sky found by imcore
  • SKY_NOISE The sky noise found by imcore The following QC parameters are written to the catalogue extension header propertylist
  • IMAGE_SIZE The average FWHM of stellar objects in the catalogue
  • ELLIPTICITY The average stellar ellipticity
  • POSANG The average position angle on the image
  • APERTURE_CORR The aperture correction for an aperture with a radius of Rcore.
  • NOISE_OBJ The number of noise objects detected on the image
DRS headers:
The following DRS parameters are read from the catalogue extension header propertylist
  • THRESHOL The detection threshold used by imcore
  • RCORE The core radius used by imcore
  • SEEING The averaged seeing found by imcore
  • NXOUT The number of pixels in a row of the original image
  • NYOUT The number of pixels in a column of the original image The following DRS parameters are written to the catalogue extension header propertylist
  • CLASSIFD Set if the catalogue has been classified
Author
Jim Lewis, CASU

Definition at line 203 of file classify.c.

References casu_tfits_get_ehu(), and casu_tfits_get_table().

Referenced by casu_imcore().

◆ imcore_conf()

int imcore_conf ( casu_fits *  infile,
casu_fits *  conf,
int  ipix,
float  threshold,
int  icrowd,
float  rcore,
int  nbsize,
int  cattype,
float  filtfwhm,
float  gain,
casu_tfits **  outcat 
)

Do source extraction.

Name:
imcore_conf
Purpose:
Do source extraction
Description:
The main driving routine for the imcore source extraction program.
Language:
C
Parameters
infileThe input image
confThe input confidence map
ipixThe minimum allowable size of an object
thresholdThe detection threshold in sigma above sky
icrowdIf set then the deblending software will be used
rcoreThe core radius in pixels
nbsizeThe smoothing box size for background map estimation
cattypeThe type of catalogue to be produced
filtfwhmThe FWHM of the smoothing kernel in the detection algorithm
gainThe header keyword with the gain in e-/ADU
outcatThe output table of object
Return values
CASU_OKif everything is ok
CASU_WARN,CASU_FATALerrors in the called routines
QC headers:
The following values will go into the table extension propertylist
  • SATURATION Saturation level in ADU
  • MEAN_SKY Mean sky brightness in ADU
  • SKY_NOISE Pixel noise at sky level in ADU
DRS headers:
The following values will go into the image extension propertylist
  • SKYLEVEL Mean sky brightness in ADU
  • SKYNOISE Pixel noise at sky level in ADU The following values will go into the table extension propertylist
  • THRESHOL The detection threshold in ADU
  • MINPIX The minimum number of pixels per image
  • CROWDED Flag for crowded field analysis
  • RCORE The core radius for default profile fit in pixels
  • FILTFWHM The FWHM of the smoothing kernel in the detection algorithm
  • SEEING The average FWHM of stellar objects in pixels
  • XCOL The column containing the X position
  • YCOL The column containing the Y position
  • NXOUT The X dimension of the original image array
  • NYOUT The Y dimension of the original image array
Author
Jim Lewis, CASU

Definition at line 147 of file imcore_conf.c.

References casu_fits_get_ehu(), casu_fits_get_image(), casu_fits_get_nexten(), casu_fits_get_phu(), casu_tabwcs(), casu_tfits_wrap(), imcore_apfu(), imcore_apinit(), imcore_apline(), imcore_background(), imcore_backstats(), imcore_do_seeing(), imcore_tabclose(), imcore_tabinit(), and imcore_terminate().

Referenced by casu_imcore().

◆ imcore_do_seeing()

int imcore_do_seeing ( ap_t *  ap,
int  cattype,
int  nobjects,
cpl_table *  tab 
)

Do seeing estimate.

Name:
imcore_do_seeing
Purpose:
Do the seeing estimate
Description:
Wrapper routine to call the relevant routine to work out the seeing for each of the allowed types of catalogues
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all went well
CASU_FATALIf catalogue type is unrecognised
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 118 of file create_table.c.

References imcore_do_seeing_1(), imcore_do_seeing_2(), imcore_do_seeing_3(), imcore_do_seeing_4(), and imcore_do_seeing_6().

Referenced by imcore_conf().

◆ imcore_do_seeing_1()

int imcore_do_seeing_1 ( ap_t *  ap,
int  nobjects,
cpl_table *  tab 
)

Do seeing estimate for type 1 catalogue.

Name:
imcore_do_seeing_1
Purpose:
Do seeing estimate for type 1 catalogue
Description:
Areal profiles in a type 1 catalogue are analysed and a seeing estimate is extracted
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well. Currently this is the only return value
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 176 of file create_table_1.c.

References imcore_do_seeing_gen().

Referenced by imcore_do_seeing().

◆ imcore_do_seeing_2()

int imcore_do_seeing_2 ( ap_t *  ap,
int  nobjects,
cpl_table *  tab 
)

Do seeing estimate for type 2 catalogue.

Name:
imcore_do_seeing_2
Purpose:
Do seeing estimate for type 2 catalogue
Description:
Areal profiles in a type 2 catalogue are analysed and a seeing estimate is extracted
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well. Currently this is the only return value
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 276 of file create_table_2.c.

References imcore_do_seeing_gen().

Referenced by imcore_do_seeing().

◆ imcore_do_seeing_3()

int imcore_do_seeing_3 ( ap_t *  ap,
int  nobjects,
cpl_table *  tab 
)

Do seeing estimate for type 3 catalogue.

Name:
imcore_do_seeing_3
Purpose:
Do seeing estimate for type 3 catalogue
Description:
Areal profiles in a type 3 catalogue are analysed and a seeing estimate is extracted
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well. Currently this is the only return value
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 156 of file create_table_3.c.

References imcore_do_seeing_gen().

Referenced by imcore_do_seeing().

◆ imcore_do_seeing_4()

int imcore_do_seeing_4 ( ap_t *  ap)

Dummy seeing routine for type 4 catalogue (object mask)

Name:
imcore_do_seeing_4
Purpose:
Do seeing estimate for type 4 catalogue (object mask)
Description:
This is a dummy routine
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well. Currently this is the only return value
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 109 of file create_table_4.c.

Referenced by imcore_do_seeing().

◆ imcore_do_seeing_6()

int imcore_do_seeing_6 ( ap_t *  ap,
int  nobjects,
cpl_table *  tab 
)

Do seeing estimate for type 6 catalogue.

Name:
imcore_do_seeing_6
Purpose:
Do seeing estimate for type 6 catalogue
Description:
Areal profiles in a type 6 catalogue are analysed and a seeing estimate is extracted
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well. Currently this is the only return value
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 278 of file create_table_6.c.

References imcore_do_seeing_gen().

Referenced by imcore_do_seeing().

◆ imcore_do_seeing_gen()

int imcore_do_seeing_gen ( ap_t *  ap,
const char *  col_ellipt,
const char *  col_pkht,
char *  col_areals[NAREAL],
int  nobjects,
cpl_table *  tab 
)

Do seeing estimate (generic)

Name:
imcore_do_seeing_gen
Purpose:
Do seeing estimate (generic)
Description:
Wrapper routine for doing the seeing estimate
Language:
C
Parameters
apThe current ap structure
col_elliptThe name of the column for ellipticity
col_pkhtThe name of the column for the peak height
col_arealsThe array of names of the areal profile columns
Return values
CASU_OKIf all is ok. This is currently the only value.
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 335 of file create_table.c.

References imcore_seeing().

Referenced by imcore_do_seeing_1(), imcore_do_seeing_2(), imcore_do_seeing_3(), and imcore_do_seeing_6().

◆ imcore_exprad()

float imcore_exprad ( float  thresh,
float  peak,
float  areal0,
float  rcores[],
int  naper 
)

Work out the exponential radius for an object.

Name:
imcore_exprad
Purpose:
Work out the exponential radius for an object
Description:
Given the detection threshold, peak flux and lowest areal profile, work out the exponential radius for an object
Language:
C
Parameters
threshThe detection threshold
peakThe peak flux of the object
areal0The lowest level areal profile for the object
rcoresThe list of aperture radii used
naperThe number of radii used
Returns
The expoential radius of the object
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 142 of file imcore_radii.c.

Referenced by imcore_process_results_2().

◆ imcore_extend()

int imcore_extend ( ap_t *  ap,
float  xniso,
float  xbar,
float  ybar,
float  sxx,
float  sxy,
float  syy,
float  areal0,
float  tmax,
float *  ttotal 
)

Do aperture integration.

Name:
imcore_extend
Purpose:
Do aperture integration
Description:
The integrated flux of an object is calculated using matched ellipses
Language:
C
Parameters
apThe current ap structure
xnisoThe isophotal flux
xbarThe X position of the object
ybarThe Y position of the object
sxxSecond moment in X
syySecond moment in Y
sxySecond moment cross term
areal0The first areal profile
tmaxThe peak flux of the object
ttotalThe output total integrated flux
Return values
CASU_OKIf all went OK. Currently this is the only value.
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 89 of file imcore_extend.c.

Referenced by imcore_process_results_1(), imcore_process_results_2(), and imcore_process_results_6().

◆ imcore_extract_data()

void imcore_extract_data ( ap_t *  ap,
int  ip 
)

Put data into the Plessey array for an object.

Name:
imcore_extract_data
Purpose:
Put data into the Plessey array for an object
Description:
The information for the object from a given parent is extracted from the link list in the ap structure and put into the Plessey array in preparation for analysis.
Language:
C
Parameters
apThe current ap structure
ipThe parent in question
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 250 of file terminate.c.

Referenced by imcore_terminate().

◆ imcore_flux()

void imcore_flux ( ap_t *  ap,
float  parm[IMNUM][NPAR],
int  nbit,
float  apers[],
float  fluxes[],
int  nr,
float  rcores[],
float  rfluxes[] 
)

Work out the fluxes for special radii.

Name:
imcore_flux
Purpose:
Work out the fluxes for special radii
Description:
The fluxes for the 'special' radii (Kron etc) are worked out by an interpolation of the pre-existing aperture photometry to the new radius
Language:
C
Parameters
apThe current ap structure
parmThe parameters for each object already detected
nbitThe number of detected objects in the current Plessey structure.
apersThe radii of the standard apertures
fluxesThe fluxes computed through the standard apertures
nrThe number of special apertures
rcoresThe radii the special apertures
rfluxesThe fluxes computed through the special apertures.
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 316 of file imcore_radii.c.

Referenced by imcore_process_results_2(), and imcore_process_results_6().

◆ imcore_halflight()

float imcore_halflight ( float  rcores[],
float  cflux[],
float  halflight,
float  peak,
int  naper 
)

Work out the half-light radius for an object.

Name:
imcore_halfrad
Purpose:
Work out the half-light radius for an object
Description:
Given the the array of core apertures and core fluxes, work out the half light radius
Language:
C
Parameters
rcoresThe list of aperture radii used
cfluxThe list of fluxes through the aperture radii
halflightAn estimate of half the light of the object
peakThe peak flux of the object
naperThe number of radii used
Returns
The half-light radius of the object
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 76 of file imcore_radii.c.

Referenced by imcore_process_results_6().

◆ imcore_kronrad()

float imcore_kronrad ( float  areal0,
float  rcores[],
float  cflux[],
int  naper 
)

Work out the Kron radius for an object.

Name:
imcore_kronrad
Purpose:
Work out the Kron radius for an object
Description:
Given the lowest areal profile and the circular aperture fluxes already done, calculate the Kron radius
Language:
C
Parameters
areal0The lowest level areal profile for the object
rcoresThe list of aperture radii used
cfluxThe aperture fluxes for each radius
naperThe number of radii used
Returns
The Kron radius of the object
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 188 of file imcore_radii.c.

Referenced by imcore_process_results_2(), and imcore_process_results_6().

◆ imcore_medsig()

void imcore_medsig ( int *  shist,
int  nh,
int  ist,
int  itarg,
float *  med,
float *  sig 
)

Analyse histogram to work out median and sigma.

Name:
imcore_medsig
Purpose:
Analyse histogram to work out median and sigma
Description:
Given a histogram work out the median and sigma of a distribution. A starting point in the histogram can be given, which allows you to ignore bins at the lower end. A target value defines at what point we stop summing the histogram.
Language:
C
Parameters
shistThe input histogram
nhThe number of bins in the histogram
istThe first bin position that we will look at
itargThe target value for the summation.
medOutput median
sigOutput sigma from the first quartile.
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 526 of file imcore_background.c.

Referenced by imcore_background(), and imcore_backstats().

◆ imcore_moments()

void imcore_moments ( ap_t *  ap,
float  results[] 
)

Do moments analysis on an object.

Name:
imcore_moments
Purpose:
Do moments analysis on an object in a Plessey array
Description:
The Plessey array is given from an ap structure for a single object. This routine does a basic zeroth, first and second moments analysis.
Language:
C
Parameters
apThe current ap structure
resultsThe output array with the moments results.
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 65 of file moments.c.

Referenced by imcore_process_results_1(), imcore_process_results_2(), imcore_process_results_3(), and imcore_process_results_6().

◆ imcore_opm()

int imcore_opm ( casu_fits *  infile,
casu_fits *  conf,
int  ipix,
float  threshold,
int  nbsize,
float  filtfwhm,
int  niter 
)

Create an object mask.

Name:
imcore_opm
Purpose:
Create an object mask
Description:
The main driving routine for the imcore object mask program.
Language:
C
Parameters
infileThe input image. The output object mask will be stored in the pixel mask for this image.
confThe input confidence map
ipixThe minimum allowable size of an object
thresholdThe detection threshold in sigma above sky
nbsizeThe smoothing box size for background map estimation
filtfwhmThe FWHM of the smoothing kernel in the detection algorithm
niterThe number of detection iterations.
Return values
CASU_OKif everything is ok
CASU_WARN,CASU_FATALerrors in the called routines
QC headers:
None
DRS headers:
The following values will go into the image extension propertylist
  • SKYLEVEL Mean sky brightness in ADU
  • SKYNOISE Pixel noise at sky level in ADU
Author
Jim Lewis, CASU

Definition at line 111 of file imcore_opm.c.

References casu_fits_get_ehu(), casu_fits_get_image(), casu_fits_get_nexten(), imcore_apfu(), imcore_apinit(), imcore_apline(), imcore_background(), imcore_backstats(), imcore_tabclose(), imcore_tabinit(), and imcore_terminate().

Referenced by casu_opm().

◆ imcore_overlp()

void imcore_overlp ( ap_t *  ap,
float  parm[IMNUM][NPAR],
int *  nbit,
float  xbar,
float  ybar,
float  total,
int  npix,
float  tmax 
)

Deblend overlapping images.

Name:
imcore_overlp
Purpose:
Deblend overlapping images
Description:
An array of pixels that are believed to be part of a single large object are anaylsed with successively higher threhsolds to see if they resolve into multiple objects
Language:
C
Parameters
apThe current input ap structure
parmThe parameter array for the deblended objects
nbitThe output number of objects found in the deblended object
xbarThe X position of the input object
ybarThe Y position of the input object
totalThe total flux of the input object
npixThe number of pixels in the original object
tmaxThe peak flux of the original object
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 99 of file imcore_overlp.c.

References imcore_apclose(), imcore_apclust(), imcore_apinit(), and imcore_apreinit().

Referenced by imcore_process_results_1(), imcore_process_results_2(), and imcore_process_results_6().

◆ imcore_petrad()

float imcore_petrad ( float  areal0,
float  rcores[],
float  cflux[],
int  naper 
)

Work out the Petrosian.

Name:
imcore_petrad
Purpose:
Work out the Petrosian radius for an object
Description:
Given the lowest areal profile and the circular aperture fluxes already done, calculate the Petrosian radius
Language:
C
Parameters
areal0The lowest level areal profile for the object
rcoresThe list of aperture radii used
cfluxThe aperture fluxes for each radius
naperThe number of radii used
Returns
The Petrosian radius of the object
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 242 of file imcore_radii.c.

Referenced by imcore_process_results_2(), and imcore_process_results_6().

◆ imcore_phopt()

void imcore_phopt ( ap_t *  ap,
float  parm[IMNUM][NPAR],
int  nbit,
int  naper,
float  apertures[],
float  cflux[],
float  badpix[],
int  nrcore,
float  avconf[] 
)

Do multiple profile fitting.

Name:
imcore_phopt
Purpose:
Do multiple profile fitting
Description:
Given a Plessey array and some parameters determined from a moments analysis for each of the objects detected in the array, this routine does multiple profile fitting for the given aperture set
Language:
C
Parameters
apThe current ap structure
parmThe input/output object parameters
nbitThe number of objects detected in the current Plessey structure
naperThe number of apertures
aperturesArray of aperture radii
cfluxArray of aperture fluxes
badpixArray saying how many bad pixels were included in the data for each object at each radius
nrcoreThe index of the apertures array that defines where the radius = Rcore
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 91 of file imcore_phopt.c.

Referenced by imcore_process_results_1(), imcore_process_results_2(), and imcore_process_results_6().

◆ imcore_process_results()

int imcore_process_results ( ap_t *  ap,
int  cattype,
float  gain,
int *  nobjects,
cpl_table *  tab 
)

Process results.

Name:
imcore_process_results
Purpose:
Process the results for each object and store them in the table
Description:
Wrapper routine to call the relevant routine to work out the results for each of the allowed types of catalogues
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all went well
CASU_FATALIf catalogue type is unrecognised
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 176 of file create_table.c.

References imcore_process_results_1(), imcore_process_results_2(), imcore_process_results_3(), imcore_process_results_4(), and imcore_process_results_6().

Referenced by imcore_terminate().

◆ imcore_process_results_1()

int imcore_process_results_1 ( ap_t *  ap,
int *  nobjects,
cpl_table *  tab 
)

Process results for type 1 catalogue.

Name:
imcore_process_results_1
Purpose:
Create the results for objects in a type 1 catalogue
Description:
The pixel processing is done for all the parameters wanted for a type 1 catalogue
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well.
CASU_FATALIf peak flux < 0
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 224 of file create_table_1.c.

References imcore_areals(), imcore_backest(), imcore_extend(), imcore_moments(), imcore_overlp(), and imcore_phopt().

Referenced by imcore_process_results().

◆ imcore_process_results_2()

int imcore_process_results_2 ( ap_t *  ap,
float  gain,
int *  nobjects,
cpl_table *  tab 
)

Process results for type 2 catalogue.

Name:
imcore_process_results_2
Purpose:
Create the results for objects in a type 2 catalogue
Description:
The pixel processing is done for all the parameters wanted for a type 2 catalogue
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well.
CASU_FATALIf peak flux < 0
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 324 of file create_table_2.c.

References imcore_areals(), imcore_backest(), imcore_exprad(), imcore_extend(), imcore_flux(), imcore_kronrad(), imcore_moments(), imcore_overlp(), imcore_petrad(), and imcore_phopt().

Referenced by imcore_process_results().

◆ imcore_process_results_3()

int imcore_process_results_3 ( ap_t *  ap,
int *  nobjects,
cpl_table *  tab 
)

Process results for type 3 catalogue.

Name:
imcore_process_results_3
Purpose:
Create the results for objects in a type 3 catalogue
Description:
The pixel processing is done for all the parameters wanted for a type 3 catalogue
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well.
CASU_FATALIf peak flux < 0
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 205 of file create_table_3.c.

References imcore_areals(), and imcore_moments().

Referenced by imcore_process_results().

◆ imcore_process_results_4()

int imcore_process_results_4 ( ap_t *  ap)

Process results for type 4 catalogue (object mask)

Name:
imcore_process_results_4
Purpose:
Create the results for objects in a type 4 catalogue (object mask)
Description:
The positions for pixels identified as being part of a detected object are flagged in the object pixel mask.
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well. This is currently the only value
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 144 of file create_table_4.c.

Referenced by imcore_process_results().

◆ imcore_process_results_6()

int imcore_process_results_6 ( ap_t *  ap,
float  gain,
int *  nobjects,
cpl_table *  tab 
)

Process results for type 6 catalogue.

Name:
imcore_process_results_6
Purpose:
Create the results for objects in a type 6 catalogue
Description:
The pixel processing is done for all the parameters wanted for a type 6 catalogue
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well.
CASU_FATALIf peak flux < 0
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 326 of file create_table_6.c.

References imcore_areals(), imcore_backest(), imcore_extend(), imcore_flux(), imcore_halflight(), imcore_kronrad(), imcore_moments(), imcore_overlp(), imcore_petrad(), and imcore_phopt().

Referenced by imcore_process_results().

◆ imcore_restack()

void imcore_restack ( ap_t *  ap,
int  ip 
)

Free information for an object from the ap structure.

Name:
imcore_restack
Purpose:
Free information for an object from the ap structure
Description:
The starting address for an object in the ap structure is given. Information relating to that object is erased and the space made available
Language:
C
Parameters
apThe current ap structure
ipThe parent number for the object
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 64 of file terminate.c.

Referenced by imcore_apfu(), and imcore_terminate().

◆ imcore_seeing()

void imcore_seeing ( ap_t *  ap,
int  nrows,
float *  ellipt,
float *  pkht,
float **  areal,
float *  work,
float *  fwhm 
)

Work out the median seeing.

Name:
imcore_seeing
Purpose:
Work out the median seeing
Description:
The areal profiles for an array of objects is examined. The point where the areal profile falls to half its peak value is found for each object and the final seeing estimate is the median of these results
Language:
C
Parameters
apThe current ap structure
nrowsThe number rows in the object catalogue
elliptThe array of ellipticities from the object catalogue
pkhtThe array of peak heights from the object catalogue
arealThe array of areal profiles from the object catalogue
workA work array (should probably allocate this local at some stage)
fwhmThe output FWHM estimate
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 80 of file seeing.c.

Referenced by imcore_do_seeing_gen().

◆ imcore_tabclose()

int imcore_tabclose ( ap_t *  ap,
int  cattype 
)

Close the table structure.

Name:
imcore_tabclose
Purpose:
Close the table structure
Description:
Wrapper routine to call the relevant routine to close the table for each of the allowed types of catalogues
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all went well
CASU_FATALIf catalogue type is unrecognised
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 234 of file create_table.c.

References imcore_tabclose_4().

Referenced by imcore_conf(), and imcore_opm().

◆ imcore_tabclose_4()

int imcore_tabclose_4 ( ap_t *  ap)

Close object mask.

Name:
imcore_tabclose_4
Purpose:
Close the object mask
Description:
The object mask array in the ap structure is freed and the internal mask in the input image is marked with the object locations.
Language:
C
Parameters
apThe current ap structure
Return values
CASU_OKIf all is well. This is currently the only value
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 194 of file create_table_4.c.

Referenced by imcore_tabclose().

◆ imcore_tabinit()

void imcore_tabinit ( ap_t *  ap,
int *  xcol,
int *  ycol,
int  cattype,
cpl_table **  tab 
)

Initialise catalogues.

Name:
imcore_tabinit
Purpose:
Initialise the output table.
Description:
Wrapper routine to call the relevant initialisation routine for each of the allowed types of catalogues.
Language:
C
Parameters
apThe current ap structure
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 62 of file create_table.c.

References imcore_tabinit_1(), imcore_tabinit_2(), imcore_tabinit_3(), imcore_tabinit_4(), and imcore_tabinit_6().

Referenced by casu_dummy_catalogue(), imcore_conf(), and imcore_opm().

◆ imcore_tabinit_1()

void imcore_tabinit_1 ( int *  imcore_xcol,
int *  imcore_ycol,
cpl_table **  tab 
)

Initialise type 1 catalogue.

Name:
imcore_tabinit_1
Purpose:
Initialise type 1 catalogue
Description:
Type 1 catalogue is initialised and the xy columns are identified.
Language:
C
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 136 of file create_table_1.c.

References imcore_tabinit_gen().

Referenced by imcore_tabinit().

◆ imcore_tabinit_2()

void imcore_tabinit_2 ( int *  imcore_xcol,
int *  imcore_ycol,
cpl_table **  tab 
)

Initialise type 2 catalogue.

Name:
imcore_tabinit_2
Purpose:
Initialise type 2 catalogue
Description:
Type 2 catalogue is initialised and the xy columns are identified.
Language:
C
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 235 of file create_table_2.c.

References imcore_tabinit_gen().

Referenced by imcore_tabinit().

◆ imcore_tabinit_3()

void imcore_tabinit_3 ( int *  imcore_xcol,
int *  imcore_ycol,
cpl_table **  tab 
)

Initialise type 1 catalogue.

Name:
imcore_tabinit_3
Purpose:
Initialise type 3 catalogue
Description:
Type 3 catalogue is initialised and the xy columns are identified.
Language:
C
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 116 of file create_table_3.c.

References imcore_tabinit_gen().

Referenced by imcore_tabinit().

◆ imcore_tabinit_4()

void imcore_tabinit_4 ( ap_t *  ap,
int *  imcore_xcol,
int *  imcore_ycol,
cpl_table **  tab 
)

Initialise type 4 catalogue (object mask)

Name:
imcore_tabinit_4
Purpose:
Initialise type 4 catalogue (object mask)
Description:
Type 4 catalogue is initialised. This is in fact an object mask.
Language:
C
Parameters
apThe current ap structure
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 62 of file create_table_4.c.

Referenced by imcore_tabinit().

◆ imcore_tabinit_6()

void imcore_tabinit_6 ( int *  imcore_xcol,
int *  imcore_ycol,
cpl_table **  tab 
)

Initialise type 6 catalogue.

Name:
imcore_tabinit_6
Purpose:
Initialise type 6 catalogue
Description:
Type 6 catalogue is initialised and the xy columns are identified.
Language:
C
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 237 of file create_table_6.c.

References imcore_tabinit_gen().

Referenced by imcore_tabinit().

◆ imcore_tabinit_gen()

void imcore_tabinit_gen ( int  ncols,
const char *  ttype[],
const char *  tunit[],
cpl_type  tform[],
cpl_table **  tab 
)

Initialise tables (generic)

Name:
imcore_tabinit_gen
Purpose:
Initialise tables (generic)
Description:
Generic routine to create FITS tables for the output catalogues
Language:
C
Parameters
ncolsThe number of columns in the table
ttypeArray of column names for FITS table
tunitArray of units for each of the columns
tformArray of formats for each of the columns as defined in the FITS standard
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 281 of file create_table.c.

Referenced by imcore_tabinit_1(), imcore_tabinit_2(), imcore_tabinit_3(), and imcore_tabinit_6().

◆ imcore_terminate()

void imcore_terminate ( ap_t *  ap,
int  cattype,
float  gain,
int *  nobjects,
cpl_table *  tab 
)

Check for objects that have terminated.

Name:
imcore_terminate
Purpose:
Check for objects that have terminated
Description:
The parents in the current ap structure are examined to see which have not grown since the last pass. Any that have not grown are sent to the processing routine.
Language:
C
Parameters
apThe current ap structure
Returns
Nothing
QC headers:
None
DRS headers:
None
Author
Jim Lewis, CASU

Definition at line 130 of file terminate.c.

References imcore_extract_data(), imcore_process_results(), and imcore_restack().

Referenced by imcore_conf(), and imcore_opm().