Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/AsymBasis' into AsymBasis
Browse files Browse the repository at this point in the history
  • Loading branch information
marcorossignolo committed Aug 23, 2021
2 parents 55cc9e5 + 0669c86 commit b825b26
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/quocslib/pulses/BasePulse.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class BasePulse:
final_time: float

def __init__(self, map_index=-1, pulse_name="pulse", bins_number=101, time_name="time", lower_limit=0.0,
upper_limit=1.0, amplitude_variation=0.1, initial_guess=None, scaling_function=None, is_shrinked:bool = False,
shaping_options: list = None, **kwargs):
upper_limit=1.0, amplitude_variation=0.1, initial_guess=None, scaling_function=None,
is_shrinked:bool = False, shaping_options: list = None, overwrite_base_pulse: bool = False, **kwargs):
"""
Here we defined all the basic features a pulse should have.
:param int map_index: index number for pulse control parameters association
Expand Down Expand Up @@ -98,6 +98,8 @@ def __init__(self, map_index=-1, pulse_name="pulse", bins_number=101, time_name=
self.scaling_function = scaling_function
# Shrink option
self.is_shrinked = is_shrinked
# Overwrite the base pulse at the end of the superiteration
self.overwrite_base_pulse = overwrite_base_pulse

def _set_time_grid(self, final_time: float) -> None:
"""Set the time grid"""
Expand Down Expand Up @@ -174,7 +176,10 @@ def set_base_pulse(self, optimized_control_parameters: np.ndarray, final_time: f
""" Set the base optimal pulse pulse """
self._set_control_parameters(optimized_control_parameters)
self._set_time_grid(final_time)
self.base_pulse += self._get_shaped_pulse()
if self.overwrite_base_pulse:
self.base_pulse = self._get_shaped_pulse()
else:
self.base_pulse += self._get_shaped_pulse()

def _set_control_parameters(self, optimized_control_parameters: np.ndarray) -> None:
""" Set the optimized control parameters vector """
Expand Down

0 comments on commit b825b26

Please sign in to comment.