Overview

The PyoScience repo can be used for open science project. The objective is to provide an uniform way to share python code and to facilitate the transfer between academic researches and production.

Module Object

The Pyoscience python code relies on modules. A module is a python object that has a particular method called forward. The forward method describes how the incomming data is processed.

  • Analysers: An Analyser stores the incomming data for offline analysis. It can also be used for plotting incomming data. Analyser should outputs the incomming data without performing any transformation on this data.

  • Processors: A processor is used to process the incomming data.

  • Generator: A generator is used to generate some data.

For example, the following code shows how to create a Generator that synthesize a sine wave.

from .core import Generator
import numpy as np

class Sinewave(Generator):

    def __init__(self,a0,f0,phi0,Fs=1):
        super().__init__()
        self._a0 = a0
        self._f0 = f0
        self._phi0 = phi0
        self._Fs = Fs

    def forward(self,N):
        n = np.arange(N)
        t = n / self._Fs
        x = np.sin(2*np.pi*self._f0*t+self._phi0)
        return x

Sequential Object

The Sequential object combines several Module to create a particular processing chain. For example, the following code shows how to create a realization of a simple sine wave with additive white Gaussian noise

generator = Sinewave(1,100,0,Fs=1000)
noise = AWGN(0)

chain = Sequential([generator,noise])
y = chain(100)