Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/arbitrary noise spectra #585

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

sjoerd-bouma
Copy link
Collaborator

New feature - rather than simulating only flat noise spectra with the channelGenericNoiseAdder, I added the option to specify the desired frequency spectrum as a function of frequency. Note that this (somewhat by design) is not compatible with specifying a desired Vrms.

Just sharing in case someone else thinks this might be useful - happy to refine the implementation if desired.

@cg-laser
Copy link
Collaborator

I think this is useful for standalone applications. However, it should still be able to define the desired Vrms. We do that all the time. One just needs to calculate the normalization, which is the integral over the square of the filter function within the fmin, fmax interval.
I suggest to change the interface to add an additional optional parameter which defines the frequency filter. Either directly an array with an amplitude for each frequency bin, or as a function. I would prefer the former as it allows for more flexibility, e.g., one can directly load in the measured S21 parameters of a signal chain.

Copy link
Collaborator

@MartinRavn MartinRavn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Christan, that it would be nice to have the custom filter as an additional parameter that can both be an array of amplitudes or a function that returns the amplitudes. Then maybe the amplitude can be taken into account.

Otherwise I only have two minor comments.

Comment on lines +146 to +149
if callable(amplitude):
sigscale = sampling_rate
else:
sigscale = (1. * n_samples) / np.sqrt(nbinsactive)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These four lines can maybe be included in the if statements above (line 137 to 144) as this is just another scaling. It should maybe also be applied there.

Comment on lines 92 to 94
type: string
perfect_white: flat frequency spectrum
rayleigh: Amplitude of each frequency bin is drawn from a Rayleigh distribution
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe type should be renamed to fluctuation_type and perfect_white to just perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants