various
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from stimuli.AbstractStimulus import AbstractStimulus
|
||||
import numpy as np
|
||||
from numba import jit, njit
|
||||
from warnings import warn
|
||||
|
||||
|
||||
@@ -63,7 +62,6 @@ def convert_to_array(carrier_freq, amplitude, modulation_freq, contrast, start_t
|
||||
else:
|
||||
am_end = time_start + total_time
|
||||
|
||||
|
||||
idx_start = (am_start - time_start) / step_size_s
|
||||
idx_end = (am_end - time_start) / step_size_s
|
||||
|
||||
@@ -80,46 +78,4 @@ def convert_to_array(carrier_freq, amplitude, modulation_freq, contrast, start_t
|
||||
values = full_carrier * amplitude
|
||||
values[idx_start:idx_end] = values[idx_start:idx_end]*am
|
||||
|
||||
return values
|
||||
|
||||
|
||||
# # if the whole stimulus time has the amplitude modulation just built it at once;
|
||||
# if time_start >= start_time and start_time+duration < time_start+total_time:
|
||||
# carrier = np.sin(2 * np.pi * carrier_freq * np.arange(start_time, total_time - start_time, step_size_s))
|
||||
# modulation = 1 + contrast * np.sin(2 * np.pi * modulation_freq * np.arange(start_time, total_time - start_time, step_size_s))
|
||||
# values = amplitude * carrier * modulation
|
||||
# return values
|
||||
#
|
||||
# # if it is split into parts with and without amplitude modulation built it in parts:
|
||||
# values = np.array([])
|
||||
#
|
||||
# # there is some time before the modulation starts:
|
||||
# if time_start < start_time:
|
||||
# carrier_before_am = np.sin(2 * np.pi * carrier_freq * np.arange(time_start, start_time, step_size_s))
|
||||
# values = np.concatenate((values, amplitude * carrier_before_am))
|
||||
#
|
||||
# # there is at least a second part of the stimulus that contains the amplitude:
|
||||
# # time starts before the end of the am and ends after it was started
|
||||
# if time_start < start_time+duration and time_start+total_time > start_time:
|
||||
# if duration is np.inf:
|
||||
#
|
||||
# carrier_during_am = np.sin(
|
||||
# 2 * np.pi * carrier_freq * np.arange(start_time, time_start + total_time, step_size_s))
|
||||
# am = 1 + contrast * np.sin(
|
||||
# 2 * np.pi * modulation_freq * np.arange(start_time, time_start + total_time, step_size_s))
|
||||
# else:
|
||||
# carrier_during_am = np.sin(
|
||||
# 2 * np.pi * carrier_freq * np.arange(start_time, start_time + duration, step_size_s))
|
||||
# am = 1 + contrast * np.sin(
|
||||
# 2 * np.pi * modulation_freq * np.arange(start_time, start_time + duration, step_size_s))
|
||||
# values = np.concatenate((values, amplitude * am * carrier_during_am))
|
||||
#
|
||||
# else:
|
||||
# if contrast != 0:
|
||||
# print("Given stimulus time parameters (start, total) result in no part of it containing the amplitude modulation!")
|
||||
#
|
||||
# if time_start+total_time > start_time+duration:
|
||||
# carrier_after_am = np.sin(2 * np.pi * carrier_freq * np.arange(start_time + duration, time_start + total_time, step_size_s))
|
||||
# values = np.concatenate((values, amplitude*carrier_after_am))
|
||||
#
|
||||
# return values
|
||||
return values
|
||||
Reference in New Issue
Block a user