measure.fluxes: Measure Fluxes

View source: R/measure.fluxes.R

measure.fluxesR Documentation

Measure Fluxes

Description

Measure Photometric fluxes from an arbitrary FITS image, when provided an appropriate input parameter file. Detailed descriptions of the many functions called by this procedure can be found in their relevant help files. The procedure has many high-level options available, all of which are designated in the input parameter file. A default parameter file can be created by running measure.fluxes("–makepar"). For more in depth examples, see below.

Usage

measure.fluxes(par.file, quiet = FALSE, mpi.backend=FALSE,
do.return=FALSE, stop.on.missing=TRUE, ...)

Arguments

par.file

Path to, and name of, the Input Parameter file (ie. ‘/path/to/par.file.par’).

quiet

logical; if TRUE all output to screen is suppressed

mpi.backend

logical; if TRUE, will use Rmpi and doMPI backends to foreach.

do.return

logical; if TRUE, a set of core outputs (for every object) will be passed to the R console on program completion.

stop.on.missing

logical; if TRUE, the program stops when an image is not found. If FALSE, the program will simply move to the next loop stage (i.e. the next image).

...

Any arguments that are intended to be passed to the ‘create.par.file’ routine; see examples below.

Details

measure.fluxes is the principle routine in the LAMBDAR package. The LAMBDAR package is intended for use in astronomy, and other related fields, to determine photometry from input FITS photometric images of arbitrary resolution.

The program has many optional functions, and can be run in a standard threaded mode or in a Cluster-enabled MPI mode. Examples of how to run the program utilising the MPI backend are supplied in the examples below. __See note regarding MPI in Interactive R Shells__ The many options available to the program are outlined in the CreateParFile function's manual page, as well as being explained in greater detail in related manual pages.

Value

measure.fluxes will return either NULL (if do.return=FALSE) or a list containing a subset the photometric results (if do.return=TRUE). By Default, measure.fluxes will return NULL and all outputs are to file. If requested the returned list contains the following:

SFAflux

The flux of each aperture, without consideration of deblending, in image units.

SFAerror

The error on the un-deblended flux, in image units.

DFAflux

The final deblended flux of each aperture, in image units.

DFAerror

The error associated with the final deblended flux for each aperture, in image units.

Additionally, if the Diagnostic flag is 1 in the parameter file, do.return=TRUE will also return the entire aperture stamps lists:

SA_Stamps

The list of aperture stamps generated by the make.catalogue.apertures function

SFA_Stamps

The list of aperture stamps generated by the make.convolved.apertures function without flux.weighting

WSFA_Stamps

The list of aperture stamps generated by the make.convolved.apertures function with flux.weighting active

DFA_Stamps

The list of aperture stamps generated by the make.convolved.apertures function, and after deblending

Note

All parameters and data used by measure.fluxes are stored in environments created within the function. At completion of the routine, these environments are all discarded, meaning that there is no modification to the runtime environment (as per CRAN requirements).

Note

If using the MPI backend, LAMBDAR assumes that R is being launched within an mpirun wrapper, and will exit at the program end using mpi.quit(). Running LAMBDAR with mpi.backend=TRUE inside an Interactive R Shell may therefore have unintended consequences and cause R to exit without warning on exiting measure.fluxes.

Author(s)

Angus H Wright ICRAR angus.wright@icrar.org

See Also

create.par.file

Examples


#Load LAMBDAR
library(LAMBDAR)
###Parameter File Generation:
# To generate a default parameter file for use
measure.fluxes("--makepar")

# When generating the parameter file, all parameters can be
# made custom by including the parameter name and its desired
# value in the makepar call. For Example, to generate a
# parameter file for use, with customised Catalogue name
# value, and send it to the file 'Lambdar_Sample.par':
measure.fluxes("--makepar", filename="Lambdar_Sample.par",
Catalogue="MyCat.csv")

# Or changing the input Catalogue name, and changing number of
# foreach/doParallel processors
measure.fluxes("--makepar", filename="Lambdar_Sample.par",
Catalogue="MyCat.csv", nProcessors=10)

#Alternatively, you can call the create.par.file function yourself
create.par.file(file="Lambdar_Sample.par", Catalogue="MyCat.csv",
nProcessors=10)

###Example of Measuring Photometry:

#Load a Sample Image and Catalogue
data("SDSS.sample",envir=environment())
data("ApCat.sample",envir=environment())
#Show the loaded data
lsos(envir=environment())
#Write Sample Image to File
write.fits(file="SampleImage.fits",SDSS.sample)
#Write Sample Catalogue to File
write.csv(file="SampleCat.csv",ApCat.sample,row.names=FALSE,
quote=FALSE)
#Generate Parameter File
create.par.file(file="Lambdar_Sample.par",DataMap="SampleImage.fits",
Catalogue="SampleCat.csv")

#Measure Photometry
measure.fluxes("Lambdar_Sample.par")

#Read the Results file
output<-read.csv("LAMBDAR_Results.csv",stringsAsFactors=FALSE)

#Summarise Results
summary(output$DFAFlux_Jy)

###Running using MPI:
# To execute the program using the MPI backend (provided that
# you have a functional System installation of MPI, as well as
# the relevant R packages Rmpi, and doMPI) you would execute:

## Not run: 

mpirun -np <NUM_PROCESSORS> R --slave \
-e "measure.fluxes('/path/to/par.file.par',mpi.backend=TRUE)"


## End(Not run)


AngusWright/LAMBDAR documentation built on May 12, 2022, 1:49 a.m.