class_docstr: Class storing combined amplitude and phase callable if either or both
  of amplitude or phase are callable.
class_docstr_tok: ["Class","storing","combined","amplitude","and","phase","callable","if","either","or","both","of","amplitude","or","phase","are","callable","."]
code: def __init__(self, trig_fn, amp, phase, hz_to_rads=2 * np.pi):
      # The factor of 2pi converts amplitude in Hz to amplitude in radians/second
      self.amp_is_callable = callable(amp)
      self.phase_is_callable = callable(phase)
  
      def callable_amp_and_phase(params, t):
          return (
              hz_to_rads
              * amp(params[0], t)
              * trig_fn(phase(params[1], t))
          )
  
      def callable_amp(params, t):
          return hz_to_rads * amp(params, t) * trig_fn(phase)
  
      def callable_phase(params, t):
          return hz_to_rads * amp * trig_fn(phase(params, t))
  
      if self.amp_is_callable and self.phase_is_callable:
          self.func = callable_amp_and_phase
  
      elif self.amp_is_callable:
          self.func = callable_amp
  
      elif self.phase_is_callable:
          self.func = callable_phase
  
imports: from dataclasses import dataclass
  from typing import Callable, List, Union
  import numpy
  import pennylane
  from pennylane.wires import Wires
  from pennylane.operation import Operator
  from pennylane.ops.qubit.hamiltonian import Hamiltonian
  from .parametrized_hamiltonian import ParametrizedHamiltonian
label_desc: Use image node_id 1 to create a new AmplitudeAndPhase object  with example: obj = AmplitudeAndPhase(trig_fn, amp, phase, hz_to_rads)