{
  "$schema": "https://ambiqai.github.io/helia-ui/schema/reference-model-1.json",
  "generatedFrom": {
    "sourceCommit": "f341fb11f7f5d77a4974ba8273c4cd55d67c21f0",
    "tool": "pyref",
    "version": "1.7.3"
  },
  "language": "python",
  "modules": [
    {
      "description": "# Amplitude Warp Layer\n\n**Classes**\n\n| Name | Description |\n| --- | --- |\n| `AmplitudeWarp` | Amplitude warping layer |",
      "name": "amplitude_warp",
      "path": "helia_edge.layers.preprocessing.amplitude_warp",
      "submodules": [],
      "summary": "Amplitude Warp Layer",
      "symbols": [
        {
          "description": "Apply amplitude warping to the 1D input.\nTime points are first generated at given frequency resolution with amplitude picked from uniform distribution.\nThese points are then interpolated to match the input duration and multiplied to the input.\n\nExample:\n\n```python\nsample_rate = 100 # Hz\nduration = 3*sample_rate # 3 seconds\nsig_freq = 10 # Hz\nsig_amp = 1 # Signal amplitude\nnoise_freq = (1, 2) # Noise frequency range\namplitude = (0.5, 2) # Noise amplitude range\nx = sig_amp*np.sin(2*np.pi*sig_freq*np.arange(duration)/sample_rate).reshape(-1, 1).astype(np.float32)\nx = keras.ops.convert_to_tensor(x)\nimport helia_edge as helia\n\nlyr = helia.layers.preprocessing.AmplitudeWarp(\n    sample_rate=sample_rate,\n    frequency=noise_freq,\n    amplitude=amplitude,\n)\ny = lyr(x)\nplt.plot(x.numpy())\nplt.plot(y.numpy())\nplt.show()\n```\n\n\n\nBase class: [BaseAugmentation1D](/helia-edge/reference/api/helia_edge/layers/preprocessing/base_augmentation/#helia_edge.layers.preprocessing.base_augmentation.BaseAugmentation1D).\n\nInherited from [BaseAugmentation](/helia-edge/reference/api/helia_edge/layers/preprocessing/base_augmentation/#helia_edge.layers.preprocessing.base_augmentation.BaseAugmentation): [augment_masks()](/helia-edge/reference/api/helia_edge/layers/preprocessing/base_augmentation/#helia_edge.layers.preprocessing.base_augmentation.BaseAugmentation.augment_masks), [augment_sample()](/helia-edge/reference/api/helia_edge/layers/preprocessing/base_augmentation/#helia_edge.layers.preprocessing.base_augmentation.BaseAugmentation.augment_sample), [augment_targets()](/helia-edge/reference/api/helia_edge/layers/preprocessing/base_augmentation/#helia_edge.layers.preprocessing.base_augmentation.BaseAugmentation.augment_targets), [batch_augment()](/helia-edge/reference/api/helia_edge/layers/preprocessing/base_augmentation/#helia_edge.layers.preprocessing.base_augmentation.BaseAugmentation.batch_augment), [call()](/helia-edge/reference/api/helia_edge/layers/preprocessing/base_augmentation/#helia_edge.layers.preprocessing.base_augmentation.BaseAugmentation.call).",
          "examples": [],
          "id": "helia_edge.layers.preprocessing.amplitude_warp.AmplitudeWarp",
          "kind": "class",
          "language": "python",
          "members": [
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.preprocessing.amplitude_warp.AmplitudeWarp.noise_type",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "noise_type",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "noise_type: str",
              "source": {
                "line": 19,
                "path": "helia_edge/layers/preprocessing/amplitude_warp.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/preprocessing/amplitude_warp.py#L19"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.preprocessing.amplitude_warp.AmplitudeWarp.sample_rate",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "sample_rate",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "sample_rate: float = sample_rate",
              "source": {
                "line": 66,
                "path": "helia_edge/layers/preprocessing/amplitude_warp.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/preprocessing/amplitude_warp.py#L66"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.preprocessing.amplitude_warp.AmplitudeWarp.frequency",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "frequency",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "frequency: tuple[float, float] = parse_factor(frequency, min_value=None, max_value=sample_rate / 2, param_name='frequency')",
              "source": {
                "line": 67,
                "path": "helia_edge/layers/preprocessing/amplitude_warp.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/preprocessing/amplitude_warp.py#L67"
              },
              "summary": ""
            },
            {
              "description": "",
              "examples": [],
              "id": "helia_edge.layers.preprocessing.amplitude_warp.AmplitudeWarp.amplitude",
              "kind": "attribute",
              "language": "python",
              "members": [],
              "name": "amplitude",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "amplitude: tuple[float, float] = parse_factor(amplitude, min_value=0, max_value=None, param_name='amplitude')",
              "source": {
                "line": 68,
                "path": "helia_edge/layers/preprocessing/amplitude_warp.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/preprocessing/amplitude_warp.py#L68"
              },
              "summary": ""
            },
            {
              "description": "Generate noise distortion tensor",
              "examples": [],
              "id": "helia_edge.layers.preprocessing.amplitude_warp.AmplitudeWarp.get_random_transformations",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "get_random_transformations",
              "params": [
                {
                  "description": "Input shape.",
                  "name": "input_shape",
                  "type": "tuple[int, ...]"
                }
              ],
              "raises": [],
              "returns": [
                {
                  "description": "Dictionary containing the noise tensor.",
                  "name": "dict",
                  "type": "dict"
                }
              ],
              "signature": "get_random_transformations(input_shape: tuple[int, int, int]) -> dict",
              "source": {
                "line": 70,
                "path": "helia_edge/layers/preprocessing/amplitude_warp.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/preprocessing/amplitude_warp.py#L70"
              },
              "summary": "Generate noise distortion tensor"
            },
            {
              "description": "Augment all samples in the batch as it's faster.",
              "examples": [],
              "id": "helia_edge.layers.preprocessing.amplitude_warp.AmplitudeWarp.augment_samples",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "augment_samples",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "augment_samples(inputs) -> keras.KerasTensor",
              "source": {
                "line": 120,
                "path": "helia_edge/layers/preprocessing/amplitude_warp.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/preprocessing/amplitude_warp.py#L120"
              },
              "summary": "Augment all samples in the batch as it's faster."
            },
            {
              "description": "Serialize the layer configuration to a JSON-compatible dictionary.",
              "examples": [],
              "id": "helia_edge.layers.preprocessing.amplitude_warp.AmplitudeWarp.get_config",
              "kind": "method",
              "language": "python",
              "members": [],
              "name": "get_config",
              "params": [],
              "raises": [],
              "returns": [],
              "signature": "get_config()",
              "source": {
                "line": 127,
                "path": "helia_edge/layers/preprocessing/amplitude_warp.py",
                "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/preprocessing/amplitude_warp.py#L127"
              },
              "summary": "Serialize the layer configuration to a JSON-compatible dictionary."
            }
          ],
          "name": "AmplitudeWarp",
          "params": [
            {
              "default": "1",
              "description": "Sample rate of the input.",
              "name": "sample_rate",
              "type": "float"
            },
            {
              "default": "100",
              "description": "Frequency of the warping in Hz. If tuple, frequency is randomly picked between the values.",
              "name": "frequency",
              "type": "float | tuple[float, float]"
            },
            {
              "default": "0.1",
              "description": "Amplitude of the warping. If tuple, amplitude is randomly picked between the values.",
              "name": "amplitude",
              "type": "float | tuple[float, float]"
            }
          ],
          "raises": [],
          "returns": [],
          "signature": "AmplitudeWarp(\n    sample_rate: float = 1,\n    frequency: float | tuple[float, float] = 100,\n    amplitude: float | tuple[float, float] = 0.1,\n    **kwargs={},\n)",
          "source": {
            "line": 14,
            "path": "helia_edge/layers/preprocessing/amplitude_warp.py",
            "url": "https://github.com/AmbiqAI/helia-edge/blob/f341fb11f7f5d77a4974ba8273c4cd55d67c21f0/helia_edge/layers/preprocessing/amplitude_warp.py#L14"
          },
          "summary": "Apply amplitude warping to the 1D input."
        }
      ]
    }
  ],
  "name": "helia_edge"
}
