Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

515

516

517

518

519

520

521

522

523

524

525

526

527

528

529

530

531

532

533

534

535

536

537

538

539

540

541

542

543

544

545

546

547

548

549

550

551

552

553

554

555

556

557

558

559

560

561

562

563

564

565

566

567

568

569

570

571

572

573

574

575

576

577

578

579

580

581

582

583

584

585

586

587

588

589

590

591

592

593

594

595

596

597

598

599

600

601

602

603

604

605

606

607

608

609

610

611

612

613

614

615

616

617

618

619

620

621

622

623

624

625

626

627

628

629

630

631

632

633

634

635

636

637

638

639

640

641

642

643

644

645

646

647

648

649

650

651

652

653

654

655

656

657

658

659

660

661

662

663

664

665

666

667

668

669

670

671

672

673

674

675

676

677

678

679

680

681

682

683

684

685

686

687

688

689

690

691

692

693

694

695

696

697

698

699

700

701

702

703

704

705

706

707

708

709

710

711

712

713

714

715

716

717

718

719

720

721

722

723

724

725

726

727

728

729

730

731

732

733

734

735

736

737

738

739

740

741

742

743

744

745

746

747

748

749

750

751

752

753

754

755

756

757

758

759

760

761

762

763

764

765

766

767

768

769

770

771

772

773

774

775

776

777

778

779

780

781

782

783

784

785

786

787

788

789

790

791

792

793

794

795

796

797

798

799

800

801

802

803

804

805

806

807

808

809

810

811

812

813

814

815

816

817

818

819

820

821

822

823

824

825

826

827

828

829

830

831

832

833

834

835

836

837

838

839

840

841

842

843

844

845

846

847

848

849

850

851

852

853

854

855

856

857

858

859

860

861

862

863

864

865

866

867

868

869

870

871

872

873

874

875

876

877

878

879

880

881

882

883

884

885

886

887

888

889

890

891

892

893

894

895

896

897

898

899

900

901

902

903

904

905

906

907

908

909

910

911

912

913

914

915

916

917

918

919

920

921

922

923

924

925

926

927

928

929

930

931

932

933

934

935

936

937

938

939

940

941

942

943

944

945

946

947

948

949

950

951

952

953

954

955

956

957

958

959

960

961

962

963

964

965

966

967

968

969

970

971

972

973

974

975

976

977

978

979

980

981

982

983

984

985

986

987

988

989

990

991

992

993

994

995

996

997

998

999

1000

1001

1002

1003

1004

1005

1006

1007

1008

1009

1010

1011

1012

1013

1014

1015

1016

1017

1018

1019

1020

1021

1022

1023

1024

1025

1026

1027

1028

1029

1030

1031

1032

1033

1034

1035

1036

1037

1038

1039

1040

1041

1042

1043

1044

1045

1046

1047

1048

1049

1050

1051

1052

1053

1054

1055

1056

1057

1058

1059

1060

1061

1062

1063

1064

1065

1066

1067

1068

1069

1070

1071

1072

1073

1074

1075

1076

1077

1078

1079

1080

1081

1082

1083

1084

1085

1086

1087

1088

1089

1090

1091

1092

1093

1094

1095

1096

1097

1098

1099

1100

1101

1102

1103

1104

1105

1106

1107

1108

1109

1110

1111

1112

1113

1114

1115

1116

1117

1118

1119

1120

1121

1122

1123

1124

1125

1126

1127

1128

1129

1130

1131

1132

1133

1134

1135

1136

1137

1138

1139

1140

1141

1142

1143

1144

1145

1146

1147

1148

1149

1150

1151

1152

1153

1154

1155

1156

1157

1158

1159

1160

1161

1162

1163

1164

1165

1166

1167

1168

1169

1170

1171

1172

1173

1174

1175

1176

1177

1178

1179

1180

1181

1182

1183

1184

1185

1186

1187

1188

1189

1190

1191

1192

1193

1194

1195

1196

1197

1198

1199

1200

1201

1202

1203

1204

1205

1206

1207

1208

1209

1210

1211

1212

1213

1214

1215

1216

1217

1218

1219

1220

1221

1222

1223

1224

1225

1226

1227

1228

1229

1230

1231

1232

1233

1234

1235

1236

1237

1238

1239

1240

1241

1242

1243

1244

1245

1246

1247

1248

1249

1250

1251

1252

1253

1254

1255

1256

1257

1258

1259

1260

1261

1262

1263

1264

1265

1266

1267

1268

1269

1270

1271

1272

1273

1274

1275

1276

1277

1278

1279

1280

1281

1282

1283

1284

1285

1286

1287

1288

1289

1290

1291

1292

1293

1294

1295

1296

1297

1298

1299

1300

1301

1302

1303

1304

1305

1306

1307

1308

1309

1310

1311

1312

1313

1314

1315

1316

1317

1318

1319

1320

1321

1322

1323

1324

1325

1326

1327

1328

1329

1330

1331

1332

1333

1334

1335

1336

1337

1338

1339

1340

1341

1342

1343

1344

1345

1346

1347

1348

1349

1350

1351

1352

1353

1354

1355

1356

1357

1358

1359

1360

1361

1362

1363

1364

1365

1366

1367

1368

1369

1370

1371

1372

1373

1374

1375

1376

1377

1378

1379

1380

1381

1382

1383

1384

1385

1386

1387

1388

1389

1390

1391

1392

1393

1394

1395

1396

1397

1398

1399

1400

1401

1402

1403

1404

1405

1406

1407

1408

1409

1410

1411

1412

1413

1414

1415

1416

1417

1418

1419

1420

1421

1422

1423

1424

1425

1426

1427

1428

1429

1430

1431

1432

1433

1434

1435

1436

1437

1438

1439

1440

1441

1442

1443

1444

1445

1446

1447

1448

1449

1450

1451

1452

1453

1454

1455

1456

1457

1458

1459

1460

1461

1462

1463

1464

1465

1466

1467

1468

1469

1470

1471

1472

1473

1474

1475

1476

1477

1478

1479

1480

1481

1482

1483

1484

1485

1486

1487

1488

1489

1490

1491

1492

1493

1494

1495

1496

1497

1498

1499

1500

1501

1502

1503

1504

1505

1506

1507

1508

1509

1510

1511

1512

1513

1514

1515

1516

1517

1518

1519

1520

1521

1522

1523

1524

1525

1526

1527

1528

1529

1530

1531

1532

1533

1534

1535

1536

1537

1538

1539

1540

1541

1542

1543

1544

1545

1546

1547

1548

1549

1550

1551

1552

1553

1554

1555

1556

1557

1558

1559

1560

1561

1562

1563

1564

1565

1566

1567

1568

1569

1570

1571

1572

1573

1574

1575

1576

1577

1578

1579

1580

1581

1582

1583

1584

1585

1586

1587

1588

1589

1590

1591

1592

1593

1594

1595

1596

1597

1598

1599

1600

1601

1602

1603

1604

1605

1606

1607

1608

1609

1610

1611

1612

1613

1614

1615

1616

1617

1618

1619

1620

1621

1622

1623

1624

1625

1626

1627

1628

1629

1630

1631

1632

1633

1634

1635

1636

1637

1638

1639

1640

1641

1642

1643

1644

1645

1646

1647

1648

1649

1650

1651

1652

1653

1654

1655

1656

1657

1658

1659

1660

1661

1662

1663

1664

1665

1666

1667

1668

1669

1670

1671

1672

1673

1674

1675

1676

1677

1678

1679

1680

1681

1682

1683

1684

1685

1686

1687

1688

1689

1690

1691

1692

1693

1694

1695

1696

1697

1698

1699

1700

1701

1702

1703

1704

1705

1706

1707

1708

1709

1710

1711

1712

1713

1714

1715

1716

1717

1718

1719

1720

1721

1722

1723

1724

1725

1726

1727

1728

1729

1730

1731

1732

1733

1734

1735

1736

1737

1738

1739

1740

1741

1742

1743

1744

1745

1746

1747

1748

1749

1750

1751

1752

1753

1754

1755

1756

1757

1758

1759

1760

1761

1762

1763

1764

1765

1766

1767

1768

1769

1770

1771

1772

1773

1774

1775

1776

1777

1778

1779

1780

1781

1782

1783

1784

1785

1786

1787

1788

1789

1790

1791

1792

1793

1794

1795

1796

1797

1798

1799

1800

1801

1802

1803

1804

1805

1806

1807

1808

1809

1810

1811

1812

1813

1814

1815

1816

1817

1818

1819

1820

1821

1822

1823

1824

1825

1826

1827

1828

1829

1830

1831

1832

1833

1834

1835

1836

1837

1838

1839

1840

1841

1842

1843

1844

1845

1846

1847

1848

1849

1850

1851

1852

1853

1854

1855

1856

1857

1858

1859

1860

1861

1862

1863

1864

1865

1866

1867

1868

1869

1870

1871

1872

1873

1874

1875

1876

1877

1878

1879

1880

1881

1882

1883

1884

1885

1886

1887

1888

1889

1890

1891

1892

1893

1894

1895

1896

1897

1898

1899

1900

1901

1902

1903

1904

1905

1906

1907

1908

1909

1910

1911

1912

1913

1914

1915

1916

1917

1918

1919

1920

1921

1922

1923

1924

1925

1926

1927

1928

1929

1930

1931

1932

1933

1934

1935

1936

1937

1938

1939

1940

1941

1942

1943

1944

1945

1946

1947

1948

1949

1950

1951

1952

1953

1954

1955

1956

1957

1958

1959

1960

1961

1962

1963

1964

1965

1966

1967

1968

1969

1970

1971

1972

1973

1974

1975

1976

1977

1978

1979

1980

1981

1982

1983

1984

1985

1986

1987

1988

1989

1990

1991

1992

1993

1994

1995

1996

1997

1998

1999

2000

2001

2002

2003

2004

2005

2006

2007

2008

2009

2010

2011

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

2022

2023

2024

2025

2026

2027

2028

2029

2030

2031

2032

2033

2034

2035

2036

2037

2038

2039

2040

2041

2042

2043

2044

2045

2046

2047

2048

2049

2050

2051

2052

2053

2054

2055

2056

2057

2058

2059

2060

2061

2062

2063

2064

2065

2066

2067

2068

2069

2070

2071

2072

2073

2074

2075

2076

2077

2078

2079

2080

2081

2082

2083

2084

2085

2086

2087

2088

2089

2090

2091

2092

2093

2094

2095

2096

2097

2098

2099

2100

2101

2102

2103

2104

2105

2106

2107

2108

2109

2110

2111

2112

2113

2114

2115

2116

2117

2118

2119

2120

2121

2122

2123

2124

2125

2126

2127

2128

2129

2130

2131

2132

2133

2134

2135

2136

2137

2138

2139

2140

2141

2142

2143

2144

2145

2146

2147

2148

2149

2150

2151

2152

2153

2154

2155

2156

2157

2158

2159

2160

2161

2162

2163

2164

2165

2166

2167

2168

2169

2170

2171

2172

2173

2174

2175

2176

2177

2178

2179

2180

2181

2182

2183

2184

2185

2186

2187

2188

2189

2190

2191

2192

2193

2194

2195

2196

2197

2198

2199

2200

2201

2202

2203

2204

2205

2206

2207

2208

2209

2210

2211

2212

2213

2214

2215

2216

2217

2218

2219

2220

2221

2222

2223

2224

2225

# This file was automatically generated by SWIG (http://www.swig.org). 

# Version 2.0.4 

# 

# Do not make changes to this file unless you know what you are doing--modify 

# the SWIG interface file instead. 

 

 

 

from sys import version_info 

if version_info >= (2,6,0): 

    def swig_import_helper(): 

        from os.path import dirname 

        import imp 

        fp = None 

        try: 

            fp, pathname, description = imp.find_module('_quanta', [dirname(__file__)]) 

        except ImportError: 

            import _quanta 

            return _quanta 

        if fp is not None: 

            try: 

                _mod = imp.load_module('_quanta', fp, pathname, description) 

            finally: 

                fp.close() 

            return _mod 

    _quanta = swig_import_helper() 

    del swig_import_helper 

else: 

    import _quanta 

del version_info 

try: 

    _swig_property = property 

except NameError: 

    pass # Python < 2.2 doesn't have 'property'. 

def _swig_setattr_nondynamic(self,class_type,name,value,static=1): 

    if (name == "thisown"): return self.this.own(value) 

    if (name == "this"): 

        if type(value).__name__ == 'SwigPyObject': 

            self.__dict__[name] = value 

            return 

    method = class_type.__swig_setmethods__.get(name,None) 

    if method: return method(self,value) 

    if (not static): 

        self.__dict__[name] = value 

    else: 

        raise AttributeError("You cannot add attributes to %s" % self) 

 

def _swig_setattr(self,class_type,name,value): 

    return _swig_setattr_nondynamic(self,class_type,name,value,0) 

 

def _swig_getattr(self,class_type,name): 

    if (name == "thisown"): return self.this.own() 

    method = class_type.__swig_getmethods__.get(name,None) 

    if method: return method(self) 

    raise AttributeError(name) 

 

def _swig_repr(self): 

    try: strthis = "proxy of " + self.this.__repr__() 

    except: strthis = "" 

    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) 

 

try: 

    _object = object 

    _newclass = 1 

except AttributeError: 

    class _object : pass 

    _newclass = 0 

 

 

class quanta(_object): 

    """Proxy of C++ casac::quanta class""" 

    __swig_setmethods__ = {} 

    __setattr__ = lambda self, name, value: _swig_setattr(self, quanta, name, value) 

    __swig_getmethods__ = {} 

    __getattr__ = lambda self, name: _swig_getattr(self, quanta, name) 

    __repr__ = _swig_repr 

    def __init__(self): 

        """__init__(self) -> quanta""" 

        this = _quanta.new_quanta() 

        try: self.this.append(this) 

        except: self.this = this 

    __swig_destroy__ = _quanta.delete_quanta 

    __del__ = lambda self : None; 

    def convertfreq(self, *args, **kwargs): 

        """ 

        convertfreq(self, v = initialize_variant("1.0"), outunit = string("Hz")) -> record 

 

        Summary 

                convert a frequency quantity to another unit 

 

        Description 

                 

        convertfreq converts a frequency quantity to another unit. 

 

 

 

        Input Parameters: 

                v                quantity to convert 1.0  

                outunit          unit to convert to Hz  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     convertfreq Ex 1       ----' 

        print qa.convertfreq('5GHz','cm') 

        #{'value': 5.9958491599999997, 'unit': 'cm'} 

        print qa.convertfreq('5cm','GHz') 

        #{'value': 5.9958491599999997, 'unit': 'GHz'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_convertfreq(self, *args, **kwargs) 

 

    def convertdop(self, *args, **kwargs): 

        """ 

        convertdop(self, v = initialize_variant("0.0"), outunit = string("km/s")) -> record 

 

        Summary 

                convert a doppler velocity quantity to another unit 

 

        Description 

                 

        convertfreq converts a velocity quantity to another unit. Units are either 

         velocity or dimensionless. 

 

 

        Input Parameters: 

                v                quantity to convert 0.0  

                outunit          unit to convert to km/s  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     convertdop Ex 1        ----' 

        print qa.convertdop('1','km/s') 

        #{'value': 299792.45799999998, 'unit': 'km/s'} 

        print qa.convertdop('10km/s','1')  

        #{'value': 3.3356409519815205e-05, 'unit': '1'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_convertdop(self, *args, **kwargs) 

 

    def quantity(self, *args, **kwargs): 

        """ 

        quantity(self, v, unitname = string("")) -> record 

 

        Summary 

                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.  print qa.map() to get a list of recognized units. 

        'd' is usually days, but can be degrees (see example). 

 

 

 

        Input Parameters: 

                v                quantity or numeric or string to convert to quantity  

                unitname         unit string if v numeric  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     quantity Ex 1  ----' 

        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') # Composite unit 

        print q1 

        #{'value': array([  8.57132661e+09,   1.71426532e+10]), 'unit': 'km/s'} 

        q = qa.quantity('5d'); print q 

        #{'value': 5.0, 'unit': 'd'}            # d = days 

        q = qa.quantity('5 d'); print q 

        #{'value': 5.0, 'unit': 'd'}            # even if there's a space, as of 5/28/09 

        q = qa.quantity('5d30m'); print q 

        #{'value': 5.5, 'unit': 'deg'}          # Unless followed by an m! 

        qa.quantity('5d30s')                    # WRONG 

        # {'unit': 'd30s', 'value': 5.0}        # I told you... 

        qa.quantity('5d0m30s')                  # OK 

        # {'unit': 'deg', 'value': 5.0083333333333337} 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_quantity(self, *args, **kwargs) 

 

    def getvalue(self, *args, **kwargs): 

        """ 

        getvalue(self, v) -> std::vector<(double)> 

 

        Summary 

                get the internal value of a quantity 

 

        Description 

                 

        getvalue returns the internal value of a quantity. It also can handle an array 

        of quantities. 

 

 

        Input Parameters: 

                v                quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     getvalue Ex 1  ----' 

        tu = qa.quantity(-1.3, 'Jy')         # make quantity 

        print tu 

        #{'value': -1.3, 'unit': 'Jy'} 

        print qa.getvalue(tu) 

        #-1.3  

        print qa.getunit(tu) 

        #Jy  

        a = qa.quantity([3,5],'cm') 

        print a 

        #{'value': array([ 3.,  5.]), 'unit': 'cm'} 

        print qa.getvalue(a) 

        #[3.0, 5.0] 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_getvalue(self, *args, **kwargs) 

 

    def getunit(self, *args, **kwargs): 

        """ 

        getunit(self, v) -> string 

 

        Summary 

                get the internal unit of a quantity 

 

        Description 

                 

        getunit returns the internal unit string of a quantity 

 

 

        Input Parameters: 

                v                quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     getunit Ex 1   ----' 

        tu = qa.quantity(-1.3, 'Jy')         # make quantity 

        print tu 

        #{'value': -1.3, 'unit': 'Jy'} 

        print qa.getvalue(tu) 

        #-1.3  

        print qa.getunit(tu) 

        #Jy  

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_getunit(self, *args, **kwargs) 

 

    def canonical(self, *args, **kwargs): 

        """ 

        canonical(self, v = initialize_variant("1.0")) -> record 

 

        Summary 

                get canonical value of quantity 

 

        Description 

                 

        canonical (with alias canon) gets the canonical value of a quantity 

 

 

        Input Parameters: 

                v                value to convert 1.0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     canonical Ex 1         ----' 

        print qa.canonical('1Jy')                       # canonical value of a string 

        #{'value': 1e-26, 'unit': 'kg.s-2'} 

        print qa.canon(qa.quantity('1Jy'))              # canonical value of a unit 

        #{'value': 1e-26, 'unit': 'kg.s-2'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_canonical(self, *args, **kwargs) 

 

    def canon(self, *args, **kwargs): 

        """ 

        canon(self, v) -> record 

 

        Summary 

                get canonical value of quantity 

 

        Description 

                 

        canon gets the canonical value of a quantity 

 

 

        Input Parameters: 

                v                value to convert  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     canon Ex 1     ----' 

        print qa.canon('1Jy')                           # canonical value of a string 

        #{'value': 1e-26, 'unit': 'kg.s-2'} 

        print qa.canonical(qa.quantity('1Jy'))          # canonical value of a unit 

        #{'value': 1e-26, 'unit': 'kg.s-2'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_canon(self, *args, **kwargs) 

 

    def convert(self, *args, **kwargs): 

        """ 

        convert(self, v, outunit) -> record 

 

        Summary 

                convert a quantity to another unit 

 

        Description 

                 

        convert converts a quantity to another unit. If no output unit given, 

        conversion is to canonical units 

 

 

        Input Parameters: 

                v                quantity to convert  

                outunit          unit to convert to  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     convert Ex 1   ----' 

        tu = qa.quantity('5Mm/s')               # specify a quantity 

        print tu 

        #{'value': 5.0, 'unit': 'Mm/s'} 

        print qa.convert(tu, 'pc/a')            # convert it to parsec per year 

        #{'value': 0.0051135608266237404, 'unit': 'pc/a'} 

        print qa.convert(tu)                    # convert to canonical units 

        #{'value': 5000000.0, 'unit': 'm.s-1'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_convert(self, *args, **kwargs) 

 

    def define(self, *args, **kwargs): 

        """ 

        define(self, name, v = initialize_variant("1")) -> bool 

 

        Summary 

                define a new unit name 

 

        Description 

                 

        define defines the name and value of a user defined unit 

 

 

        Input Parameters: 

                name             name of unit to define  

                v                quantity value of new unit 1  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     define Ex 1    ----' 

        print qa.define('JY','1Jy')                     # your misspelling 

        #True 

        print qa.define('VLAunit', '0.898 JY')  # a special unit using it 

        #True 

        print qa.quantity('5 VLAunit')                  # check its use 

        #{'value': 5.0, 'unit': 'VLAunit'} 

        print qa.convert('5 VLAunit','Jy') 

        #{'value': 4.4900000000000002, 'unit': 'Jy'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_define(self, *args, **kwargs) 

 

    def map(self, *args, **kwargs): 

        """ 

        map(self, v = string("all")) -> string 

 

        Summary 

                list known unit names and constants 

 

        Description 

                 

        map lists the known mapping of units and constants. It has a single argument, 

        which can be a coded string (no-case, minimax match): 

        egin{description} 

        \item[all] all of the following units (not constants): also the default  

        \item[Prefix] known decimal prefixes 

        \item[SI] known SI units 

        \item[Customary] a set of customary units known to programs 

        \item[User] units defined by the user 

        \item[Constants] known constants (note: only 'const', 'Const', 'constants' 

        and 'Constants' recognised). 

        nd{description} 

 

 

        Input Parameters: 

                v                type of information to list - coded string all  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     map Ex 1       ----' 

        print qa.map('pre')                     # list decimal prefixes 

        #        == Prefix ==== 20 ==== 

        #        E         (exa)                        1e+18 

        #        G         (giga)                       1000000000 

        #        M         (mega)                       1000000 

        #        P         (peta)                       1e+15 

        #        T         (tera)                       1e+12 

        #        Y         (yotta)                      1e+24 

        #        Z         (zetta)                      1e+21 

        #        a         (atto)                       1e-18 

        #        c         (centi)                      0.01 

        #        d         (deci)                       0.1 

        #        da        (deka)                       10 

        #        f         (femto)                      1e-15 

        #        h         (hecto)                      100 

        #        k         (kilo)                       1000 

        #        m         (milli)                      0.001 

        #        n         (nano)                       1e-09 

        #        p         (pico)                       1e-12 

        #        u         (micro)                      1e-06 

        #        y         (yocto)                      1e-24 

        #        z         (zepto)                      1e-21 

        print qa.map('Constants')                       # list known constants 

        #        == Constants ==== 

        #        pi    3.14..                    3.14159  

        #        ee    2.71..                    2.71828  

        #        c     light vel.                2.99792e+08 m/s 

        #        G     grav. const               6.67259e-11 N.m2/kg2 

        #        h     Planck const              6.62608e-34 J.s 

        #        HI    HI line                   1420.41 MHz 

        #        R     gas const                 8.31451 J/K/mol 

        #        NA    Avogadro #                6.02214e+23 mol-1 

        #        e     electron charge           1.60218e-19 C 

        #        mp    proton mass               1.67262e-27 kg 

        #        mp_me mp/me                     1836.15  

        #        mu0   permeability vac.         1.25664e-06 H/m 

        #        eps0  permittivity vac.         1.60218e-19 C 

        #        k     Boltzmann const           1.38066e-23 J/K 

        #        F     Faraday const             96485.3 C/mol 

        #        me    electron mass             9.10939e-31 kg 

        #        re    electron radius           2.8179e-15 m 

        #        a0    Bohr's radius             5.2918e-11 m 

        #        R0    solar radius              6.9599e+08 m 

        #        k2    IAU grav. const^2         0.000295912 AU3/d2/S0 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_map(self, *args, **kwargs) 

 

    def maprec(self, *args, **kwargs): 

        """ 

        maprec(self, v = string("all")) -> record 

 

        Summary 

                create record containing list of known unit names and 

           constants 

 

        Description 

                 

        maprec returns a record with the known mapping of units and constants. It has a single argument, 

        which can be a coded string (no-case, minimax match): 

        egin{description} 

        \item[all] all of the following units (not constants): also the default  

        \item[Prefix] known decimal prefixes 

        \item[SI] known SI units 

        \item[Customary] a set of customary units known to programs 

        \item[User] units defined by the user 

        nd{description} 

 

 

        Input Parameters: 

                v                type of information to list - coded string all  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     maprec Ex 1    ----' 

        p = qa.maprec('pre')                    # list decimal prefixes 

        print p['Prefix_G'] 

        #        G         (giga)               1000000000 

        s = qa.maprec('SI')                     # list SI units 

        print s['SI_Jy'] 

        #Jy        (jansky)                     1e-26 kg.s-2 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_maprec(self, *args, **kwargs) 

 

    def fits(self): 

        """ 

        fits(self) -> bool 

 

        Summary 

                define some FITS units 

 

        Description 

                 

        fits defines some unit names used in reading and writing FITS files. 

 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     fits Ex 1      ----' 

        print qa.fits() 

        #True 

        print qa.map('user') 

        #        == User ==== 

        #        BEAM      (dimensionless beam)         1 _ 

        #        DAYS      (day)                        86400 s 

        #        DEG       (degree)                     0.0174532925199 rad 

        #        DEGREES   (degree)                     0.0174532925199 rad 

        #        HZ        (hertz)                      1 s-1 

        #        JY        (jansky)                     1e-26 kg.s-2 

        #        KELVIN    (kelvin)                     1 K 

        #        KELVINS   (kelvin)                     1 K 

        #        KM        (km)                         1000 m 

        #        M         (meter)                      1 m 

        #        METERS    (meter)                      1 m 

        #        PASCAL    (pascal)                     1 m-1.kg.s-2 

        #        PIXEL     (dimensionless pixel)        1 _ 

        #        S         (second)                     1 s 

        #        SEC       (second)                     1 s 

        #        SECONDS   (second)                     1 s 

        #        VOLTS     (volt)                       1 m2.kg.s-3.A-1 

        #        YEAR      (year)                       31557600 s 

        #        YEARS     (year)                       31557600 s 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_fits(self) 

 

    def angle(self, *args, **kwargs): 

        """ 

        angle(self, v, prec = 0, form = std::vector< string >(1, ""), showform = False) -> std::vector<(std::string)> 

 

        Summary 

                show an angle as a formatted string 

 

        Description 

                 

        angle converts an angle quantity to a formatted string. The formatting 

        information is a precision (0 is default, 6 includes +-ddd.mm.ss) and a 

        string array of codes (no-case, minimax match): 

        Codes include: 

        egin{description} 

        \item[clean] delete leading/trailing superfluous separators 

        \item[no\_d] do not show degrees part 

        \item[no\_dm] do not show degrees and minutes part 

        \item[dig2] show only 2 digits of degrees in angle format 

        \item[time] show as time (hh:mm:ss.ttt) rather than as angle 

        nd{description} 

        If a multi-dimensional value is given for the value $v$, the returned value 

        is a string vector of a length equal to last dimension. Each string has a 

        number of fields equal to the number of elements in all earlier 

        dimensions. If the {m showform} is $T$, each vector element is surrounded 

        by a pair of square brackets if there is more than one entry, and fields are 

        separated by a ','. 

 

 

        Input Parameters: 

                v                angle quantity value to output  

                prec             number of digits shown 0  

                form             formatting information in coded string array  

                showform         show square brackets and separating , false  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     angle Ex 1     ----' 

        tu = qa.quantity('5.7.12.345678')               # define an angle 

        print tu 

        #{'value': 5.1200960216666669, 'unit': 'deg'} 

        print qa.angle(tu)                              # default output 

        #+005.07.12  

        print qa.angle(tu, prec=7)                      # 7 digits 

        #+005.07.12.3  

        print qa.angle(tu, prec=4)                      # 4 digits 

        #+005.07.  

        print qa.angle(tu, form=['tim','no_d'])         # as time, no hours shown 

        #:20:29  

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_angle(self, *args, **kwargs) 

 

    def time(self, *args, **kwargs): 

        """ 

        time(self, v, prec = 0, form = std::vector< string >(1, ""), showform = False) -> std::vector<(std::string)> 

 

        Summary 

                show a time (or date) as a formatted string 

 

        Description 

                 

        time converts a time quantity to a formatted string. The formatting 

        information is a precision (0 is default, 6 includes hh.mm.ss) and a 

        string array of codes (no-case, minimax match): 

        Codes include: 

        egin{description} 

        \item[clean] delete leading/trailing superfluous separators 

        \item[no\_d] do not show hours part 

        \item[no\_dm] do not show hours and minutes part 

        \item[ymd] include a date as yyyy/mm/dd (date is by default not shown) 

        \item[dmy] include a date as ddMMMyyyy (date is by default not shown) 

        \item[mjd] include a date as Modified Julian Day (date is by default not shown) 

        \item[fits] include a date and show time in FITS format: le from OS 

        \item[angle] show in angle (dd.mm.ss.ttt) rather than time format 

        \item[day] prefix day-of-week to output 

        \item[local] show local time rather than UTC (add timezone offset) 

        \item[no\_time] suppress printing of time part 

        nd{description} 

        If a multi-dimensional value is given for the value $v$, the returned value 

        is a string vector of a length equal to last dimension. Each string has a 

        number of fields equal to the number of elements in all earlier 

        dimensions. If the {m showform} is $T$, each vector element is surrounded 

        by a pair of square brackets if there is more than one entry, and fields are 

        separated by a ','. 

 

 

        Input Parameters: 

                v                time quantity value to output  

                prec             number of digits shown 0  

                form             formatting information in coded string array  

                showform         show square brackets and separating , false  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     time Ex 1      ----' 

        tu = qa.quantity('today')               # a time 

        print tu 

        #{'value': 54175.708981504627, 'unit': 'd'} 

        print qa.time(tu)                       # default format 

        #17:00:56 

        print qa.time(tu,form='dmy')            # show date 

        #16-Mar-2007/17:00:56 

        print qa.time(tu,form=['ymd','day'])    # and day 

        #Fri-2007/03/16/17:00:56 

        print qa.time(tu,form='fits')           # FITS format     

        #2007-03-16T17:00:56 

        print qa.time(tu,form=['fits','local']) # local FITS format 

        #2007-03-16T10:00:56-07:00 

        print qa.time(tu,form=['ymd','local'])  # local time          

        #2007/03/16/10:00:56 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_time(self, *args, **kwargs) 

 

    def add(self, *args, **kwargs): 

        """ 

        add(self, v, a = initialize_variant("0")) -> record 

 

        Summary 

                add quantities 

 

        Description 

                 

        add adds two quantities 

 

 

        Input Parameters: 

                v                value  

                a                value 0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     add Ex 1       ----' 

        print qa.add('5m', '2yd')    

        #{'value': 6.8288000000000002, 'unit': 'm'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_add(self, *args, **kwargs) 

 

    def sub(self, *args, **kwargs): 

        """ 

        sub(self, v, a = initialize_variant("0")) -> record 

 

        Summary 

                subtract quantities 

 

        Description 

                 

        sub subtracts two quantities 

 

 

        Input Parameters: 

                v                value  

                a                value 0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     sub Ex 1       ----' 

        print qa.sub('5m', '2yd')    

        #{'value': 3.1712000000000002, 'unit': 'm'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_sub(self, *args, **kwargs) 

 

    def mul(self, *args, **kwargs): 

        """ 

        mul(self, v, a = initialize_variant("1")) -> record 

 

        Summary 

                multiply quantities 

 

        Description 

                 

        mul multiplies two quantities 

 

 

        Input Parameters: 

                v                value  

                a                value 1  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     mul Ex 1       ----' 

        print qa.mul('5m', '3s') 

        #{'value': 15.0, 'unit': 'm.s'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_mul(self, *args, **kwargs) 

 

    def div(self, *args, **kwargs): 

        """ 

        div(self, v, a = initialize_variant("1")) -> record 

 

        Summary 

                divides quantities 

 

        Description 

                 

        div divides two quantities 

 

 

        Input Parameters: 

                v                value  

                a                value 1  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     div Ex 1       ----' 

        print qa.div('5m', '3s')  

        #{'value': 1.6666666666666667, 'unit': 'm/(s)'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_div(self, *args, **kwargs) 

 

    def neg(self, *args, **kwargs): 

        """ 

        neg(self, v = initialize_variant("1")) -> record 

 

        Summary 

                negate quantities 

 

        Description 

                 

        neg negates a quantity 

 

 

        Input Parameters: 

                v                value 1  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     neg Ex 1       ----' 

        print qa.neg('5m')    

        #{'value': -5.0, 'unit': 'm'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_neg(self, *args, **kwargs) 

 

    def norm(self, *args, **kwargs): 

        """ 

        norm(self, v, a = -0.5) -> record 

 

        Summary 

                normalise angle 

 

        Description 

                 

        norm normalise angles in interval of $2\pi$ radians. The default interval is 

        from -0.5 to +0.5 of a full interval (i.e. from -180 to +180 degrees). The 

        lower end of the interval can be set as a fraction of $2\pi$ 

 

 

        Input Parameters: 

                v                angle quantity  

                a                lower interval boundary -0.5  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     norm Ex 1      ----' 

        print qa.norm('713deg')                 #default normalisation 

        #{'value': -6.9999999999999716, 'unit': 'deg'} 

        print qa.norm('713deg', -2.5)           # normalise to interval -900 - -540 deg 

        #{'value': -727.0, 'unit': 'deg'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_norm(self, *args, **kwargs) 

 

    def le(self, *args, **kwargs): 

        """ 

        le(self, v, a = initialize_variant("0")) -> bool 

 

        Summary 

                compare quantities 

 

        Description 

                 

        le compares two quantities for less than or equal. 

 

 

        Input Parameters: 

                v                value  

                a                value 0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     le Ex 1        ----' 

        print qa.le('5m', '2yd')    

        #False 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_le(self, *args, **kwargs) 

 

    def lt(self, *args, **kwargs): 

        """ 

        lt(self, v, a = initialize_variant("0")) -> bool 

 

        Summary 

                compare quantities 

 

        Description 

                 

        lt compares two quantities for less than. 

 

 

        Input Parameters: 

                v                value  

                a                value 0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     lt Ex 1        ----' 

        print qa.lt('5m', '2yd')  

        #False 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_lt(self, *args, **kwargs) 

 

    def eq(self, *args, **kwargs): 

        """ 

        eq(self, v, a = initialize_variant("0")) -> bool 

 

        Summary 

                compare quantities 

 

        Description 

                 

        eq compares two quantities for equality. 

 

 

        Input Parameters: 

                v                value  

                a                value 0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     eq Ex 1        ----' 

        print qa.eq('5m', '2yd')   

        #False 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_eq(self, *args, **kwargs) 

 

    def ne(self, *args, **kwargs): 

        """ 

        ne(self, v, a = initialize_variant("0")) -> bool 

 

        Summary 

                compare quantities 

 

        Description 

                 

        ne compares two quantities for non equality. 

 

 

        Input Parameters: 

                v                value  

                a                value 0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     ne Ex 1        ----' 

        print qa.ne('5m', '2yd')    

        #True 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_ne(self, *args, **kwargs) 

 

    def gt(self, *args, **kwargs): 

        """ 

        gt(self, v, a = initialize_variant("0")) -> bool 

 

        Summary 

                compare quantities 

 

        Description 

                 

        gt compares two quantities for greater than. 

 

 

        Input Parameters: 

                v                value  

                a                value 0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     gt Ex 1        ----' 

        print qa.gt('5m', '2yd')    

        #True 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_gt(self, *args, **kwargs) 

 

    def ge(self, *args, **kwargs): 

        """ 

        ge(self, v, a = initialize_variant("0")) -> bool 

 

        Summary 

                compare quantities 

 

        Description 

                 

        ge  compares two quantities for greater than or equal. 

 

 

        Input Parameters: 

                v                value  

                a                value 0  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     ge Ex 1        ----' 

        print qa.ge('5m', '2yd')  

        #True 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_ge(self, *args, **kwargs) 

 

    def sin(self, *args, **kwargs): 

        """ 

        sin(self, v) -> record 

 

        Summary 

                sine of quantity 

 

        Description 

                 

        sin gives sine of angle quantity 

 

 

        Input Parameters: 

                v                angle quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     sin Ex 1       ----' 

        print qa.sin('7deg') 

        #{'value': 0.12186934340514748, 'unit': ''} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_sin(self, *args, **kwargs) 

 

    def cos(self, *args, **kwargs): 

        """ 

        cos(self, v) -> record 

 

        Summary 

                cosine of quantity 

 

        Description 

                 

        cos gives cosine of angle quantity 

 

 

        Input Parameters: 

                v                angle quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     cos Ex 1       ----' 

        print qa.cos('7deg') 

        #{'value': 0.99254615164132198, 'unit': ''} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_cos(self, *args, **kwargs) 

 

    def tan(self, *args, **kwargs): 

        """ 

        tan(self, v) -> record 

 

        Summary 

                tangent of quantity 

 

        Description 

                 

        tan gives tangent of angle quantity 

 

 

        Input Parameters: 

                v                angle quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     tan Ex 1       ----' 

        print qa.tan('7deg') 

        #{'value': 0.1227845609029046, 'unit': ''} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_tan(self, *args, **kwargs) 

 

    def asin(self, *args, **kwargs): 

        """ 

        asin(self, v) -> record 

 

        Summary 

                arcsine of quantity 

 

        Description 

                 

        asin gives arcsine of non-dimensioned quantity 

 

 

        Input Parameters: 

                v                non-dimensioned quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     asin Ex 1      ----' 

        print qa.convert(qa.asin(qa.sin('7deg')), 'deg') 

        #{'value': 7.0, 'unit': 'deg'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_asin(self, *args, **kwargs) 

 

    def acos(self, *args, **kwargs): 

        """ 

        acos(self, v) -> record 

 

        Summary 

                arccosine of quantity 

 

        Description 

                 

        acos gives arccosine of non-dimensioned quantity 

 

 

        Input Parameters: 

                v                non-dimensioned quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     acos Ex 1      ----' 

        print qa.convert(qa.acos(qa.cos('7deg')), 'deg') 

        #{'value': 7.0000000000000249, 'unit': 'deg'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_acos(self, *args, **kwargs) 

 

    def atan(self, *args, **kwargs): 

        """ 

        atan(self, v) -> record 

 

        Summary 

                arctangent of quantity 

 

        Description 

                 

        atan gives arctangent of non-dimensioned quantity 

 

 

        Input Parameters: 

                v                non-dimensioned quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     atan Ex 1      ----' 

        print qa.convert(qa.atan(qa.tan('7deg')), 'deg') 

        #{'value': 7.0, 'unit': 'deg'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_atan(self, *args, **kwargs) 

 

    def atan2(self, *args, **kwargs): 

        """ 

        atan2(self, v, a) -> record 

 

        Summary 

                arctangent of two quantity 

 

        Description 

                 

        atan gives arctangent of two non-dimensioned quantity 

 

 

        Input Parameters: 

                v                non-dimensioned quantity  

                a                non-dimensioned quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     atan2 Ex 1     ----' 

        print qa.convert(qa.atan2(qa.sin('7deg'), qa.cos('7deg')), 'deg') 

        #{'value': 7.0, 'unit': 'deg'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_atan2(self, *args, **kwargs) 

 

    def abs(self, *args, **kwargs): 

        """ 

        abs(self, v) -> record 

 

        Summary 

                absolute value of quantity 

 

        Description 

                 

        abs gives absolute value of quantity 

 

 

        Input Parameters: 

                v                value  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     abs Ex 1       ----' 

        print qa.abs('-5km/s') 

        #{'value': 5.0, 'unit': 'km/s'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_abs(self, *args, **kwargs) 

 

    def ceil(self, *args, **kwargs): 

        """ 

        ceil(self, v) -> record 

 

        Summary 

                ceil value of quantity 

 

        Description 

                 

        ceil gives ceiling value of quantity 

 

 

        Input Parameters: 

                v                value  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     ceil Ex 1      ----' 

        print qa.ceil('5.1AU') 

        #{'value': 6.0, 'unit': 'AU'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_ceil(self, *args, **kwargs) 

 

    def floor(self, *args, **kwargs): 

        """ 

        floor(self, v) -> record 

 

        Summary 

                floor value of quantity 

 

        Description 

                 

        floor gives flooring value of quantity 

 

 

        Input Parameters: 

                v                value  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     floor Ex 1     ----' 

        print qa.floor('-5.1AU') 

        #{'value': -6.0, 'unit': 'AU'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_floor(self, *args, **kwargs) 

 

    def log(self, *args, **kwargs): 

        """ 

        log(self, v) -> record 

 

        Summary 

                logarithm of quantity 

 

        Description 

                 

        log gives natural logarithm of dimensionless quantity 

 

 

        Input Parameters: 

                v                dimensionless quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     log Ex 1       ----' 

        print qa.log('2') 

        #{'value': 0.69314718055994529, 'unit': ''} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_log(self, *args, **kwargs) 

 

    def log10(self, *args, **kwargs): 

        """ 

        log10(self, v) -> record 

 

        Summary 

                logarithm of quantity 

 

        Description 

                 

        log10 gives logarithm of dimensionless quantity 

 

 

        Input Parameters: 

                v                dimensionless quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     log10 Ex 1     ----' 

        print qa.log10('2') 

        #{'value': 0.3010299956639812, 'unit': ''} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_log10(self, *args, **kwargs) 

 

    def exp(self, *args, **kwargs): 

        """ 

        exp(self, v) -> record 

 

        Summary 

                exponential of quantity 

 

        Description 

                 

        exp gives exponential value of dimensionless quantity 

 

 

        Input Parameters: 

                v                dimensionless quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     exp Ex 1       ----' 

        print qa.exp('2') 

        #{'value': 7.3890560989306504, 'unit': ''} 

        try: 

          print qa.exp('2m') 

        except Exception, e: 

          print 'Caught an expected exception', e 

        #Caught an expected exception Quantum::exp illegal unit type 'm' 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_exp(self, *args, **kwargs) 

 

    def sqrt(self, *args, **kwargs): 

        """ 

        sqrt(self, v) -> record 

 

        Summary 

                square root of quantity 

 

        Description 

                 

        sqrt gives square root of quantity with only even powered dimensions 

 

 

        Input Parameters: 

                v                dimensionless quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     sqrt Ex 1      ----' 

        print qa.sqrt('2m2') 

        #{'value': 1.4142135623730951, 'unit': 'm'} 

        try: 

          print qa.sqrt('2s') 

        except Exception, e: 

          print 'Caught an expected exception', e 

        #Caught an expected exception UnitVal::UnitVal Illegal unit dimensions for root 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_sqrt(self, *args, **kwargs) 

 

    def compare(self, *args, **kwargs): 

        """ 

        compare(self, v, a) -> bool 

 

        Summary 

                compare dimensionality of units 

 

        Description 

                 

        compare compares the dimensionality of units of two qauntities 

 

 

        Input Parameters: 

                v                value  

                a                value  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     compare Ex 1   ----' 

        print qa.compare('5yd/a', '6m/s')               # equal dimensions 

        #True 

        print qa.compare('5yd', '5s')           # unequal dimensions 

        #False 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_compare(self, *args, **kwargs) 

 

    def check(self, *args, **kwargs): 

        """ 

        check(self, v) -> bool 

 

        Summary 

                check for proper unit string 

 

        Description 

                 

        check checks if the argument has a properly defined unit string 

 

 

        Input Parameters: 

                v                value  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     check Ex 1     ----' 

        print qa.check('5AE/Jy.pc5/s') 

        #True 

        print qa.check('7MYs') 

        #False 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_check(self, *args, **kwargs) 

 

    def checkfreq(self, *args, **kwargs): 

        """ 

        checkfreq(self, cm) -> bool 

 

        Summary 

                check for proper frequency unit 

 

        Description 

                 

        checkfreq checks if the argument has a properly defined frequency interpretable 

        unit string 

 

 

        Input Parameters: 

                cm               value  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     checkfreq Ex 1         ----' 

        print qa.checkfreq('5GHz') 

        #True 

        print qa.checkfreq('5cm')   

        #True 

        print qa.checkfreq('5cm/s2') 

        #False 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_checkfreq(self, *args, **kwargs) 

 

    def pow(self, *args, **kwargs): 

        """ 

        pow(self, v, a = 1) -> record 

 

        Summary 

                raise quantity to power 

 

        Description 

                 

        pow raises a quantity to an integer power 

 

 

        Input Parameters: 

                v                value  

                a                power 1  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     pow Ex 1       ----' 

        print qa.pow('7.2km/s', -3) 

        #{'value': 0.0026791838134430724, 'unit': '(km/s)-3'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_pow(self, *args, **kwargs) 

 

    def constants(self, *args, **kwargs): 

        """ 

        constants(self, v = string("pi")) -> record 

 

        Summary 

                get a constant 

 

        Description 

                 

        constants gets a named constant quantity. Names (no-case, minimax) are: 

 

                pi    3.14..                    3.14159  

                ee    2.71..                    2.71828  

                c     light vel.                2.99792e+08 m/s 

                G     grav. const               6.67259e-11 N.m2/kg2 

                h     Planck const              6.62608e-34 J.s 

                HI    HI line                   1420.41 MHz 

                R     gas const                 8.31451 J/K/mol 

                NA    Avogadro number           6.02214e+23 mol-1 

                e     electron charge           1.60218e-19 C 

                mp    proton mass               1.67262e-27 kg 

                mp\_me mp/me                     1836.15  

                mu0   permeability vac.         1.25664e-06 H/m 

                eps0  permittivity vac.         1.60218e-19 C 

                k     Boltzmann const           1.38066e-23 J/K 

                F     Faraday const             96485.3 C/mol 

                me    electron mass             9.10939e-31 kg 

                re    electron radius           2.8179e-15 m 

                a0    Bohr's radius             5.2918e-11 m 

                R0    solar radius              6.9599e+08 m 

                k2    IAU grav. const\^2         0.000295912 AU3/d2/S0 

 

 

 

        Input Parameters: 

                v                name pi  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     constants Ex 1         ----' 

        print qa.constants() 

        #{'unit': '', 'value': 3.1415926535897931} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_constants(self, *args, **kwargs) 

 

    def isangle(self, *args, **kwargs): 

        """ 

        isangle(self, v) -> bool 

 

        Summary 

                check if valid angle or time quantity 

 

        Description 

                 

        isangle checks if the argument is a valid angle/time quantity. 

 

 

        Input Parameters: 

                v                angle/time quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     isangle Ex 1   ----' 

        print qa.isangle(qa.constants('pi')) 

        #False 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_isangle(self, *args, **kwargs) 

 

    def totime(self, *args, **kwargs): 

        """ 

        totime(self, v) -> record 

 

        Summary 

                convert an angle (or a time) to a time 

 

        Description 

                 

        totime converts an angle quantity (or a time) to a time quantity 

 

 

        Input Parameters: 

                v                angle/time quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     totime Ex 1    ----' 

        print qa.totime('2d5m') 

        #{'value': 0.0057870370370370376, 'unit': 'd'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_totime(self, *args, **kwargs) 

 

    def toangle(self, *args, **kwargs): 

        """ 

        toangle(self, v) -> record 

 

        Summary 

                convert a time (or an angle) to an angle 

 

        Description 

                 

        toangle converts a time quantity (or an angle) to an angle quantity 

 

 

        Input Parameters: 

                v                angle/time quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     toangle Ex 1   ----' 

        print qa.toangle('5h30m12.6') 

        #{'value': 82.552499999999995, 'unit': 'deg'} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_toangle(self, *args, **kwargs) 

 

    def splitdate(self, *args, **kwargs): 

        """ 

        splitdate(self, v) -> record 

 

        Summary 

                split a date/time into a record 

 

        Description 

                 

        splitdate splits a date/time quantity into a record with constituent fields 

        like year, yearday, month etc. All fields will be integer (to enable use as 

        index and easy personal formatting), with the exception of the {m s} field 

        which is a double float. See the example for the fields returned. 

 

 

        Input Parameters: 

                v                angle/time quantity  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     splitdate Ex 1         ----' 

        print qa.splitdate('today') 

 

        #{'mjd': 54175.752367291658, 'week': 11, 'usec': 533999, 'hour': 18, 

        # 'min': 3, 'yearday': 75, 'msec': 533, 'month': 3, 's': 

        # 24.533999226987362, 'sec': 24, 'weekday': 5, 'year': 2007, 'monthday': 

        # 16} print qa.splitdate('183.33333333deg') 

        #{'mjd': 0.50925925925000004, 'week': 46, 'usec': 999999, 'hour': 12, 

        # 'min': 13, 'yearday': 321, 'msec': 999, 'month': 11, 's': 

        # 19.999999200003487, 'sec': 19, 'weekday': 3, 'year': 1858, 

        # 'monthday': 17} 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_splitdate(self, *args, **kwargs) 

 

    def tos(self, *args, **kwargs): 

        """ 

        tos(self, v, prec = 9) -> string 

 

        Summary 

                convert quantity to string 

 

        Description 

                 

        tos converts a quantity to a string with the precision defined with 

        the {m setformat('prec')} (which defaults to 9). If the optional 

        {m prec} argument is set to an integer value greater than 1, that 

        precision is used in the conversion 

 

 

        Input Parameters: 

                v                value  

                prec             convert precision of value 9  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     tos Ex 1       ----' 

        a = qa.quantity('2.56 yd/s') 

        print a 

        #{'value': 2.5600000000000001, 'unit': 'yd/s'} 

        print qa.tos(a) 

        #2.560000000yd/s 

        a=qa.quantity(1./7, 'km/s') 

        print qa.tos(a) 

        #0.142857143km/s 

        print qa.tos(a,2) 

        #0.14km/s 

        print qa.tos(a,20) 

        #0.14285714285714284921km/s 

        print qa.tos(a)    

        #0.142857143km/s 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_tos(self, *args, **kwargs) 

 

    def type(self): 

        """ 

        type(self) -> string 

 

        Summary 

                type of tool 

 

        Description 

                 

        type will return the tool name. 

 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     type Ex 1      ----' 

        print qa.type() 

        #quanta  

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_type(self) 

 

    def done(self, kill = False): 

        """ 

        done(self, kill = False) -> bool 

 

        Summary 

                Free resources used by tool.  Current implementation 

            ignores input parameter, does nothing and returns true 

 

        Description 

                 

        Currently, this method is an NOP. 

 

 

 

        Input Parameters: 

                kill             force kill of the default tool (ignored) false  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     done Ex 1      ----' 

        print qa.done() 

        #True 

        print qa.done() 

        #True 

        print qa.done(kill=T) 

        #True 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_done(self, kill) 

 

    def unit(self, *args, **kwargs): 

        """ 

        unit(self, v, unitname = string("")) -> record 

 

        Summary 

                quantity from value v and unit string 

 

        Description 

                 

        unit makes a quantity from a string, or from a value and a string. 

        Note that unit is a synonym for quantity (see example there). 

 

 

        Input Parameters: 

                v                 

                unitname          

                 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_unit(self, *args, **kwargs) 

 

    def isquantity(self, *args, **kwargs): 

        """ 

        isquantity(self, v) -> bool 

 

        Summary 

                Check if quantity 

 

        Description 

                 

        Checks if the operand is a correct quantity 

 

 

        Input Parameters: 

                v                value to be tested  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     isQuantity Ex 1        ----' 

        a = qa.quantity('5Jy')               # make a quantity 

        print a 

        #{'value': 5.0, 'unit': 'Jy'} 

        print qa.isquantity(a)                  # is it one? 

        #True 

        print qa.isquantity('5Jy')              # and this string? 

        #True 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_isquantity(self, *args, **kwargs) 

 

    def setformat(self, *args, **kwargs): 

        """ 

        setformat(self, t = string(""), v = string("F")) -> bool 

 

        Summary 

                set format for output of numbers.  

           (NOT IMPLEMENTED YET!) 

 

        Input Parameters: 

                t                type -coded string indicating which format parameter to set  

                v                format parameter value - numeric or coded string, depending on format type to be set F  

                 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_setformat(self, *args, **kwargs) 

 

    def getformat(self, *args, **kwargs): 

        """ 

        getformat(self, t = string("")) -> string 

 

        Summary 

                get current output format 

           (NOT IMPLEMENTED YET!) 

 

        Description 

                 

        getformat returns the current format value set for the different 

        format possibilities. See the 

        setformat function for the 

        different format type descriptions. The known types are: \ 

        prec, aprec, tprec, long, lat, len, dtime, elev, auto, vel, freq, 

        dop, unit. 

 

 

        Input Parameters: 

                t                type - coded string  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     getformat Ex 1         ----' 

        print qa.getformat('prec') 

        #6  

        #setformat is NOT IMPLEMENTED YET! 

        #qa.setformat('prec', 12)       # set precision to 12 significant digits 

        #T  

        #print qa.getformat('prec')                                              

        #12  

        print qa.getformat('long') 

        #hms 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_getformat(self, *args, **kwargs) 

 

    def formxxx(self, *args, **kwargs): 

        """ 

        formxxx(self, v, format = string("dms"), prec = 2) -> string 

 

        Summary 

                Format a quantity using given format, allowed are hms, dms, deg, rad, +deg. 

            

 

        Description 

                 

        form.xxx (xxx can be lat, long, len, vel, freq, dtime, unit) will format the 

        input into a string using the global format information set by setformat(). 

 

 

        Input Parameters: 

                v                value to be converted  

                format           xxx can be hms, dms, deg, rad or +deg dms  

                prec             digits in fractional part of output string for dms,hms 2  

                 

        Example: 

                 

 

        ''' 

        # 

        print ' ----     formxxx Ex 1   ----' 

        #qa.setformat('freq','cm') 

        #T  

        #qa.formxxx('freq',qa.quantity('5GHz')) 

        #form_xxx NOT IMPLEMENTED YET! 

        #5.99584916 cm  

        print 'Last example, exiting! ...' 

        exit() 

        # 

        ''' 

 

 

        -------------------------------------------------------------------------------- 

                       

        """ 

        return _quanta.quanta_formxxx(self, *args, **kwargs) 

 

quanta_swigregister = _quanta.quanta_swigregister 

quanta_swigregister(quanta) 

 

# This file is compatible with both classic and new-style classes.