# Path: imusim/environment/gravity.py
# STANDARD_GRAVITY = 9.81


import numpy as np
from imusim.platforms.sensors import *
from imusim.environment.gravity import STANDARD_GRAVITY
from imusim.utilities.documentation import prepend_method_doc

class NoisyTransformedAccelerometer(NoisyTransformedSensor, IdealAccelerometer):
    """
    Accelerometer with affine transform transfer function and Gaussian noise.
    """
    pass

class MMA7260Q(NoisyTransformedSensor, Accelerometer):
    """
    Model of the Freescale MMA7260Q accelerometer.

    @ivar sensitivity: Sensitivity setting, '1.5g', '2g', '4g', or '6g'.
    """

    NOMINAL_SENSITIVITIES = {'1.5g':800E-3, '2g':600E-3,
            '4g':300E-3, '6g':200E-3}
    NOMINAL_OFFSET = 1.65
    MAX_CROSS_AXIS = 0.05

    @prepend_method_doc(Accelerometer)
    def __init__(self, platform, sensitivity, noiseStdDev, rng=None, **kwargs):
        """
        @param sensitivity: Sensitivity setting, '1.5g', '2g', '4g', or '6g'.
        @param noiseStdDev: Standard deviation of measured output voltage noise
            in the system in which the accelerometer is integrated.
        @param rng: L{np.random.RandomState} from which to draw imperfections.
        """
        if rng is None:
            rng = np.random.RandomState()


# Path: imusim/environment/gravity.py
# STANDARD_GRAVITY = 9.81


# Path: imusim/platforms/accelerometers.py
import numpy as np
from imusim.platforms.sensors import *
from imusim.environment.gravity import STANDARD_GRAVITY
from imusim.utilities.documentation import prepend_method_doc


class NoisyTransformedAccelerometer(NoisyTransformedSensor, IdealAccelerometer):
    """
    Accelerometer with affine transform transfer function and Gaussian noise.
    """
    pass

class MMA7260Q(NoisyTransformedSensor, Accelerometer):
    """
    Model of the Freescale MMA7260Q accelerometer.

    @ivar sensitivity: Sensitivity setting, '1.5g', '2g', '4g', or '6g'.
    """

    NOMINAL_SENSITIVITIES = {'1.5g':800E-3, '2g':600E-3,
            '4g':300E-3, '6g':200E-3}
    NOMINAL_OFFSET = 1.65
    MAX_CROSS_AXIS = 0.05

    @prepend_method_doc(Accelerometer)
    def __init__(self, platform, sensitivity, noiseStdDev, rng=None, **kwargs):
        """
        @param sensitivity: Sensitivity setting, '1.5g', '2g', '4g', or '6g'.
        @param noiseStdDev: Standard deviation of measured output voltage noise
            in the system in which the accelerometer is integrated.
        @param rng: L{np.random.RandomState} from which to draw imperfections.
        """
        if rng is None:
            rng = np.random.RandomState()


        sensitivity = MMA7260Q.NOMINAL_SENSITIVITIES[sensitivity] / STANDARD_GRAVITY