Permalink
Browse files

Merge branch 'master' into erfa

Conflicts:
	CHANGES.rst
  • Loading branch information...
2 parents 93a9ae0 + c9b52ba commit 8fb6e1dd046eff198f508a933c251756be016830 @sergiopasra sergiopasra committed Aug 10, 2013
Showing with 8,694 additions and 3,033 deletions.
  1. +2 −2 .travis.yml
  2. +183 −7 CHANGES.rst
  3. +15 −12 astropy/__init__.py
  4. +5 −2 astropy/constants/constant.py
  5. +4 −0 astropy/constants/si.py
  6. +19 −0 astropy/constants/tests/test_constant.py
  7. +1 −1 astropy/coordinates/angle_lextab.py
  8. +32 −30 astropy/coordinates/angle_parsetab.py
  9. +100 −72 astropy/coordinates/angle_utilities.py
  10. +498 −377 astropy/coordinates/angles.py
  11. +18 −18 astropy/coordinates/builtin_systems.py
  12. +13 −12 astropy/coordinates/coordsystems.py
  13. +4 −3 astropy/coordinates/distances.py
  14. +2 −2 astropy/coordinates/tests/accuracy/test_fk4_no_e_fk4.py
  15. +2 −2 astropy/coordinates/tests/accuracy/test_fk4_no_e_fk5.py
  16. +2 −2 astropy/coordinates/tests/accuracy/test_galactic_fk4.py
  17. +2 −2 astropy/coordinates/tests/accuracy/test_icrs_fk5.py
  18. +72 −11 astropy/coordinates/tests/test_angles.py
  19. +88 −86 astropy/coordinates/tests/test_api.py
  20. +73 −6 astropy/coordinates/tests/test_arrays.py
  21. +81 −0 astropy/coordinates/tests/test_formatting.py
  22. +11 −11 astropy/coordinates/tests/test_name_resolve.py
  23. +2 −2 astropy/coordinates/tests/test_sphere_ang_dists.py
  24. +24 −24 astropy/coordinates/tests/test_transformations.py
  25. +148 −122 astropy/cosmology/core.py
  26. +12 −12 astropy/cosmology/funcs.py
  27. +1 −1 astropy/cosmology/parameters.py
  28. +110 −71 astropy/cosmology/tests/test_cosmology.py
  29. +4 −0 astropy/extern/setup_package.py
  30. +404 −0 astropy/extern/six.py
  31. +1 −1 astropy/io/ascii/fixedwidth.py
  32. +1 −1 astropy/io/ascii/tests/common.py
  33. +0 −1 astropy/io/fits/hdu/compressed.py
  34. +1 −1 astropy/io/fits/hdu/groups.py
  35. +2 −2 astropy/io/fits/header.py
  36. +1 −1 astropy/io/fits/scripts/fitscheck.py
  37. +3 −0 astropy/io/fits/src/compressionmodule.c
  38. +7 −0 astropy/io/fits/tests/test_core.py
  39. +26 −2 astropy/io/fits/util.py
  40. +2 −0 astropy/io/votable/__init__.py
  41. +6 −6 astropy/io/votable/connect.py
  42. +59 −47 astropy/io/votable/converters.py
  43. +20 −22 astropy/io/votable/exceptions.py
  44. +4 −0 astropy/io/votable/setup_package.py
  45. +14 −13 astropy/io/votable/table.py
  46. +7 −4 astropy/io/votable/tests/converter_test.py
  47. +6 −3 astropy/io/votable/tests/ucd_test.py
  48. +0 −6 astropy/io/votable/tests/util_test.py
  49. +48 −48 astropy/io/votable/tests/vo_test.py
  50. +90 −95 astropy/io/votable/tree.py
  51. +13 −13 astropy/io/votable/ucd.py
  52. +7 −27 astropy/io/votable/util.py
  53. +1 −1 astropy/io/votable/validator/__init__.py
  54. +83 −81 astropy/io/votable/validator/html.py
  55. +3 −2 astropy/io/votable/validator/main.py
  56. +21 −22 astropy/io/votable/validator/result.py
  57. +0 −1 astropy/io/votable/volint.py
  58. +1 −1 astropy/io/votable/xmlutil.py
  59. +0 −236 astropy/modeling/constraints.py
  60. +176 −50 astropy/modeling/core.py
  61. +108 −63 astropy/modeling/fitting.py
  62. +618 −161 astropy/modeling/functional_models.py
  63. +88 −0 astropy/modeling/models.py
  64. +77 −43 astropy/modeling/parameters.py
  65. +7 −4 astropy/modeling/polynomial.py
  66. +63 −21 astropy/modeling/projections.py
  67. +30 −29 astropy/modeling/rotations.py
  68. +1 −1 astropy/modeling/setup_package.py
  69. +161 −0 astropy/modeling/tests/model_lists.py
  70. +194 −4 astropy/modeling/tests/test_constraints.py
  71. +0 −5 astropy/modeling/tests/test_input.py
  72. +128 −34 astropy/modeling/tests/test_models.py
  73. +3 −3 astropy/modeling/tests/test_parameters.py
  74. +102 −42 astropy/modeling/tests/test_projections.py
  75. +1 −0 astropy/modeling/utils.py
  76. +120 −39 astropy/setup_helpers.py
  77. +9 −0 astropy/tests/tests/test_imports.py
  78. +161 −34 astropy/time/core.py
  79. +1 −0 astropy/time/setup_package.py
  80. +20 −22 astropy/time/tests/test_basic.py
  81. +4 −4 astropy/time/tests/test_comparisons.py
  82. +10 −7 astropy/time/tests/test_delta.py
  83. +101 −0 astropy/time/tests/test_precision.py
  84. +114 −60 astropy/units/core.py
  85. +206 −1 astropy/units/equivalencies.py
  86. +1 −1 astropy/units/format/cds.py
  87. +2 −1 astropy/units/format/console.py
  88. +2 −11 astropy/units/format/generic.py
  89. +2 −1 astropy/units/format/latex.py
  90. +5 −1 astropy/units/format/unicode_format.py
  91. +19 −1 astropy/units/format/utils.py
  92. +624 −204 astropy/units/quantity.py
  93. +294 −0 astropy/units/quantity_helper.py
  94. +68 −0 astropy/units/tests/test_equivalencies.py
  95. +12 −0 astropy/units/tests/test_format.py
  96. +137 −12 astropy/units/tests/test_quantity.py
  97. +365 −0 astropy/units/tests/test_quantity_array_methods.py
  98. +25 −0 astropy/units/tests/test_quantity_non_ufuncs.py
  99. +579 −0 astropy/units/tests/test_quantity_ufuncs.py
  100. +10 −2 astropy/units/tests/test_units.py
  101. +19 −2 astropy/utils/compat/misc.py
  102. +8 −5 astropy/utils/console.py
  103. +2 −2 astropy/version_helpers.py
  104. +4 −3 astropy/wcs/src/pyutil.c
  105. +0 −3 astropy/wcs/src/str_list_proxy.c
  106. +3 −3 astropy/wcs/src/wcslib_wrap.c
  107. +30 −2 astropy/wcs/tests/test_wcs.py
  108. +93 −0 astropy/wcs/wcs.py
  109. +3 −3 cextern/wcslib/C/GNUmakefile
  110. +2 −2 cextern/wcslib/C/cel.c
  111. +3 −3 cextern/wcslib/C/cel.h
  112. +2 −2 cextern/wcslib/C/fitshdr.h
  113. +2 −2 cextern/wcslib/C/fitshdr.l
  114. +2 −2 cextern/wcslib/C/flexed/fitshdr.c
  115. +2 −2 cextern/wcslib/C/flexed/wcsbth.c
  116. +2 −2 cextern/wcslib/C/flexed/wcspih.c
  117. +2 −2 cextern/wcslib/C/flexed/wcsulex.c
  118. +2 −2 cextern/wcslib/C/flexed/wcsutrn.c
  119. +2 −2 cextern/wcslib/C/getwcstab.c
  120. +2 −2 cextern/wcslib/C/getwcstab.h
  121. +2 −2 cextern/wcslib/C/lin.c
  122. +3 −3 cextern/wcslib/C/lin.h
  123. +2 −2 cextern/wcslib/C/log.c
  124. +3 −3 cextern/wcslib/C/log.h
  125. +240 −0 cextern/wcslib/C/makedefs.in
  126. +329 −5 cextern/wcslib/C/prj.c
  127. +9 −4 cextern/wcslib/C/prj.h
  128. +2 −2 cextern/wcslib/C/spc.c
  129. +3 −3 cextern/wcslib/C/spc.h
  130. +2 −2 cextern/wcslib/C/sph.c
  131. +3 −3 cextern/wcslib/C/sph.h
  132. +2 −2 cextern/wcslib/C/spx.c
  133. +3 −3 cextern/wcslib/C/spx.h
  134. +2 −2 cextern/wcslib/C/tab.c
  135. +3 −3 cextern/wcslib/C/tab.h
  136. +2 −2 cextern/wcslib/C/wcs.c
  137. +3 −3 cextern/wcslib/C/wcs.h
  138. +2 −2 cextern/wcslib/C/wcsbth.l
  139. +18 −0 cextern/wcslib/C/wcsconfig.h.in
  140. +18 −0 cextern/wcslib/C/wcsconfig_tests.h.in
  141. +2 −2 cextern/wcslib/C/wcserr.c
  142. +2 −2 cextern/wcslib/C/wcserr.h
  143. +3 −3 cextern/wcslib/C/wcsfix.c
  144. +8 −7 cextern/wcslib/C/wcsfix.h
  145. +2 −2 cextern/wcslib/C/wcshdr.c
  146. +3 −3 cextern/wcslib/C/wcshdr.h
  147. +3 −3 cextern/wcslib/C/wcslib.h
  148. +2 −2 cextern/wcslib/C/wcsmath.h
  149. +2 −2 cextern/wcslib/C/wcspih.l
  150. +2 −2 cextern/wcslib/C/wcsprintf.c
  151. +3 −3 cextern/wcslib/C/wcsprintf.h
  152. +2 −2 cextern/wcslib/C/wcstrig.c
  153. +2 −2 cextern/wcslib/C/wcstrig.h
  154. +2 −2 cextern/wcslib/C/wcsulex.l
  155. +2 −2 cextern/wcslib/C/wcsunits.c
  156. +3 −3 cextern/wcslib/C/wcsunits.h
  157. +2 −2 cextern/wcslib/C/wcsutil.c
  158. +2 −2 cextern/wcslib/C/wcsutil.h
  159. +2 −2 cextern/wcslib/C/wcsutrn.l
  160. +35 −1 cextern/wcslib/CHANGES
  161. +4 −4 cextern/wcslib/GNUmakefile
  162. +4 −4 cextern/wcslib/INSTALL
  163. +3 −3 cextern/wcslib/README
  164. +2 −1 cextern/wcslib/THANKS
  165. +10 −1 cextern/wcslib/VALIDATION
  166. +12 −12 cextern/wcslib/configure
  167. +3 −3 cextern/wcslib/configure.ac
  168. +1 −1 cextern/wcslib/flavours
  169. +4 −4 cextern/wcslib/makedefs.in
  170. +2 −2 cextern/wcslib/wcsconfig.h.in
  171. +2 −2 cextern/wcslib/wcsconfig_f77.h.in
  172. +2 −2 cextern/wcslib/wcsconfig_tests.h.in
  173. +2 −2 cextern/wcslib/wcsconfig_utils.h.in
  174. +8 −0 distribute_setup.py
  175. +35 −29 docs/coordinates/angles.rst
  176. +15 −10 docs/coordinates/creating.rst
  177. +5 −5 docs/coordinates/formatting.rst
  178. +36 −32 docs/coordinates/index.rst
  179. +7 −6 docs/coordinates/separations.rst
  180. +18 −18 docs/coordinates/sgr-example.py
  181. +101 −101 docs/coordinates/sgr-example.rst
  182. +17 −14 docs/coordinates/transforming.rst
  183. +25 −14 docs/cosmology/index.rst
  184. +107 −92 docs/development/workflow/development_workflow.rst
  185. +26 −0 docs/install.rst
  186. +8 −2 docs/modeling/fitting.rst
  187. +11 −12 docs/modeling/index.rst
  188. +28 −28 docs/modeling/new.rst
  189. +8 −0 docs/time/index.rst
  190. +48 −0 docs/units/equivalencies.rst
  191. +135 −74 docs/units/quantity.rst
  192. +50 −1 docs/whatsnew/0.3.rst
  193. +18 −0 licenses/SIX_LICENSE.rst
  194. +10 −25 setup.py
View
@@ -35,9 +35,9 @@ matrix:
# now try do scipy on 2.7 and an appropriate 3.x build (with latest numpy)
- python: 2.7
- env: SETUP_CMD='test --parallel=8' NUMPY_VERSION=1.7.1 OPTIONAL_DEPS=true
+ env: SETUP_CMD='test --parallel=8' NUMPY_VERSION=1.7.1 OPTIONAL_DEPS=true LC_CTYPE=C.ascii
- python: 3.2
- env: SETUP_CMD='test' NUMPY_VERSION=1.7.1 OPTIONAL_DEPS=true
+ env: SETUP_CMD='test' NUMPY_VERSION=1.7.1 OPTIONAL_DEPS=true LC_CTYPE=C.ascii
# try alternate numpy versions
- python: 2.7
View
@@ -4,7 +4,7 @@
New Features
^^^^^^^^^^^^
-- `astropy.io.votable`
+- ``astropy.io.votable``
- The format of the units of a VOTable file can be specified using
the `unit_format` parameter. Note that units are still always
@@ -13,6 +13,10 @@ New Features
- ``astropy.time``
+ - Update internal time manipulations so that arithmetic with Time and
+ TimeDelta objects maintains sub-nanosecond precision over a time span
+ longer than the age of the universe [#1189].
+
- Add ``datetime`` format which allows converting to and from standard
library ``datetime.datetime`` objects.
@@ -31,7 +35,7 @@ New Features
- Allow multiplication and division of TimeDelta objects by
constants and arrays, as well as changing sign (negation) and
taking the absolute value of TimeDelta objects [#1082].
-
+
- Allow comparisons of Time and TimeDelta objects [#1171].
- ``astropy.stats``
@@ -52,25 +56,63 @@ New Features
MaskedColumn, Row, and Table are now deprecated in favor of the
single-tense 'unit' and 'dtype' [#1174].
-- :ref:`astropy.vo <astropy_vo>`
+- ``astropy.vo``
- New package added to support Virtual Observatory Simple Cone Search query
and service validation [#552].
+- ``astropy.units.equivalencies``
+
+ - Added new spectroscopic equivalencies for velocity conversions
+ (relativistic, optical, and radio conventions are supported)
+
- Astropy now uses the free software library ERFA in place of the
non-free library SOFA [#1195].
API Changes
^^^^^^^^^^^
+- ``astropy.coordinates``
+
+ - The `astropy.coordinates.Angle` class is now a subclass of
+ `astropy.units.Quantity`.
+
+ - All angular units are now supported, not just `radian`, `degree`
+ and `hour`, but now `arcsecond` and `arcminute` as well. The
+ object will retain its native unit, so when printing out a value
+ initially provided in hours, its `to_string()` will, by default,
+ also be expressed in hours.
+
+ - The `Angle` class now supports arrays of angles.
+
+ - To be consistent with `units.Unit`, `Angle.format` has been
+ deprecated and renamed to `Angle.to_string`.
+
+ - To be consistent with `astropy.units`, all plural forms of unit
+ names have been removed. Therefore, the following properties of
+ `astropy.coordinates.Angle` should be renamed:
+
+ - ``radians`` -> ``radian``
+ - ``degrees`` -> ``degree``
+ - ``hours`` -> ``hour``
+
+ - Multiplication and division of two `Angle` objects used to raise
+ `NotImplementedError`. Now they raise `TypeError`.
+
+ - `astropy.coordinates.angles.rotation_matrix` and
+ `astropy.coordinates.angles.angle_axis` now take a `unit` kwarg
+ instead of `degrees` kwarg to specify the units of the angles.
+ `rotation_matrix` will also take the unit from the given `Angle`
+ object if no unit is provided.
+
- ``astropy.io.ascii``
- In the ``read`` method of ``astropy.io.ascii``, empty column values in an ASCII table
are now treated as missing values instead of the previous treatment as a zero-length
string "". This now corresponds to the behavior of other table readers like
``numpy.genfromtxt``. To restore the previous behavior set ``fill_values=None`` in the
call to ``ascii.read()``.
-
+
- The ``read`` and ``write`` methods of ``astropy.io.ascii`` now have a ``format``
argument for specifying the file format. This is the preferred way to choose
the format instead of the ``Reader`` and ``Writer`` arguments [#961].
@@ -125,19 +167,148 @@ API Changes
the first argument is now ``order='C'``. This is required for compatibility
with Numpy 1.8 which is currently in development [#1250].
+- ``astropy.units``
+
+ - The ``Quantity`` class now inherits from the Numpy array class, and
+ includes the following API changes [#929]:
+
+ - Using ``float(...)``, ``int(...)``, and ``long(...)`` on a quantity will
+ now only work if the quantity is dimensionless and unscaled.
+
+ - All Numpy ufuncs should now treat units correctly (or raise an exception
+ if not supported), rather than extract the value of quantities and
+ operate on this, emitting a warning about the implicit loss of units.
+
+ - When using relevant Numpy ufuncs on dimensionless quantities (e.g.
+ ``np.exp(h * nu / (k_B * T))``), or combining dimensionless quantities
+ with Python scalars or plain Numpy arrays ``1 + v / c``, the
+ dimensionless Quantity will automatically be converted to an unscaled
+ dimensionless Quantity.
+
+ - When initializing a quantity from a value with no unit, it is now set to
+ be dimensionless and unscaled by default. When initializing a Quantity
+ from another Quantity and with no unit specified in the initializer, the
+ unit is now taken from the unit of the Quantity being initialized from.
+
Bug Fixes
^^^^^^^^^^
- ``astropy.io.ascii``
- - The ``write()`` function was ignoring the ``fill_values`` argument (#910).
+ - The ``write()`` function was ignoring the ``fill_values`` argument [#910].
+
+- ``astropy.units``
+
+ - Fixed a bug that caused the order of multiplication/division of plain
+ Numpy arrays with Quantities to matter (i.e. if the plain array comes
+ first the units were not preserved in the output) [#899].
+
+
+0.2.5 (unreleased)
+------------------
+
+Bug Fixes
+^^^^^^^^^
+
+- ``astropy.io.fits``
+ - Fixed a bug that could cause a segfault when trying to decompress an
+ compressed HDU whose contents are truncated (due to a corrupt file, for
+ example). This still causes a Python traceback but better that than a
+ segfault. [#1332]
-0.2.4 (unreleased)
+0.2.4 (2013-07-24)
------------------
- - Nothing yet.
+Bug Fixes
+^^^^^^^^^
+
+- ``astropy.coordinates``
+
+ - Fixed the angle parser to support parsing the string "1 degree". [#1168]
+
+- ``astropy.cosmology``
+
+ - Fixed a crash in the ``comoving_volume`` method on non-flat cosmologies
+ when passing it an array of redshifts.
+
+- ``astropy.io.ascii``
+
+ - Fixed a bug that prevented saving changes to the comment symbol when
+ writing changes to a table. [#1167]
+
+- ``astropy.io.fits``
+
+ - Added a workaround for a bug in 64-bit OSX that could cause truncation when
+ writing files greater than 2^32 bytes in size. [#839]
+
+- ``astropy.io.votable``
+
+ - Fixed incorrect reading of tables containing multiple ``<RESOURCE>``
+ elements. [#1223]
+
+- ``astropy.table``
+
+ - Fixed a bug where ``Table.remove_column`` and ``Table.rename_column``
+ could cause a maksed table to lose its masking. [#1120]
+
+ - Fixed bugs where subclasses of ``Table`` did not preserver their class in
+ certain operations. [#1142]
+
+ - Fixed a bug where slicing a masked table did not preserve the mask. [#1187]
+
+- ``astropy.units``
+
+ - Fixed a bug where the ``.si`` and ``.cgs`` properties of dimensionless
+ ``Quantity`` objects raised a ``ZeroDivisionError``. [#1150]
+
+ - Fixed a bug where multiple subsequent calls to the ``.decompose()`` method
+ on array quantities applied a scale factor each time. [#1163]
+
+- Misc
+
+ - Fixed an installation crash that could occur sometimes on Debian/Ubuntu
+ and other \*NIX systems where ``pkg_resources`` can be installed without
+ installing ``setuptools``. [#1150]
+
+ - Updated the ``distribute_setup.py`` bootstrapper to use setuptools >= 0.7
+ when installing on systems that don't already have an up to date version
+ of distribute/setuptools. [#1180]
+
+ - Changed the ``version.py`` template so that Astropy affiliated packages can
+ (and they should) use their own ``cython_version.py`` and
+ ``utils._compiler`` modules where appropriate. This issue only pertains to
+ affiliated package maintainers. [#1198]
+
+ - Fixed a corner case where the default config file generation could crash
+ if building with matplotlib but *not* Sphinx installed in a virtualenv.
+ [#1225]
+
+ - Fixed a crash that could occur in the logging module on systems that
+ don't have a default preferred encoding (in particular this happened
+ in some versions of PyCharm). [#1244]
+
+ - The Astropy log now supports passing non-string objects (and calling
+ ``str()`` on them by default) to the logging methods, in line with Python's
+ standard logging API. [#1267]
+
+ - Minor documentation fixes [#582, #696, #1154, #1194, #1212, #1213, #1246,
+ #1252]
+
+Other Changes and Additions
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+- ``astropy.cosmology``
+
+ - Added a new ``Plank13`` object representing the Plank 2013 results. WMAP7
+ remains the default cosmology so this should not affect any existing
+ computations using the defaults. [#895]
+
+- ``astropy.units``
+
+ - Performance improvements in initialization of ``Quantity`` objects with
+ a large number of elements. [#1231]
0.2.3 (2013-05-30)
@@ -407,6 +578,11 @@ Bug Fixes
- Fixed ``TypeError`` when calling ``WCS.to_header_string()``. [#822]
+ - Added new method `WCS.all_world2pix` for converting from world coordinates
+ to pixel space, including inversion of the astrometric distortion
+ correction. [#1066, #1281]
+
+
- Misc
- Fixed a minor issue when installing with ``./setup.py develop`` on a fresh
View
@@ -17,6 +17,7 @@
import __builtin__ as builtins
builtins._ASTROPY_SETUP_ = False
del version_info
+ del builtins
try:
from .version import version as __version__
@@ -30,9 +31,6 @@
__githash__ = ''
-import logging
-
-
# The location of the online documentation for astropy
# This location will normally point to the current released version of astropy
if 'dev' in __version__:
@@ -124,21 +122,15 @@ def test(package=None, test_path=None, args=None, plugins=None,
parallel=parallel)
-# Use the root logger as a dummy log before initilizing Astropy's logger
-log = logging.getLogger()
-
# if we are *not* in setup mode, import the logger and possibly populate the
# configuration file with the defaults
-if not _ASTROPY_SETUP_:
- from .logger import _init_log
+def _initialize_astropy():
from . import config
import os
import sys
from warnings import warn
- log = _init_log()
-
try:
from .utils import _compiler
except ImportError:
@@ -162,6 +154,17 @@ def test(package=None, test_path=None, args=None, plugins=None,
wmsg = (e.args[0] + " Cannot install default profile. If you are "
"importing from source, this is expected.")
warn(config.configuration.ConfigurationDefaultMissingWarning(wmsg))
- del e
- del _init_log, os, warn, config_dir # clean up namespace
+
+import logging
+
+# Use the root logger as a dummy log before initilizing Astropy's logger
+log = logging.getLogger()
+
+
+if not _ASTROPY_SETUP_:
+ from .logger import _init_log
+
+ log = _init_log()
+
+ _initialize_astropy()
@@ -57,7 +57,10 @@ def wrapper(self, *args, **kwargs):
# The wrapper applies to so many of the __ methods that it's easier to
# just exclude the ones it doesn't apply to
- exclude = set(['__init__', '__str__', '__repr__'])
+ exclude = set(['__new__', '__array_finalize__', '__array_wrap__',
+ '__dir__', '__getattr__', '__init__', '__str__',
+ '__repr__', '__hash__', '__iter__', '__getitem__',
+ '__len__', '__nonzero__'])
for attr, value in vars(Quantity).items():
if (isinstance(value, types.FunctionType) and
attr.startswith('__') and attr.endswith('__') and
@@ -87,7 +90,7 @@ def __new__(cls, abbrev, name, value, unit, uncertainty, reference,
warnings.warn('Constant {0!r} is already has a definition in the '
'{1!r} system'.format(name, system))
- inst = super(Constant, cls).__new__(cls)
+ inst = super(Constant, cls).__new__(cls, value)
for c in instances.values():
if system is not None and not hasattr(c.__class__, system):
View
@@ -30,6 +30,10 @@
G = Constant('G', "Gravitational constant", 6.67384e-11, 'm3 / (kg s2)',
0.00080e-11, 'CODATA 2010', system='si')
+# Standard acceleration of gravity
+g0 = Constant('g0', "Standard acceleration of gravity", 9.80665, 'm / s2', 0.0,
+ 'CODATA 2010', system='si')
+
# Proton mass
m_p = Constant('m_p', "Proton mass", 1.672621777e-27, 'kg', 0.000000074e-27,
'CODATA 2010', system='si')
@@ -66,6 +66,25 @@ def test_e():
assert e.esu * E == Q(e.esu.value * E.value, 'Fr V/m')
+def test_g0():
+ """Tests for #1263 demonstrating how g0 constant should behave."""
+ from .. import g0
+
+ # g0 is an exactly defined constant, so it shouldn't be changing
+ assert g0.value == 9.80665 # default is S.I.
+ assert g0.si.value == 9.80665
+ assert g0.cgs.value == 9.80665e2
+
+ # make sure it has the necessary attributes and they're not blank
+ assert g0.uncertainty == 0 # g0 is a *defined* quantity
+ assert g0.name
+ assert g0.reference
+ assert g0.unit
+
+ # Check that its unit have the correct physical type
+ assert g0.unit.physical_type == 'acceleration'
+
+
def test_unit():
from ... import units as u
@@ -4,6 +4,6 @@
_lexreflags = 0
_lexliterals = ''
_lexstateinfo = {'INITIAL': 'inclusive'}
-_lexstatere = {'INITIAL': [(u'(?P<t_UFLOAT>((\\d+\\.\\d*)|(\\.\\d+))([eE][+-]?\\d+)?)|(?P<t_UINT>\\d+)|(?P<t_SIGN>[+-])|(?P<t_SIMPLE_UNIT>(arcminute)|(rad)|(arcsec)|(uas)|(arcsecond)|(mas)|(arcmin)|(radian))|(?P<t_MINUTE>m(in(ute(s)?)?)?|\u2032|\\\')|(?P<t_SECOND>s(ec(ond(s)?)?)?|\u2033|\\")|(?P<t_DEGREE>d(eg(ree(s)?)?)?|\xb0)|(?P<t_HOUR>hour(s)?|h(r)?|\u02b0)|(?P<t_COLON>:)', [None, (u't_UFLOAT', 'UFLOAT'), None, None, None, None, (u't_UINT', 'UINT'), (u't_SIGN', 'SIGN'), (None, 'SIMPLE_UNIT'), None, None, None, None, None, None, None, None, (None, 'MINUTE'), None, None, None, (None, 'SECOND'), None, None, None, (None, 'DEGREE'), None, None, None, (None, 'HOUR'), None, None, (None, 'COLON')])]}
+_lexstatere = {'INITIAL': [(u'(?P<t_UFLOAT>((\\d+\\.\\d*)|(\\.\\d+))([eE][+-]?\\d+)?)|(?P<t_UINT>\\d+)|(?P<t_SIGN>[+-])|(?P<t_SIMPLE_UNIT>(?:hectoradian)|(?:petaradian)|(?:decaarcminute)|(?:hrad)|(?:zeptoradian)|(?:arcsec)|(?:aarcmin)|(?:Marcmin)|(?:Parcsec)|(?:kiloarcsecond)|(?:exaarcsecond)|(?:deciradian)|(?:yoctoarcminute)|(?:prad)|(?:Parcmin)|(?:yottaradian)|(?:marcmin)|(?:aarcsec)|(?:milliarcsecond)|(?:milliradian)|(?:parcsec)|(?:arad)|(?:uarcmin)|(?:parcmin)|(?:radian)|(?:dekaarcsecond)|(?:teraarcsecond)|(?:Tarcsec)|(?:attoarcsecond)|(?:yarcsec)|(?:krad)|(?:Zarcmin)|(?:Earcmin)|(?:exaarcminute)|(?:farcmin)|(?:Prad)|(?:dekaarcminute)|(?:Earcsec)|(?:Yarcsec)|(?:Garcmin)|(?:daarcmin)|(?:kiloradian)|(?:nanoarcminute)|(?:kiloarcminute)|(?:megaradian)|(?:zettaarcsecond)|(?:Zarcsec)|(?:carcsec)|(?:femtoarcsecond)|(?:Marcsec)|(?:arcminute)|(?:yarcmin)|(?:yoctoarcsecond)|(?:arcsecond)|(?:decaarcsecond)|(?:zeptoarcminute)|(?:attoradian)|(?:Grad)|(?:microarcminute)|(?:nrad)|(?:marcsec)|(?:picoarcminute)|(?:teraradian)|(?:narcsec)|(?:milliarcminute)|(?:zettaradian)|(?:darad)|(?:microradian)|(?:centiradian)|(?:gigaarcsecond)|(?:decaradian)|(?:exaradian)|(?:centiarcminute)|(?:cy)|(?:femtoradian)|(?:mrad)|(?:femtoarcminute)|(?:yottaarcsecond)|(?:centiarcsecond)|(?:gigaradian)|(?:zettaarcminute)|(?:gigaarcminute)|(?:yoctoradian)|(?:crad)|(?:picoradian)|(?:zrad)|(?:dekaradian)|(?:narcmin)|(?:farcsec)|(?:Erad)|(?:hectoarcminute)|(?:urad)|(?:nanoarcsecond)|(?:microarcsecond)|(?:hectoarcsecond)|(?:petaarcsecond)|(?:deciarcsecond)|(?:nanoradian)|(?:Mrad)|(?:carcmin)|(?:yottaarcminute)|(?:rad)|(?:uas)|(?:harcmin)|(?:megaarcsecond)|(?:yrad)|(?:Zrad)|(?:Yarcmin)|(?:zeptoarcsecond)|(?:zarcmin)|(?:darcmin)|(?:karcmin)|(?:attoarcminute)|(?:daarcsec)|(?:Tarcmin)|(?:Trad)|(?:mas)|(?:frad)|(?:petaarcminute)|(?:teraarcminute)|(?:harcsec)|(?:uarcsec)|(?:drad)|(?:arcmin)|(?:Garcsec)|(?:darcsec)|(?:zarcsec)|(?:cycle)|(?:karcsec)|(?:megaarcminute)|(?:deciarcminute)|(?:picoarcsecond)|(?:Yrad))|(?P<t_MINUTE>m(in(ute(s)?)?)?|\u2032|\\\'|\u1d50)|(?P<t_SECOND>s(ec(ond(s)?)?)?|\u2033|\\"|\u02e2)|(?P<t_DEGREE>d(eg(ree(s)?)?)?|\xb0)|(?P<t_HOUR>hour(s)?|h(r)?|\u02b0)|(?P<t_COLON>:)', [None, (u't_UFLOAT', 'UFLOAT'), None, None, None, None, (u't_UINT', 'UINT'), (u't_SIGN', 'SIGN'), (u't_SIMPLE_UNIT', 'SIMPLE_UNIT'), (None, 'MINUTE'), None, None, None, (None, 'SECOND'), None, None, None, (None, 'DEGREE'), None, None, None, (None, 'HOUR'), None, None, (None, 'COLON')])]}
_lexstateignore = {'INITIAL': u' '}
_lexstateerrorf = {'INITIAL': 't_error'}
Oops, something went wrong.

0 comments on commit 8fb6e1d

Please sign in to comment.