MCPcopy Create free account
hub / github.com/brainflow-dev/brainflow / get_window

Function get_window

src/data_handler/data_handler.cpp:750–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

748}
749
750int get_window (int window_function, int window_len, double *output_window)
751{
752 if ((window_len <= 0) || (window_function < 0) || (output_window == NULL))
753 {
754 data_logger->error ("Please check the arguments: data_len must be > 0, window_function >= "
755 "0 and output_window cannot be empty.");
756 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
757 }
758 // from https://www.edn.com/windowing-functions-improve-fft-results-part-i/
759 switch (static_cast<WindowOperations> (window_function))
760 {
761 case WindowOperations::NO_WINDOW:
762 no_window_function (window_len, output_window);
763 break;
764 case WindowOperations::HAMMING:
765 hamming_function (window_len, output_window);
766 break;
767 case WindowOperations::HANNING:
768 hanning_function (window_len, output_window);
769 break;
770 case WindowOperations::BLACKMAN_HARRIS:
771 blackman_harris_function (window_len, output_window);
772 break;
773 default:
774 data_logger->error ("Invalid Window function. Window function:{}", window_function);
775 return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
776 }
777 return (int)BrainFlowExitCodes::STATUS_OK;
778}
779
780int perform_fft (
781 double *data, int data_len, int window_function, double *output_re, double *output_im)

Callers 3

perform_fftFunction · 0.70
get_windowMethod · 0.50
mainFunction · 0.50

Calls 4

no_window_functionFunction · 0.85
hamming_functionFunction · 0.85
hanning_functionFunction · 0.85
blackman_harris_functionFunction · 0.85

Tested by

no test coverage detected