# Path: seapy/base.py
# class Attribute(object):
#     """Descriptor for storing spectral values.
#     """
# 
#     def __init__(self, dtype="float64"):
#         self.dtype = dtype
#         self.attribute = None
#         """Attribute will be set by Base.__init__"""
# 
#     def __get__(self, instance, cls):
#         if instance is None:
#             return self
#         else:
#             return instance.__dict__[self.attribute]
# 
#     def __set__(self, instance, value):
#         try:
#             instance.__dict__[self.attribute][:] = value
#         except ValueError:
#             raise ValueError("Invalid value.")
# 
# Path: seapy/excitations/excitation.py
# class Excitation(Base):
#     """Abstract Base Class for excitations."""
# 
#     SORT = "Excitation"
# 
#     _DEPENDENCIES = ["subsystem"]
# 
#     subsystem = SubsystemExcitationLink()
#     """
#     Subsystem that is being excited by this excitation
#     """
# 
#     def __init__(self, name, system, **properties):
#         """Constructor.
#         
#         :param name: Identifier
#         :type name: string
#         :param system: Component
#         :type system: :class:`seapy.system.System`
#         
#         """
#         super().__init__(name, system, **properties)
# 
#         # self.subsystem = subsystem
# 
#     def _save(self):
#         attrs = super()._save()
#         attrs["subsystem"] = self.subsystem.name
#         return attrs
# 
#     def disable(self, subsystem=False):
#         """
#         Disable this excitation. Optionally disable excitations' subsystem.
#         
#         :param subsystem: Disable subsystem
#         :type subsystem: bool
#         """
#         self.__dict__["enabled"] = False
# 
#         if subsystem:
#             self.subsystem.disable()
# 
#     def enable(self, subsystem=False):
#         """
#         Enable this excitation. Optionally enable excitations' subsystem.
#         
#         :param subsystem: Enable subsystem
#         :type subsystem: bool
#         """
#         self.__dict__["enabled"] = True
# 
#         if subsystem:
#             self.subsystem.enable()
# 
#     @property
#     @abc.abstractmethod
#     def impedance(self):
#         """Impedance :math:`Z`.
#         """
#         pass
# 
#     @property
#     @abc.abstractmethod
#     def mobility(self):
#         """Impedance :math:`Z`.
#         """
#         pass
# 
#     @property
#     def resistance(self):
#         """The resistance :math:`R` is the real part of the impedance :math:`Z`.
#         """
#         return self.impedance.real
# 
#     @property
#     def reactance(self):
#         """The reactance :math:`X` is the imaginary part of the impedance :math:`Z`.
#         """
#         return self.impedance.imag
# 
#     @property
#     def conductance(self):
#         """The conductance :math:`G` is the real part of the mobility :math:`Y`.
#         
#         .. math:: G = \\mathrm{Re)\\left( Y \\right)
#         
#         """
#         return self.mobility.real
# 
#     @property
#     def susceptance(self):
#         """The susceptance :math:`B` is the imaginary part of the mobility :math:`Y`.
#         
#         .. math:: B = \\mathrm{Im)\\left( Y \\right)
#         
#         """
#         return self.mobility.imag
# 
#     @property
#     @abc.abstractmethod
#     def power(self):
#         """Input power.
#         """
# 
#     @property
#     def power_level(self):
#         """Input power level.
#         
#         .. math:: L_{P} = 10 \\log_{10}{\\left( \\frac{P}{P_0} \\right)}
#         
#         """
#         return 10.0 * np.log10(self.power / self.system.reference_power)


from ..base import Attribute
from .excitation import Excitation
import numpy as np
        
        .. math:: P = F^2 \\Re{Y}
        
        with:
        
        * rms force :math:`F`
        * mobility :math:`Y`.
        
        """
        if self.force.any():
            return self.force ** 2.0 * self.mobility.real
        elif self.velocity.any():
            return self.velocity ** 2.0 * self.impedance.real
        else:
            raise ValueError("Neither force nor velocity is specified.")

    @property
    def impedance(self):
        return self.subsystem.impedance_point_force


class ExcitationPointMoment(ExcitationPoint):
    """
    Point excitation of a moment.
    """

    moment = Attribute()
    """Moment :math:`M`.
    """


# Path: seapy/base.py
# class Attribute(object):
#     """Descriptor for storing spectral values.
#     """
# 
#     def __init__(self, dtype="float64"):
#         self.dtype = dtype
#         self.attribute = None
#         """Attribute will be set by Base.__init__"""
# 
#     def __get__(self, instance, cls):
#         if instance is None:
#             return self
#         else:
#             return instance.__dict__[self.attribute]
# 
#     def __set__(self, instance, value):
#         try:
#             instance.__dict__[self.attribute][:] = value
#         except ValueError:
#             raise ValueError("Invalid value.")
# 
# Path: seapy/excitations/excitation.py
# class Excitation(Base):
#     """Abstract Base Class for excitations."""
# 
#     SORT = "Excitation"
# 
#     _DEPENDENCIES = ["subsystem"]
# 
#     subsystem = SubsystemExcitationLink()
#     """
#     Subsystem that is being excited by this excitation
#     """
# 
#     def __init__(self, name, system, **properties):
#         """Constructor.
#         
#         :param name: Identifier
#         :type name: string
#         :param system: Component
#         :type system: :class:`seapy.system.System`
#         
#         """
#         super().__init__(name, system, **properties)
# 
#         # self.subsystem = subsystem
# 
#     def _save(self):
#         attrs = super()._save()
#         attrs["subsystem"] = self.subsystem.name
#         return attrs
# 
#     def disable(self, subsystem=False):
#         """
#         Disable this excitation. Optionally disable excitations' subsystem.
#         
#         :param subsystem: Disable subsystem
#         :type subsystem: bool
#         """
#         self.__dict__["enabled"] = False
# 
#         if subsystem:
#             self.subsystem.disable()
# 
#     def enable(self, subsystem=False):
#         """
#         Enable this excitation. Optionally enable excitations' subsystem.
#         
#         :param subsystem: Enable subsystem
#         :type subsystem: bool
#         """
#         self.__dict__["enabled"] = True
# 
#         if subsystem:
#             self.subsystem.enable()
# 
#     @property
#     @abc.abstractmethod
#     def impedance(self):
#         """Impedance :math:`Z`.
#         """
#         pass
# 
#     @property
#     @abc.abstractmethod
#     def mobility(self):
#         """Impedance :math:`Z`.
#         """
#         pass
# 
#     @property
#     def resistance(self):
#         """The resistance :math:`R` is the real part of the impedance :math:`Z`.
#         """
#         return self.impedance.real
# 
#     @property
#     def reactance(self):
#         """The reactance :math:`X` is the imaginary part of the impedance :math:`Z`.
#         """
#         return self.impedance.imag
# 
#     @property
#     def conductance(self):
#         """The conductance :math:`G` is the real part of the mobility :math:`Y`.
#         
#         .. math:: G = \\mathrm{Re)\\left( Y \\right)
#         
#         """
#         return self.mobility.real
# 
#     @property
#     def susceptance(self):
#         """The susceptance :math:`B` is the imaginary part of the mobility :math:`Y`.
#         
#         .. math:: B = \\mathrm{Im)\\left( Y \\right)
#         
#         """
#         return self.mobility.imag
# 
#     @property
#     @abc.abstractmethod
#     def power(self):
#         """Input power.
#         """
# 
#     @property
#     def power_level(self):
#         """Input power level.
#         
#         .. math:: L_{P} = 10 \\log_{10}{\\left( \\frac{P}{P_0} \\right)}
#         
#         """
#         return 10.0 * np.log10(self.power / self.system.reference_power)


# Path: seapy/excitations/excitationpoint.py
from ..base import Attribute
from .excitation import Excitation
import numpy as np

        
        .. math:: P = F^2 \\Re{Y}
        
        with:
        
        * rms force :math:`F`
        * mobility :math:`Y`.
        
        """
        if self.force.any():
            return self.force ** 2.0 * self.mobility.real
        elif self.velocity.any():
            return self.velocity ** 2.0 * self.impedance.real
        else:
            raise ValueError("Neither force nor velocity is specified.")

    @property
    def impedance(self):
        return self.subsystem.impedance_point_force


class ExcitationPointMoment(ExcitationPoint):
    """
    Point excitation of a moment.
    """

    moment = Attribute()
    """Moment :math:`M`.
    """


    velocity = Attribute()