Skip to content
This repository was archived by the owner on Nov 1, 2024. It is now read-only.
This repository was archived by the owner on Nov 1, 2024. It is now read-only.

Data Generation and Parser from OpenGPT #97

@jfResearchEng

Description

@jfResearchEng

🚀 Feature

Generate data set for training using opengpt. And also create a parser to separate the coded from the context.

The starting points would be filtering techniques: e.g. Kalman Filter and IIR filter.

Convert:

An infinite impulse response (IIR) filter is a type of digital filter that can be used to implement a variety of different frequency response characteristics. It is characterized by its recursive structure, which allows it to have an impulse response that extends indefinitely into the past. Here is some sample code that demonstrates how to implement an IIR filter using a direct form II structure:

import numpy as np

class IIRFilter:
    def __init__(self, b, a):
        self.b = b
        self.a = a
        self.z = np.zeros(max(len(b), len(a)))

    def filter(self, x):
        y = np.zeros_like(x)
        for n in range(len(x)):
            y[n] = self.b[0] * x[n]
            for m in range(1, len(self.b)):
                if n-m >= 0:
                    y[n] += self.b[m] * x[n-m]
            for m in range(1, len(self.a)):
                if n-m >= 0:
                    y[n] -= self.a[m] * y[n-m]
            self.z[0] = x[n]
            self.z[1:] = self.z[:-1]
        return y

to
result[0] = "An infinite impulse response (IIR) filter is a type of digital filter that can be used to implement a variety of different frequency response characteristics. It is characterized by its recursive structure, which allows it to have an impulse response that extends indefinitely into the past. Here is some sample code that demonstrates how to implement an IIR filter using a direct form II structure:"

result[1] =

import numpy as np

class IIRFilter:
    def __init__(self, b, a):
        self.b = b
        self.a = a
        self.z = np.zeros(max(len(b), len(a)))

    def filter(self, x):
        y = np.zeros_like(x)
        for n in range(len(x)):
            y[n] = self.b[0] * x[n]
            for m in range(1, len(self.b)):
                if n-m >= 0:
                    y[n] += self.b[m] * x[n-m]
            for m in range(1, len(self.a)):
                if n-m >= 0:
                    y[n] -= self.a[m] * y[n-m]
            self.z[0] = x[n]
            self.z[1:] = self.z[:-1]
        return y

The example above is a transformer node.

For this issue, we would like to prioritize the following nodes (priority high to low):

  1. Transformer Node (e.g. IIRFilter)
  2. Source Node (e.g. Microphone integration)
  3. UI (e.g. Matplotlib-based plotting)

Additional context

  1. The code should be added at folder is https://github.com/facebookresearch/labgraph/tree/main/extensions/lgpilot
  2. Create setup.py and README.md, where example can be found at: https://github.com/facebookresearch/labgraph/tree/main/extensions/labgraph_viz
  3. Add github action support, reference: https://github.com/facebookresearch/labgraph/actions/workflows/main.yml
  4. Add proper license header.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions