How to use the brainflow.exit_codes.BrainflowExitCodes function in brainflow

To help you get started, we’ve selected a few brainflow examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Andrey1994 / brainflow / python-package / brainflow / data_filter.py View on Github external
:type sampling_rate: float
        :param center_freq: center frequency
        :type center_freq: float
        :param band_width: band width
        :type band_width: float
        :param order: filter order
        :type order: int
        :param filter_type: filter type from special enum
        :type filter_type: int
        :param ripple: ripple value for Chebyshev filter
        :type ripple: float
        """
        if not isinstance (sampling_rate, int):
            raise BrainFlowError ('wrong type for sampling rate', BrainflowExitCodes.INVALID_ARGUMENTS_ERROR.value)
        if not isinstance (filter_type, int):
            raise BrainFlowError ('wrong type for filter type', BrainflowExitCodes.INVALID_ARGUMENTS_ERROR.value)
        if len (data.shape) != 1:
            raise BrainFlowError ('wrong shape for filter data array, it should be 1d array', BrainflowExitCodes.INVALID_ARGUMENTS_ERROR.value)
        res = DataHandlerDLL.get_instance ().perform_bandpass (data, data.shape[0], sampling_rate, center_freq, band_width, order, filter_type, ripple)
        if res != BrainflowExitCodes.STATUS_OK.value:
            raise BrainFlowError ('unable to apply band pass filter', res)
github Andrey1994 / brainflow / python-package / brainflow / data_filter.py View on Github external
:param data: data to filter, filter works in-place
        :type data: 1d numpy array
        :param sampling_rate: board's sampling rate
        :type sampling_rate: float
        :param cutoff: cutoff frequency
        :type cutoff: float
        :param order: filter order
        :type order: int
        :param filter_type: filter type from special enum
        :type filter_type: int
        :param ripple: ripple value for Chebyshev filter
        :type ripple: float
        """
        if not isinstance (sampling_rate, int):
            raise BrainFlowError ('wrong type for sampling rate', BrainflowExitCodes.INVALID_ARGUMENTS_ERROR.value)
        if not isinstance (filter_type, int):
            raise BrainFlowError ('wrong type for filter type', BrainflowExitCodes.INVALID_ARGUMENTS_ERROR.value)
        if len (data.shape) != 1:
            raise BrainFlowError ('wrong shape for filter data array, it should be 1d array', BrainflowExitCodes.INVALID_ARGUMENTS_ERROR.value)
        res = DataHandlerDLL.get_instance ().perform_lowpass (data, data.shape[0], sampling_rate, cutoff, order, filter_type, ripple)
        if res != BrainflowExitCodes.STATUS_OK.value:
            raise BrainFlowError ('unable to perform low pass filter', res)
github Andrey1994 / brainflow / python-package / brainflow / board_shim.py View on Github external
def __init__ (self, message, exit_code):
        detailed_message = '%s:%d %s' % (BrainflowExitCodes (exit_code).name, exit_code, message)
        super (BrainFlowError, self).__init__ (detailed_message)
        self.exit_code = exit_code
github Andrey1994 / brainflow / python-package / brainflow / board_shim.py View on Github external
def __init__ (self, board_id, input_params):
        try:
            self.input_json = input_params.to_json ().encode ()
        except:
            self.input_json = input_params.to_json ()
        else:
            self.port_name = None
        self.board_id = board_id
        # we need it for streaming board
        if board_id == BoardIds.STREAMING_BOARD.value:
            try:
                self._master_board_id = int (input_params.other_info)
            except:
                raise BrainFlowError ('set master board id using params.other_info for STREAMING_BOARD',
                                    BrainflowExitCodes.INVALID_ARGUMENTS_ERROR.value)
        else:
            self._master_board_id = self.board_id
github Andrey1994 / brainflow / python-package / brainflow / board_shim.py View on Github external
def get_eda_channels (cls, board_id):
        """get list of eda channels in resulting data table for a board

        :param board_id: Board Id
        :type board_id: int
        :return: list of eda channels in returned numpy array
        :rtype: list
        :raises BrainFlowError: If this board has no such data exit code is UNSUPPORTED_BOARD_ERROR
        """
        num_channels = numpy.zeros (1).astype (numpy.int32)
        eda_channels = numpy.zeros (512).astype (numpy.int32)

        res = BoardControllerDLL.get_instance ().get_eda_channels (board_id, eda_channels, num_channels)
        if res != BrainflowExitCodes.STATUS_OK.value:
            raise BrainFlowError ('unable to request info about this board', res)
        result = eda_channels.tolist () [0:num_channels[0]]
        return result