Skip to content

Commit

Permalink
Update src/qutip_qip/noise.py
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Cross <hodgestar+github@gmail.com>
  • Loading branch information
BoxiLi and hodgestar committed Jul 14, 2021
1 parent 6d2696b commit 2317ea6
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/qutip_qip/noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,17 @@ def get_noisy_pulses(self, dims=None, pulses=None, systematic_noise=None):
systematic_noise : :class:`.Pulse`
The dummy pulse representing pulse-independent noise.
"""
try:
# Try to check if the old API is defined.
result = self.get_noisy_dynamics(dims, pulses, systematic_noise)
get_noisy_dynamics = getattr(self, "get_noisy_dynamics", None)
if get_noisy_dynamics is not None:
warnings.warn(
"Using get_noisy_dynamics as the hook function for custom "
"noise will be deprecated, "
"please use get_noisy_pulses instead.",
PendingDeprecationWarning)
return result
except AttributeError:
raise NotImplementedError(
"Subclass error needs a method"
"`get_noisy_pulses` to process the noise.") from None
return self.get_noisy_dynamics(dims, pulses, systematic_noise)
raise NotImplementedError(
"Subclass error needs a method"
"`get_noisy_pulses` to process the noise.")

def _apply_noise(self, pulses=None, systematic_noise=None, dims=None):
"""
Expand Down

0 comments on commit 2317ea6

Please sign in to comment.