Functions
Time dependent function objects.
ApodizedStep
- class onscale.functions.ApodizedStep(amplitude: float, amplitude_before: float = 0.0, amplitude_after: float = 0.0, step_time1: float = 0.0, step_time2: float | None = None, exponent: float = 1.0, band: float = 0.0, time_delay: float = 0.0, step_type: str = 'cos')
Apodized step function.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.functions.ApodizedStep(amplitude=1.0)
- An apodization function is a function used to smoothly bring a
sampled signal down to zero at the edges of the sampled region.
- Parameters:
amplitude – Required. Amplitude of step function for: step_time1 < time < step_time2
amplitude_before – Amplitude before the first step starts, time <= steptime1
amplitude_after – Amplitude before the second step ends, steptime2 < time
step_time1 – Time at which first step occurs.
step_time2 – Time at which second step occurs.
exponent – Exponent for cosine function.
band – Apodization band. For either side of the function
time_delay – The shift in time for all input time values. Positive time_delay indicates a later step.
step_type – Apodization function type. Function types: cos
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
BlackmannHarrisWavelet
- class onscale.functions.BlackmannHarrisWavelet(amplitude: float, drive_freq: float, time_delay: float = 0.0)
Blackmann Harris wavelet function.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.functions.BlackmannHarrisWavelet(1.0, 1e-2)
- The Blackman-Harris (BH) window family is a straightforward
generalization of the hamming family. The following parameters define the functional form of the 2nd derivative of the BH window. This function produces a wavelet in time whose frequency content is a Gaussian distribution centered at the center frequency.
- Parameters:
amplitude – The absolute difference from the wave’s equilibrium to the maximum positive peak.
drive_freq – The initial value given to the frequency of the selected time function.
time_delay – Time delay of wavelet in periods.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
ChirpPulse
- class onscale.functions.ChirpPulse(start_freq: float, stop_freq: float, amplitude: float, pulse_duration: float, ramp_up: float = 0.0, ramp_down: float = 0.0, time_delay: float = 0.0)
Chirp pulse function.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.functions.ChirpPulse(1.0, 1e2, 10.0, 1e-2)
- A chirp is a signal in which the frequency increase or decrease
with time, these can also be referred to respectively as up-chirp or down-chirp. The term chirp is used interchangeably with a sweep signal.
- Parameters:
start_freq – Start frequency of the chirp function being defined.
stop_freq – Stop frequency of the chirp function being defined.
amplitude – The absolute difference from the wave’s equilibrium to the maximum positive peak.
pulse_duration – Time duration of the chirp function.
ramp_up – Time duration of the chirp function.
ramp_down – Time duration to ramp up to full amplitude at start of function.
time_delay – Time duration to ramp up to full amplitude at start of function.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Custom
- class onscale.functions.Custom(x: Iterable[float], y: Iterable[float])
Custom user-defined function.
Examples
>>> import onscale as on >>> import numpy as np >>> with on.Simulation("Static Solve") as sim: ... x = np.arange(6) ... y = np.sin(x) ** 2 ... on.functions.Custom(x,y)
- Parameters:
x – Independent variable samples.
y – Dependent variable samples.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
Gaussian
- class onscale.functions.Gaussian(amplitude: float, width: float = 0.5, time_delay: float = 0.0)
Gaussian time function.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.functions.Gaussian(20.0)
- Parameters:
amplitude – The absolute difference from the wave’s equilibrium to the maximum positive peak.
width – The time width between the positive and negative peaks of the two-sided Gaussian distribution. Approximately equal to one half the total pulse duration.
time_delay – Time delay of wavelet in periods.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
RickerWavelet
- class onscale.functions.RickerWavelet(amplitude: float, drive_freq: float, phase_shift: float = 0.0, num_wavelets: float = 4.0, time_delay: float = 2.0)
Ricker wavelet function.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.functions.RickerWavelet(15.0, 2e-4)
- The Ricker Wavelet considers the effect of Newtonian viscosity and
is applicable to seismic waves propagated through viscoelastic homogeneous media. The Ricker Wavelet is defined in the time domain by a single parameter, which is the peak frequency in the amplitude spectrum.
- Parameters:
amplitude – The absolute difference from the wave’s equilibrium to the maximum positive peak.
drive_freq – The initial value given to the frequency of the selected time function.
phase_shift – Defines a change in phase of a waveform. Specified as a numerical value and returned in degrees.
num_wavelets – The number of wavelets found at either side of the Ricker Wavelets central maxima.
time_delay – Time delay of wavelet in periods.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
SinusoidPulse
- class onscale.functions.SinusoidPulse(drive_freq: float, amplitude: float, num_cycles: int = 1, ramped_cycles: int = 0, time_delay: float = 0.0, phase_shift: float = 0.0, offset: float = 0.0)
Sinusoidal pulse function.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.functions.SinusoidPulse(14.0, 1e3)
A sinusoidal wave function.
- Parameters:
drive_freq – User defined value specifying the maximum frequency at which the drive function will operate at.
amplitude – The absolute difference from the wave’s equilibrium to the maximum positive peak.
num_cycles – Length of time (periods) for the sinusoidal function defined. A period is the time needed for one complete cycle of vibration to pass.
ramped_cycles – The number of cycles over which the amplitude envelope is smoothly increased from 0 to 1.
time_delay – Time delay of wavelet in periods.
phase_shift – Defines a change in phase of a waveform. Specified as a numerical value and returned in degrees.
offset – Defines an offset in amplitude. Can be offset in the positive and negative direction.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.
SquareWave
- class onscale.functions.SquareWave(pulse_duration: float, amplitude: float, time_delay: float = 0.0)
Square wave function.
Examples
>>> import onscale as on >>> with on.Simulation("Static Solve") as sim: ... on.functions.SquareWave(5.0, 6.0)
A single pulse of a square wave.
- Parameters:
pulse_duration – The duration of the square wave pulse.
amplitude – The height of the square pulse wave.
time_delay – Time delay before the pulse is sent.
- static from_dict(data: Dict[str, Any], sim: Simulation | None = None) Node
Construct this node from serialized dictionary data
- to_json() str
Convert this node into JSON representation
- property uuid: str
Get the UUID associated with this node.