Skip to content

Commit fa5c6fc

Browse files
committed
fixing code style for c#
Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
1 parent 87291ce commit fa5c6fc

File tree

3 files changed

+42
-42
lines changed

3 files changed

+42
-42
lines changed

csharp-package/brainflow/brainflow/board_shim.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -147,11 +147,11 @@ public static int get_num_rows (int board_id)
147147
/// <param name="board_id"></param>
148148
/// <returns>array of 10-20 locations</returns>
149149
/// <exception cref="BrainFlowException">If this board has no such data exit code is UNSUPPORTED_BOARD_ERROR</exception>
150-
public static string[] get_eeg_names(int board_id)
150+
public static string[] get_eeg_names (int board_id)
151151
{
152152
int[] len = new int[1];
153153
byte[] str = new byte[4096];
154-
int res = BoardControllerLibrary.get_eeg_names(board_id, str, len);
154+
int res = BoardControllerLibrary.get_eeg_names (board_id, str, len);
155155
if (res != (int)CustomExitCodes.STATUS_OK)
156156
{
157157
throw new BrainFlowException(res);
@@ -461,11 +461,11 @@ public static int[] get_temperature_channels (int board_id)
461461
/// <param name="board_id"></param>
462462
/// <returns>array of row nums</returns>
463463
/// <exception cref="BrainFlowException">If this board has no such data exit code is UNSUPPORTED_BOARD_ERROR</exception>
464-
public static int[] get_resistance_channels(int board_id)
464+
public static int[] get_resistance_channels (int board_id)
465465
{
466466
int[] len = new int[1];
467467
int[] channels = new int[512];
468-
int res = BoardControllerLibrary.get_resistance_channels(board_id, channels, len);
468+
int res = BoardControllerLibrary.get_resistance_channels (board_id, channels, len);
469469
if (res != (int)CustomExitCodes.STATUS_OK)
470470
{
471471
throw new BrainFlowException(res);

csharp-package/brainflow/brainflow/data_filter.cs

+26-26
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ public static double[] perform_rolling_filter (double[] data, int period, int op
178178
/// <param name="data"></param>
179179
/// <param name="operation"></param>
180180
/// <returns>data with removed trend</returns>
181-
public static double[] detrend(double[] data, int operation)
181+
public static double[] detrend (double[] data, int operation)
182182
{
183183
double[] new_data = new double[data.Length];
184-
Array.Copy(data, new_data, data.Length);
185-
int res = DataHandlerLibrary.detrend(new_data, new_data.Length, operation);
184+
Array.Copy (data, new_data, data.Length);
185+
int res = DataHandlerLibrary.detrend (new_data, new_data.Length, operation);
186186
if (res != (int)CustomExitCodes.STATUS_OK)
187187
{
188188
throw new BrainFlowException(res);
@@ -291,11 +291,11 @@ public static double[] perform_wavelet_denoising (double[] data, string wavelet,
291291
/// <param name="data">data for csp</param>
292292
/// <param name="labels">labels for each class</param>
293293
/// <returns>Tuple of two arrays: [n_channels x n_channels] shaped array of filters and n_channels length array of eigenvalues</returns>
294-
public static Tuple<double[,], double[]> get_csp(double[,,] data, double[] labels)
294+
public static Tuple<double[,], double[]> get_csp (double[,,] data, double[] labels)
295295
{
296-
int n_epochs = data.GetLength(0);
297-
int n_channels = data.GetLength(1);
298-
int n_times = data.GetLength(2);
296+
int n_epochs = data.GetLength (0);
297+
int n_channels = data.GetLength (1);
298+
int n_times = data.GetLength (2);
299299

300300
double[] temp_data1d = new double[n_epochs * n_channels * n_times];
301301
for (int e = 0; e < n_epochs; e++)
@@ -338,7 +338,7 @@ public static Tuple<double[,], double[]> get_csp(double[,,] data, double[] label
338338
/// <param name="window_function">window function</param>
339339
/// <param name="window_len">len of the window</param>
340340
/// <returns>array of the size specified in window_len</returns>
341-
public static double[] get_window(int window_function, int window_len)
341+
public static double[] get_window (int window_function, int window_len)
342342
{
343343
double[] window_data = new double[window_len];
344344
int res = DataHandlerLibrary.get_window (window_function, window_len, window_data);
@@ -357,7 +357,7 @@ public static double[] get_window(int window_function, int window_len)
357357
/// <param name="end_pos">end pos, end_pos - start_pos must be a power of 2</param>
358358
/// <param name="window">window function</param>
359359
/// <returns>complex array of size N / 2 + 1 of fft data</returns>
360-
public static Complex[] perform_fft(double[] data, int start_pos, int end_pos, int window)
360+
public static Complex[] perform_fft (double[] data, int start_pos, int end_pos, int window)
361361
{
362362
if ((start_pos < 0) || (end_pos > data.Length) || (start_pos >= end_pos))
363363
{
@@ -391,7 +391,7 @@ public static Complex[] perform_fft(double[] data, int start_pos, int end_pos, i
391391
/// </summary>
392392
/// <param name="data">data from perform_fft</param>
393393
/// <returns>restored data</returns>
394-
public static double[] perform_ifft(Complex[] data)
394+
public static double[] perform_ifft (Complex[] data)
395395
{
396396
int len = (data.Length - 1) * 2;
397397
double[] temp_re = new double[data.Length];
@@ -464,13 +464,13 @@ public static void write_file (double[,] data, string file_name, string file_mod
464464
/// </summary>
465465
/// <param name="value"></param>
466466
/// <returns>nearest power of two</returns>
467-
public static int get_nearest_power_of_two(int value)
467+
public static int get_nearest_power_of_two (int value)
468468
{
469469
int[] output = new int[1];
470-
int res = DataHandlerLibrary.get_nearest_power_of_two(value, output);
470+
int res = DataHandlerLibrary.get_nearest_power_of_two (value, output);
471471
if (res != (int)CustomExitCodes.STATUS_OK)
472472
{
473-
throw new BrainFlowException(res);
473+
throw new BrainFlowException (res);
474474
}
475475
return output[0];
476476
}
@@ -483,7 +483,7 @@ public static int get_nearest_power_of_two(int value)
483483
/// <param name="sampling_rate">sampling rate</param>
484484
/// <param name="apply_filters">apply bandpass and bandstop filters before calculation</param>
485485
/// <returns>Tuple of avgs and stddev arrays</returns>
486-
public static Tuple<double[], double[]> get_avg_band_powers(double[,] data, int[] channels, int sampling_rate, bool apply_filters)
486+
public static Tuple<double[], double[]> get_avg_band_powers (double[,] data, int[] channels, int sampling_rate, bool apply_filters)
487487
{
488488
double[] data_1d = new double[data.GetRow (0).Length * channels.Length];
489489
for (int i = 0; i < channels.Length; i++)
@@ -493,7 +493,7 @@ public static Tuple<double[], double[]> get_avg_band_powers(double[,] data, int[
493493
double[] avgs = new double[5];
494494
double[] stddevs = new double[5];
495495

496-
int res = DataHandlerLibrary.get_avg_band_powers(data_1d, channels.Length, data.GetRow(0).Length, sampling_rate, (apply_filters) ? 1 : 0, avgs, stddevs);
496+
int res = DataHandlerLibrary.get_avg_band_powers (data_1d, channels.Length, data.GetRow (0).Length, sampling_rate, (apply_filters) ? 1 : 0, avgs, stddevs);
497497
if (res != (int)CustomExitCodes.STATUS_OK)
498498
{
499499
throw new BrainFlowException(res);
@@ -511,26 +511,26 @@ public static Tuple<double[], double[]> get_avg_band_powers(double[,] data, int[
511511
/// <param name="sampling_rate">sampling rate</param>
512512
/// <param name="window">window function</param>
513513
/// <returns>Tuple of ampls and freqs arrays of size N / 2 + 1</returns>
514-
public static Tuple<double[], double[]> get_psd(double[] data, int start_pos, int end_pos, int sampling_rate, int window)
514+
public static Tuple<double[], double[]> get_psd (double[] data, int start_pos, int end_pos, int sampling_rate, int window)
515515
{
516516
if ((start_pos < 0) || (end_pos > data.Length) || (start_pos >= end_pos))
517517
{
518-
throw new BrainFlowException((int)CustomExitCodes.INVALID_ARGUMENTS_ERROR);
518+
throw new BrainFlowException ((int)CustomExitCodes.INVALID_ARGUMENTS_ERROR);
519519
}
520520
int len = end_pos - start_pos;
521521
if ((len & (len - 1)) != 0)
522522
{
523-
throw new BrainFlowException((int)CustomExitCodes.INVALID_ARGUMENTS_ERROR);
523+
throw new BrainFlowException ((int)CustomExitCodes.INVALID_ARGUMENTS_ERROR);
524524
}
525525
double[] data_to_process = new double[len];
526526
Array.Copy(data, start_pos, data_to_process, 0, len);
527527
double[] temp_ampls = new double[len / 2 + 1];
528528
double[] temp_freqs = new double[len / 2 + 1];
529529

530-
int res = DataHandlerLibrary.get_psd(data_to_process, len, sampling_rate, window, temp_ampls, temp_freqs);
530+
int res = DataHandlerLibrary.get_psd (data_to_process, len, sampling_rate, window, temp_ampls, temp_freqs);
531531
if (res != (int)CustomExitCodes.STATUS_OK)
532532
{
533-
throw new BrainFlowException(res);
533+
throw new BrainFlowException (res);
534534
}
535535
Tuple<double[], double[]> return_data = new Tuple<double[], double[]>(temp_ampls, temp_freqs);
536536
return return_data;
@@ -545,7 +545,7 @@ public static Tuple<double[], double[]> get_psd(double[] data, int start_pos, in
545545
/// <param name="sampling_rate">sampling rate</param>
546546
/// <param name="window">window function</param>
547547
/// <returns>Tuple of ampls and freqs arrays</returns>
548-
public static Tuple<double[], double[]> get_psd_welch(double[] data, int nfft, int overlap, int sampling_rate, int window)
548+
public static Tuple<double[], double[]> get_psd_welch (double[] data, int nfft, int overlap, int sampling_rate, int window)
549549
{
550550
if ((nfft & (nfft - 1)) != 0)
551551
{
@@ -554,10 +554,10 @@ public static Tuple<double[], double[]> get_psd_welch(double[] data, int nfft, i
554554
double[] temp_ampls = new double[nfft / 2 + 1];
555555
double[] temp_freqs = new double[nfft / 2 + 1];
556556

557-
int res = DataHandlerLibrary.get_psd_welch(data, data.Length, nfft, overlap, sampling_rate, window, temp_ampls, temp_freqs);
557+
int res = DataHandlerLibrary.get_psd_welch (data, data.Length, nfft, overlap, sampling_rate, window, temp_ampls, temp_freqs);
558558
if (res != (int)CustomExitCodes.STATUS_OK)
559559
{
560-
throw new BrainFlowException(res);
560+
throw new BrainFlowException (res);
561561
}
562562
Tuple<double[], double[]> return_data = new Tuple<double[], double[]>(temp_ampls, temp_freqs);
563563
return return_data;
@@ -570,14 +570,14 @@ public static Tuple<double[], double[]> get_psd_welch(double[] data, int nfft, i
570570
/// <param name="start_freq">lowest frequency of band</param>
571571
/// <param name="stop_freq">highest frequency of band</param>
572572
/// <returns>band power</returns>
573-
public static double get_band_power(Tuple<double[], double[]> psd, double start_freq, double stop_freq)
573+
public static double get_band_power (Tuple<double[], double[]> psd, double start_freq, double stop_freq)
574574
{
575575
double[] band_power = new double[1];
576576

577-
int res = DataHandlerLibrary.get_band_power(psd.Item1, psd.Item2, psd.Item1.Length, start_freq, stop_freq, band_power);
577+
int res = DataHandlerLibrary.get_band_power (psd.Item1, psd.Item2, psd.Item1.Length, start_freq, stop_freq, band_power);
578578
if (res != (int)CustomExitCodes.STATUS_OK)
579579
{
580-
throw new BrainFlowException(res);
580+
throw new BrainFlowException (res);
581581
}
582582
return band_power[0];
583583
}

csharp-package/brainflow/brainflow/data_handler_library.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,17 @@ public static extern int perform_inverse_wavelet_transform (double[] wavelet_coe
7171
[DllImport ("DataHandler.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
7272
public static extern int perform_ifft (double[] re, double[] im, int data_len, double[] data);
7373
[DllImport("DataHandler.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
74-
public static extern int get_nearest_power_of_two(int value, int[] output);
74+
public static extern int get_nearest_power_of_two (int value, int[] output);
7575
[DllImport ("DataHandler.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
76-
public static extern int get_psd(double[] data, int data_len, int sampling_rate, int window, double[] ampls, double[] freqs);
76+
public static extern int get_psd (double[] data, int data_len, int sampling_rate, int window, double[] ampls, double[] freqs);
7777
[DllImport ("DataHandler.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
78-
public static extern int get_band_power(double[] ampls, double[] freqs, int data_len, double freq_start, double freq_end, double[] res);
78+
public static extern int get_band_power (double[] ampls, double[] freqs, int data_len, double freq_start, double freq_end, double[] res);
7979
[DllImport ("DataHandler.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
80-
public static extern int get_psd_welch(double[] data, int data_len, int nfft, int overlap, int sampling_rate, int window, double[] ampls, double[] freqs);
80+
public static extern int get_psd_welch (double[] data, int data_len, int nfft, int overlap, int sampling_rate, int window, double[] ampls, double[] freqs);
8181
[DllImport ("DataHandler.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
82-
public static extern int detrend(double[] data, int len, int operation);
82+
public static extern int detrend (double[] data, int len, int operation);
8383
[DllImport ("DataHandler.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
84-
public static extern int get_avg_band_powers(double[] data, int rows, int cols, int sampling_rate, int apply_filters, double[] avgs, double[] stddevs);
84+
public static extern int get_avg_band_powers (double[] data, int rows, int cols, int sampling_rate, int apply_filters, double[] avgs, double[] stddevs);
8585
}
8686

8787
class DataHandlerLibrary32
@@ -124,17 +124,17 @@ public static extern int perform_inverse_wavelet_transform (double[] wavelet_coe
124124
[DllImport ("DataHandler32.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
125125
public static extern int perform_ifft (double[] re, double[] im, int data_len, double[] data);
126126
[DllImport ("DataHandler32.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
127-
public static extern int get_nearest_power_of_two(int value, int[] output);
127+
public static extern int get_nearest_power_of_two (int value, int[] output);
128128
[DllImport ("DataHandler32.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
129-
public static extern int get_psd(double[] data, int data_len, int sampling_rate, int window, double[] ampls, double[] freqs);
129+
public static extern int get_psd (double[] data, int data_len, int sampling_rate, int window, double[] ampls, double[] freqs);
130130
[DllImport ("DataHandler32.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
131-
public static extern int get_band_power(double[] ampls, double[] freqs, int data_len, double freq_start, double freq_end, double[] res);
131+
public static extern int get_band_power (double[] ampls, double[] freqs, int data_len, double freq_start, double freq_end, double[] res);
132132
[DllImport ("DataHandler32.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
133-
public static extern int get_psd_welch(double[] data, int data_len, int nfft, int overlap, int sampling_rate, int window, double[] ampls, double[] freqs);
133+
public static extern int get_psd_welch (double[] data, int data_len, int nfft, int overlap, int sampling_rate, int window, double[] ampls, double[] freqs);
134134
[DllImport ("DataHandler32.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
135-
public static extern int detrend(double[] data, int len, int operation);
135+
public static extern int detrend (double[] data, int len, int operation);
136136
[DllImport ("DataHandler32.dll", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
137-
public static extern int get_avg_band_powers(double[] data, int rows, int cols, int sampling_rate, int apply_filters, double[] avgs, double[] stddevs);
137+
public static extern int get_avg_band_powers (double[] data, int rows, int cols, int sampling_rate, int apply_filters, double[] avgs, double[] stddevs);
138138
}
139139

140140
class DataHandlerLibraryLinux

0 commit comments

Comments
 (0)