Step Frequency modulation
timecave.data_generation.frequency_modulation.FrequencyModulationWithStep(freq_init, t_split)
Bases: BaseFrequency
Frequency modulation with step.
This class implements frequency modulation with a step change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
freq_init |
float or int
|
The initial frequency value. |
required |
t_split |
int
|
The timestep at which the frequency changes. |
required |
Methods:
| Name | Description |
|---|---|
modulate |
Adjusts the frequency based on the given time. |
Raises:
| Type | Description |
|---|---|
TypeError
|
If 'freq_init' is not a float or int. If 't_split' is not an int. |
ValueError
|
If 'freq_init' is not greater than zero. If 't_split' is not greater than zero. |
Source code in timecave/data_generation/frequency_modulation.py
modulate(time)
Adjusts the frequency based on the given time.
This method calculates the frequency modulation based on the given time and the initial frequency value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
time |
int
|
Number of timesteps for which modulation is meant to be performed. |
required |
Returns:
| Type | Description |
|---|---|
array
|
Each entry of the array corresponds to the frequency at a given timestep. |
Examples:
>>> from timecave.data_generation.frequency_modulation import FrequencyModulationWithStep
>>> mod = FrequencyModulationWithStep(1, 50);
>>> mod.modulate(25)
array(1)
>>> mod.modulate(100)
array(2)
>>> mod.modulate(50)
array(1)