Beispiel #1
0
    """Automagic GPS scaling based on visible data
    """
    name = 'auto-gps'


register_scale(AutoGPSScale)


# register all the astropy time units that have sensible long names
def _gps_scale_factory(unit):
    """Construct a GPSScale for this unit
    """
    class FixedGPSScale(GPSScale):
        """`GPSScale` for a specific GPS time unit
        """
        name = str('%ss' % unit.long_names[0])

        def __init__(self, axis, epoch=None):
            super(FixedGPSScale, self).__init__(axis, epoch=epoch, unit=unit)

    return FixedGPSScale


for _unit in TIME_UNITS:
    register_scale(_gps_scale_factory(_unit))

# update the docstring for matplotlib scale methods
docstring.interpd.update(scale=' | '.join([repr(x)
                                           for x in get_scale_names()]),
                         scale_docs=get_scale_docs().rstrip())
Beispiel #2
0

# register all the astropy time units that have sensible long names
def _gps_scale_factory(unit):
    """Construct a GPSScale for this unit
    """
    class FixedGPSScale(GPSScale):
        """`GPSScale` for a specific GPS time unit
        """
        name = str('{0}s'.format(
            unit.long_names[0] if unit.long_names else unit.names[0]))

        def __init__(self, axis, epoch=None):
            """
            """
            super(FixedGPSScale, self).__init__(axis, epoch=epoch, unit=unit)

    return FixedGPSScale


for _unit in TIME_UNITS:
    if _unit is units.kiloyear:  # don't go past 'year' for GPSScale
        break
    register_gps_scale(_gps_scale_factory(_unit))

# update the docstring for matplotlib scale methods
docstring.interpd.update(
    scale=' | '.join([repr(x) for x in get_scale_names()]),
    scale_docs=get_scale_docs().rstrip(),
)
Beispiel #3
0
            self.set_unit(unit)


register_gps_scale(GPSScale)


# register all the astropy time units that have sensible long names
def _gps_scale_factory(unit):
    """Construct a GPSScale for this unit
    """
    class FixedGPSScale(GPSScale):
        """`GPSScale` for a specific GPS time unit
        """
        name = str('{0}s'.format(unit.long_names[0] if unit.long_names else
                                 unit.names[0]))

        def __init__(self, axis, epoch=None):
            super(FixedGPSScale, self).__init__(axis, epoch=epoch, unit=unit)
    return FixedGPSScale


for _unit in TIME_UNITS:
    if _unit is units.kiloyear:  # don't go past 'year' for GPSScale
        break
    register_gps_scale(_gps_scale_factory(_unit))

# update the docstring for matplotlib scale methods
docstring.interpd.update(
    scale=' | '.join([repr(x) for x in get_scale_names()]),
    scale_docs=get_scale_docs().rstrip())
    class InvertedAudioTransform(transforms.Transform):
        input_dims = 1
        output_dims = 1
        is_separable = True

        def __init__(self, stops=None):
            super(AudioHzScale.InvertedAudioTransform, self).__init__()
            self.stops = stops
            if not self.stops:
                self.stops = AudioHzScale._default_stops

        def transform_non_affine(self, a):
            log_params = AudioHzScale._log_params

            b = a - log_params['v_shift']
            b = b / log_params['v_scale']
            b = np.where(b < 0, 0, b)
            b = np.float_power(2, b)
            b = b - log_params['h_shift']
            b = b / log_params['h_scale']

            return b

        def inverted(self):
            return AudioHzScale.AudioTransform(self.stops)


scale_names = scale.get_scale_names()
if 'audio_hz' not in scale_names:
    scale.register_scale(AudioHzScale)