Learn R Programming

UPMASK (version 1.2)

outerLoop: UPMASK outer loop

Description

outerLoop executes the UPMASK method's outer loop on a data frame, and returns another data frame as output, with the id of the object and it's classification as a stellar cluster member or not.

The outerLoop perform cuts in the data if necessary (by calling performCuts), take errors in the data table into account if the user request (by calling innerLoop), runs the inner loop (by calling innerLoop) until convergence of the membership list or util the maximum number of iterations is reached.

Usage

outerLoop(ocdata_full, positionDataIndexes=c(1,2),
photometricDataIndexes=c(3,5,7,9,11,19,21,23,25,27),
photometricErrorDataIndexes=c(4,6,8,10,12,20,22,24,26,28), threshold=1, maxIter=25, 
plotIter=FALSE, verbose=FALSE, starsPerClust_kmeans=50, nstarts_kmeans=50, 
finalXYCut=FALSE, autoCalibrated=FALSE, considerErrors=FALSE, run=0, 
smartTableDB, nDimsToKeep=4, dimRed="PCA", scale=TRUE)

Arguments

ocdata_full

a data frame with the data to perform the analysis

positionDataIndexes

an array of integers indicating the columns of the data frame containing the spatial position measurements

photometricDataIndexes

an array of integers with the column numbers containing photometric measurements (or any other measurement to go into the PCA step)

photometricErrorDataIndexes

an array of integers with the column numbers containing the errors of the photometric measurements

threshold

a double indicating the thresholding level for the random field analysis

maxIter

an integer the maximum amount of iterations of the outer loop before giving up convergence (usually it is not necessary to modify this)

plotIter

a boolean indicating if the user wants to see iteration plots

verbose

a boolean indicating if the output to screen should be verbose

starsPerClust_kmeans

an integer with the average number of stars per k-means cluster

nstarts_kmeans

an integer the amount of random re-initializations of the k-means clustering method (usually it is not necessary to modify this)

finalXYCut

a boolean indicating if a final cut in the XY space should be performed (defaults to FALSE)

autoCalibrated

a boolean indicating if the number of random field realizations for the clustering check in the position space should be autocalibrated (experimental code, defaults to FALSE).

considerErrors

a boolean indicating if the errors should be taken into account

run

an integer greater than zero indicating the run number

smartTableDB

a database connection to the smart look-up table

nDimsToKeep

an integer with the number of dimensions to consider (defaults to 4)

dimRed

a string with the dimensionality reduction method to use (defaults to PCA. The only other options are LaplacianEigenmaps or None)

scale

a boolean indicating if the data should be scaled and centered

Value

A data frame with the id and class (member / not member) of each object at this run.

References

Krone-Martins, A. & Moitinho, A., A&A, v.561, p.A57, 2014

Examples

Run this code
# NOT RUN {
# Perform a one run of the outerLoop using a simulated open cluster with 
# spatial and photometric data 
# Load the data into a data frame
fileName <- "oc_12_500_1000_1.0_p019_0880_1_25km_120nR_withcolors.dat"
inputFileName <- system.file("extdata", fileName, package="UPMASK")
ocData <- read.table(inputFileName, header=TRUE)

# Create the look up table
library(RSQLite)
stcon <- create_smartTable()

# Run the outer loop 
posIdx <- c(1,2)
photIdx <- c(3,5,7,9,11,19,21,23,25,27)
photErrIdx <- c(4,6,8,10,12,20,22,24,26,28)
outerLoopRes <- outerLoop(ocData, posIdx, photIdx, PhotErrIdx,
                          starsPerClust_kmeans=25, verbose=TRUE, smartTableDB=stcon)

# Clean the environment
rm(list=c("inputFileName", "ocData", "posIdx", "photIdx", "photErrIdx", 
          "outerLoopRes", "fileName"))
dbDisconnect(stcon)
# }
# NOT RUN {
 
# }

Run the code above in your browser using DataLab