Skip to content

Using RNG in DSP #5

@iguinn

Description

@iguinn

It could be useful to generate random numbers in a ProcessingChain. One use for this would be in pulse generation. An example of what such a processing chain config might look like is:

{
    "processors": {
	"amp": {
	    "processor": "random_gaus",
	    "module": "???",
	    "args": [10, 1, "amp"]
	},
	"risetime": {
	    "processor": "random_uniform",
	    "module": "???",
	    "args": ["0.5*us", "1*us", "risetime(unit=us)"]
	},
	"offset": {
	    "processor": "random_gaus",
	    "module": "???",
	    "args": ["10*us", "1*us", "offset(unit=us)"],
	},
	"waveform": {
	    "processor": "pulse_injector",
	    "module": "pygama.dsp.processors",
	    "args": ["zeros_in", "amp", "risetime", "offset", "waveform"]
	}
    }
}

However, right now it's not clear what RNG processors we could use. The numpy.random generators to do not work with in place array filling. The same is true of the scipy.stats generators. Numba seems to have support for random number generation, but I'm not sure how it works yet. We also want to make sure that we can control the seeding of the RNGs, and make sure that this would work for multi-threading.

Here are the features we want for our RNG processors:

  1. Fill output array in place (i.e. have an out argument)
  2. Have a way to set initial seeds
  3. Robust for multithreaded and MPI

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions