1.4.1 make a quantity from a string or from a numeric value and a unit
string
Description
quantity makes a quantity from a string, or from a value and a string. Note
that a function unit exists which is a synonym for quantity. If only a string is
given, it can be a scalar string. The result will be a scalar quantity.
If a numeric value and a unit string are given, the numeric value can be any numeric type, and can also be a vector of numeric values.
Arguments
| Inputs |
| ||
| v |
| quantity or numeric or string to convert to quantity
| |
| allowed: | variant |
|
| Default: |
|
|
| unitname |
| unit string if v numeric
| |
| allowed: | string |
|
| Default: |
|
|
Example
"""
# print "\t----\t quantity Ex 1 \t----" tu = qa.quantity(’1Jy’) # make quantity print tu #{’value’: 1.0, ’unit’: ’Jy’} print qa.quantity(tu) # also accepts a quantity #{’value’: 1.0, ’unit’: ’Jy’} tu = qa.unit(’1Jy’) # make quantity with synonym print tu #{’value’: 1.0, ’unit’: ’Jy’} print qa.quantity(-1.3, ’Jy’) # make quantity with separate value #{’value’: -1.3, ’unit’: ’Jy’} q1 = qa.quantity([8.57132661e+09, 1.71426532e+10], ’km/s’) print q1 #{’value’: array([ 8.57132661e+09, 1.71426532e+10]), ’unit’: ’km/s’} # """ |
Please send any comments or questions about CASA or AIPS++ to aips2-requests@nrao.edu
Copyright © 2008 Associated Universities Inc., Washington, D.C.
This code is available under the terms of the GNU General Public Lincense
Home |
Contact Us |
Directories |
Site Map |
Help |
Privacy Policy |
Search
Updated daily during alpha development.