Skip to content

Commit

Permalink
Minor refactoring of namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
ocsmit committed Sep 21, 2023
1 parent 7f58c72 commit 818cef9
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 115 deletions.
4 changes: 2 additions & 2 deletions R/RcppExports.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Generated by using Rcpp::compileAttributes() -> do not edit by hand
# Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393

C_spike_center <- function(signal, parameter_list, dates_idx = NULL) {
.Call('_spiker_C_spike_center', PACKAGE = 'spiker', signal, parameter_list, dates_idx)
C_spike_filter <- function(signal, parameter_list, dates_idx = NULL) {
.Call('_spiker_C_spike_filter', PACKAGE = 'spiker', signal, parameter_list, dates_idx)
}

4 changes: 2 additions & 2 deletions R/spike.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ spike_filter <- function(
)

# Run and get outlier idx's
outlier_idx <- C_spike_center(signal, params, dates_idx)
outlier_idx <- C_spike_filter(signal, params, dates_idx)

} else if (methods::is(object = previous, class2 = "Spike")) {
params <- previous$params
Expand All @@ -52,7 +52,7 @@ spike_filter <- function(
previous_idx_pnts <- previous$outlier_idx


outlier_idx <- C_spike_center(signal, params, dates_idx)
outlier_idx <- C_spike_filter(signal, params, dates_idx)
outlier_idx <- c(previous_idx_pnts, outlier_idx) # Update outlier idx
} else {
# if neither condition is true, logic isn't working as expected.
Expand Down
10 changes: 5 additions & 5 deletions src/RcppExports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
#endif

// C_spike_center
IntegerVector C_spike_center(NumericVector& signal, List& parameter_list, Nullable<IntegerVector> dates_idx);
RcppExport SEXP _spiker_C_spike_center(SEXP signalSEXP, SEXP parameter_listSEXP, SEXP dates_idxSEXP) {
// C_spike_filter
IntegerVector C_spike_filter(NumericVector& signal, List& parameter_list, Nullable<IntegerVector> dates_idx);
RcppExport SEXP _spiker_C_spike_filter(SEXP signalSEXP, SEXP parameter_listSEXP, SEXP dates_idxSEXP) {
BEGIN_RCPP
Rcpp::RObject rcpp_result_gen;
Rcpp::RNGScope rcpp_rngScope_gen;
Rcpp::traits::input_parameter< NumericVector& >::type signal(signalSEXP);
Rcpp::traits::input_parameter< List& >::type parameter_list(parameter_listSEXP);
Rcpp::traits::input_parameter< Nullable<IntegerVector> >::type dates_idx(dates_idxSEXP);
rcpp_result_gen = Rcpp::wrap(C_spike_center(signal, parameter_list, dates_idx));
rcpp_result_gen = Rcpp::wrap(C_spike_filter(signal, parameter_list, dates_idx));
return rcpp_result_gen;
END_RCPP
}

static const R_CallMethodDef CallEntries[] = {
{"_spiker_C_spike_center", (DL_FUNC) &_spiker_C_spike_center, 3},
{"_spiker_C_spike_filter", (DL_FUNC) &_spiker_C_spike_filter, 3},
{NULL, NULL, 0}
};

Expand Down
102 changes: 0 additions & 102 deletions src/bench.R

This file was deleted.

4 changes: 2 additions & 2 deletions src/center_filter.cc → src/spike_filter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* License: MIT
**/
#include "param.h"
#include "spiker.h"
#include "spike_filter.h"

/* What do we need?
- Option to take a previous `spike` object and update for new data
Expand All @@ -18,7 +18,7 @@
*/

// [[Rcpp::export]]
IntegerVector C_spike_center(NumericVector &signal, List &parameter_list,
IntegerVector C_spike_filter(NumericVector &signal, List &parameter_list,
Nullable<IntegerVector> dates_idx = R_NilValue
) {
// TODO: Reduce number of allocs happening. Should pass signal by ref and
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ double combined_stddev(NumericVector &x1, NumericVector &x2)
return sqrt(((q1 + q2) - (n * 2) * pow(x, 2)) / (n * 2 - 1));

}


0 comments on commit 818cef9

Please sign in to comment.