Variable Star package provides the main funtions to analized patterns on the oscilation modes of variable stars.
All the code is based on these two papers:
install.packages("devtools")
library(devtools)
install_github("rmaestre/variableStars")
We strongly recommend to use The Microsoft R Open & MKL R distribution as R distribution.
Also, please do not forgive to include the file Makevars.win
into
the src project folder with the next content:
CXX_STD = CXX11
PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS)
PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS)
library(variableStars)
runUISynthetic()
Please, find here or here the main execution of the complete package procedure.
(The pulsar in the Crab Nebula is composed by images taken by Hubble (red) and Chandra X-Ray(blue))
All core funcionalities are programmed in C++ using RcppArmadillo integrated through Rcpp. An example of function to calculate all differences between pair of element using Armadillo C++ library, iterators and std operattions:
// Calculate all frequences differences
int n = frequences.n_elem;
int diagSupElements = n * (n - 1) / 2;
arma::vec diff(diagSupElements); // Number of elements in the sup. diag.
NumericVector::iterator it_first, it_second, it_diff;
it_diff = diff.begin(); // output iterator
int countElements = 0;
// Double loop (n^2 complexity)
for (it_first = frequences.begin(); it_first < frequences.end(); it_first++) {
for (it_second = it_first; it_second < frequences.end() & it_diff < diff.end(); it_second++) {
if (it_first != it_second) { // Jump same elements
* it_diff =
std::abs( * it_second - * it_first); // Save absolute difference
if ( * it_diff != 0) {
it_diff++; // Increase pointer
countElements++; // Increase elements
}
}
}
}
// Remove unused memory
diff.resize(diagSupElements - (diagSupElements - countElements));
// Return results
return diff;
}
However, all code can be call from R easily with the next function
result <- process(
data$frequency,
data$amplitude,
filter = "uniform",
gRegimen = 0,
minDnu = 15,
maxDnu = 95,
dnuValue = -1,
dnuGuessError = 10,
dnuEstimation = TRUE,
numFrequencies = 30,
debug = TRUE
)
This package is also used as feature engineering in Deep Neural Network application to Dnu and dr estimation.