"""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())
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())