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

2226

2227

2228

2229

2230

2231

2232

2233

2234

2235

2236

2237

2238

2239

2240

2241

2242

2243

2244

2245

2246

2247

2248

2249

2250

2251

2252

2253

2254

2255

2256

2257

2258

2259

2260

2261

2262

2263

2264

2265

2266

2267

2268

2269

2270

2271

2272

2273

2274

2275

2276

2277

2278

2279

2280

2281

2282

2283

2284

2285

2286

2287

2288

2289

2290

2291

2292

2293

2294

2295

2296

2297

2298

2299

2300

2301

2302

2303

2304

2305

2306

2307

2308

2309

2310

2311

2312

2313

2314

2315

2316

2317

2318

2319

2320

2321

2322

2323

2324

2325

2326

2327

2328

2329

2330

2331

2332

2333

2334

2335

2336

2337

2338

2339

2340

2341

2342

2343

2344

2345

2346

2347

2348

2349

2350

2351

2352

2353

2354

2355

2356

2357

2358

2359

2360

2361

2362

2363

2364

2365

2366

2367

2368

2369

2370

2371

2372

2373

2374

2375

2376

2377

2378

2379

2380

2381

2382

2383

2384

2385

2386

2387

2388

2389

2390

2391

2392

2393

2394

2395

2396

2397

2398

2399

2400

2401

2402

2403

2404

2405

2406

2407

2408

2409

2410

2411

2412

2413

2414

2415

2416

2417

2418

2419

2420

2421

2422

2423

2424

2425

2426

2427

2428

2429

2430

2431

2432

2433

2434

2435

2436

2437

2438

2439

2440

2441

2442

2443

2444

2445

2446

2447

2448

2449

2450

2451

2452

2453

2454

2455

2456

2457

2458

2459

2460

2461

2462

2463

2464

2465

2466

2467

2468

2469

2470

2471

2472

2473

2474

2475

2476

2477

2478

2479

2480

2481

2482

2483

2484

2485

2486

2487

2488

2489

2490

2491

2492

2493

2494

2495

2496

2497

2498

2499

2500

2501

2502

2503

2504

2505

2506

2507

2508

2509

2510

2511

2512

2513

2514

2515

2516

2517

2518

2519

2520

2521

2522

2523

2524

2525

2526

2527

2528

2529

2530

2531

2532

2533

2534

2535

2536

2537

2538

2539

2540

2541

2542

2543

2544

2545

2546

2547

2548

2549

2550

2551

2552

2553

2554

2555

2556

2557

2558

2559

2560

2561

2562

2563

2564

2565

2566

2567

2568

2569

2570

2571

2572

2573

2574

2575

2576

2577

2578

2579

2580

2581

2582

2583

2584

2585

2586

2587

2588

2589

2590

2591

2592

2593

2594

2595

2596

2597

2598

2599

2600

2601

2602

2603

2604

2605

2606

2607

2608

2609

2610

2611

2612

2613

2614

2615

2616

2617

2618

2619

2620

2621

2622

2623

2624

2625

2626

2627

2628

2629

2630

2631

2632

2633

2634

2635

2636

2637

2638

2639

2640

2641

2642

2643

2644

2645

2646

2647

2648

2649

2650

2651

2652

2653

2654

2655

2656

2657

2658

2659

2660

2661

2662

2663

2664

2665

2666

2667

2668

2669

2670

2671

2672

2673

2674

2675

2676

2677

2678

2679

2680

2681

2682

2683

2684

2685

2686

2687

2688

2689

2690

2691

2692

2693

2694

2695

2696

2697

2698

2699

2700

2701

2702

2703

2704

2705

2706

2707

2708

2709

2710

2711

2712

2713

2714

2715

2716

2717

2718

2719

2720

2721

2722

2723

2724

2725

2726

2727

2728

2729

2730

2731

2732

2733

2734

2735

2736

2737

2738

2739

2740

2741

2742

2743

2744

2745

2746

2747

2748

2749

2750

2751

2752

2753

2754

2755

2756

2757

2758

2759

2760

2761

2762

2763

2764

2765

2766

2767

2768

2769

2770

2771

2772

2773

2774

2775

2776

2777

2778

2779

2780

2781

2782

2783

2784

2785

2786

2787

2788

2789

2790

2791

2792

2793

2794

2795

2796

2797

2798

2799

2800

2801

2802

2803

2804

2805

2806

2807

2808

2809

2810

2811

2812

2813

2814

2815

2816

2817

2818

2819

2820

2821

2822

2823

2824

2825

2826

2827

2828

2829

2830

2831

2832

2833

2834

2835

2836

2837

2838

2839

2840

2841

2842

2843

2844

2845

2846

2847

2848

2849

2850

2851

2852

2853

2854

2855

2856

2857

2858

2859

2860

2861

2862

2863

2864

2865

2866

2867

2868

2869

2870

2871

2872

2873

2874

2875

2876

2877

2878

2879

2880

2881

2882

2883

2884

2885

2886

2887

2888

2889

2890

2891

2892

2893

2894

2895

2896

2897

2898

2899

2900

2901

2902

2903

2904

2905

2906

2907

2908

2909

2910

2911

2912

2913

2914

2915

2916

2917

2918

2919

2920

2921

2922

2923

2924

2925

2926

2927

2928

2929

2930

2931

2932

2933

2934

2935

2936

2937

2938

2939

2940

2941

2942

2943

2944

2945

2946

2947

2948

2949

2950

2951

2952

2953

2954

2955

2956

2957

2958

2959

2960

2961

2962

2963

2964

2965

2966

2967

2968

2969

2970

2971

2972

2973

2974

2975

2976

2977

2978

2979

2980

2981

2982

2983

2984

2985

2986

2987

2988

2989

2990

2991

2992

2993

2994

2995

2996

2997

2998

2999

3000

3001

3002

3003

3004

3005

3006

3007

3008

3009

3010

3011

3012

3013

3014

3015

3016

3017

3018

3019

3020

3021

3022

3023

3024

3025

3026

3027

3028

3029

3030

3031

3032

3033

3034

3035

3036

3037

3038

3039

3040

3041

3042

3043

3044

3045

3046

3047

3048

3049

3050

3051

3052

3053

3054

3055

3056

3057

3058

3059

3060

3061

3062

3063

3064

3065

3066

3067

3068

3069

3070

3071

3072

3073

3074

3075

3076

3077

3078

3079

3080

3081

3082

3083

3084

3085

3086

3087

3088

3089

3090

3091

3092

3093

3094

3095

3096

3097

3098

3099

3100

3101

3102

3103

3104

3105

3106

3107

3108

3109

3110

3111

3112

3113

3114

3115

3116

3117

3118

3119

3120

3121

3122

3123

3124

3125

3126

3127

3128

3129

3130

3131

3132

3133

3134

3135

3136

3137

3138

3139

3140

3141

3142

3143

3144

3145

3146

3147

3148

3149

3150

3151

3152

3153

3154

3155

3156

3157

3158

3159

3160

3161

3162

3163

3164

3165

3166

3167

3168

3169

3170

3171

3172

3173

3174

3175

3176

3177

3178

3179

3180

3181

3182

3183

3184

3185

3186

3187

3188

3189

3190

3191

3192

3193

3194

3195

3196

3197

3198

3199

3200

3201

3202

3203

3204

3205

3206

3207

3208

3209

3210

3211

3212

3213

3214

3215

3216

3217

3218

3219

3220

3221

3222

3223

3224

3225

3226

3227

3228

3229

3230

3231

3232

3233

3234

3235

3236

3237

3238

3239

3240

3241

3242

3243

3244

3245

3246

3247

3248

3249

3250

3251

3252

3253

3254

3255

3256

3257

3258

3259

3260

3261

3262

3263

3264

3265

3266

3267

3268

3269

3270

3271

3272

3273

3274

3275

3276

3277

3278

3279

3280

3281

3282

3283

3284

3285

3286

3287

3288

3289

3290

3291

3292

3293

3294

3295

3296

3297

3298

3299

3300

3301

3302

3303

3304

3305

3306

3307

3308

3309

3310

3311

3312

3313

3314

3315

3316

3317

3318

3319

3320

3321

3322

3323

3324

3325

3326

3327

3328

3329

3330

3331

3332

3333

3334

3335

3336

3337

3338

3339

3340

3341

3342

3343

3344

3345

3346

3347

3348

3349

3350

3351

3352

3353

3354

3355

3356

3357

3358

3359

3360

3361

3362

3363

3364

3365

3366

3367

3368

3369

3370

3371

3372

3373

3374

3375

3376

3377

3378

3379

3380

3381

3382

3383

3384

3385

3386

3387

3388

3389

3390

3391

3392

3393

3394

3395

3396

3397

3398

3399

3400

3401

3402

3403

3404

3405

3406

3407

3408

3409

3410

3411

3412

3413

3414

3415

3416

3417

3418

3419

3420

3421

3422

3423

3424

3425

3426

3427

3428

3429

3430

3431

3432

3433

3434

3435

3436

3437

3438

3439

3440

3441

3442

3443

3444

3445

3446

3447

3448

3449

3450

3451

3452

3453

3454

3455

# 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('_ms', [dirname(__file__)]) 

        except ImportError: 

            import _ms 

            return _ms 

        if fp is not None: 

            try: 

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

            finally: 

                fp.close() 

            return _mod 

    _ms = swig_import_helper() 

    del swig_import_helper 

else: 

    import _ms 

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 ms(_object): 

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

    __swig_setmethods__ = {} 

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

    __swig_getmethods__ = {} 

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

    __repr__ = _swig_repr 

    def __init__(self): 

        """__init__(self) -> ms""" 

        this = _ms.new_ms() 

        try: self.this.append(this) 

        except: self.this = this 

    __swig_destroy__ = _ms.delete_ms 

    __del__ = lambda self : None; 

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

        """ 

        fromfits(self, msfile = string(""), fitsfile = string(""), nomodify = True,  

            lock = False, obstype = 0, host = string(""),  

            forcenewserver = False, antnamescheme = string("old")) -> bool 

 

        Summary 

                Create a measurement set from a uvfits file 

 

        Description 

                 

            This function will convert a \uvfits\ file to a measurement set table and 

            then open the measurement set table. The newly created measurement set 

            table will continue to exist after the tool has been closed. 

 

            Setting the lock argument to True will permanently lock the table 

            preventing other processes from writing to the measurement set. Unless you 

            expect this to happen, and want to prevent it, you should leave the lock 

            argument at the default value which implies auto-locking. 

 

 

 

            Note that the variety of fits files that fromfits is able to 

            interpret correctly is limited mostly to files similar to those 

            produced by classic AIPS. In particular, it understands only binary 

            table extensions for the antenna (AN), frequency (FQ) and source 

            (SU) information and ignores other extensions. 

 

            This function returns True if it successfully attachs the ms tool 

            to a newly created Measurement Set or False if something went 

            wrong, like an error in a file name. 

           

 

        Input Parameters: 

                msfile           Filename for the newly created measurement set  

                fitsfile         uvfits file to read  

                nomodify         open for read access only true  

                lock             lock the table for exclusive use false  

                obstype          specify the observation type: 0=standard, 1=fastmosaic, requiring small tiles in the measurement set 0  

                host             host to start ms tool on (IGNORED!!!)  

                forcenewserver   start a new server tool (IGNORED!!!) false  

                antnamescheme    For VLA only, antenna name scheme, old style is just antenna number, new style prepends VA or EV old old new  

                 

        Example: 

                 

             

              ms.fromfits('3C273XC1.MS', '3C273XC1.fits') 

             

           

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

                       

        """ 

        return _ms.ms_fromfits(self, *args, **kwargs) 

 

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

        """ 

        fromfitsidi(self, msfile = string(""), fitsfile = string(""), nomodify = True,  

            lock = False, obstype = 0) -> bool 

 

        Summary 

                Create a measurement set from a fits-idi file 

 

        Description 

                 

            This function will convert a \uvfits\ file to a measurement set table and 

            then open the measurement set table. The newly created measurement set 

            table will continue to exist after the tool has been closed. 

 

            Setting the lock argument to True will permanently lock the table 

            preventing other processes from writing to the measurement set. Unless you 

            expect this to happen, and want to prevent it, you should leave the lock 

            argument at the default value which implies auto-locking. 

 

            Note that the variety of fits files that fromfits is able to 

            interpret correctly is limited mostly to files similar to those 

            produced by classic AIPS. In particular, it understands only binary 

            table extensions for the antenna (AN), frequency (FQ) and source 

            (SU) information and ignores other extensions. 

 

            This function returns True if it successfully attachs the ms tool 

            to a newly created Measurement Set or False if something went 

            wrong, like an error in a file name. 

           

 

        Input Parameters: 

                msfile           Filename for the newly created measurement set  

                fitsfile         fits-idi file to read  

                nomodify         open for read access only true  

                lock             lock the table for exclusive use false  

                obstype          specify the observation type: 0=standard, 1=fastmosaic, requiring small tiles in the measurement set 0  

                 

        Example: 

                 

             

              ms.fromfits('3C273XC1.MS', '3C273XC1.fits') 

             

           

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

                       

        """ 

        return _ms.ms_fromfitsidi(self, *args, **kwargs) 

 

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

        """ 

        listfits(self, fitsfile) -> bool 

 

        Summary 

                 

                 

 

        Description 

                 

                 

 

        Input Parameters: 

                fitsfile         list HDU and typical data rows in a uvfits file  

                 

        Example: 

                 

                    ms.listfits('ngc5921.fits') 

                 

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

                       

        """ 

        return _ms.ms_listfits(self, *args, **kwargs) 

 

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

        """ 

        createmultims(self, outputTableName, tables, subtables, nomodify = True,  

            lock = False, copysubtables = False, omitsubtables = std::vector< string >(1, "")) -> bool 

 

        Summary 

                 

                 

 

        Description 

                 

                 

 

        Input Parameters: 

                outputTableName  

                tables           

                subtables        

                nomodify         prevent changes to the measurement set true  

                lock             lock the table for exclusive use by this tool false  

                copysubtables    copy the subtables from the first to all other member MSs false  

                omitsubtables    Omit the subtables from this list when copying subtables  

                 

        Example: 

                 

                 

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

                       

        """ 

        return _ms.ms_createmultims(self, *args, **kwargs) 

 

    def ismultims(self): 

        """ 

        ismultims(self) -> bool 

 

        Summary 

                 

                 

 

        Description 

                 

                 

        Example: 

                 

                 

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

                       

        """ 

        return _ms.ms_ismultims(self) 

 

    def getreferencedtables(self): 

        """ 

        getreferencedtables(self) -> std::vector<(std::string)> 

 

        Summary 

                 

                 

 

        Description 

                 

                 

        Example: 

                 

                 

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

                       

        """ 

        return _ms.ms_getreferencedtables(self) 

 

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

        """ 

        getfielddirmeas(self, dircolname = string("PHASE_DIR"), fieldid = 0, time = 0,  

            format = string("measure")) -> variant 

 

        Summary 

                Returns the direction measure from the given FIELD table column and row 

 

        Description 

                 

            This function returns the direction measures from the 

            given direction column of the MS FIELD table as a either a measure dictionary 

            or sexigesimal string representation. 

           

 

        Input Parameters: 

                dircolname       Name of the direction column in the FIELD table PHASE\_DIR PHASE\_DIR DELAY\_DIR REFERENCE\_DIR  

                fieldid          Field ID, starting at 0 0  

                time             (optional) time for ephemeris access (in seconds, as in Main table TIME column) 0  

                format           Output format. Either 'measure' (measure dictionary) or 'string' (sexigesimal representation). Minimum match supported. measure  

                 

        Example: 

                 

             

              ms.open('3C273XC1.MS') 

              print 'Delay direction from FIELD table row 3 =', ms.getfielddirmeas('DELAY_DIR', 3) 

             

           

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

                       

        """ 

        return _ms.ms_getfielddirmeas(self, *args, **kwargs) 

 

    def nrow(self, selected = False): 

        """ 

        nrow(self, selected = False) -> int 

 

        Summary 

                Returns the number of rows in the measurement set 

 

        Description 

                 

            This function returns the number of rows in the measurement 

            set. If the optional argument selected is set to True, it returns 

            the number of currently selected rows, otherwise it returns the  

            the number of rows in the original measurement. 

           

 

        Input Parameters: 

                selected         return number of selected rows false  

                 

        Example: 

                 

             

              ms.open('3C273XC1.MS') 

              print 'Number of rows in ms =', ms.nrow() 

              #Number of rows in ms = 7669 

             

           

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

                       

        """ 

        return _ms.ms_nrow(self, selected) 

 

    def iswritable(self): 

        """ 

        iswritable(self) -> bool 

 

        Summary 

                Returns True is the underlying Table is 

          writable 

 

        Description 

                 

            This function returns True if the underlying MeasurementSet 

          Table was opened for writing/update. 

           

        Example: 

                 

             

              ms.open('3C273XC1.MS',nomodify=False) 

              if ms.iswritable(): 

                print 'MeasurementSet is writable' 

              else: 

                print 'MeasurementSet is readonly' 

              #MeasurementSet is writable 

             

           

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

                       

        """ 

        return _ms.ms_iswritable(self) 

 

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

        """ 

        open(self, thems = string(""), nomodify = True, lock = False) -> bool 

 

        Summary 

                Attach the ms tool to a measurement set table 

 

        Description 

                 

               Use this function when you have detached (using the 

               close function) the ms tool from a 

               measurement set table and wish to reattach to another measurement 

               set table.   

              

 

        Input Parameters: 

                thems            Name of the measurement set table to open  

                nomodify         prevent changes to the measurement set true  

                lock             lock the table for exclusive use by this tool false  

                 

        Example: 

                 

             

               ms.open('3C273XC1.MS') 

               ms.close() 

               ms.open('anotherms', nomodify=False, lock=False) 

             

              

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

                       

        """ 

        return _ms.ms_open(self, *args, **kwargs) 

 

    def reset(self): 

        """ 

        reset(self) -> bool 

 

        Summary 

                Re-attach the tool to the original MS. 

 

        Description 

                 

               This function re-attaches the ms tool to the original MS, 

               effectively discarding any prior operations, in particular any 

               data selection operations 

               using msselect 

               function. 

              

        Example: 

                 

              

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

                       

        """ 

        return _ms.ms_reset(self) 

 

    def close(self): 

        """ 

        close(self) -> bool 

 

        Summary 

                Detach the ms tool from the measurement set table 

 

        Description 

                 

               This function detaches the ms tool from the associated measurement 

               set table after flushing all the cached changes.  After calling 

               this function the ms tool is not associated with any measurement 

               set and using any function other than 

               open or 

               fromfits 

               will result in an error message being sent to the logger. 

 

               This function can be useful to avoid synchronization problems 

               which can occur when different processes have the same ms open. 

              

        Example: 

                 

               See the example for the open function. 

              

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

                       

        """ 

        return _ms.ms_close(self) 

 

    def name(self): 

        """ 

        name(self) -> string 

 

        Summary 

                Name of the measurement set table the tool is attached to. 

 

        Description 

                 

            This function returns the name of the measurement set table that 

            is being manipulated. If the ms tool is not attached to any 

            measurement set then this function will return the string ``none''. 

           

        Example: 

                 

             

               

              ms.open('3C273XC1.MS') 

              print 'Processing file', ms.name() 

             

           

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

                       

        """ 

        return _ms.ms_name(self) 

 

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

        """ 

        tofits(self, fitsfile = string(""), column = string("corrected"),  

            field = initialize_variant(""), spw = initialize_variant(""),  

            width = 1, baseline = initialize_variant(""),  

            time = string(""), scan = initialize_variant(""),  

            uvrange = initialize_variant(""),  

            taql = string(""), writesyscal = False,  

            multisource = False, combinespw = False,  

            writestation = False, padwithflags = False) -> bool 

 

        Summary 

                Convert a measurement set to a uvfits file 

 

        Description 

                 

            This function writes a \uvfits\ file that contains the data in 

            the measurement set associated with this tool. The its\ file is 

            always written in floating point format and the data are always 

            stored in the primary array of the its\ file. 

 

            If the measurement set has been imaged or calibrated in CASA, it 

            may contain additional data columns. You need to select ONE of 

            these columns to be written to the its\ file. The possible 

            options are: 

            egin{description} 

              \item[observed] This is the raw data as collected by the 

                              telescope. All interferometric measurement sets must 

                              contain this column. A synonym for 'observed' is 

                              'data'. 

              \item[corrected] This is the calibrated data. A synonym for 

                               'corrected' is 'corrected\_data'. 

              \item[model] This is the visibilites that would be measured using 

                           the current model of the sky. A synonym for 

                           'model' is 'model\_data'. 

            nd{description} 

            The parsing of these strings is case insensitive. If any other 

            option is specified then the observed data will be written. 

 

            By default a single-source \uvfits\ file is written, but if the 

            measurement set contains more than one field or if you set the 

            multisource argument to True a multi-source \uvfits\ file will be 

            written. Because of limitations in the \uvfits\ format you have to 

            ensure that the data shape is fixed for all the data you intend to 

            write to one its\ file. See the general description of this tool 

            for how you can select data to meet this condition. 

 

            The combinespw argument is used to control whether data from 

            different spectral windows will be written as different entries in 

            the its\ FQ (frequency) table or combined as different IF's 

            within one entry in the FQ table. You should normally only set 

            this to True if you know that the data from different spectral 

            windows were observed simultaneously, and the data in the 

            measurement set can be equally divided between all the spectral 

            windows (i.e.\ each window should have the same width).  Use of 

            this switch is recommended for data to be processed in classic 

            AIPS and difmap (if possible, e.g., standard dual IF observations). 

 

            The padwithflags argument is only relevant if combinespw is True. 

            If true, it will fill in data that is 'missing' with flags to fit 

            the IF structure.  This is appropriate if the MS had a few 

            frequency-dependent flags applied, and was then time-averaged by 

            split.  If the spectral windows were observed at different times, 

            padwithflags=True will add a large number of flags, making the  

            output file significantly longer.  It does not yet support spectral 

            windows with different widths. 

 

            The its\ GC (gain curve) and TY (system temperature) tables can 

            be optionally written by setting the writesyscal argument to True. 

            This is a rather WSRT-specific operation at the moment and may not 

            work correctly for measurement sets from other telescopes. 

 

            The width argument is for channel averaging while outputing the  

            data to the fits file. The default values of 1 will copy the  

            channels of the input as is. The start channel number is the  

            first channel of the spw expression. The number of output channels 

            is determined by spw expression and the width. The width is the  

            number of channels of the input data to make 1 channel of the output data.  

           

 

        Input Parameters: 

                fitsfile         Name of the new uvfits file  

                column           Data column to write, see above for options corrected  

                field            Field ids (0-based) or fieldnames to split out  

                spw              Spectral windows to split  

                width            number of input channels to average 1  

                baseline         Antenna names or Antenna indices to select  

                time             Limit data selected to be within a given time range. Syntax is the defined in the msselection link  

                scan             Limit data selected on scan numbers. Syntax is the defined in the msselection link  

                uvrange          Limit data selected on uv distance. Syntax is the defined in the msselection link  

                taql             For the TAQL experts, flexible data selection using the TAQL syntax  

                writesyscal      Write GC and TY tables false  

                multisource      Write in multisource format false  

                combinespw       Export spectral windows as IFs false  

                writestation     Write station name instead of antenna name false  

                padwithflags     If combinespw==True, pad data with flags to fit IFs false  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS') 

              ms.tofits('3C273XC1.fits', column='DATA');  

              ms.done() 

             

             This example writes  the observed data of a measurement set to a  

             \uvfits\ file. 

 

               

              ms.open('big.ms') 

              ms.tofits('part.fits', column='CORRECTED', field=[0,1], spw=[2]);  

              ms.done() 

             

             This example writes part (the first 2 fields and the third spectral  

             window) of the corrected data to the fits file.   

             

 

           

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

                       

        """ 

        return _ms.ms_tofits(self, *args, **kwargs) 

 

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

        """ 

        summary(self, verbose = False, listfile = string(""), listunfl = False,  

            cachesize = 50, overwrite = False) -> record 

 

        Summary 

                (PARTIALLY IMPLEMENTED!!!) Summarize the measurement set 

 

        Description 

                 

            This method will print a summary of the measurement set to the 

            system logger. The verbose argument provides some control on how 

            much information is displayed. 

 

            For especially large datasets, the cachesize parameter can be increased for possibly better 

            performance. 

 

            This method can also return, in the header argument, a record 

            containing the following fields. 

            egin{description} 

              \item[nrow]       Number of rows in the measurement set 

              \item[name]       Name of the measurement set 

            nd{description} 

             

            DESCRIPTION OF ALGORITHM TO CALCULATE THE NUMBER OF UNFLAGGED ROWS 

            The number of unflagged rows will only be computed if listunflis True. 

            The number of unflagged rows (the nUnflRows columns in the scans and fields portions of the listing) is 

            calculated by summing the fractional unflagged bandwidth for each row (and hence why the number of unflagged 

            rows, in general, is not an integer). Thus a row which has half of its 

            total bandwidth flagged contributes 0.5 rows to the unflagged row count. A row with 20 of 32 channels of 

            homogeneous width contributes 20/32 = 0.625 rows to the unflagged row count. A row with a value of False 

            in the FLAG\_ROW column is not counted in the number of unflagged rows. 

           

 

        Input Parameters: 

                verbose          Produce verbose logging output false  

                listfile         Output file  

                listunfl         List unflagged row counts? If true, it can have significant negative performance impact. false  

                cachesize        EXPERIMENTAL. Maximum size in megabytes of cache in which data structures can be held. 50  

                overwrite        If True, tacitly overwrite listfile if it exists. false  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS') 

              outr=ms.summary(verbose=True) 

              ###print the begining of observation in this ms 

              print qa.time(qa.quantity(outr['header']['BeginTime'],'d'), form='ymd') 

              ###print  a dictionary of the info of scan 1 

              outr['header']['scan_1'] 

             

            This example will send a verbose summary of the measurement 

            set to the logger. 

           

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

                       

        """ 

        return _ms.ms_summary(self, *args, **kwargs) 

 

    def getscansummary(self): 

        """ 

        getscansummary(self) -> record 

 

        Summary 

                Get the summary of the ms 

 

        Description 

                 

            This function will return a summary of the main table as a structure 

           

        Example: 

                 

            ms.open('3C273XC1.MS') 

            scanInfo = ms.getscansummary() 

           

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

                       

        """ 

        return _ms.ms_getscansummary(self) 

 

    def getspectralwindowinfo(self): 

        """ 

        getspectralwindowinfo(self) -> record 

 

        Summary 

                Get a summary of the spectral windows 

 

        Description 

                 

            This method will get a summary of the spectral window actually 

            used in this ms. To be precise those reference by the data 

            description table. 

           

        Example: 

                 

            ms.open('3C273XC1.MS') 

            spwInfo = ms.getspectralwindowinfo() 

           

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

                       

        """ 

        return _ms.ms_getspectralwindowinfo(self) 

 

    def listhistory(self): 

        """ 

        listhistory(self) -> bool 

 

        Summary 

                List history of the measurement set 

 

        Description 

                 

            This function lists the contents of the measurement set history 

            table. 

           

        Example: 

                 

             

              ms.open('3C273XC1.MS') 

              ms.listhistory() 

             

            The history table contents are listed in the logger. 

           

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

                       

        """ 

        return _ms.ms_listhistory(self) 

 

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

        """ 

        writehistory(self, message = string(""), parms = string(""), origin = string("MSHistoryHandler::addMessage()"),  

            msname = string(""),  

            app = string("ms")) -> bool 

 

        Summary 

                Add a row of arbitrary information to the measurement set history table 

 

        Description 

                 

            This function adds a row to the history table of the specified 

            measurement set containing any message that the user wishes to 

            record.  By default the history entry is written to the history 

            table of the measurement set that is currently open, the message 

            origin is recorded as 'MSHistoryHandler::addMessage()', the originating 

            application is 'ms' and the input parameters field is empty. 

           

 

        Input Parameters: 

                message          Message to be recorded in message field  

                parms            String to be written to input parameter field  

                origin           String to be written to origin field MSHistoryHandler::addMessage()  

                msname           name of selected measurement set  

                app              String to be written to application field ms  

                 

        Example: 

                 

             

              ms.open('3C273XC1.MS') 

              ms.writehistory('an arbitrary history message') 

              ms.listhistory() 

             

            A row is appended to the measurement set history table. 

           

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

                       

        """ 

        return _ms.ms_writehistory(self, *args, **kwargs) 

 

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

        """ 

        statistics(self, column = string(""), complex_value = string(""), useflags = True,  

            spw = string(""), field = string(""),  

            baseline = string(""), uvrange = string(""),  

            time = string(""), correlation = string(""),  

            scan = string(""), array = string(""),  

            obs = string("")) -> record 

 

        Summary 

                Get statistics on the selected measurement set 

 

        Description 

                 

            This function computes descriptive statistics on the measurement set. 

            It returns the statistical values as a python dictionary.  The given  

            column name must be a numerical column. 

            If it is a complex valued column, the parameter complex\_value defines 

            which derived real value is used for the statistics computation. 

           

 

        Input Parameters: 

                column           Column name  

                complex_value    Which derived value to use for complex columns (amp, amplitude, phase, imag, real, imaginary)  

                useflags         Use the data flags true  

                spw              Spectral Window Indices or names : example : '1,2'  

                field            Field indices or source names : example : '2,3C48'  

                baseline         Baseline number(s): example: '2\&3;4\&5'  

                uvrange          UV-distance range, with a unit : example : '2.0-3000.0 m'  

                time             Time range, as MJDs or date strings : example : 'xx.x.x.x.x~yy.y.y.y.y'  

                correlation      Correlations/polarizations : example : 'RR,LL,RL,LR,XX,YY,XY,YX'  

                scan             Scan number : example : '1,2,3'  

                array            Array Indices or names : example : 'VLAA'  

                obs              Observation ID(s): examples : '' or '1~3'  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS') 

              ms.statistics(column='DATA', antenna='2') 

             

           

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

                       

        """ 

        return _ms.ms_statistics(self, *args, **kwargs) 

 

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

        """ 

        range(self, items = std::vector< string >(1, ""), useflags = True,  

            blocksize = 10) -> record 

 

        Summary 

                Get the range of values in the measurement set 

 

        Description 

                 

            This function will return the range of values in the currently 

            selected measurement set for the items specified.  Possible items 

            include most scalar columns, interferometer number 

            (1000*antenna1+antenna2), uvdist(ance), u, v, w, amplitude, phase, 

            real and imaginary components of the data (and corrected and model 

            versions of these - if these columns are present). See the table 

            at the top of the document to find the exact list. 

 

            You specify items in which you are interested using a string 

            vector where each element is a case insensitive item name.  This 

            function will then return a record that has fields corresponding 

            to each of the specified items. Each field will contain the range 

            of the specified item. For many items the range will be the 

            minimum and maximum values but for some it will be a list of 

            unique values. Unrecognized items are ignored. 

             

            By default the FLAG column is used to exclude flagged data before 

            any ranges are determined, but you can set useflags=False to include 

            flagged data in the range.  However, if you average in frequency,  

            flagging will still be applied. 

 

            You can influence the memory use and the reading speed using  

            the blocksize argument - it specifies how big a block of data 

            to read at once (in MB). For large datasets on machines with lots 

            of memory you may speed things up by setting this higher than the 

            default (10 MB). 

 

            For some items, as indicated with an \S\ in table 

            ref{ms:tblItems} (in the general description of this tool), you 

            need to call selectinit to select a portion of the data with a 

            unique shape prior to calling this function. 

 

            Items prefixed with corrected, model, residual or 

            obs\_residual and the imaging\_weight item are not available unless 

            your measurement set has been processed either with the imager or 

            calibrator tools. 

           

 

        Input Parameters: 

                items            Item names  

                useflags         Use the data flags true  

                blocksize        Set the blocksize in MB 10  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS') 

              ms.selectinit(datadescid=0) 

              ms.range(['time','uvdist','amplitude','antenna1']) 

        #{'amplitude': array([  2.60339398e-02,   3.38518333e+01]), 

        # 'antenna1': array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 11, 12, 13, 

        #                    14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]), 

        # 'time': array([  4.12162940e+09,   4.12164267e+09]), 

        # 'uvdist': array([   46.26912101,  3727.97385983])} 

             

            In this example the minimum and maximum observation times, 

            uvdistances, data amplitudes are returned as well as a list of all the 

            antennas in the antenna1 column.  

 

            For this dataset the selectinit function did not need to be 

            called as all the data is of one shape. 

           

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

                       

        """ 

        return _ms.ms_range(self, *args, **kwargs) 

 

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

        """ 

        lister(self, options = string(""), datacolumn = string("data"),  

            field = string(""), spw = string(""), antenna = string(""),  

            timerange = string(""), correlation = string(""),  

            scan = string(""), feed = string(""),  

            array = string(""), observation = string(""),  

            uvrange = string(""), average = string(""),  

            showflags = False, msselect = string(""),  

            pagerows = 50, listfile = string("")) -> bool 

 

        Summary 

                List measurement set visibilities 

 

        Description 

                 

 

        This tool lists measurement set visibility data under a number of 

        input selection conditions.  The measurement set data columns that 

        can be listed are: the raw data, corrected data, model data, and 

        residual (corrected - model) data. 

 

        The output table format is dynamic.  Field, Spectral Window, and 

        Channel columns are not displayed if the column contents are uniform. 

        For example, if ``spw = `1' '' is specified, the spw column will not be 

        displayed.  When a column is not displayed, a message is sent to the 

        logger and terminal indicating that the column values are uniform and 

        listing the uniform value. 

 

        Table column descriptions: 

 

        egin{tabular}{ll} 

        \hline\hline 

        Column Name \& Description \ 

        \hline 

        Date/Time   \& Average date and time of data sample interval \ 

        Intrf       \& Interferometer baseline (antenna names) \ 

        UVDist      \& uv-distance (units of wavelength) \ 

        Fld         \& Field ID \ 

        SpW         \& Spectral Window ID \ 

        Chn         \& Channel number \ 

        (Correlated \& Correlated polarizations (eg: RR, LL, XY) \ 

          polarization) \&   Sub-columns are: Amp, Phs, Wt, F \ 

        Amp         \& Visibility amplitude \ 

        Phs         \& Visibility phase \ 

        Wt          \& Weight of visibility measurement \ 

        F           \& Flag: `F' = flagged datum; ` ' = unflagged \ 

        \hline\hline 

        nd{tabular} 

           

           

 

        Input Parameters: 

                options          Output options (not yet implemented)  

                datacolumn       Column to list: data, model, corrected, residual data  

                field            Fields  

                spw              Spectral Windows  

                antenna          Antenna/Baselines  

                timerange        Time range  

                correlation      Polarization correlations  

                scan             Scan  

                feed             Feed (not yet implemented)  

                array            Array  

                observation      Select by observation ID(s)  

                uvrange          uv-distance (output units: wavelength)  

                average          Average mode (not yet implemented)  

                showflags        Showflags (not yet implemented) false  

                msselect         TaQL expression  

                pagerows         Rows per page 50  

                listfile         Output file  

                 

        Example: 

                 

 

             

              ms.open('AZ136.ms') 

              ms.lister() 

             

            These commands yeild the following listing:  

             

        Date/Time:                         RR:                      RL:                      LR:                      LL:                      

        2001/12/01/  Intrf UVDist Fld SpW      Amp   Phs       Wt F     Amp   Phs       Wt F     Amp   Phs       Wt F     Amp   Phs       Wt F 

        ------------|-----|------|---|---|-------------------------|------------------------|------------------------|------------------------ 

          19:30:05.0  0- 1   1400   0   0:   0.002-102.7   229035 F   0.003-178.3   239694 F   0.001 136.0   208264 F   0.001 -79.7   263599 F 

          19:30:05.0  0- 2   7203   0   0:   0.002 127.3   267464 F   0.001 165.0   305192 F   0.003-118.2   265174 F   0.002  16.3   307829 F 

          19:30:05.0  0- 3   9621   0   0:   0.002 -55.9   179652 F   0.002 -27.1   230130 F   0.001 -94.9   199954 F   0.003 -89.3   206764 F 

          19:30:05.0  0- 4   1656   0   0:   0.001 133.3   199677 F   0.002  80.6   258140 F   0.001 -35.1   224291 F   0.003  23.9   229812 F 

          19:30:05.0  0- 5   3084   0   0:   0.002 -18.4   197565 F   0.001 -83.1   228541 F   0.002 -85.1   198574 F   0.002 -28.5   227381 F 

          19:30:05.0  0- 6   5020   0   0:   0.001-173.2   236475 F   0.002-104.0   257575 F   0.000   0.0   223800 F   0.000-142.5   272162 F 

          19:30:05.0  0- 7  12266   0   0:   0.003 -34.6   264977 F   0.002   5.3   280113 F   0.001-152.7   243383 F   0.002 -78.8   304966 F 

            .   

            .   

            .   

             

 

            Notice that the channel column is not displayed.  This measurement set 

            contains only one channel; since the channel column values are uniform, 

            the channel column is not displayed.  Instead, message  

            'All selected data has CHANNEL = 0' is sent to the console. 

 

           

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

                       

        """ 

        return _ms.ms_lister(self, *args, **kwargs) 

 

    def metadata(self, cachesize = 50): 

        """ 

        metadata(self, cachesize = 50) -> casac::msmetadata 

 

        Summary 

                Get the MS metadata associated with this MS. 

 

        Description 

                Get the MS metadata associated with this MS. 

 

        Input Parameters: 

                cachesize        Maximum cache size, in megabytes, to use. 50  

                 

        Example: 

                 

                # get the number of spectral windows in the specified MS 

                ms.open'my.ms') 

                metadata = ms.metadata() 

                ms.done() 

                nspw = metadata.nspw() 

                metadata.done() 

             

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

                       

        """ 

        return _ms.ms_metadata(self, cachesize) 

 

    def selectinit(self, datadescid = 0, reset = False): 

        """ 

        selectinit(self, datadescid = 0, reset = False) -> bool 

 

        Summary 

                Initialize the selection of an ms 

 

        Description 

                 

            A measurement set can contain data with a variety of different 

            shapes (as described in the overall description to this tool).  To 

            allow functions to return data in fixed shape arrays you need to 

            select, using this function, rows that contain the same data 

            shape. You do not need to use this function if all the data in 

            your measurement set has only one shape. 

 

            The DATA\_DESC\_ID column in the measurement set contains a 

            value that maps to a particular row in the POLARIZATION and 

            SPECTRAL\_WINDOW subtables. Hence all rows with the same 

            value in the DATA\_DESC\_ID column must have the same data 

            shape. To select all the data where the DATA\_DESC\_ID value 

            is $N$ you call this function with the datadescid argument set to 

            $N$.  

 

            It is possible to have a measurement set with differing values in 

            the DATA\_DESC\_ID column but where all the data is a fixed 

            shape. For example this will occur if the reference frequency 

            changes but the number of spectral channels is fixed. In cases 

            like this all the data can be selected, using this function with 

            an argument of zero.  If the data shape does change and you call 

            this function with an datadescid set to zero  the return value will be False. In all other cases it will be 

            True. 

 

            To return to the completely unselected measurement set, set the 

            reset argument to True. This will allow you to access the full 

            range of rows in the measurement set, rather than just the 

            selected measurement set. 

 

            The datadescid must always be a non-negative integer. 

           

 

        Input Parameters: 

                datadescid       Data description id 0  

                reset            Reset to unselected state false  

                 

        Example: 

                 

             

              ms.open('3C273XC1.MS') 

              ms.selectinit(datadescid=0) 

              print ms.range(['uvdist']) 

              ms.selectinit(reset=True) 

              print ms.range('uvdist') 

             

 

            In this example we display the range of uv distances for the data 

            in the specified measurement set. The first print statement will 

            only use data where the DATA\_DESC\_ID column is 0. This will 

            correspond to a specific spectral window and polarization 

            setup. The second print statement will print the range of uv 

            distances for all the data in the measurement set (which is the 

            same in this case). 

 

           

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

                       

        """ 

        return _ms.ms_selectinit(self, datadescid, reset) 

 

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

        """ 

        msselect(self, items = initialize_record(""), onlyparse = False) -> bool 

 

        Summary 

                Use the MSSelection module for data selection. 

 

        Description 

                 

               A retun value of True implies that the combination of all selection expressions 

               resulted in a non-Null combined TaQL expression. False implies 

               that the combined TaQL could not be formed (i.e. it is Null, 

               and the 'selected MS' will be the same as the input MS). 

 

               The details of selection expressions are desribed in the 

               MSSelection Memo. 

 

               Note that this function can be called multiple times but the 

               result is cumulative.  I.e. selection will work on the data 

               already selected from all previous calls of this function.  Use 

               the function reset() to reset all selections to NULL (original 

               database). 

              

 

        Input Parameters: 

                items            Record with fields contain the selection experessions. Keys recognized in the record are: 'spw', 'time', 'field', 'baseline', 'scan', 'scanintent', 'polarization', 'observation', 'array', 'uvdist' and 'taql'.  

                onlyparse        If set to True, expressions will only be parsed but not applied to the MS for selection. When set to False, a selected MS will also be generated internally. Default is False. When only parsing is requested, the selected-MS is the same as the original MS. false  

                 

        Example: 

                 

               CASA: staql={'field':'3C286', 'spw':'0~7:10~55'}; 

               CASA: ms.open(MSNAME); 

               CASA: ms.msselect(staql, onlyparse=True); # For only getting the list 

                                                         # of indices correspoding to the selection 

               CASA: ndx=ms.msselectedindices(); 

               CASA: ndx['field'] 

                 Out[5]: array([1], dtype=int32) 

                  : 

                  : 

               CASA: ms.msselect(staql);  # To do the actual selection. 

                                          # From this point on, the ms-tool is 

                                          # attached to the selected MS. 

              

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

                       

        """ 

        return _ms.ms_msselect(self, *args, **kwargs) 

 

    def msselectedindices(self): 

        """ 

        msselectedindices(self) -> record 

 

        Summary 

                 

               Return the selected indices of the MS database.  The keys in 

               the record are the same as those used in msselect function 

               (i.e. 'spw', 'time', 'field', 'baseline', 'scan', 'scanintent', 

               'polarization' and 'uvdist'). 

              

 

        Description 

                 

               The return indices are the result of parsing the MSSelection 

               expressions provided in 

               the msselect 

               function. 

              

        Example: 

                 

              

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

                       

        """ 

        return _ms.ms_msselectedindices(self) 

 

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

        """ 

        select(self, items = initialize_record("")) -> bool 

 

        Summary 

                Select a subset of the measurement set. 

 

        Description 

                 

            This function will select a subset of the current measurement set 

            based on the range of values for each field in the input 

            record. The range function will return a record that can be 

            altered and used as the argument for this function.  A successful 

            selection returns True. Allowable fields are tabulated in 

            table~ref{ms:tblItems} (in the general description of this 

            tool). Unrecognized fields are ignored. 

 

            You need to call selectinit before 

            calling this function. If you haven't then selectinit will be 

            called for you with default arguments. 

 

            Repeated use of this function, with different arguments, will 

            further refine the selection, resulting in a successively smaller 

            selected measurement set. If the selected measurement set does not 

            contain any rows then this function will return False and send a 

            warning message in the logger. Otherwise this function will return 

            True. To undo all the selections you need to use the selectinit 

            function (with reset=True). 

           

 

        Input Parameters: 

                items            record with fields contain ranges and enumerations  

                 

        Example: 

                 

             

              ms.open('3C273XC1.MS') 

              ms.selectinit(datadescid=0) 

              ms.select({'antenna1':[1,3,5],'uvdist':[1200.,1900.]}) 

              ms.select({'time':[4121629420.,4121638290.]}) 

              start = qa.getvalue(qa.convert(qa.quantity('1989/06/27/01:03:40'),'s')) 

              stop = qa.getvalue(qa.convert(qa.quantity('1989/06/27/03:31:30'),'s')) 

              rec = {} 

              rec['time'] = [start, stop] 

              ms.select(items=rec) 

             

            This example selects all the data from the measurement set where 

            the value in the DATA\_DESC\_ID column is zero. This 

            corresponds to a particular spectral window and polarization 

            setup. It then selects all the data where the first antenna in the 

            interferometer is number one, three or five and where the uv 

            distance is between 1200 and 1900 meters.  Finally it selects all 

            the data which was observed between 4121629420 seconds and 

            4121638290 seconds (since zero hours on the day where the modified 

            Julian day is zero). Since this time in seconds is quite obscure I 

            have also illustrated how to use the quanta tool to convert a 

            date/time string into seconds which can then be used to perform 

            the same time selection. 

 

            The selections are cumulative so that at the end of this example 

            only data in the specified time range, with the specified, 

            interferometers, uv distances, spectral window and polarization 

            setup are selected. 

           

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

                       

        """ 

        return _ms.ms_select(self, *args, **kwargs) 

 

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

        """ 

        selecttaql(self, msselect = string("")) -> bool 

 

        Summary 

                Select a subset of the measurement set. 

 

        Description 

                 

            This function will select a subset of the current measurement set 

            based on the standard TaQL selection string given. 

 

            Repeated use of this function, with different arguments, will 

            further refine the selection, resulting in a successively smaller 

            selected measurement set. If the selected measurement set does not 

            contain any rows then this function will return False and send a 

            warning message in the logger. Otherwise this function will return 

            True. To undo all the selections you need to use the selectinit 

            function (with reset=True). 

            Note that index values used in the TaQL string are zero-based 

            as are all tool indices. 

 

           

 

        Input Parameters: 

                msselect         TaQL selection string  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS') 

              ms.selectinit(datadescid=0) 

              ms.select({'antenna1':[0,2,4],'uvdist':[1200.,1900.]}) 

              ms.selecttaql('ANTENNA1==2') 

              ms.range(['ANTENNA1','ANTENNA2']) 

              # {'antenna1': array([2]), 

              #  'antenna2': array([ 6,  9, 11, 18, 20, 21, 24])} 

             

            This example selects all the data from the measurement set where 

            the value in the DATA_DESC_ID column is zero. This 

            corresponds to a particular spectral window and polarization 

            setup. It then selects all the data where the first antenna in the 

            interferometer is number zero, two or four and where the uv 

            distance is between 1200 and 1900 meters.  Finally it uses a query 

            to select all the data for which the ANTENNA1 column is 2 (this 

            selects the middle antenna of the previous, zero-based, selection). 

            The selections are cumulative so that at the end of this example 

            only data in the specified time range, with the specified, 

            interferometers, uv distances, spectral window and polarization 

            setup are selected. 

           

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

                       

        """ 

        return _ms.ms_selecttaql(self, *args, **kwargs) 

 

    def selectchannel(self, nchan = 1, start = 0, width = 1, inc = 1): 

        """ 

        selectchannel(self, nchan = 1, start = 0, width = 1, inc = 1) -> bool 

 

        Summary 

                Select and average frequency channels 

 

        Description 

                 

            This function allows you to select a subset of the frequency 

            channels in the current measurement set.  This function can also 

            average, over frequency channels, prior to providing the values to 

            the user. 

 

            Selection on channels is not allowed using either the select or 

            command functions as they can only select entire rows in a 

            measurement set. Channel selection involves accessing only some of 

            the values in a row. Like all the selection functions this 

            function does not change the current measurement but updates the 

            measurement set selection parameters so that functions like 

            getdata will return the desired subset of the data.  Repeated use 

            of this function will overwrite any previous channel 

            selection. 

 

            There are four parameters, the number of output channels, the 

            first input channel to use, the number of input channels to 

            average into one output channel, and the increment in the input 

            spectrum for the next output channel. All four parameters need to 

            be specified.  

 

            This function return True if the selection was successful, and False if 

            not. In the latter case an error message will also be sent to the 

            logger. 

 

            You need to call selectinit before 

            calling this function. If you haven't then selectinit will be 

            called for you with default arguments. 

           

 

        Input Parameters: 

                nchan            Number of output channels, positive integer 1  

                start            First input channel to use, positive integer 0  

                width            Number of input channels to average together, positive integer 1  

                inc              Increment to next (group of) input channel(s), positive integer 1  

                 

        Example: 

                 

             

              ms.fromfits('NGC5921.MS', 

                          '/usr/lib/casapy/data/demo/NGC5921.fits') 

              ms.selectinit(datadescid=0) 

              ms.selectchannel(3,2,5,3) 

             

            This example selects all the data from the measurement set where 

            the value in the DATA_DESC_ID column is zero. This 

            corresponds to a particular spectral window and polarization 

            setup. It then selects on frequency channels to produce 3 output 

            channels, the first output channel is the average of channels 

            2,3,4,5,6 in the input, the second output channel is the average 

            of channel 5,6,7,8,9 and the third is the average of channels 

            8,9,10,11,12. 

           

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

                       

        """ 

        return _ms.ms_selectchannel(self, nchan, start, width, inc) 

 

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

        """ 

        selectpolarization(self, wantedpol = std::vector< string >(1, "")) -> bool 

 

        Summary 

                Selection and convertion of polarizations 

 

        Description 

                 

            This function allows you to select a subset of the polarizations 

            in the current measurement set.  This function can also setup 

            conversion to different polarization representations. 

 

            You specify the polarizations using a string vector. Allowable 

            strings are include I, Q, U, V, RR, RL, LR, LL, XX, YY, XY, 

            YX. These string must be specified in upper case. If the 

            polarizations match those present in the measurement set they will 

            be selected directly, otherwise all polarizations are read and 

            then a conversion step is done. If the conversion cannot be done 

            then an error will be produced when you try to access the data. 

 

            This function return True if the selection was successful, and False if 

            not. 

 

            You need to call selectinit before 

            calling this function. If you haven't then selectinit will be 

            called for you with default arguments. 

           

 

        Input Parameters: 

                wantedpol        The polarizations wanted  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS') 

              ms.selectinit(datadescid=0) 

              ms.selectpolarization(['I','V']) 

              rec = ms.getdata('data') 

             

            This example selects all the data from the measurement set where 

            the value in the DATA_DESC_ID column is zero. This 

            corresponds to a particular spectral window and polarization 

            setup. It then selects the I and V polarizations and when the 

            getdata function is called the conversion from RR, LL, LR, RL 

            polarizations to I and V occurs. 

           

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

                       

        """ 

        return _ms.ms_selectpolarization(self, *args, **kwargs) 

 

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

        """ 

        regridspw(self, outframe = string("LSRK"), mode = string("chan"), restfreq = -3E30,  

            interpolation = string("LINEAR"),  

            start = -3E30, center = -3E30, bandwidth = -1.,  

            chanwidth = -1., hanning = True) -> bool 

 

        Summary 

                transform spectral data to different reference frame and/or regrid the frequency channels 

            

 

        Description 

                 

          This function permits you to transform the spectral data of your measurement set to a  

          given reference frame. The present reference frame information in the MS is examined and  

          the transformation performed accordingly. Since all such transformations are linear in  

          frequency, a pure change of reference frame only affects the channel boundary definitions. 

 

          In addition, the function permits you to permanently regrid the data, i.e. reduce the  

          channel number and/or move the boundaries using several interpolation methods (selected  

          using parameter 'interpolation'). The new channels are equidistant in frequency  

          (if parameter 'mode' is chosen to be vrad or freq, or equidistant in 

          wavelength if  parameter 'mode' is chosen to be vopt or wave). 

          If 'mode' is chosen to be 'chan', the regridding is performed by combining 

          the existing channels, i.e. not moving but just eliminating channel boundaries where 

          necessary. 

 

          The regridding is applied to the channel definition and all data of the MS, i.e. all  

          columns which contain arrays whose dimensions depend on the number of channels.  

          The input parameters are verified before any modification is made to the MS. 

 

          The target reference frame can be set by providing the name of a standard reference  

          frame (LSRK, LSRD, BARY, GALACTO, LGROUP, CMB, TOPO, GEO, or SOURCE, default = no change of  

          frame) in parameter 'outframe'. 

          For each field in the MS, the channel frequencies are transformed from their present  

          reference frame to the one given by parameter 'outframe'. 

 

          If the regridding parameters are set, they are interpreted in the 'outframe' reference 

          frame. The regridding is applied to the data after the reference frame transformation. 

 

           

 

        Input Parameters: 

                outframe         Name of the reference frame to transform to (LSRK, LSRD, BARY, GALACTO, LGROUP, CMB, GEO, TOPO, or SOURCE). SOURCE is meant for solar system work and corresponds to GEO + a radial velocity correction (only available for ephemeris objects). If no reference frame is given, the present reference frame given by the data is used, i.e. the reference frame is not changed. The observatory position is taken as the average of all antenna positions. LSRK  

                mode             The quantity (radio velocity (m/s), optical velocity (m/s), frequency (Hz), wavelength (m), or original channels) in which the user would like to give the regridding parameters below ('center', 'chanwidth', 'bandwidth'): vrad, vopt, freq, wave, or chan. chan  

                restfreq         Required in case the value of mode is 'vrad' or 'vopt': Rest frequency (Hz) for the conversion of the regrid parameters 'center', 'chanwidth', and 'bandwidth' to frequencies. -3E30  

                interpolation    Name of the interpolation method (NEAREST, LINEAR, SPLINE, CUBIC, FFTSHIFT) used in the regridding. Flagging information is combined using 'inclusive or'. LINEAR  

                start            Desired lower edge of the spectral window after regridding in the units given by 'mode' and in the reference frame given by 'outframe'. If no value is given, it is determined from 'center' and 'bandwidth'. -3E30  

                center           (Alternative to setting the parameter 'start'.) Desired center of the spectral window after regridding in the units given by 'mode' and in the reference frame given by 'outframe'. If no value is given, the center is determined from 'start' and 'bandwidth' or, if 'start' is not given either, it is kept as it is. -3E30  

                bandwidth        Desired width of the entire spectral window after regridding in the units given by 'mode' and in the reference frame given by 'outframe'. If no value is given or the given width is larger than the bandwidth of the data, the width will be truncated to the maximum width possible symmetrically around the value given by 'center'. -1.  

                chanwidth        Desired width of the channels in the units given by 'mode' and in the reference frame given by 'outframe'. This implies that channels will be equidistant in the unit given by 'mode'. If no value is given and 'mode' is vrad or freq, the function will keep the resolution as it is. If 'mode' is vopt or wave, the total number of channels will be kept as is. -1.  

                hanning          If true, perform hanning smoothing before regridding. true  

                 

        Example: 

                 

             

              ms.fromfits('NGC5921.MS', '/usr/lib/casapy/data/demo/NGC5921.fits') 

              ms.regridspw(outframe='LSRK') 

             

            This example reads a measurement set and transforms its spectral axis to 

            the LSRK reference frame. 

             

              ms.regridspw(outframe='BARY', mode='vrad',  

              center=73961800., chanwidth=50., bandwidth=1000., 

              restfreq=1420405750e6) 

             

            In this example, all spectral windows in the MS will be transformed  

            to the BARY reference frame and then be regridded such that the center of the  

            new spectral window is at radio velocity = 73961800. m/s (BARY). If the bandwidth  

            of the observation is large enough the total width of the spectral window will 

            be 1000 m/s, i.e. 20 channels of width 50 m/s, 10 on each side of the given 

            center. 

             

              ms.regridspw(mode='vopt', restfreq=1420405750e6) 

             

            In this example the channels are regridded such that they are 

            equidistant in optical velocity. The reference frame and number of channels  

            is kept as is. 

             

              ms.regridspw(mode='chan', center=64, chanwidth=2, 

              bandwidth=102) 

             

            In this example, the channels are regridded such that the new bandwidth is 

            102 of the original channels centered on the original channel 64, and the new 

            channels are twice as wide as the original channels.  

           

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

                       

        """ 

        return _ms.ms_regridspw(self, *args, **kwargs) 

 

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

        """ 

        cvel(self, mode = string("channel"), nchan = -1, start = initialize_variant("0"),  

            width = initialize_variant("1"),  

            interp = string("linear"), phasec = initialize_variant(""),  

            restfreq = initialize_variant("1.4GHz"),  

            outframe = string(""), veltype = string("radio"),  

            hanning = True) -> bool 

 

        Summary 

                transform spectral data to different reference frame and/or regrid the frequency channels 

            

 

        Description 

                 

          This function permits you to transform the spectral data of your measurement set to a  

          given reference frame and/or regrid it. It will combine all spectral windows of the MS into one. 

           

 

        Input Parameters: 

                mode             'channel', 'velocity', 'frequency', or 'channel\_b', default = 'channel' channel  

                nchan            number of channels, default = -1 = all -1  

                start            start channel, default = 0 0  

                width            new channel width, default = 1 1  

                interp           interpolation method 'nearest', 'linear', 'spline', 'cubic', 'fftshift', default = linear linear  

                phasec           phase center, default = first field  

                restfreq         rest frequency, default = 1.4GHz 1.4GHz  

                outframe         LSRK, LSRD, BARY, GALACTO, LGROUP, CMB, GEO, TOPO, or SOURCE default = '' = keep reference frame.  

                veltype          radio or optical, default = radio radio  

                hanning          If true, perform hanning smoothing before regridding. true  

                 

        Example: 

                 

           

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

                       

        """ 

        return _ms.ms_cvel(self, *args, **kwargs) 

 

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

        """ 

        cvelfreqs(self, spwids = initialize_vector(1, (int)0), fieldids = initialize_vector(1, (int)0),  

            obstime = string(""),  

            mode = string("channel"), nchan = -1, start = initialize_variant("0"),  

            width = initialize_variant("1"),  

            phasec = initialize_variant(""),  

            restfreq = initialize_variant("1.4GHz"),  

            outframe = string(""), veltype = string("radio"),  

            verbose = True) -> std::vector<(double)> 

 

        Summary 

                calculate the transformed grid of the SPW obtained by combining a given set of SPWs (MS is not modified) 

            

 

        Description 

                 

            Take the spectral grid of a given spectral window, tranform and regrid it as prescribed by the given 

            grid parameters (same as in cvel and clean) and return the transformed values as a list. 

            The MS is not modified. Useful for tests of gridding parameters before using them in cvel or clean. 

           

 

        Input Parameters: 

                spwids           The list of ids of the spectral windows from which the input grid is to be taken. 0  

                fieldids         The list of ids of the fields which are selected (for observation time determination), default: all 0  

                obstime          the observation time to assume, default: time of the first row of the MS =  

                mode             'channel', 'velocity', 'frequency', or 'channel\_b', default = channel  

                nchan            number of channels, default = all = -1  

                start            start channel, default = 0  

                width            new channel width, default = 1  

                phasec           phase center, default = first field in selection =  

                restfreq         rest frequency, default = 1.4GHz  

                outframe         LSRK, LSRD, BARY, GALACTO, LGROUP, CMB, GEO, TOPO, or SOURCE default = keep reference frame =  

                veltype          radio or optical, default = radio  

                verbose          If true, create log output true  

                 

        Example: 

                 

            ms.open('my.ms') 

            ms.cvelfreqs(spwids=[1], mode='channel', nchan=20, start=2, width=3, outframe='LSRK') 

 

            will take the grid of SPW 1 (i.e. the second in the SPW table), regrid it as in cvel 

            with the given grid parameters and return the resulting channel centers as an array. 

            The MS is not modified. See help cvel for more details on the grid parameters. 

 

           

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

                       

        """ 

        return _ms.ms_cvelfreqs(self, *args, **kwargs) 

 

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

        """ 

        getdata(self, items = std::vector< string >(1, ""), ifraxis = False,  

            ifraxisgap = 0, increment = 1, average = False) -> record 

 

        Summary 

                Read values from the measurement set. 

 

        Description 

                 

            This function will read the specified items from the currently 

            selected measurement set and returns them in fields of a record. 

            The main difference between this and direct access of the table, 

            using the table tool, is that this function reads data from the 

            mph{selected} measurement set, it provides access to derived 

            quantities like amplitude \& flag\_sum and it can reorder the 

            data. 

 

            The items to read are specified, as with the range function, using 

            a vector of strings. Table~ref{ms:tblItems} shows the allowable 

            items. Unrecognized items will result in a warning being sent to 

            the logger.  Duplicate items are silently ignored. 

 

            The record that is returned contains fields that correspond to 

            each of the specified items. Most fields will contain an 

            array. The array may be one, two or three dimensional depending on 

            whether the corresponding row in the measurement set is a scalar, 

            one or two dimensional. Unless the ifraxis argument is set to T 

            the length of the last axis on these arrays will correspond to the 

            number of rows in the selected measurement set. 

 

            If the ifraxis argument is set to True, the row axis is split into an 

            interferometer axis and a time axis. For example a measurement set 

            with 90 rows, in an array with 6 telescopes (so that there are 15 

            interferometers), may have a data array of shape erb|[4,32,90]| 

            if ifraxis is False or erb|[4,32,15,6]|, if ifraxis is True (assuming 

            there are 4 correlations and 32 channels). If there are missing 

            rows as will happen if not all interferometers where used for all 

            time-slots then a default value will be inserted. 

             

            This splitting of the row axis may not happen for items where 

            there is only a single value per row. For some items the returned 

            vector will contain only as many values as there are 

            interferometers and it is implicit that the same value should be 

            used for all time slots. The antenna1, antenna2, feed1, feed2 \& 

            ifr\_number items fall in this category. For other items the 

            returned vector will have as many values as there are time slots 

            and it is implicit that the same value should be used for all 

            interefometers. The field\_id, scan\_number, data\_desc\_id \& 

            time items fall into this category. 

 

            The axis\_info item provides data labelling information. It 

            returns a record with the following fields: corr\_axis, 

            freq\_axis, ifr\_axis \& time\_axis. The latter two fields are not 

            present if ifr\_axis is set to False. The corr\_axis field contains a 

            string vector with elements like 'RR' or 'XY' that indicates which 

            polarizations where correlated together to produce the data. The 

            length of this vector will always be the same as the length of the 

            first axis of the data array. The freq\_axis field contains a 

            record with two fields, chan\_freq \& resolution. Each of these 

            fields contains vectors which indicate the centre frequency and 

            spectral resolution (FWHM) of each channel. The length of these 

            vectors will be the same as the length of the second axis in the 

            data. The ifr\_axis field contains fields: ifr\_number, 

            ifr\_name, ifr\_shortname \& baseline. The ifr\_number is the same 

            as returned by the ifr\_item, the ifr\_name \& ifr\_shortname are 

            string vecors containing descriptions of the interferometer and 

            the baseline is the Euclidian distance, in meters between the two 

            antennas. All of these vectors have a length equal to the number 

            of interferometers in the selected measurement set ie., to the 

            length of the third axis in the data when ifraxis is True. The 

            time\_axis field contains the MJD seconds field and optionally the 

            HA, UT \& LAST fields. To include the optional fields you need to 

            add the ha, last or ut strings to the list of requested items. All 

            the fields in the time\_axis record contain vectors that indicate 

            the time at the midpoint of the observation and are in 

            seconds. The MJD seconds field is since 0 hours on the day having a 

            modified julian day number of zero and the rest are since midnight 

            prior to the start of the observation. 

 

            An optional gap size can be specified to visually separate groups of  

            interferometers with the same antenna1 index (handy for 

            identifying antennas in an interferometer vs time display). The 

            default is no gap. 

 

            An optional increment can be specified to return data from every 

            row matching the increment only. 

 

            When the average flag is set, the data will be averaged over the 

            time axis if the ifraxis is True or the row axis i.e., different 

            interferometers and times may be averaged together. In the latter 

            case, some of the coordinate information, like antenna\_id, will 

            no longer make sense. 

 

            You need to call selectinit before 

            calling this function. If you haven't then selectinit will be 

            called for you with default arguments. 

 

            Items prefixed with either; corrected, model, residual or 

            obs\_residual and the imaging\_weight item are not available unless 

            your measurement set has been processed either with the imager or 

            calibrator tools. 

           

 

        Input Parameters: 

                items            Item names  

                ifraxis          Create interferometer axis if True false  

                ifraxisgap       Gap size on ifr axis when antenna1 changes 0  

                increment        Row increment for data access 1  

                average          Average the data in time or over rows false  

                 

        Example: 

                 

             

        ms.open('3C273XC1.MS') 

        ms.selectinit(datadescid=0) 

        # The following line causes an EXCEPTION 

        # d = ms.getdata(['amplitude','axis_info','ha'],ifraxis=True) 

        # so we settle for MJDseconds rather than HA in seconds 

        d = ms.getdata(['amplitude','axis_info'],ifraxis=True) 

        tstart = min(d['axis_info']['time_axis']['MJDseconds']) 

        tstop  = max(d['axis_info']['time_axis']['MJDseconds']) 

        maxamp = max(max(d['amplitude'][:,0,0,0]),max(d['amplitude'][0,:,0,0]), 

            max(d['amplitude'][0,0,:,0]),max(d['amplitude'][0,0,0,:])) 

        print 'MJD start time (seconds) =', tstart 

        # MJD start time (seconds) = 4121629400.0 

        print 'MJD stop time (seconds) =', tstop 

        # MJD stop time (seconds) = 4121642670.0 

        # MJDseconds Correlation amplitude 

        print 'Maximum correlation amplitude =', maxamp 

        # Maximum correlation amplitude = 33.5794372559 

        chan = 0 

        corr = 0 

        freqGHz = d['axis_info']['freq_axis']['chan_freq'][chan]/1.0E9 

        baselineStr = d['axis_info']['ifr_axis']['ifr_name'][corr] 

        corrStr = d['axis_info']['corr_axis'][corr] 

        tcoord = d['axis_info']['time_axis']['MJDseconds'] 

        acoord = d['amplitude'][0,0,0,:] 

        print 'Frequency', freqGHz, 'GHz', 'Baseline', baselineStr, '(', corrStr, ')' 

        print 'MJDseconds', 'Correlation amplitude' 

        for i in range(len(tcoord)): 

            print tcoord[i], acoord[i] 

        # 

        # Frequency [ 8.085] GHz Baseline 1-2 ( RR ) 

        # MJDseconds Correlation amplitude 

        # 4121629400.0 29.2170944214 

        # 4121629410.0 29.1688995361 

        # 4121629420.0 29.2497825623 

        # 4121629430.0 29.2029647827 

        # 4121629440.0 29.166015625 

        # 4121629450.0 29.2417526245 

        # 4121629460.0 29.2867794037 

        # 4121638270.0 0.0 

        # 4121638280.0 29.4539775848 

        # 4121638290.0 29.472661972 

        # 4121638300.0 29.4424362183 

        # 4121638310.0 29.4234466553 

        # 4121638320.0 29.4018745422 

        # 4121638330.0 29.3326053619 

        # 4121638340.0 29.3575496674 

        # 4121642600.0 31.1411132812 

        # 4121642610.0 31.0726108551 

        # 4121642620.0 31.1242599487 

        # 4121642630.0 31.0505466461 

        # 4121642640.0 31.0448284149 

        # 4121642650.0 30.9974422455 

        # 4121642660.0 31.0648326874 

        # 4121642670.0 31.0638961792 

 

 

            This example selects all the data from the 

            measurement set where the value in the DATA_DESC_ID column is 

            zero. This corresponds to a particular spectral window and 

            polarization setup. It then gets the correlated amplitude, and the 

            axis information from this selected measurement set. This is 

            returned in the casapy variable d. The remainder of the example 

            prints a table of 'hour angle' and corresponding 'correlated 

            amplitude' for the first channel, correlation and baseline. 

           

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

                       

        """ 

        return _ms.ms_getdata(self, *args, **kwargs) 

 

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

        """ 

        putdata(self, items = initialize_record("")) -> bool 

 

        Summary 

                Write new values into the measurement set 

 

        Description 

                 

            This function allows you to write values from casapy variables back 

            into the measurement set table. The main difference between this 

            and directly accessing the table using the table tool is that this 

            function writes data to the mph{selected} measurement set. 

 

            Unlike the getdata function you can only put items that correspond 

            to actual table columns. You cannot change the data shape either 

            so that the number of correlations, channels and rows (or 

            intereferometers/time slots) must match the values in the selected 

            measurement set. If the values were obtained using the getdata 

            function with ifraxis argument set to True, then any default values 

            added to fill in missing intereferometer/timeslots pairs will be 

            ignored when writing the modified values back using this function. 

 

            The measurement set has to be opened for read/write access to be 

            able to use this function. 

 

            You need to call selectinit before 

            calling this function. If you haven't then selectinit will be 

            called for you with default arguments. 

 

            Items prefixed with either; corrected, model, residual or 

            obs\_residual and the imaging\_weight item are not available unless 

            your measurement set has been processed either with the imager or 

            calibrator tools. 

           

 

        Input Parameters: 

                items            Record with items and their new values  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS', nomodify=False) 

              ms.selectinit(datadescid=0) 

              rec = ms.getdata(['weight','data']) 

              rec['weight'][:,:] = 1 

              import Numeric 

              meanrec = Numeric.average(rec['data'],axis=None) 

              print 'Mean data value = ', meanrec 

              rec['data'][:,:,:] -= meanrec 

              ms.putdata(rec) 

             

            This example selects all the data from the measurement set where 

            the value in the DATA_DESC_ID column is zero. This 

            corresponds to a particular spectral window and polarization 

            setup. Note that the measurement set was opened for writing as 

            well as reading. The third line reads all the weights and the 

            data into the casapy variable rec. The weights are set 

            to one. The more obscure syntax is used as typing  

            rec['weight'] = 1 will not preserve the shape of the weight 

            array. The data then has its mean subtracted from 

            it. The average function is defined in Numeric module. Finally the data 

            is written back into the measurement set table. (NOTE: normally 

            one should not modify the raw data column.  Such adjustments are more 

            appropriate for the corrected_data column, if it exists.) 

           

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

                       

        """ 

        return _ms.ms_putdata(self, *args, **kwargs) 

 

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

        """ 

        concatenate(self, msfile = string(""), freqtol = initialize_variant("1Hz"),  

            dirtol = initialize_variant("1mas"), weightscale = 1.,  

            handling = 0, destmsfile = string(""),  

            respectname = False) -> bool 

 

        Summary 

                Concatenate two measurement sets 

 

        Description 

                 

            This function concatenates two measurement sets together.  

 

            The data is copied from the measurement set specified in the 

            msfile arguement to the end of the measurement set attached to the 

            ms tool. If a lot of data needs to be copied this function may 

            take some time. You need to open the measurement set for writing 

            in order to use this function. 

 

           

 

        Input Parameters: 

                msfile           The name of the measurement set to append  

                freqtol          Frequency difference within which 2 spectral windows are considered similar; e.g '10Hz' 1Hz  

                dirtol           Direction difference within which 2 fields are considered the same; e.g '1mas' 1mas  

                weightscale      Scale the weights of the MS to be appended by this factor 1.  

                handling         Switch for the handling of the Main and Pointing tables: 0=standard, 1=no Main, 2=no Pointing, 3=no Main and Pointing, 4=virtual 0 0 1 2 3  

                destmsfile       Optional support for virtual concat: empty table (no subtables) where to store the appended MS copy  

                respectname      If true, fields with a different name are not merged even if their direction agrees false  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS', nomodify=False) 

              ms.concatenate('BLLAC.ms', '1GHz', '1arcsec') 

              ms.done() 

             

            This example appends the data from the BLLAC measurement set to 

            the end of the 3C273 measurement set. Its going to assume a 

            frequency tolerance of 1GHz and position tolerance of 1 arcsec in 

            deciding if the spw and field in the measurementsets are 

            similar or not.  

           

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

                       

        """ 

        return _ms.ms_concatenate(self, *args, **kwargs) 

 

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

        """ 

        testconcatenate(self, msfile = string(""), freqtol = initialize_variant("1Hz"),  

            dirtol = initialize_variant("1mas"), respectname = False) -> bool 

 

        Summary 

                Concatenate only the subtables of two measurement sets excluding the POINTING table (resulting MAIN and POINTING table not useful) 

 

        Description 

                 

            This function acts like ms.concatenate() with handling==3 (do not concatenate 

            the MAIN and POINTING tables). This is useful for generating, e.g., 

            SPECTRAL\_WINDOW and FIELD tables which contain all used SPW and FIELD ids 

            for a set of MSs without having to actually carry out a time-consuming 

            concatenation on disk. The MAIN table in the resulting output MS is 

            that of the original MS, i.e. it is not touched.  

           

 

        Input Parameters: 

                msfile           The name of the measurement set from which the subtables should be appended  

                freqtol          Frequency difference within which 2 spectral windows are considered similar; e.g '10Hz' 1Hz  

                dirtol           Direction difference within which 2 fields are considered the same; e.g '1mas' 1mas  

                respectname      If true, fields with a different name are not merged even if their direction agrees false  

                 

        Example: 

                 

             

              tb.open('3C273XC1.MS') 

              tb.copy('TEMP.MS', norows=True) 

              tb.close() 

              ms.open('TEMP.MS', nomodify=False) 

              ms.testconcatenate('3C273XC1.ms', '1GHz', '1arcsec') 

              ms.testconcatenate('BLLAC.ms', '1GHz', '1arcsec') 

              ms.done() 

             

            This example makes a copy of the structure of an MS and then 

            appends the subtables data from two  measurement sets to the empty structure.  

            Its going to assume a frequency tolerance of 1GHz and position tolerance  

            of 1 arcsec in deciding if the spw and field in the measurementsets are 

            similar or not.  

           

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

                       

        """ 

        return _ms.ms_testconcatenate(self, *args, **kwargs) 

 

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

        """ 

        virtconcatenate(self, msfile = string(""), auxfilename = string(""), freqtol = initialize_variant("1Hz"),  

            dirtol = initialize_variant("1mas"),  

            weightscale = 1., respectname = True) -> bool 

 

        Summary 

                Concatenate two measurement sets virtually 

 

        Description 

                 

            This function virtually concatenates two measurement sets together 

            such that they can later be turned into a multi-MS with createmultims().  

 

            You need to open the measurement set for writing in order to use this function. 

 

           

 

        Input Parameters: 

                msfile           The name of the measurement set to append  

                auxfilename      The name of a auxiliary file which is needed when more than two MSs are to be concatenated.  

                freqtol          Frequency difference within which 2 spectral windows are considered similar; e.g '10Hz' 1Hz  

                dirtol           Direction difference within which 2 fields are considered the same; e.g '1mas' 1mas  

                weightscale      Scale the weights of the MS to be appended by this factor 1.  

                respectname      If true, fields with a different name are not merged even if their direction agrees true  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.ms', nomodify=False) 

              ms.virtconcatenate('3C273XC1-2.ms', '3Caux.dat', '1GHz', '1arcsec') 

              ms.virtconcatenate('3C273XC1-3.ms', '3Caux.dat', '1GHz', '1arcsec') 

              ms.close() 

              os.remove('3Caux.dat') 

              m.createmultims(concatvis,  

                              ['3C273XC1.ms','3C273XC1-2.ms','3C273XC1-3.ms'], 

                              [], 

                              True, # nomodify 

                              False,# lock 

                              True) # copysubtables from first to all other members 

              ms.close() 

             

            This example virtually appends the data from the 3C273XC1-2 and 3C273XC1-3 to 

            the end of the 3C273XC1 measurement set. Its going to assume a 

            frequency tolerance of 1GHz and position tolerance of 1 arcsec in 

            deciding if the spw and field in the measurementsets are 

            similar or not. The file 3Caux.dat which is created in the process is 

            no longer needed after the last call to virtconcatenate() and can 

            be deleted. 

           

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

                       

        """ 

        return _ms.ms_virtconcatenate(self, *args, **kwargs) 

 

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

        """ 

        timesort(self, newmsname = string("")) -> bool 

 

        Summary 

                Sort the main table of an MS by time 

 

        Description 

                 

            This function sorts the main table of the measurement set by the contents 

            of the column TIME in ascending order and writes a copy of the MS with the sorted 

            main table into newmsfile. 

 

            If no newmsname is given, a sorted copy of the MS is written into a new MS under the name 

            x.sorted (where x is the name of the original MS). The original MS is then closed and deleted. 

            The new MS is renamed to the name of the original MS and then reopened. 

           

 

        Input Parameters: 

                newmsname        Name of the output measurement set (default: overwrite original)  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS', nomodify=False) 

              ms.timesort() 

              ms.done() 

             

            This example sorts the main table of 3C273XC1.MS by time. 

            The original MS is overwritten by the sorted one. 

           

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

                       

        """ 

        return _ms.ms_timesort(self, *args, **kwargs) 

 

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

        """ 

        sort(self, newmsname = string(""), columns = std::vector< string >(1, "")) -> bool 

 

        Summary 

                Sort the main table of an MS using a custom set of columns 

 

        Description 

                 

            This function sorts the main table of the measurement set by the contents 

            of the input set of columns in ascending order and writes a copy of the MS  

            with the sorted main table into newmsfile. 

 

            If no newmsname is given, a sorted copy of the MS is written into a new MS under the name 

            x.sorted (where x is the name of the original MS). The original MS is then closed and deleted. 

            The new MS is renamed to the name of the original MS and then reopened. 

           

 

        Input Parameters: 

                newmsname        Name of the output measurement set (default: overwrite original)  

                columns          Vector of column names (case sensitive).  

                 

        Example: 

                 

             

               

              ms.open('3C273XC1.MS', nomodify=False) 

              ms.sort(['ANTENNA1','ANTENNA2']) 

              ms.done() 

             

            This example sorts the main table of 3C273XC1.MS by ANTENNA1 and then ANTENNA2. 

            The original MS is overwritten by the sorted one. 

           

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

                       

        """ 

        return _ms.ms_sort(self, *args, **kwargs) 

 

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

        """ 

        contsub(self, outputms = string(""), fitspw = initialize_variant("*"),  

            fitorder = 1, combine = string(""), spw = initialize_variant("*"),  

            unionspw = initialize_variant("*"),  

            field = initialize_variant(""),  

            scan = initialize_variant(""), intent = string(""),  

            correlation = string(""), obs = string(""),  

            whichcol = string("CORRECTED_DATA")) -> bool 

 

        Summary 

                Subtract the continuum from the visibilities 

 

        Description 

                 

            NOT FULLY IMPLEMENTED YET.  uvcontsub uses the cb tool for now. 

            (The only reason to implement it in ms is to save time and disk space.) 

 

            This function estimates the continuum emission of the MS and writes a MS 

            with that estimate subtracted, using the ms tool.  The estimate is made, 

            separately for the real and imaginary parts of each baseline, by fitting a 

            low order polynomial to the unflagged visibilities selected by fitspw 

            (depending on combine). 

           

 

        Input Parameters: 

                outputms         The name of the resulting measurement set  

                fitspw           Line-free spectral windows (and :channels) to fit to *  

                fitorder         The order of the polynomial to use when fitting. 1  

                combine          Ignore changes in these columns (spw, scan, and/or state) when fitting.  

                spw              Spectral windows (and :channels) to select *  

                unionspw         The union of fitspw and spw, i.e. how much needs to be read. '*' always works, but may be more than you need. *  

                field            Fields to include, by names or 0-based ids. ('' =\> all)  

                scan             Only use the scan numbers requested using the msselection syntax.  

                intent           Only use the requested scan intents.  

                correlation      Limit data to specific correlations (LL, XX, LR, XY, etc.).  

                obs              Only use the requested observation IDs.  

                whichcol         'DATA', 'MODEL\_DATA', 'CORRECTED\_DATA', and/or 'FLOAT\_DATA' CORRECTED\_DATA  

                 

        Example: 

                 

           

          ms.open('multiwin.ms') 

          ms.contsub('contsub.ms', fitspw='0:0~123;145~211,2:124~255', fitorder=0, 

                     field=[0], spw='0,2')  

 

          In this example the continuum estimates are made by seperately averaging 

          channels 0:0~123;145~211 and 2:124~255, and the separate estimates are 

          subtracted from spws 0 and 2.  The output only includes field 0 and spws 0 

          and 2 (now called 1). 

 

          ms.contsub('contsub.ms', fitspw='0:0~123;145~211,2:124~255', fitorder=0, 

                     field=[0], combine='spw') 

          ms.close() 

 

          This time the estimate was made by simultaneously averaging channels 

          0:0~123;145~211 and 2:124~255, and the continuum is subtracted from all the 

          spws, including 1 (treated as a completely line-filled spw).  The output only 

          includes field 0. 

 

           

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

                       

        """ 

        return _ms.ms_contsub(self, *args, **kwargs) 

 

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

        """ 

        statwt(self, dorms = False, byantenna = True, sepacs = True, fitspw = initialize_variant("*"),  

            fitcorr = initialize_variant(""),  

            combine = string(""), timebin = initialize_variant("0s"),  

            minsamp = 3,  

            field = initialize_variant(""), spw = initialize_variant("*"),  

            antenna = initialize_variant(""),  

            timerange = string(""), scan = initialize_variant(""),  

            intent = string(""), array = initialize_variant(""),  

            correlation = string(""),  

            obs = string(""), datacolumn = string("corrected_data")) -> bool 

 

        Summary 

                Set WEIGHT and SIGMA from the scatter of the visibilities 

 

        Description 

                 

            NOT IMPLEMENTED YET. 

 

            This function estimates the noise from the scatter of the visibilities, 

            sets SIGMA to it, and WEIGHT to SIGMA**-2. 

 

            Ideally the visibilities used to estimate the scatter, as selected by 

            fitspw and fitcorr, should be pure noise.  If you know for certain that 

            they are, then setting dorms to True will give the best result.  Otherwise, 

            use False (standard sample standard deviation).  More robust scatter 

            estimates like the interquartile range or median absolute deviation from 

            the median are not offered because they require sorting by value, which is 

            not possible for complex numbers. 

 

            To beat down the noise of the noise estimate, the sample size per estimate 

            can be made larger than a single spw and baseline.  (Using combine='spw' is 

            to interpolate between spws with line-free channels is recommended when an 

            spw has no line-free channels.)  timebin smooths the noise estimate over 

            time.  windowtype sets the type of time smoothing. 

 

            WEIGHT and SIGMA will not be changed for samples that have fewer than 

            minsamp visibilities.  Selected visibilities for which no noise estimate is 

            made will be flagged.  Note that minsamp is effectively at least 2 if dorms 

            is False, and 1 if it is True. 

 

           

 

        Input Parameters: 

                dorms            How the scatter should be estimated (True -\> rms, False -\> stddev) false  

                byantenna        How the scatters are solved for (by antenna or by baseline) true  

                sepacs           If solving by antenna, treat autocorrs separately true  

                fitspw           Line-free spectral windows (and :channels) to get the scatter from. ('' =\> all) *  

                fitcorr          Correlations (V, LL, XX, LR, XY, etc.) to get the scatter from. ('' =\> all)  

                combine          Ignore changes in these columns (spw, scan, and/or state) when getting the scatter.  

                timebin          Duration of the moving window over which to estimate the scatter. Defaults to 0s, with an effective minimum of 1 integration. 0s  

                minsamp          The minimum number of visibilities for a scatter estimate 3  

                field            Fields to reweight, by names or 0-based ids. ('' =\> all)  

                spw              Spectral windows to reweight. ('' =\> all) *  

                antenna          Select data based on antenna/baseline  

                timerange        Select data by time range  

                scan             Scan numbers to reweight. ('' =\> all)  

                intent           Scan intents to reweight. ('' =\> all)  

                array            Select (sub)array(s) by array ID number  

                correlation      Correlations (LL, XX, LR, XY, etc.) to reweight. ('' =\> all)  

                obs              Observation IDs to reweight. ('' =\> all)  

                datacolumn       Which data column to calculate the scatter from. corrected\_data  

                 

        Example: 

                 

           

          ms.open('multiwin.ms', nomodify=False) 

          ms.statwt(fitspw='0:0~123;145~211,2:124~255', field=[0], spw='0,2')  

 

          In this example the noise estimates are seperately made from and applied  

          to spws 0 and 2. 

 

          ms.statwt(fitspw='0:0~123;145~211,2:124~255', fitorder=0, field=[0], 

                    combine='spw') 

          ms.close() 

 

          This time the estimate for each baseline is made from the line-free channels 

          of spws 0 and 2, and applied to all the spws, including 1 (which could be a 

          completely line-filled spw). 

 

           

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

                       

        """ 

        return _ms.ms_statwt(self, *args, **kwargs) 

 

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

        """ 

        split(self, outputms = string(""), field = initialize_variant(""),  

            spw = initialize_variant("*"), step = initialize_vector(1, (int)1),  

            baseline = initialize_variant(""),  

            timebin = initialize_variant("-1s"),  

            time = string(""), scan = initialize_variant(""),  

            uvrange = initialize_variant(""),  

            taql = string(""), whichcol = string("DATA"),  

            tileshape = initialize_variant(""), subarray = initialize_variant(""),  

            combine = string(""),  

            correlation = string(""), intent = string(""),  

            obs = string("")) -> bool 

 

        Summary 

                make a new ms from a subset of an existing ms, adjusting subtables and indices 

 

        Description 

                 

            This function splits out part of the MS into a new MS. Time and 

            channel averaging can be performed in the process (but not in 

            the same call). 

             

            When splitting multiple spectral windows, the parameters {  t 

            nchan, start, step} can be vectors, so that each spectral window 

            has its own selection on averaging and number of output 

            channels. But the option of using only one value for each of these 

            parameters means that it will be replicated for all the spectral 

            windows selected.   

               

           

 

        Input Parameters: 

                outputms         The name of the resulting measurement set  

                field            Fields to include, by names or 0-based ids. ('' =\> all)  

                spw              Spectral windows (and :channels) to select *  

                step             number of input per output channels - Int vector of length 1 or same as spw 1  

                baseline         Antenna names or indices to select ('' =\> all)  

                timebin          Duration for averaging. Defaults to no averaging. -1s  

                time             Only use data in the given time range, using the msselection syntax.  

                scan             Only use the scan numbers requested using the msselection syntax.  

                uvrange          Limit data by uv distance using the msselection syntax.  

                taql             For the TAQL experts, flexible data selection using the TAQL syntax  

                whichcol         'DATA', 'MODEL\_DATA', 'CORRECTED\_DATA', 'FLOAT\_DATA', 'LAG\_DATA', and/or 'all' DATA  

                tileshape        Tile shape of the disk data columns, most users should not need to touch this parameter [0] =\> normal tiling, [1] =\> fast mosaic style tile [4,15,351] =\> a tile shape of 4 pol 15 chan and 351 rows  

                subarray         Limit data to specific (sub)array numbers.  

                combine          Ignore changes in these columns (scan, and/or state) when time averaging.  

                correlation      Limit data to specific correlations (LL, XX, LR, XY, etc.).  

                intent           Only use the requested scan intents.  

                obs              Only use the requested observation IDs.  

                 

        Example: 

                 

           

          ms.open('multiwin.ms') 

          ms.split('subms.ms', field=[0], spw=[0], nchan=[10], 

                   start=[0], step=[5], whichcol='CORRECTED_DATA')  

           

          In this example we split out data from the 1st field and 1st 

          spectral window. The output data will have 10 channels which is 

          taken from 50 channels from the input data starting at channel 0 and 

          averaging every 5. 

 

               

          ms.open('multiwin.ms') 

          ms.split('subms.ms', field=[0], spw=[0,1,2,3], nchan=[10], 

                   start=[0], step=[5], whichcol='CORRECTED_DATA')  

          

        In this example we split out data from the 1st field and four spectral 

        windows. The output data will have 4 spectral windows each of 10 

        channels which is taken from 50 channels from the input data starting 

        at channel 0 and averaging every 5. 

 

               

          ms.open('multiwin.ms') 

          ms.split('subms.ms', field=[0], spw=[0,1,2,3], nchan=[10,10,30,40], 

                   start=[0,4,9,9], step=[1,10,5,2], whichcol='CORRECTED_DATA') 

 

        In this example we split out data from the 1st field and four spectral 

        windows. There will be four spectral windows in the output data, 

        with 10, 10, 30 and 40 channels respectively. These are averages 

        of the input spectral windows. The first output spectral window 

        will be formed by picking 10 channels, starting at 0 with no 

        averaging, of the input spwid 0. The second output spectral window 

        will consists of 10 channels and is formed by picking 100 channels 

        from spwid 1 of the input data, starting at channel 4, and every 

        10 channels to make one output channel. 

 

              

          ms.open('WSRT.ms') 

          ms.split('subms.ms', timebin='20s', whichcol='all', combine='scan') 

          ms.close() 

 

          This example averages a WSRT MS into 20s bins, selecting whichever of DATA, 

          MODEL_DATA, CORRECTED_DATA, or FLOAT_DATA, or LAG_DATA is present.  Normally 

          the bins would not cross scans, but in this MS the scan number goes up with 

          each integration, making it redundant enough with time that it would defeat 

          any time averaging.  Therefore the combine parameter forces the SCAN column 

          to be ignored for setting the bins. 

 

           

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

                       

        """ 

        return _ms.ms_split(self, *args, **kwargs) 

 

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

        """ 

        partition(self, outputms = string(""), field = initialize_variant(""),  

            spw = initialize_variant("*"), baseline = initialize_variant(""),  

            timebin = initialize_variant("-1s"),  

            time = string(""), scan = initialize_variant(""),  

            uvrange = initialize_variant(""),  

            taql = string(""), whichcol = string("DATA"),  

            tileshape = initialize_variant(""),  

            subarray = initialize_variant(""), combine = string(""),  

            intent = string(""), obs = string("")) -> bool 

 

        Summary 

                make a new ms from a subset of an existing ms, without changing any subtables 

 

        Description 

                 

            This function splits out part of the MS into a new MS. Time averaging can 

            be performed in the process.  Unlike split, the subtables and IDs 

            (ANTENNA1, DATA\_DESCRIPTION\_ID, etc.) are never changed to account for the 

            selection. 

 

            As a side effect of that property, partition cannot select by channel or 

            correlation, or average channels.  It CAN select by spectral window(s).    

           

 

        Input Parameters: 

                outputms         The name of the resulting measurement set  

                field            Fields to include, by names or 0-based ids. ('' =\> all)  

                spw              Spectral windows (and :channels) to select *  

                baseline         Antenna names or indices to select ('' =\> all)  

                timebin          Duration for averaging. Defaults to no averaging. -1s  

                time             Only use data in the given time range, using the msselection syntax.  

                scan             Only use the scan numbers requested using the msselection syntax.  

                uvrange          Limit data by uv distance using the msselection syntax.  

                taql             For the TAQL experts, flexible data selection using the TAQL syntax  

                whichcol         'DATA', 'MODEL\_DATA', 'CORRECTED\_DATA', 'FLOAT\_DATA', 'LAG\_DATA', and/or 'all' DATA  

                tileshape        Tile shape of the disk data columns, most users should not need to touch this parameter [0] =\> normal tiling, [1] =\> fast mosaic style tile [4,15,351] =\> a tile shape of 4 pol 15 chan and 351 rows  

                subarray         Limit data to specific (sub)array numbers.  

                combine          Ignore changes in these columns (scan, and/or state) when time averaging.  

                intent           Only use the requested scan intents.  

                obs              Only use the requested observation IDs.  

                 

        Example: 

                 

                 

          ms.open('multiwin.ms') 

          ms.partition('partition.ms', field=[0], spw=[1], whichcol='CORRECTED_DATA')  

           

          In this example we partition out data from the 1st field and 2nd spectral 

          window.  Only the CORRECTED_DATA data column will be copied, and it will be 

          written to the DATA column of partition.ms. 

               

 

          ms.open('multiwin.ms') 

          ms.partition('partition.ms', field=[0], spw=[0,1,2,3], 

                       whichcol='CORRECTED_DATA')  

          

          In this example we partition out calibrated data from the 1st field and four 

          spectral windows. 

               

 

          ms.open('WSRT.ms') 

          ms.partition('partition.ms', timebin='20s', whichcol='all', combine='scan') 

          ms.close() 

 

          This example averages a WSRT MS into 20s bins, selecting whichever of DATA, 

          MODEL_DATA, CORRECTED_DATA, or FLOAT_DATA, or LAG_DATA is present.  Normally 

          the bins would not cross scans, but in this MS the scan number goes up with 

          each integration, making it redundant enough with time that it would defeat 

          any time averaging.  Therefore combine parameter forces the SCAN column to be 

          ignored for setting the bins. 

 

           

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

                       

        """ 

        return _ms.ms_partition(self, *args, **kwargs) 

 

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

        """ 

        iterinit(self, columns = std::vector< string >(1, ""), interval = 0.0,  

            maxrows = 0, adddefaultsortcolumns = True) -> bool 

 

        Summary 

                Initialize for iteration over an ms 

 

        Description 

                 

            Specify the columns to iterate over and the time interval to use 

            for the TIME column iteration.  The columns are specified by their 

            MS column name.  Note that the following columns are always added 

            to the specified columns: array\_id, field\_id, data\_desc\_id and 

            time. This is so that the iterator can keep track of the 

            coordinates associated with the data (field direction, frequency 

            etc.) If you want to sort on these columns last instead of first 

            you need to include them in the columns specified. If you don't 

            want to sort on these columns at all, you can set 

            adddefaultsortcolumns to False. 

            You need to call selectinit before  

            calling this.  See the example below. 

           

 

        Input Parameters: 

                columns          Vector of column names (case sensitive).  

                interval         Time interval in seconds (greater than 0), to group together in iteration 0.0  

                maxrows          Max number of rows (greater than 0) to return in iteration 0  

                adddefaultsortcolumns    Add the default sort columns true  

                 

        Example: 

                 

            See the example for the iterend function. 

           

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

                       

        """ 

        return _ms.ms_iterinit(self, *args, **kwargs) 

 

    def iterorigin(self): 

        """ 

        iterorigin(self) -> bool 

 

        Summary 

                Set the iterator to the start of the data. 

 

        Description 

                 

            Set or reset the iterator to the start of the currently specified 

            iteration. You need to call this before attempting to retrieve 

            data with getdata. You can set the iteration back to the start 

            before you reach the end of the data.  You need to call iterinit 

            before calling this.  See the example below. 

           

        Example: 

                 

            See the example for the iterend function. 

           

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

                       

        """ 

        return _ms.ms_iterorigin(self) 

 

    def iternext(self): 

        """ 

        iternext(self) -> bool 

 

        Summary 

                Advance the iterator to the next lot of data 

 

        Description 

                 

            This sets the currently selected table (as accessed with getdata) 

            to the next iteration. If there is no more data, the function 

            returns False and the selection is reset to that before the 

            iteration started.  You need to call iterinit and iterorigin 

            before calling this.  See the example below. 

           

        Example: 

                 

            See the example for the iterend function. 

           

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

                       

        """ 

        return _ms.ms_iternext(self) 

 

    def iterend(self): 

        """ 

        iterend(self) -> bool 

 

        Summary 

                End the iteration and reset the selected table 

 

        Description 

                 

            This sets the currently selected table (as accessed with 

            getdata) to the table that was selected 

            before iteration started.  Use this to end the iteration 

            prematurely.  There is no need to call this if you continue 

            iterating until iternext returns False. 

 

            See the example below. 

           

        Example: 

                 

             

               

              ms.open('3C273XC1.MS') 

              ms.selectinit(datadescid=0) 

              ms.iterinit(['ANTENNA1','ANTENNA2','TIME'],60.0) 

              ms.iterorigin() 

              rec=ms.getdata(['u','v','data']) 

              ms.iternext() 

              ms.iterend() 

             

            We open the MS, select an array and spectral window and then 

            specify an iteration over interferometer and time, with a 60s time 

            interval.  We then set the iterator to the start of the data and 

            get out some data. Finally we advance the iterator to the next lot 

            of data and then end the iteration. 

           

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

                       

        """ 

        return _ms.ms_iterend(self) 

 

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

        """ 

        fillbuffer(self, item = string(""), ifraxis = False) -> bool 

 

        Summary 

                Fill the internal buffer with data and flags. 

 

        Description 

                 

        Read the specified data item from the table, including its flags 

        and keep the results in an internal buffer 

 

 

        Input Parameters: 

                item             data derived item  

                ifraxis          Create interferometer axis if True false  

                 

        Example: 

                 

 

        ms.open('3C273XC1.MS') 

        ms.select({'antenna1':[3]}) 

        ms.fillbuffer('PHASE',True) 

 

 

 

        We open the MS for reading, select a subset and then  

        read the DATA, FLAG and FLAG\_ROW column, extract the PHASE, 

        reorder the data to add an interferometer axis, 

        and keep the results around in an internal buffer. 

 

 

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

                       

        """ 

        return _ms.ms_fillbuffer(self, *args, **kwargs) 

 

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

        """ 

        diffbuffer(self, direction = string("TIME"), window = 1) -> record 

 

        Summary 

                Differentiate or difference the internal buffer. 

 

        Description 

                 

        Subtract the previous point from each data point in the buffer (for 

        window equal 2), or subtract the average over a window (for window 

        greater than 2) from each point. The window can be in the time / row 

        direction or the frequency / channel direction. The input data can be 

        float or complex but the output is always float.  The function returns 

        statistics over the buffer: median for each time and channel, the 

        average absolute deviation from the median in time and channel 

        direction and over all pixels. 

 

 

        Input Parameters: 

                direction        choose between time or channel direction: TIME or CHANNEL TIME  

                window           width of averaging window in timeslots or channels; integer greater than 0 1  

                 

        Example: 

                 

 

        ms.open('3C273XC1.MS') 

        ms.select({'antenna1':[3]}) 

        ms.fillbuffer('DATA') 

        ms.diffbuffer('TIME',15) 

        # {'aad': array([[ 0.58959275], 

        #       [ 0.20988081], 

        #       [ 0.15907532], 

        #       [ 0.58837521]]), 

        # 'median': array([[ 2.67179847], 

        #       [ 0.32471114], 

        #       [ 0.37952924], 

        #       [ 2.60897708]])} 

 

 

 

        We open the MS for reading, select a subset and then  

        read the DATA, FLAG and FLAG\_ROW column,  

        we then subtract the average over a 15 point time-window from each 

        data point. 

 

 

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

                       

        """ 

        return _ms.ms_diffbuffer(self, *args, **kwargs) 

 

    def getbuffer(self): 

        """ 

        getbuffer(self) -> record 

 

        Summary 

                Return the internal buffer as a Record for access from the intrepreter. 

 

        Description 

                 

        Returns the internal buffer with either 'raw' or differenced data, 

        flags and buffer statistics (if a difference operation was performed). 

 

        Example: 

                 

 

        ms.open('3C273XC1.MS') 

        ms.select({'antenna1':[3]}) 

        ms.fillbuffer('PHASE') 

        rec=ms.getbuffer() 

 

 

 

        We open the MS for reading, select a subset and then  

        read the DATA, FLAG and FLAG\_ROW column, extract the PHASE 

        and then obtain the results in a record. 

 

 

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

                       

        """ 

        return _ms.ms_getbuffer(self) 

 

    def clipbuffer(self, pixellevel = 0.0, timelevel = 0.0, channellevel = 0.0): 

        """ 

        clipbuffer(self, pixellevel = 0.0, timelevel = 0.0, channellevel = 0.0) -> bool 

 

        Summary 

                (NON-FUNCTIONAL???) Clip the internal buffer with specified limits. 

 

        Description 

                 

        This sets flags in the internal buffer based on the clip levels 

        specified. You can flag times, channels and individual pixels based on 

        their deviation from the median. The cliplevel is specified in units of 

        the corresponding average absolute deviation (a robust version of rms). 

 

 

        Input Parameters: 

                pixellevel       cliplevel for pixels (greater than 0) 0.0  

                timelevel        cliplevel for time slots (greater than 0) 0.0  

                channellevel     cliplevel for channels (greater than 0) 0.0  

                 

        Example: 

                 

 

        ms.open('3C273XC1.MS') 

        ms.select({'antenna1':[3]}) 

        ms.fillbuffer('DATA') 

        stats=ms.diffbuffer('TIME',15) 

        ms.clipbuffer(6,5,5) 

        #2008-05-28 17:15:27  SEVERE  casa::ms::open 

        #  Exception Reported: RecordInterface: field medTmeF is unknown 

        #--------------------------------------------------------------------------- 

        #type 'exceptions.StandardError'         Traceback (most recent call last) 

        # 

        #/home/aips2mgr/testing/ipython console in module() 

        # 

        #type 'exceptions.StandardError': RecordInterface: field medTmeF is unknown 

 

 

 

        We open the MS for reading, select a subset and 

        read the data into the buffer. We then remove the average over a 15 

        point time window and clip the resulting data at 6 times the average 

        absolute deviation from the median for individual pixels, and at 5 

        times this for channels and timeslots. 

 

 

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

                       

        """ 

        return _ms.ms_clipbuffer(self, pixellevel, timelevel, channellevel) 

 

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

        """ 

        asdmref(self, abspath = string("")) -> string 

 

        Summary 

                Test if the MS was imported with option lazy=True in importasdm and optionally change the ASDM reference 

 

        Description 

                 

           If the MS is imported from an ASDM  with option lazy=True, the DATA column of the MS is virtual 

           and directly reads the visibilities from the ASDM. A reference to the original ASDM is stored 

           with the MS. If the ASDM needs to be moved to a different path, the reference to it in the MS 

           needs to be updated. This can be achieved with ms.asdmref(). 

           When called with an empty string (default), the method just reports the currently set ASDM path. 

 

           Return value is a string containing the new path if the path was successfully set or  

           (in the case abspath was empty) the MS indeed contains a ASDM reference, i.e. was lazily imported. 

 

           If the ASDM does not contain an ASDM reference, the method returns an empty string. 

           If abspath is not empty and there was an error setting the new reference, the method throws 

           an exception. 

            

 

        Input Parameters: 

                abspath          new absolute path of the ASDM to be referenced (empty string = report current setting)  

                 

        Example: 

                 

             Set the path to the referenced ASDM to '/home/alma/myanalysis/uid___A12345_X678_X910':      

                ms.open('uid___A12345_X678_X910.ms',False) 

                ms.asdmref('/home/alma/myanalysis/uid___A12345_X678_X910') 

                ms.close() 

 

             Test if the MS was imported with lazy=True and therefore references an ASDM: 

                ms.open('uid___A12345_X678_X910.ms') 

                myref = ms.asdmref() 

                ms.close() 

                if myref=='': 

                  print 'This MS does not reference an ASDM.' 

                else: 

                  print 'This MS references the ASDM ', myref 

            

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

                       

        """ 

        return _ms.ms_asdmref(self, *args, **kwargs) 

 

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

        """ 

        setbufferflags(self, flags = initialize_record("")) -> bool 

 

        Summary 

                Set the flags in the buffer 

 

        Description 

                 

             Replace the flag and flag\_row fields in the internal 

             buffer with those in the input record. 

             The input record can be e.g., a modified version of the record 

             returned by getbuffer(). The other fields in the record are ignored. 

            

 

        Input Parameters: 

                flags            record with flag and flag\_row  

                 

        Example: 

                 

              

             ms.open('3C273XC1.MS',False) 

             ms.select({'antenna1':[3]}) 

             ms.fillbuffer('PHASE') 

             rec=ms.getbuffer() 

             rec['flag_row'][17]=True 

             ms.setbufferflags(rec) 

              

              

               We open the MS for reading, select a subset and 

               read the data. We get the data into casapy, flag timeslot 17 and put 

               the modified flags back into the buffer. 

              

            

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

                       

        """ 

        return _ms.ms_setbufferflags(self, *args, **kwargs) 

 

    def writebufferflags(self): 

        """ 

        writebufferflags(self) -> bool 

 

        Summary 

                Write the flags in the internal buffer back to the table. 

 

        Description 

                 

               Takes the flag and flag\_row field in the internal buffer and writes 

               them back to the FLAG and FLAG\_ROW column in the currently selected 

               table. 

              

        Example: 

                 

                

               ms.open('3C273XC1.MS',False) 

               ms.select({'antenna1':[3]}) 

               ms.fillbuffer('PHASE') 

               rec=ms.getbuffer() 

               rec['flag_row'][17]=True 

               ms.setbufferflags(rec) 

               ms.writebufferflags() 

                

 

                

                 We open the MS for reading, select a subset and 

                 read the data. We get the data into casapy, flag timeslot 17 and put 

                 the modified flags back into the buffer. We then write the buffer 

                 flags back to the table, causing the corresponding data to be 

                 marked flagged on subsequent access. 

                

              

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

                       

        """ 

        return _ms.ms_writebufferflags(self) 

 

    def clearbuffer(self): 

        """ 

        clearbuffer(self) -> bool 

 

        Summary 

                Clear the internal buffer. 

 

        Description 

                 

        Clears the internal buffer, returning the memory. 

        This can be used after the (final) clipping/flagging operations have 

        been performed. 

 

        Example: 

                 

 

        ms.open('3C273XC1.MS',False) 

        ms.select({'antenna1':[3]}) 

        ms.fillbuffer('PHASE') 

        rec=ms.getbuffer() 

        rec['flag_row'][17]=True 

        ms.setbufferflags(rec) 

        ms.writebufferflags() 

        ms.clearbuffer() 

 

 

 

        We open the MS for reading, select a subset and 

        read the data. We get the data into casapy, flag timeslot 17 and put 

        the modified flags back into the buffer. We then write the buffer 

        flags back to the table, causing the corresponding data to be 

        marked flagged on subsequent access. Finally we clear the internal 

        buffer. This step can be omitted if you are about to do another fillbuffer(). 

 

 

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

                       

        """ 

        return _ms.ms_clearbuffer(self) 

 

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

        """ 

        continuumsub(self, field = initialize_variant(""), fitspw = initialize_variant(""),  

            spw = initialize_variant(""), solint = initialize_variant("int"),  

            fitorder = 0,  

            mode = string("subtract")) -> bool 

 

        Summary 

                Continuum fitting and subtraction in uv plane 

 

        Description 

                  

        This function provides a means of continuum determination and 

        subtraction by fitting a polynomial of desired order to a subset of 

        channels in each time-averaged uv spectrum.  The fit is used to model 

        the continuum in all channels (not just those used in the fit), for 

        subtraction, if desired.  Use the {     t fitspw} parameter to limit the 

        spectral windows processed and the range of channels used to estimate  

        the continuum  in each (avoid channels containing spectral lines).  The  

        default solution interval 'int' will result in per-integration continuum 

        fits for each baseline.  The {  t mode} parameter indicates  

        how the continuum model (the result of the fit) should be used:  

        {       t 'subtract'} will store the continuum 

        model in the MODEL\_DATA column and subtract it from the CORRECTED\_DATA 

        column; {       t 'replace'} will replace the CORRECTED\_DATA column with 

        the continuum model (useful if you want to image the continuum model 

        result); and {  t 'model'} will only store the continuum model in the 

        MODEL\_DATA column (the CORRECTED\_DATA is unaffected). 

 

        It is important to start the ms tool with {     t nomodify=False} so that 

        changes to the dataset will be allowed (see example below). 

 

        For now, the only way to recover the un-subtracted CORRECTED\_DATA column 

        is to use calibrater.correct() again. 

 

        Note that the MODEL\_DATA and CORRECTED\_DATA columns must be present 

        for {   t continuumsub} to work correctly.  The function will warn the user 

        if they are not present, and abort.  To add these scratch columns (for 

        now), close the ms tool, then start a calibrater or an imager 

        tool, which will add the scratch columns.  Then restart the ms tool, 

        and try {       t continuumsub} again. 

 

        Options for shifting known bright sources to the phase center and 

        for editing based on the rms fit will be added in the near future. 

 

           

 

        Input Parameters: 

                field            Select fields to fit  

                fitspw           Spectral windows/channels to use for fitting the continuum; default all spectral windows in all channels  

                spw              Select spectral windows and channels from which to subtract a continuum estimate; default: all channels in all spectral windows for which the continuum was estimated  

                solint           Continuum fit timescale (units optional) int  

                fitorder         Polynomial order for fit 0  

                mode             Desired use of fit model (see below) subtract  

                 

        Example: 

                 

             

         ms.fromfits('ngc5921.ms','/aips++/data/demo/NGC5921.fits') 

         ms.close() 

         cb.open('ngc5921.ms')  # add MODEL_DATA, CORRECTED_DATA columns 

         cb.close() 

         ms.open('ngc5921.ms',nomodify=False);    # writable! 

         ms.continuumsub(fldid=2,fitspw='0:5~9;50~59', 

                         solint=0.0,fitorder=1,mode='sub') 

         ms.done() 

             

            This example will fit a linear continuum to channels 5-9 and 50-59 in  

            spectral window 0 in each scan-averaged spectrum for field 2, and  

            store the result in the MODEL\_DATA column and subtract it from the  

            CORRECTED\_DATA column. 

 

           

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

                       

        """ 

        return _ms.ms_continuumsub(self, *args, **kwargs) 

 

    def done(self): 

        """ 

        done(self) -> bool 

 

        Summary 

                Closes the ms tool 

 

        Description 

                 

            You should call close() when you are finished using the ms 

                ool\   

            to close the measurement set table and free any associated file 

            locks. The measurement set is not deleted.  

           

        Example: 

                 

             

              ms.open('3C273XC1.MS') 

              ... 

              ms.done() 

             

           

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

                       

        """ 

        return _ms.ms_done(self) 

 

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

        """ 

        msseltoindex(self, vis = string(""), spw = initialize_variant(""), field = initialize_variant(""),  

            baseline = initialize_variant(""),  

            time = initialize_variant(""),  

            scan = initialize_variant(""), uvrange = initialize_variant(""),  

            observation = initialize_variant(""),  

            polarization = initialize_variant(""),  

            taql = string("")) -> record 

 

        Summary 

                Returns ids of the selection used 

 

        Description 

                  

         Utility function that will return the ids of the selection used.  

           

 

        Input Parameters: 

                vis              Measurementset for which this selection applies  

                spw              Spectral Window Ids (0 relative) to select; -1 interpreted as all  

                field            Field Ids (0 relative) or Field names (msselection syntax and wilcards are used) to select  

                baseline         Antenna Ids (0 relative) or Antenna names (msselection syntax and wilcards are used) to select  

                time             Limit data selected to be within a given time range. Syntax is the defined in the msselection link  

                scan             Limit data selected on scan numbers. Syntax is the defined in the msselection link  

                uvrange          Limit data selected on uv distance. Syntax is the defined in the msselection link  

                observation      Select data by observation ID(s). The syntax is the same as for scan numbers.  

                polarization     Select data by polarization(s).  

                taql             For the TAQL experts, flexible data selection using the TAQL syntax  

                 

        Example: 

                 

             a= ms.msseltoindex(vis='3C273XC1.MS', field='3C*') 

             print a['field'] 

             # [0] 

             print a 

             #{'antenna1': array([], dtype=int32), 

             # 'antenna2': array([], dtype=int32), 

             #  'channel': array([], shape=(0, 0), dtype=int32), 

             #  'field': array([0]), 

             #  'scan': array([], dtype=int32), 

             #  'spw': array([], dtype=int32), 

             #  'obsids': array([], dtype=int32)} 

             

 

          Field name '3C*', in this case 3C273, corresponds to field id 0. 

 

          N.B.: The return values of unspecified fields (like antenna* and spw in the 

                above example) will be left empty - this does not mean that selection 

                excludes all antennas! 

 

                Some fields (like 'field') are checked against the subtables of vis, 

                but others are not.  For example, field='123~132' will produce an error 

                if vis does not have fields 123 to 132, but for scan and obsids 

                '123~132' would just return an array of integers from 123 to 132 

                regardless of whether vis has those scan or observation IDs.  (The 

                difference comes from it being quicker to check a subtable than the 

                main table.) 

           

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

                       

        """ 

        return _ms.ms_msseltoindex(self, *args, **kwargs) 

 

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

        """ 

        hanningsmooth(self, datacolumn = string("corrected")) -> bool 

 

        Summary 

                Hanning smooth the frequency channels to remove Gibbs ringing. 

 

        Description 

                 

            This function Hanning smooths the frequency channels with a 

            weighted running average of smoothedData[i] = 

            0.25*correctedData[i-1] + 0.50*correctedData[i] + 

            0.25*correctedData[i-1].  The first and last channels are flagged. 

            Inclusion of a flagged value in an average causes that averaged data value 

            to be flagged. 

           

 

        Input Parameters: 

                datacolumn       the name of the MS column into which to write the smoothed data corrected  

                 

        Example: 

                 

             

            ms.open('ngc5921.ms',nomodify=False) 

            ms.hanningsmooth('data') 

            ms.close() 

             

           

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

                       

        """ 

        return _ms.ms_hanningsmooth(self, *args, **kwargs) 

 

    def uvsub(self, reverse = False): 

        """ 

        uvsub(self, reverse = False) -> bool 

 

        Summary 

                Subtract model from the corrected visibility data. 

 

        Description 

                 

            This function subtracts model visibility data from corrected visibility 

            data leaving the residuals in the corrected data column.  If the parameter 

            reverse is set True, this process is reversed. 

           

 

        Input Parameters: 

                reverse          When False subtracts model from visibility data; when True adds model to visibility data false  

                 

        Example: 

                 

          The following example subtracts a model from the visibility data leaving 

          the residuals in the corrected data column. 

             

           ms.open('ngc5921.ms',nomodify=False) 

           ms.uvsub() 

           ms.close()     

             

           The following example adds the model back into the residuals. 

             

           ms.open('ngc5921.ms',nomodify=False) 

           ms.uvsub(reverse=True) 

           ms.close()     

             

           

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

                       

        """ 

        return _ms.ms_uvsub(self, reverse) 

 

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

        """ 

        moments(self, moments = initialize_vector(1, (int)0), antenna = initialize_variant(""),  

            field = initialize_variant(""),  

            spw = initialize_variant(""), includemask = initialize_vector(1, (double)-1),  

            excludemask = initialize_vector(1, (double)-1),  

            peaksnr = 0.0,  

            stddev = 0.0, doppler = string(""),  

            outfile = string(""), overwrite = False,  

            async = False) -> casac::table 

 

        Summary 

                Calculate moments from MS with FLOAT_DATA column. 

 

        Description 

                 

             This function generates moments from the MS data. It is only applicable  

             for single-dish MS, i.e., the MS must have FLOAT\_DATA column. Results are  

             stored separate MSs for each moment. The function returns a table object  

             of the MS that stores a first moment in its FLOAT\_DATA column. 

 

             This is defined by analogy with ia.moments(). It allows to generate moments  

             along any axis (spectral axis, direction, and polarization), while ms.moments()  

             only accepts to generate moments along the spectral axis. 

 

             The available moments are: 

 

             egin{itemize} 

             \item{$-1$} -- the mean value of the spectrum  

             egin{displaymath} 

             { {1\over n}  {\sum {I_i}}} 

             nd{displaymath} 

             \medskip 

 

             \item{0} -- the integrated value of the spectrum  

             egin{displaymath} 

             M_0 = \Delta v \sum I_i 

             nd{displaymath} 

 

             where $\Delta v$ is the width (in world coordinate units) of a pixel 

             along the moment axis   

             \medskip 

 

             \item{1} -- the intensity weighted coordinate (this is 

             traditionally used to get 'velocity fields') 

 

             egin{displaymath} 

             M_1 = { {\sum {I_i v_i}} \over {M_0}} 

             nd{displaymath} 

             \medskip 

 

             \item{2} -- the intensity weighted dispersion of the coordinate  

             (this is traditionally used to get 'velocity dispersion fields') 

 

             egin{displaymath} 

             \sqrt{ { {\sum {I_i \left(v_i - M_1right)^2}} \over {M_0}}} 

             nd{displaymath} 

             \medskip 

 

             \item{3} -- the median of $I$ 

             \medskip 

 

             \item{4} -- the median coordinate.  Here we treat the spectrum as a 

             probability distribution, generate the cumulative distribution, and then 

             find the coordinate corresponding to the 50\% value.  This moment is not 

             very robust, but it is useful for quickly generating a velocity field in 

             a way that is not sensitive to noise.  However, it will only give 

             sensible results under certain conditions.  The generation of the 

             cumulative distribution and the finding of the 50\% level really only 

             makes sense if the cumulative distribution is monotonic.  This 

             essentially means only selecting pixels which are positive or negative.  

             For this reason, this moment type is only supported with the basic 

             method (see below -- i.e.  no smoothing, no windowing, no fitting) with 

             a pixel selection range that is either all positive, or all negative 

             \medskip 

 

             \item{5} -- the standard deviation about the mean of the spectrum  

             egin{displaymath} 

             \sqrt{ {1\over {\left(n-1right)}}  \sum{\left(I_i - ar{I}right)^2 }} 

             nd{displaymath} 

             \medskip 

 

             \item{6} -- the root mean square of the spectrum  

             egin{displaymath} 

             \sqrt{ {1 \over n} \sum{I_i^2}} 

             nd{displaymath} 

             \medskip 

 

             \item{7} -- the absolute mean deviation of the spectrum  

             egin{displaymath} 

             {1 \over n} \sum {|(I_i - ar{I})|} 

             nd{displaymath} 

             \medskip 

 

             \item{8} -- the maximum value of the spectrum 

             \medskip 

             \item{9} -- the coordinate of the maximum value of the spectrum 

             \medskip 

             \item{10} -- the minimum value of the spectrum 

             \medskip 

             \item{11} -- the coordinate of the minimum value of the spectrum 

             \medskip 

             nd{itemize} 

 

           

 

        Input Parameters: 

                moments          A list of moments that you want to compute. Default is an integrarted spectrum. 0  

                antenna          antenna name or id  

                field            field name or id  

                spw              spectral window id  

                includemask      A range of masks to be included when moments are computed. Default is -1 (all channels). -1  

                excludemask      A range of masks to be excluded when moments are computed. Default is -1 (do not exclude channels). -1  

                peaksnr          The SNR ratio that is a lower limit to be included a moment calculation (not implemented yet). 0.0  

                stddev           Standard deviation of the noise signal in the spectra (used by the window and fit functions only). 0.0  

                doppler          Velocity doppler definition for velocity computations along spectral axes.  

                outfile          Output MS file name (or root for multiple moments). Default is input + an auto-determined suffix.  

                overwrite        Overwrite existing output file. false  

                async            Run asynchronously? false  

                 

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

                       

        """ 

        return _ms.ms_moments(self, *args, **kwargs) 

 

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

        """ 

        addephemeris(self, id = -1, ephemerisname = string(""), comment = string(""),  

            field = initialize_variant("")) -> bool 

 

        Summary 

                Connect an ephemeris table with the MS FIELD table 

 

        Description 

                 

 

           

 

        Input Parameters: 

                id               The unique id number to give to this ephemeris (will overwrite pre-existing ephemeris of same id, -1 will use next unused id) -1  

                ephemerisname    The name of the ephemeris table which is to be copied into the MS  

                comment          Comment string (no spaces, will be part of a file name)  

                field            Field id(s) (0-based) or fieldname(s) to connect this ephemeris to  

                 

        Example: 

                 

             

              ms.addephemeris(id=0, ephemerisname='Titan_55002-55003dUTC.tab', comment='JPLTitan', field='Titan') 

             

           

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

                       

        """ 

        return _ms.ms_addephemeris(self, *args, **kwargs) 

 

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

        """ 

        ngetdata(self, items = std::vector< string >(1, ""), ifraxis = False,  

            ifraxisgap = 0, increment = 1, average = False) -> record 

 

        Summary 

                 

               Read values from the measurement set.  Use this method instead of 

               the older getdata() method which is marked for deprecation. 

              

 

        Description 

                 

               This method extracs the data as specified in the items 

               parameter.  The data is returned as a record with each item 

               as a separate key in the record (all in lower case). 

 

               Unless the iterator was initialized with a niterinit(), this 

               method initializes the iterator 

               as niterinit(['..'],0.0,0,False).  

              

 

        Input Parameters: 

                items            Item names (NOT USED)  

                ifraxis          Create interferometer axis if True (NOT USED) false  

                ifraxisgap       Gap size on ifr axis when antenna1 changes (NOT USED) 0  

                increment        Row increment for data access (NOT USED) 1  

                average          Average the data in time or over rows (NOT USED) false  

                 

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

                       

        """ 

        return _ms.ms_ngetdata(self, *args, **kwargs) 

 

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

        """ 

        niterinit(self, columns = std::vector< string >(1, ""), interval = 0.0,  

            maxrows = 0, adddefaultsortcolumns = True) -> bool 

 

        Summary 

                 

               Initialize for iteration over an ms.  Use 

               this method instead of the older iterinit() method which is 

               marked for deprecation. 

              

 

        Description 

                 

              

 

        Input Parameters: 

                columns          Vector of column names (case sensitive). This parameter is not used and is here only for backwards compatibility with the iterinit() method.  

                interval         Time interval in seconds (greater than 0), to group together in iteration 0.0  

                maxrows          Max number of rows (greater than 0) to return in iteration. 0  

                adddefaultsortcolumns    Add the default sort columns true  

                 

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

                       

        """ 

        return _ms.ms_niterinit(self, *args, **kwargs) 

 

    def niterorigin(self): 

        """ 

        niterorigin(self) -> bool 

 

        Summary 

                 

               Set the iterator to the start of the data.  Use this method 

               instead of the older iterorigin() method which is marked for 

               deprecation. 

              

 

        Description 

                 

               Set or reset the iterator to the start of the currently 

               specified iteration. You need to call this before attempting to 

               iteratively retrieve data with ngetdata. You can set the 

               iteration back to the start before you reach the end of the 

               data.  You need to call iterinit before calling this.  See the 

               example below. 

              

        Example: 

                 

               See the example for the niterend function. 

              

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

                       

        """ 

        return _ms.ms_niterorigin(self) 

 

    def niternext(self): 

        """ 

        niternext(self) -> bool 

 

        Summary 

                 

               Advance the iterator to the next lot of data.  Use 

               this method instead of the older iternext() method which is 

               marked for deprecation. 

              

 

        Description 

                 

               This sets the currently selected table (as accessed with 

               ngetdata) to the next iteration. If there is no more data, the 

               function returns False.  You need to call iterinit and 

               iterorigin before calling this.  See the example below. 

              

        Example: 

                 

               See the example for the niterend function. 

              

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

                       

        """ 

        return _ms.ms_niternext(self) 

 

    def niterend(self): 

        """ 

        niterend(self) -> bool 

 

        Summary 

                 

               Query if there are more iterations left in the iterator.  Use 

               this method instead of the older iterend() method which is marked 

               for deprecation. 

              

 

        Description 

                 

               The serves redundant purpose and is here only for backward 

               compatibility. 

                

               This method returns True if there are no more iterations left. 

               I.e., the iterations have ended.  This same information is also 

               returned by niternext(). 

 

               With the use of the VisibilityIterator in the niterinit(), 

               niterorigin(), niternext() methods, the iterator is set to the 

               original state by calling niterinit() at any time. 

 

               See the example below. 

              

        Example: 

                 

               ms.open('3C273XC1.MS') 

               staql={'baseline':'1 & 2'}; 

               ms.msselect(staql); 

               ms.niterinit([' '],60.0) 

               ms.niterorigin() 

               while (!ms.niterend()): 

                  rec=ms.ngetdata(['u','v','data']) 

                  ms.niternext() 

               ms.close() 

                

               We open the MS, select a baseline and then specify an iteration 

               over time, with a 60s time interval.  We then set the iterator 

               to the start of the data and get out some data.  We advance the 

               iterator to the next lot of data and continue till the end of 

               iterations is indicated.  Finally, we close the ms tool which 

               restores the tool to its original state. 

              

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

                       

        """ 

        return _ms.ms_niterend(self) 

 

ms_swigregister = _ms.ms_swigregister 

ms_swigregister(ms) 

 

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