dsp_api module#
- class edgeimpulse_api.api.dsp_api.DSPApi(api_client=None)[source]#
Bases:
object
- clear_dsp_block(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- **kwargs,
Clear DSP block
Clear generated features for a DSP block (used in tests).
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- download_dsp_artifact(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- key: StrictStr[StrictStr],
- **kwargs,
Download a DSP artifact
Download an artifact from a DSP block for debugging. This is an internal API.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
key (str) – DSP artifact file key (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
str
- download_dsp_data(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- category: StrictStr[StrictStr],
- raw: StrictBool | None[StrictBool | None] = None,
- **kwargs,
Download DSP data
Download output from a DSP block over all data in the training set, already sliced in windows. In Numpy binary format.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
category (str) – Which of the three acquisition categories to download data from (required)
raw (bool) – Whether to download raw data or processed data. Processed data is the default.
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
str
- download_dsp_labels(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- category: StrictStr[StrictStr],
- **kwargs,
Download DSP labels
Download labels for a DSP block over all data in the training set, already sliced in windows.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
category (str) – Which of the three acquisition categories to download data from (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
str
- dsp_get_features_for_sample(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- **kwargs,
Features for sample
Runs the DSP block against a sample. This will move the sliding window (dependent on the sliding window length and the sliding window increase parameters in the impulse) over the complete file, and run the DSP function for every window that is extracted.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
sample_id (int) – Sample ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- dsp_sample_trained_features(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- feature_ax1: StrictInt[StrictInt],
- feature_ax2: StrictInt[StrictInt],
- feature_ax3: StrictInt[StrictInt],
- category: StrictStr[StrictStr],
- **kwargs,
Sample of trained features
Get a sample of trained features, this extracts a number of samples and their labels. Used to visualize the current training set.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
feature_ax1 (int) – Feature axis 1 (required)
feature_ax2 (int) – Feature axis 2 (required)
feature_ax3 (int) – Feature axis 3 (required)
category (str) – Which of the three acquisition categories to download data from (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_autotuner_results(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- **kwargs,
Get results from DSP autotuner
Get a set of parameters, found as a result of running the DSP autotuner.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_dsp_config(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- **kwargs,
Get config
Retrieve the configuration parameters for the DSP block. Use the impulse functions to retrieve all DSP blocks.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_dsp_feature_importance(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- **kwargs,
Feature importance
Retrieve the feature importance for a DSP block (only available for blocks where dimensionalityReduction is not enabled)
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_dsp_feature_labels(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- **kwargs,
Feature labels
Retrieve the names of the features the DSP block generates
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_dsp_metadata(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- exclude_included_samples: StrictBool | None[StrictBool | None] = None,
- **kwargs,
Get metadata
Retrieve the metadata from a generated DSP block.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
exclude_included_samples (bool) – Whether to exclude ‘includedSamples’ in the response (as these can slow down requests significantly).
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_dsp_raw_sample(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- limit_payload_values: StrictInt | None[StrictInt | None] = None,
- **kwargs,
Get raw sample
Get raw sample data, but with only the axes selected by the DSP block. E.g. if you have selected only accX and accY as inputs for the DSP block, but the raw sample also contains accZ, accZ is filtered out. If you pass dspId = 0 this will return a raw graph without any processing.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
sample_id (int) – Sample ID (required)
limit_payload_values (int) – Limit the number of payload values in the response
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_dsp_sample_slice(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- slice_start: StrictInt[StrictInt],
- slice_end: StrictInt | None[StrictInt | None] = None,
- **kwargs,
Get raw sample (slice)
Get slice of raw sample data, but with only the axes selected by the DSP block. E.g. if you have selected only accX and accY as inputs for the DSP block, but the raw sample also contains accZ, accZ is filtered out.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
sample_id (int) – Sample ID (required)
slice_start (int) – Begin index of the slice (required)
slice_end (int) – End index of the slice. If not given, the sample will be sliced to the same length as the impulse input block window length.
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- get_performance_all_variants(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- **kwargs,
Get DSP block performance for all latency devices
Get estimated performance (latency and RAM) for the DSP block, for all supported project latency devices.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- run_dsp_on_features_array(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- dsp_run_request_with_features: DspRunRequestWithFeatures,
- **kwargs,
Get processed sample (from features array)
Takes in a features array and runs it through the DSP block. This data should have the same frequency as set in the input block in your impulse.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
dsp_run_request_with_features (DspRunRequestWithFeatures) – (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- run_dsp_sample_slice(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- slice_start: StrictInt[StrictInt],
- dsp_run_request_without_features: DspRunRequestWithoutFeatures,
- slice_end: StrictInt | None[StrictInt | None] = None,
- **kwargs,
Get processed sample (slice)
Get slice of sample data, and run it through the DSP block. This only the axes selected by the DSP block. E.g. if you have selected only accX and accY as inputs for the DSP block, but the raw sample also contains accZ, accZ is filtered out.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
sample_id (int) – Sample ID (required)
slice_start (int) – Begin index of the slice (required)
dsp_run_request_without_features (DspRunRequestWithoutFeatures) – (required)
slice_end (int) – End index of the slice. If not given, the sample will be sliced to the same length as the impulse input block window length.
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- run_dsp_sample_slice_read_only(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- sample_id: StrictInt[StrictInt],
- slice_start: StrictInt[StrictInt],
- slice_end: StrictInt | None[StrictInt | None] = None,
- **kwargs,
Get processed sample (slice)
Get slice of sample data, and run it through the DSP block. This only the axes selected by the DSP block. E.g. if you have selected only accX and accY as inputs for the DSP block, but the raw sample also contains accZ, accZ is filtered out.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
sample_id (int) – Sample ID (required)
slice_start (int) – Begin index of the slice (required)
slice_end (int) – End index of the slice. If not given, the sample will be sliced to the same length as the impulse input block window length.
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- set_dsp_config(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- dsp_config_request: DSPConfigRequest,
- **kwargs,
Set config
Set configuration parameters for the DSP block. Only values set in the body will be overwritten.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
dsp_config_request (DSPConfigRequest) – (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type:
- start_profile_custom_dsp_block(
- project_id: StrictInt[StrictInt],
- dsp_id: StrictInt[StrictInt],
- dsp_run_request_without_features_read_only: DspRunRequestWithoutFeaturesReadOnly,
- **kwargs,
Profile custom DSP block
Returns performance characteristics for a custom DSP block (needs hasTfliteImplementation). Updates are streamed over the websocket API (or can be retrieved through the /stdout endpoint). Use getProfileTfliteJobResult to get the results when the job is completed.
- Parameters:
project_id (int) – Project ID (required)
dsp_id (int) – DSP Block ID, use the impulse functions to retrieve the ID (required)
dsp_run_request_without_features_read_only (DspRunRequestWithoutFeaturesReadOnly) – (required)
async_req (bool, optional) – Whether to execute the request asynchronously.
_preload_content (bool, optional) – if False, the urllib3.HTTPResponse object will be returned without reading/decoding response data. Default is True.
_request_timeout – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- Returns:
Returns the result object. If the method is called asynchronously, returns the request thread.
- Return type: