[Scipy-svn] r6948 - trunk/scipy/constants

scipy-svn@scip... scipy-svn@scip...
Sat Nov 27 02:10:46 CST 2010


Author: rgommers
Date: 2010-11-27 02:10:46 -0600 (Sat, 27 Nov 2010)
New Revision: 6948

Modified:
   trunk/scipy/constants/__init__.py
   trunk/scipy/constants/codata.py
   trunk/scipy/constants/constants.py
Log:
DOC: merge wiki edits for constants module, with some corrections.

Modified: trunk/scipy/constants/__init__.py
===================================================================
--- trunk/scipy/constants/__init__.py	2010-11-27 07:14:47 UTC (rev 6947)
+++ trunk/scipy/constants/__init__.py	2010-11-27 08:10:46 UTC (rev 6948)
@@ -1,4 +1,36 @@
+"""
+Various useful constants and conversion formulae
 
+Modules
+-------
+
+.. autosummary::
+   :toctree: generated/
+
+   codata - CODATA Recommended Values of Fundamental Physical Const (2006)
+   constants - Collection of physical constants and conversion factors
+
+Functions
+---------
+
+.. autosummary::
+   :toctree: generated/
+
+   C2F - Convert Celsius to Fahrenheit
+   C2K - Convert Celsius to Kelvin
+   F2C - Convert Fahrenheit to Celsius
+   F2K - Convert Fahrenheit to Kelvin
+   K2C - Convert Kelvin to Celsius
+   K2F - Convert Kelvin to Fahrenheit
+   find - Find the codata.physical_constant keys containing a given string
+   lambda2nu - Convert wavelength to optical frequency
+   nu2lambda - Convert optical frequency to wavelength
+   precision - Relative precision in physical_constants indexed by key
+   unit - Unit in physical_constants indexed by key
+   value - Value in physical_constants indexed by key
+
+"""
+
 # Modules contributed by BasSw (wegwerp@gmail.com)
 from codata import *
 from constants import *

Modified: trunk/scipy/constants/codata.py
===================================================================
--- trunk/scipy/constants/codata.py	2010-11-27 07:14:47 UTC (rev 6947)
+++ trunk/scipy/constants/codata.py	2010-11-27 08:10:46 UTC (rev 6948)
@@ -4,24 +4,53 @@
 
 """
 Fundamental Physical Constants
+------------------------------
+These constants are taken from CODATA Recommended Values of the Fundamental
+Physical Constants 2006.
 
-These constants are taken from CODATA Recommended Values of the
-Fundamental Physical Constants. They may be found at
+Object
+------
+physical_constants : dict
+    A dictionary containing physical constants. Keys are the names
+    of physical constants, values are tuples (value, units, precision).
 
+Functions
+---------
+value(key):
+    Returns the value of the physical constant(key).
+unit(key):
+    Returns the units of the physical constant(key).
+precision(key):
+    Returns the relative precision of the physical constant(key).
+find(sub):
+    Prints or returns list of keys containing the string sub,
+    default is all.
+
+Source
+------
+CODATA internationally recommended values are recommended for international
+use by CODATA and are the latest available. Termed the "2006 CODATA
+recommended values," they are generally recognized worldwide for use in all
+fields of science and technology. The values became available in March 2007
+and replaced the 2002 CODATA set. They are based on all of the data
+available through 31 December 2006. The 2006 adjustment was carried out
+under the auspices of the CODATA Task Group on Fundamental Constants. Also
+available is an Introduction to the constants for non-experts.
+
+Website
+-------
 http://physics.nist.gov/cuu/Constants/index.html
 
-The values are stored in the dictionary physical_constants as a tuple
-containing the value, the units, and the relative precision, in that
-order.  All constants are in SI units unless otherwise stated.
+References
+----------
+Theoretical and experimental publications relevant to the
+fundamental constants and closely related precision measurements
+published since the mid 1980s, but also including many older
+papers of particular interest, some of which date back to the
+1800s. To search bibliography visit
 
-Several helper functions are provided:
+http://physics.nist.gov/cuu/Constants/Citations/Search.html
 
-    value(key) : Returns the value of the physical constant.
-    unit(key) : Returns the units of the physical constant.
-    precision(key) : Returns the relative precision of the physical constant.
-    find(sub) : Prints a list of keys containing the string sub.
-                If sub is not specified, returns all keys.
-
 """
 
 from math import pi, sqrt
@@ -400,11 +429,11 @@
     codata : Contains the description of `physical_constants`, which, as a
         dictionary literal object, does not itself possess a docstring.
 
-    Examples
+        Examples
     --------
     >>> from scipy.constants import codata
     >>> codata.value('elementary charge')
-    1.60217653e-019
+        1.602176487e-019
 
     """
     return physical_constants[key][0]
@@ -460,7 +489,7 @@
     --------
     >>> from scipy.constants import codata
     >>> codata.precision(u'proton mass')
-    1.7338050694080732e-007
+    4.96226989798e-08
 
     """
     return physical_constants[key][2] / physical_constants[key][0]

Modified: trunk/scipy/constants/constants.py
===================================================================
--- trunk/scipy/constants/constants.py	2010-11-27 07:14:47 UTC (rev 6947)
+++ trunk/scipy/constants/constants.py	2010-11-27 08:10:46 UTC (rev 6948)
@@ -177,17 +177,17 @@
 
     Parameters
     ----------
-    C : float-like scalar or array-like
-        Celsius temperature(s) to be converted
+    C : array_like
+        Celsius temperature(s) to be converted.
 
     Returns
     -------
-    K : float or a numpy array of floats, corresponding to type of Parameters
-        Equivalent Kelvin temperature(s)
+    K : float or array of floats
+        Equivalent Kelvin temperature(s).
 
     Notes
     -----
-    Computes `K = C +` `zero_Celsius` where `zero_Celsius` = 273.15, i.e.,
+    Computes ``K = C + zero_Celsius`` where `zero_Celsius` = 273.15, i.e.,
     (the absolute value of) temperature "absolute zero" as measured in Celsius.
 
     Examples
@@ -205,17 +205,17 @@
 
     Parameters
     ----------
-    K : float-like scalar or array-like
-        Kelvin temperature(s) to be converted
+    K : array_like
+        Kelvin temperature(s) to be converted.
 
     Returns
     -------
-    C : float or a numpy array of floats, corresponding to type of Parameters
-        Equivalent Celsius temperature(s)
+    C : float or array of floats
+        Equivalent Celsius temperature(s).
 
     Notes
     -----
-    Computes `C = K -` `zero_Celsius` where `zero_Celsius` = 273.15, i.e.,
+    Computes ``C = K - zero_Celsius`` where `zero_Celsius` = 273.15, i.e.,
     (the absolute value of) temperature "absolute zero" as measured in Celsius.
 
     Examples
@@ -233,17 +233,17 @@
 
     Parameters
     ----------
-    F : float-like scalar or array-like
-        Fahrenheit temperature(s) to be converted
+    F : array_like
+        Fahrenheit temperature(s) to be converted.
 
     Returns
     -------
-    C : float or a numpy array of floats, corresponding to type of Parameters
-        Equivalent Celsius temperature(s)
+    C : float or array of floats
+        Equivalent Celsius temperature(s).
 
     Notes
     -----
-    Computes `C = (F - 32) / 1.8`
+    Computes ``C = (F - 32) / 1.8``.
 
     Examples
     --------
@@ -260,17 +260,17 @@
 
     Parameters
     ----------
-    C : float-like scalar or array-like
-        Celsius temperature(s) to be converted
+    C : array_like
+        Celsius temperature(s) to be converted.
 
     Returns
     -------
-    F : float or a numpy array of floats, corresponding to type of Parameters
-        Equivalent Fahrenheit temperature(s)
+    F : float or array of floats
+        Equivalent Fahrenheit temperature(s).
 
     Notes
     -----
-    Computes `F = 1.8 * C + 32`
+    Computes ``F = 1.8 * C + 32``.
 
     Examples
     --------
@@ -287,17 +287,17 @@
 
     Parameters
     ----------
-    F : float-like scalar or array-like
-        Fahrenheit temperature(s) to be converted
+    F : array_like
+        Fahrenheit temperature(s) to be converted.
 
     Returns
     -------
-    K : float or a numpy array of floats, corresponding to type of Parameters
-        Equivalent Kelvin temperature(s)
+    K : float or array of floats
+        Equivalent Kelvin temperature(s).
 
     Notes
     -----
-    Computes `K = (F - 32)/1.8 +` `zero_Celsius` where `zero_Celsius` =
+    Computes ``K = (F - 32)/1.8 + zero_Celsius`` where `zero_Celsius` =
     273.15, i.e., (the absolute value of) temperature "absolute zero" as
     measured in Celsius.
 
@@ -316,17 +316,17 @@
 
     Parameters
     ----------
-    K : float-like scalar or array-like
-        Kelvin temperature(s) to be converted
+    K : array_like
+        Kelvin temperature(s) to be converted.
 
     Returns
     -------
-    F : float or a numpy array of floats, corresponding to type of Parameters
-        Equivalent Fahrenheit temperature(s)
+    F : float or array of floats
+        Equivalent Fahrenheit temperature(s).
 
     Notes
     -----
-    Computes `F = 1.8 * (K -` `zero_Celsius` `) + 32` where `zero_Celsius` =
+    Computes ``F = 1.8 * (K - zero_Celsius) + 32`` where `zero_Celsius` =
     273.15, i.e., (the absolute value of) temperature "absolute zero" as
     measured in Celsius.
 
@@ -347,17 +347,17 @@
 
     Parameters
     ----------
-    lambda : float-like scalar or array-like
-        Wavelength(s) to be converted
+    lambda : array_like
+        Wavelength(s) to be converted.
 
     Returns
     -------
-    nu : float or a numpy array of floats, corresponding to type of Parameters
-        Equivalent optical frequency(ies)
+    nu : float or array of floats
+        Equivalent optical frequency.
 
     Notes
     -----
-    Computes :math:`\\nu = c / \\lambda` where `c` = 299792458.0, i.e., the
+    Computes ``nu = c / lambda`` where c = 299792458.0, i.e., the
     (vacuum) speed of light in meters/second.
 
     Examples
@@ -375,17 +375,17 @@
 
     Parameters
     ----------
-    nu : float-like scalar or array-like
-        Optical frequency(ies) to be converted
+    nu : array_like
+        Optical frequency to be converted.
 
     Returns
     -------
-    lambda : float or a numpy array of floats, corresp. to type of Parameters
-        Equivalent wavelength(s)
+    lambda : float or array of floats
+        Equivalent wavelength(s).
 
     Notes
     -----
-    Computes :math:`\\lambda = c / \\nu` where `c` = 299792458.0, i.e., the
+    Computes ``lambda = c / nu`` where c = 299792458.0, i.e., the
     (vacuum) speed of light in meters/second.
 
     Examples



More information about the Scipy-svn mailing list