API
Core Module (serval.core.py)
PowerBeamVisProjector
Bases: VisProjector
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
|
required |
longitude
|
float
|
|
required |
baseline_enu
|
tuple[float, float, float]
|
|
required |
power_beam_lmax
|
int
|
|
required |
frequencies_MHz
|
ndarray
|
|
required |
baseline_lmax
|
int | None
|
|
None
|
sky_lmax
|
int | None
|
|
None
|
sky_absm_limits
|
list[int | None]
|
|
[0, None]
|
generate_gaunt_cache_on_init
|
bool
|
|
False
|
generate_baseline_cache_on_init
|
bool
|
|
False
|
generate_pointing_contractor_on_init
|
bool
|
|
False
|
batch_parallel_mode
|
Literal['channel-opt', 'channel', 'gaunt', 'gaunt-opt']
|
|
'gaunt-opt'
|
cache_truncation_rtol
|
float
|
|
0
|
pointing_contract
|
bool
|
|
False
|
pointing_altitude
|
float | None
|
|
None
|
pointing_azimuth
|
float | None
|
|
None
|
pointing_boresight
|
float | None
|
|
None
|
pointed_beam_mmax
|
int | None
|
|
None
|
aberrate_baseline
|
bool
|
|
False
|
Attributes:
| Name | Type | Description |
|---|---|---|
pointing_contractor |
ndarray | None
|
|
Source code in src/serval/core.py
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 | |
PowerFromVoltageBeams
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
voltage_beam_lmax
|
int
|
|
required |
voltage_beam_mmax
|
int | None
|
|
None
|
power_beam_lmax
|
int | None
|
|
None
|
power_beam_mmax
|
int | None
|
|
None
|
generate_cache_on_init
|
bool
|
|
True
|
Attributes:
| Name | Type | Description |
|---|---|---|
triple_sh_integrator |
TripleSHIntegrator
|
|
Source code in src/serval/core.py
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 | |
SingleVisibilityGenerator
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
|
required |
longitude
|
float
|
|
required |
baseline_enu
|
tuple[float, float, float]
|
|
required |
frequency_MHz
|
float
|
|
required |
power_beam_alm
|
ndarray[tuple[Any, ...], dtype[complex128]]
|
|
required |
sky_alm
|
ndarray[tuple[Any, ...], dtype[complex128]]
|
|
required |
method
|
Literal['gaunt', 'grid']
|
|
'gaunt'
|
baseline_lmax
|
int | None
|
|
None
|
aberrate_baseline
|
bool
|
|
False
|
sky_absm_limits
|
tuple[int, int | None]
|
|
(0, None)
|
baseline_alm
|
None | ndarray[tuple[Any, ...], dtype[complex128]]
|
|
None
|
Attributes:
| Name | Type | Description |
|---|---|---|
sky_lmax |
int
|
|
power_beam_lmax |
int
|
|
triple_sh_integrator |
TripleSHIntegrator
|
|
Source code in src/serval/core.py
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 | |
SkyVisProjector
Bases: VisProjector
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
|
required |
longitude
|
float
|
|
required |
baseline_enu
|
tuple[float, float, float]
|
|
required |
sky_lmax
|
int
|
|
required |
frequencies_MHz
|
ndarray
|
|
required |
baseline_lmax
|
int | None
|
|
None
|
power_beam_lmax
|
int | None
|
|
None
|
sky_absm_limits
|
list[int | None]
|
|
[0, None]
|
generate_gaunt_cache_on_init
|
bool
|
|
False
|
generate_baseline_cache_on_init
|
bool
|
|
False
|
batch_parallel_mode
|
Literal['channel', 'gaunt']
|
|
'channel'
|
cache_truncation_rtol
|
float
|
|
0
|
aberrate_baseline
|
bool
|
|
False
|
Source code in src/serval/core.py
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 | |
TripleSHIntegrator
A class for performing integrals of the products of three functions on the sphere expressed as their spherical harmonic transformations.
This class provides methods for this integration performed with a variety of techniques using Gaunt coefficients and grid-based approaches. It supports caching for efficient repeated computations when changing only one of the functions. Additionally it allows for computing the Fourier transform of these integrals in an azimuthal rotation angle of one of the functions (always the 1st) around the others, ie. the \(m\)-modes.
That is,
where
etc.
For the \(m\)-modes:
where \(\matr{\mathcal{R}}_Z(-\phi)\) is a passive basis rotation about the polar axis of the sphere.
Notes
The index of the functions only matters in differentiating from the others the first function/set of coefficients as the integration can be split up in \(m_1\) values. Additionally integrals can be performed rotating this function azimuthally around the others. That is, for the purposes of this code, this represents the sky.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l1max
|
int
|
Maximum spherical harmonic degree for the first set of coefficients. |
required |
l2max
|
int
|
Maximum spherical harmonic degree for the second set of coefficients. |
required |
l3max
|
int
|
Maximum spherical harmonic degree for the third set of coefficients. |
required |
absm1_limits
|
tuple[int, int | None]
|
Inclusive lower and exclusive upper limits for the absolute value of the m1 index. Defaults to (0, None), ie, all m1 values. |
(0, None)
|
generate_cache_on_init
|
bool
|
Whether to generate the Gaunt coefficient cache during initialization, by default False. |
False
|
Attributes:
| Name | Type | Description |
|---|---|---|
m1_values |
list[int]
|
List of m1 values that integrations are performed for. |
m1_index_map |
dict[int, int]
|
Mapping of m1 values to their indices in a completed set of m1 values. |
linear_integrator_cache_12 |
ndarray[tuple[Any, ...], dtype[complex128]] | None
|
|
linear_integrator_cache_23 |
ndarray[tuple[Any, ...], dtype[complex128]] | None
|
|
gaunt_cache |
CachingGauntContractor | CachingGauntContractorOpt12 | None
|
|
m1_global_index |
list[int]
|
|
Methods:
| Name | Description |
|---|---|
generate_gaunt_cache |
Generates the Gaunt coefficient cache. |
clear_gaunt_cache |
Clears the Gaunt coefficient cache. |
grid_integrate |
Performs integration using a grid-based approach. |
gaunt_integrate |
Performs integration using a direct sum over precomputed Gaunt coefficients. |
linear_gaunt_integrator_12 |
Computes a linear integrator for fixed first and second sets of coefficients. |
generate_integrator_cache_12 |
batch_parallel_mode="channel") Generates and caches the linear integrator for fixed first and second sets of coefficients. |
batch_gaunt_integrate_cached_12 |
Uses a integrator cache for fixed first and second sets of coefficients to compute integrals over a batch of the third set of coefficients. |
linear_gaunt_integrator_23 |
Computes a linear integrator for fixed second and third sets of coefficients. |
generate_integrator_cache_23 |
Generates and caches the linear integrator for fixed second and third sets of coefficients. |
batch_gaunt_integrate_cached_12 |
Uses a integrator cache for fixed second and third sets of coefficients to compute integrals over a bacth of the first set of coefficients. |
Source code in src/serval/core.py
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 | |
clear_gaunt_cache()
gaunt_integrate(alm1, alm2, alm3, sum_m1=False)
Perform the triple integral by doing and inplace sum-product over gaunt coefficients.
Here the sum is performed inplace with no caching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm1
|
NDArray[complex128]
|
The first set of spherical harmonic coefficients with shape (l1max+1, Nm1). |
required |
alm2
|
NDArray[complex128]
|
The second set of spherical harmonic coefficients with shape (l2max+1, 2*l2max+1). |
required |
alm3
|
NDArray[complex128]
|
The third set of spherical harmonic coefficients with shape (l3max+1, 2*l3max+1). |
required |
sum_m1
|
bool
|
Whether to sum over the m1's before output, by default False. |
False
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128] | complex128
|
If sum_m1 = False, Nm1 array of the m-modes, otherwise, scalar sum over all m-modes. |
Source code in src/serval/core.py
generate_gaunt_cache(cache_type_tag='generic')
Generates the Gaunt coefficient cache.
Source code in src/serval/core.py
generate_integrator_cache_12(alm1, alm2, contract3=None, release_gaunt_cache=True, batch_parallel_mode='channel-opt', alm1_transposed=None, alm2_transposed=None)
summary
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm1
|
NDArray[complex128]
|
description |
required |
alm2
|
NDArray[complex128]
|
description |
required |
contract3
|
NDArray[complex128] | None
|
description, by default None |
None
|
release_gaunt_cache
|
bool
|
description, by default True |
True
|
batch_parallel_mode
|
Literal['channel-opt', 'channel', 'gaunt', 'gaunt-opt']
|
description, by default "channel-opt" |
'channel-opt'
|
alm1_transposed
|
NDArray[complex128] | None
|
Pre-transposed alm1 in (m, l, batch) layout, by default None |
None
|
alm2_transposed
|
NDArray[complex128] | None
|
Pre-transposed alm2 in (m, l, batch) layout, by default None |
None
|
Source code in src/serval/core.py
grid_integrate(alm1, alm2, alm3, sum_m1=False)
Perform the triple integral using a grid-based approach.
Here the product of the second and third fields are evaluated on a consistent resolution grid, decomposed to conjugate spherical harmonics and multipled by the first set of coefficients. This more standard m-mode approach is performant for single integrals but, as implemented here, can't cache intermediate results and therefore not suitable for batching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm1
|
NDArray[complex128]
|
The first set of spherical harmonic coefficients with shape (l1max+1, Nm1). |
required |
alm2
|
NDArray[complex128]
|
The second set of spherical harmonic coefficients with shape (l2max+1, 2*l2max+1). |
required |
alm3
|
NDArray[complex128]
|
The third set of spherical harmonic coefficients with shape (l3max+1, 2*l3max+1). |
required |
sum_m1
|
bool
|
Whether to sum over the m1's before output, by default False. |
False
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128] | complex128
|
If sum_m1 = False, Nm1 array of the m-modes, otherwise, scalar sum over all m-modes. |
Source code in src/serval/core.py
linear_gaunt_integrator_12(alm1, alm2, contract3=None, sum_m1=False)
Generate a linear operator that, with fixed first and second set of coefficients performs the integral when sum-producted with the third set of coefficients.
If requested, additionally contract with a linear operator along the m3 axis (e.g. a rotation with a Wigner-d matrix),
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm1
|
NDArray[complex128]
|
The first set of spherical harmonic coefficients with shape (l1max+1, Nm1). |
required |
alm2
|
NDArray[complex128]
|
The second set of spherical harmonic coefficients with shape (l2max+1, 2*l2max+1). |
required |
contract3
|
NDArray[complex128] | None
|
An optional linear operator along the m3 axis, shape (l3max+1, 2l3max+1, Nm3prime<=2l3max+1), by default None |
None
|
sum_m1
|
bool
|
Whether to sum over the m1's before output, by default False. |
False
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
By default (Nm1, Nl3, nm3) linear operator. If sum_m1=True, an (Nl3, Nm3) array where the m1 axis has been summed over. If contract3 is present, this will instead be an (Nm1, Nl3, Nm3prime) or (Nl3, Nm3prime) array resulting from the subsequent contraction on the m3 axis. |
Source code in src/serval/core.py
VisProjector
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
|
required |
longitude
|
float
|
|
required |
baseline_enu
|
tuple[float, float, float]
|
|
required |
frequencies_MHz
|
ndarray
|
|
required |
power_beam_lmax
|
int | None
|
|
None
|
baseline_lmax
|
int | None
|
|
None
|
sky_lmax
|
int | None
|
|
None
|
sky_absm_limits
|
list[int | None]
|
|
[0, None]
|
generate_gaunt_cache_on_init
|
bool
|
|
False
|
generate_baseline_cache_on_init
|
bool
|
|
False
|
batch_parallel_mode
|
Literal['channel-opt', 'channel', 'gaunt', 'gaunt-opt']
|
|
'channel'
|
cache_truncation_rtol
|
float
|
|
0
|
Attributes:
| Name | Type | Description |
|---|---|---|
baseline_mmax |
int | None
|
|
baseline_cache |
ndarray | None
|
|
integrator_cache |
ndarray | None
|
|
triple_sh_integrator |
TripleSHIntegrator
|
|
Source code in src/serval/core.py
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 | |
contract_standard(result, contract3)
Standard multiplication of the integrator result with contract3. Applied in all types of cache except gaunt-opt.
Args: result (npt.NDArray[np.complex128]): integrator 12 contract3 (npt.NDArray[np.complex128] | None): contract array
Returns: npt.NDArray[np.complex128]: the multiplication of the arguments unless contract is None.
Source code in src/serval/core.py
contract_transpose(result, contract3)
Multiplication of the integrator result with contract3 and transposition. Applied for gaunt-opt type of cache.
Args: result (npt.NDArray[np.complex128]): integrator 12 contract3 (npt.NDArray[np.complex128] | None): contract array
Returns: npt.NDArray[np.complex128]: the multiplication of the arguments if contract is not None. The transposed integrator 12.
Source code in src/serval/core.py
extend_dimensions_if_one_batch(arr, dim)
If a single frequency is calculated then the alms and cache matrices will be missing the first dimension that corresponds to the number of frequencies. This function takes the arrays and adds a (1, ...) dimension
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
NDArray[complex128]
|
The input array. |
required |
dim
|
int
|
The desired number of dimensions. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
The array with the correct number of dimensions. |
Source code in src/serval/core.py
Rotation Utilities (serval.rotate.py)
Containers (serval.containers.py)
CSTBeamInterpolator
Reads CST farfield export files and builds a Ludwig-3 callable with spline interpolation in angle and linear interpolation in frequency.
Supported CST format
Only the CST 2D farfield export is supported, with header
Theta [deg.] Phi [deg.] ..., where Theta ranges over
\([-180, 180)\) and Phi over \([-90, 90]\). Other CST export formats
(e.g. Theta \([0, 180]\), Phi \([0, 360)\)) are not guaranteed to work.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_mapping
|
dict[float, str]
|
|
required |
linearize_from_dB
|
bool
|
If |
True
|
freq_interp_kind
|
int | str
|
Interpolation order for the frequency axis. Passed as |
'linear'
|
Attributes:
| Name | Type | Description |
|---|---|---|
frequencies |
ndarray[tuple[Any, ...], dtype[float64]]
|
|
Source code in src/serval/containers.py
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 | |
__call__(freq, theta, phi)
Evaluate the interpolated beam, matching the Ludwig-3 callable signature.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
freq
|
(array, shape(n_freq, 1, 1))
|
Frequencies in MHz. |
required |
theta
|
(array, shape(nlat, nlon))
|
Colatitude in radians. |
required |
phi
|
(array, shape(nlat, nlon))
|
Azimuth in radians. |
required |
Returns:
| Type | Description |
|---|---|
(array, shape(2, n_freq, nlat, nlon))
|
Co-pol (index 0) and cross-pol (index 1). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any requested frequency is outside the range of known frequencies. |
Source code in src/serval/containers.py
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 | |
HarmonicContainer
Base container for spherical harmonic coefficient data.
Stores alm arrays in standard Fourier order with shape
(..., n_freq, lmax+1, 2*mmax+1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
<dynamic>
|
lmax
|
int
|
|
required |
frequencies_MHz
|
ndarray[tuple[Any, ...], dtype[float64]]
|
|
required |
alm
|
ndarray[tuple[Any, ...], dtype[complex128]]
|
|
required |
metadata
|
dict
|
dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2) |
<class 'dict'>
|
Source code in src/serval/containers.py
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 | |
as_coeff(pol_inds=None, freq_inds=None)
Return the alm coefficient array, optionally sliced along polarisation and frequency.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pol_inds
|
int, slice, or None
|
Polarisation index/indices to select from the leading axis. If
|
None
|
freq_inds
|
int, slice, or None
|
Frequency index/indices to select along the frequency axis. If
|
None
|
Returns:
| Type | Description |
|---|---|
ndarray of complex128
|
Sliced alm array with the same axis order as |
Source code in src/serval/containers.py
as_grid(pol_inds=None, freq_inds=None, return_shgrid=False)
Synthesise alm coefficients to a spatial grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pol_inds
|
int, slice, or None
|
Polarisation index or slice. |
None
|
freq_inds
|
int, slice, or None
|
Frequency index or slice. |
None
|
return_shgrid
|
bool
|
If True, return |
False
|
Returns:
| Type | Description |
|---|---|
NDArray | SHGrid | list[SHGrid]
|
When |
Source code in src/serval/containers.py
bandlimited_to(lmax, mmax=None)
Return a new container with alm truncated to the given bandlimits.
Source code in src/serval/containers.py
effective_bandlimits(threshold=SPARSE_THRESHOLD, per_slice=False)
Return the effective (lmax, mmax) of the alm data.
For each leading-dimension slice, finds the largest ell and m
where any coefficient exceeds threshold * max(|alm|)
(peak taken per slice).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
threshold
|
float
|
Relative threshold below which coefficients are considered
negligible. Default is |
SPARSE_THRESHOLD
|
per_slice
|
bool
|
If False (default), return the overall maximum across all
leading dimensions as a |
False
|
Returns:
| Type | Description |
|---|---|
tuple[int, int] | NDArray[int_]
|
Effective bandlimits, either as a single tuple or a per-slice array. |
Source code in src/serval/containers.py
from_zarr_store(store_location, group_path='/', lmax=None, mmax=None, freq_slice=None)
classmethod
Load a container from a zarr store on disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
Load only alm coefficients up to this degree. Must be <= the stored lmax. Defaults to the stored lmax (full read). |
None
|
mmax
|
int
|
Load only alm coefficients up to this order. Must be <= the stored mmax. Defaults to the stored mmax (full read). |
None
|
freq_slice
|
slice
|
Load only the frequency channels selected by this slice. Applied along
|
None
|
Source code in src/serval/containers.py
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 | |
rotate(eulers_or_rotation, **kwargs)
Rotate the alm coefficients by the given rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eulers_or_rotation
|
tuple[float, float, float] | Rotation
|
ZYZ Euler angles |
required |
**kwargs
|
Additional keyword arguments forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
HarmonicContainer
|
A copy of this container with rotated alm and |
Source code in src/serval/containers.py
to_healpix(nside, pol_inds=None, freq_inds=None)
Convert alm to healpix-format alm arrays.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nside
|
int
|
Healpix nside parameter (determines output lmax = 3*nside - 1). |
required |
pol_inds
|
int, slice, or None
|
Polarisation index or slice. |
None
|
freq_inds
|
int, slice, or None
|
Frequency index or slice. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
Healpy-ordered alm array(s). |
Source code in src/serval/containers.py
to_zarr_store(store_location, group_path='/', metadata=None)
Persist the container to a zarr store on disk.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store_location
|
str or Path
|
Path to the zarr store directory. |
required |
group_path
|
str
|
Group path within the store. |
'/'
|
metadata
|
dict
|
Additional key/value pairs merged into the container's |
None
|
Source code in src/serval/containers.py
SkyModel
Bases: HarmonicContainer
Container for sky model alm data.
Stores sky brightness in spherical harmonic coefficients with associated metadata for units, polarisation, coordinate frame and epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
<dynamic>
|
lmax
|
int
|
|
required |
frequencies_MHz
|
ndarray[tuple[Any, ...], dtype[float64]]
|
|
required |
alm
|
ndarray[tuple[Any, ...], dtype[complex128]]
|
|
required |
map_unit
|
Literal['K', 'Jy/sr']
|
|
required |
polarisation
|
Literal['I', 'IQU', 'IQUV']
|
|
required |
coordinate_basis
|
Literal['ICRS', 'CIRS', 'Galactic']
|
|
required |
epoch
|
str | None
|
|
None
|
Source code in src/serval/containers.py
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 | |
from_healpix_maps(maps, frequencies_MHz, lmax, mmax=None, map_unit='K', polarisation='I', coordinate_basis='ICRS')
classmethod
Construct a SkyModel from HEALPix pixel-domain maps.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
maps
|
NDArray[float64]
|
HEALPix maps. Shape depends on polarisation:
|
required |
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
lmax
|
int
|
Maximum spherical harmonic degree for the decomposition. |
required |
mmax
|
int | None
|
Maximum azimuthal order. Defaults to lmax. |
None
|
map_unit
|
``"K"`` or ``"Jy/sr"``
|
Physical unit of the map values. |
'K'
|
polarisation
|
``"I"``, ``"IQU"`` or ``"IQUV"``
|
Polarisation content of maps. |
'I'
|
coordinate_basis
|
``"ICRS"``, ``"CIRS"`` or ``"Galactic"``
|
Celestial coordinate frame of the input maps. |
'ICRS'
|
Source code in src/serval/containers.py
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 | |
from_point_source_catalog(coords, flux_Jy, frequencies_MHz, lmax, mmax=None, coordinate_basis='ICRS', epoch=None, n_jobs=None)
classmethod
Construct a sky model from a point source catalogue.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coords
|
SkyCoord
|
Source positions. Will be transformed to the frame specified by coordinate_basis before computing harmonic coefficients. |
required |
flux_Jy
|
NDArray[float64]
|
Flux densities. Shape |
required |
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int | None
|
Maximum azimuthal order. Defaults to lmax. |
None
|
coordinate_basis
|
``"ICRS"``, ``"CIRS"`` or ``"Galactic"``
|
Target coordinate frame for the output SkyModel. |
'ICRS'
|
epoch
|
str | None
|
Required when coordinate_basis is |
None
|
n_jobs
|
int | None
|
Number of worker processes for parallel source computation.
|
None
|
Source code in src/serval/containers.py
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 | |
rotate(eulers_or_rotation, **kwargs)
Rotate the alm coefficients by the given rotation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eulers_or_rotation
|
tuple[float, float, float] | Rotation
|
ZYZ Euler angles |
required |
**kwargs
|
Additional keyword arguments forwarded to |
{}
|
Returns:
| Type | Description |
|---|---|
SkyModel
|
A copy of this sky model with rotated alm and |
Warns:
| Type | Description |
|---|---|
UserWarning
|
If |
Source code in src/serval/containers.py
to_Jy_per_sr()
Return a copy converted from brightness temperature (K) to Jy/sr.
Uses the Rayleigh-Jeans approximation:
Returns a copy unchanged if already in Jy/sr.
Returns:
| Type | Description |
|---|---|
SkyModel
|
Sky model with |
Source code in src/serval/containers.py
to_brightness_K()
Return a copy converted from Jy/sr to brightness temperature (K).
Uses the Rayleigh-Jeans approximation:
Returns a copy unchanged if already in K.
Returns:
| Type | Description |
|---|---|
SkyModel
|
Sky model with |
Source code in src/serval/containers.py
to_cirs(epoch)
Rotate the sky model to the CIRS frame at the given epoch.
Supports conversion from ICRS, Galactic, or CIRS at a different epoch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
str
|
Target epoch string (e.g. |
required |
Returns:
| Type | Description |
|---|---|
SkyModel
|
A new SkyModel in the CIRS frame at epoch. |
Source code in src/serval/containers.py
TIRSPowerBeam
Bases: HarmonicContainer
Container for power beam alm data in the TIRS frame.
Represents the beam power pattern as spherical harmonic coefficients.
The alm array has shape (n_freq, lmax+1, 2*mmax+1).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sht_basis
|
Literal['Pointing', 'TIRS']
|
Basis used for the spherical harmonic decomposition. |
"Pointing"
|
pol_product
|
Literal['XX', 'YY', 'XY', 'YX']
|
Correlator polarisation product, formed from the |
"XX"
|
sky_pol
|
Literal['I', 'Q', 'U', 'V']
|
Sky Stokes parameter this power beam projects onto. |
"I"
|
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
<dynamic>
|
lmax
|
int
|
|
required |
frequencies_MHz
|
ndarray[tuple[Any, ...], dtype[float64]]
|
|
required |
alm
|
ndarray[tuple[Any, ...], dtype[complex128]]
|
|
required |
normalisation
|
Literal['unnormalised', 'peak', 'integral', 'custom']
|
|
'unnormalised'
|
Source code in src/serval/containers.py
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 | |
apply_horizon(latitude, longitude, taper_width=0.0)
Apply a horizon mask to the beam in map space.
Multiplies each frequency channel's synthesised map by a mask that is 1
above the local horizon, tapers smoothly to 0 over taper_width radians
approaching the horizon, and is exactly 0 below the horizon.
Only supported for beams with sht_basis="TIRS".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
Observer latitude in radians. |
required |
longitude
|
float
|
Observer longitude in radians. |
required |
taper_width
|
float
|
Angular width of the sin²-taper region in radians. Default 0 gives a sharp horizon cutoff. |
0.0
|
Returns:
| Type | Description |
|---|---|
TIRSPowerBeam
|
New beam with horizon mask applied; |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/serval/containers.py
clear_cache()
classmethod
from_airy(D_eff, lmax, mmax=None, *, frequencies_MHz, pol_product, sky_pol, normalisation='unnormalised', latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, asymmetry_ratio=1.0, asymmetry_angle=0.0, apply_horizon=False, horizon_taper_kwargs=None, aberrate=False)
classmethod
Construct a TIRSPowerBeam from an Airy disk power beam model.
The power pattern is \((2 J_1(x) / x)^2\) where \(x = \pi D_\mathrm{eff} \sin\theta / \lambda\), the standard diffraction pattern for a uniformly-illuminated circular aperture. The FWHM of the power beam is \(\approx 1.029 \, \lambda / D_\mathrm{eff}\). An optional elliptical asymmetry makes the effective aperture direction-dependent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
D_eff
|
float
|
Effective dish diameter in metres. Sets the major-axis power-beam FWHM via \(\mathrm{FWHM} \approx 1.029 \, \lambda / D_\mathrm{eff}\). Along the minor axis the effective diameter is \(D_\mathrm{eff} / \mathrm{asymmetry\_ratio}\). |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
None
|
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
pol_product
|
(XX, YY, XY, YX)
|
Correlator polarisation product label. |
"XX"
|
sky_pol
|
(I, Q, U, V)
|
Sky Stokes parameter this power beam projects onto. |
"I"
|
normalisation
|
(unnormalised, peak, integral, custom)
|
Normalisation convention. Default |
"unnormalised"
|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default \(\pi/2\). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (North through East). Default \(\pi\). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
asymmetry_ratio
|
float
|
Ratio of semi-major to semi-minor beam width (\(\geq 1\)). Along the major axis the aperture is \(D_\mathrm{eff}\); along the minor axis it is \(D_\mathrm{eff} / \mathrm{asymmetry\_ratio}\). Default 1.0. |
1.0
|
asymmetry_angle
|
float
|
Orientation of the major axis in the pointing frame, in radians measured from \(\phi = 0\). Default 0.0. |
0.0
|
apply_horizon
|
bool
|
Apply a horizon taper before the SHT. Default |
False
|
horizon_taper_kwargs
|
dict
|
Keyword arguments for the horizon taper. |
None
|
aberrate
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TIRSPowerBeam
|
|
Source code in src/serval/containers.py
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 | |
from_gaussian(D_eff, lmax, mmax=None, *, frequencies_MHz, pol_product, sky_pol, normalisation='unnormalised', latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, asymmetry_ratio=1.0, asymmetry_angle=0.0, use_sin_theta=False, apply_horizon=False, horizon_taper_kwargs=None, aberrate=False)
classmethod
Construct a TIRSPowerBeam from a Gaussian power beam model.
The power pattern is a Gaussian with major-axis FWHM equal to \(\approx 1.029 \, \lambda / D_\mathrm{eff}\), chosen to match the FWHM of the Airy disk for a uniformly-illuminated circular aperture. An optional elliptical asymmetry stretches the beam along a specified axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
D_eff
|
float
|
Effective dish diameter in metres. Sets the major-axis power-beam FWHM via \(\mathrm{FWHM} \approx 1.029 \, \lambda / D_\mathrm{eff}\) (the Airy-disk FWHM for a uniformly-illuminated aperture). |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
None
|
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
pol_product
|
(XX, YY, XY, YX)
|
Correlator polarisation product label. |
"XX"
|
sky_pol
|
(I, Q, U, V)
|
Sky Stokes parameter this power beam projects onto. |
"I"
|
normalisation
|
(unnormalised, peak, integral, custom)
|
Normalisation convention. Default |
"unnormalised"
|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default \(\pi/2\). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (North through East). Default \(\pi\). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
asymmetry_ratio
|
float
|
Ratio of semi-major to semi-minor FWHM (\(\geq 1\)). The major axis
FWHM equals the base FWHM from |
1.0
|
asymmetry_angle
|
float
|
Orientation of the major axis in the pointing frame, in radians measured from \(\phi = 0\). Default 0.0. |
0.0
|
use_sin_theta
|
bool
|
If |
False
|
apply_horizon
|
bool
|
Apply a horizon taper before the SHT. Default |
False
|
horizon_taper_kwargs
|
dict
|
Keyword arguments for the horizon taper. |
None
|
aberrate
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TIRSPowerBeam
|
|
Source code in src/serval/containers.py
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 | |
from_scalar_callable(scalar_callable, lmax, mmax=None, *, frequencies_MHz, pol_product, sky_pol, normalisation='unnormalised', latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, apply_horizon=False, horizon_taper_kwargs=None, aberrate=False)
classmethod
Construct a TIRSPowerBeam from a scalar power beam callable.
Evaluates a scalar (real-valued) power pattern on the TIRS grid in pointing-frame coordinates, then decomposes it into spherical harmonics.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
scalar_callable
|
Callable
|
A function
Return shape: |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
None
|
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
pol_product
|
(XX, YY, XY, YX)
|
Correlator polarisation product label. |
"XX"
|
sky_pol
|
(I, Q, U, V)
|
Sky Stokes parameter this power beam projects onto. |
"I"
|
normalisation
|
(unnormalised, peak, integral, custom)
|
Normalisation convention. Default |
"unnormalised"
|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default \(\pi/2\). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (North through East). Default \(\pi\). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
apply_horizon
|
bool
|
If |
False
|
horizon_taper_kwargs
|
dict
|
Keyword arguments for the horizon taper: |
None
|
aberrate
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TIRSPowerBeam
|
Power beam in the TIRS frame, |
Source code in src/serval/containers.py
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 | |
from_voltage_beams(vbeam_i, vbeam_j, sky_pol='I', power_beam_lmax=None, power_beam_mmax=None, method='grid')
classmethod
Construct a TIRSPowerBeam from two TIRSVoltageBeams.
The pol_product is inferred as
vbeam_i.polarisation + vbeam_j.polarisation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vbeam_i
|
TIRSVoltageBeam
|
Voltage beams for feeds i and j. |
required |
vbeam_j
|
TIRSVoltageBeam
|
Voltage beams for feeds i and j. |
required |
sky_pol
|
(I, Q, U, V)
|
Sky Stokes parameter to project onto. |
"I"
|
power_beam_lmax
|
int
|
Bandlimit of the output power beam. Defaults to 2 * vbeam_i.lmax. |
None
|
power_beam_mmax
|
int
|
Azimuthal bandlimit. Defaults to 2 * vbeam_i.mmax. |
None
|
method
|
(grid, gaunt)
|
SH product method. "grid" is faster; "gaunt" uses cached Gaunt coefficients. |
"grid"
|
Returns:
| Type | Description |
|---|---|
TIRSPowerBeam
|
Power beam in the TIRS frame with alm of shape
|
Source code in src/serval/containers.py
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 | |
integrals()
normalise(normalisation, integrals=None)
Return a new TIRSPowerBeam with normalised alm coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
normalisation
|
(peak, integral, custom)
|
Normalisation mode:
|
"peak"
|
integrals
|
ndarray of shape (n_freq,)
|
Required when |
None
|
Returns:
| Type | Description |
|---|---|
TIRSPowerBeam
|
A new container with scaled |
Source code in src/serval/containers.py
to_pointed_basis(latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, mmax=None)
Rotate the SHT decomposition basis from TIRS to a pointing-aligned frame.
Useful for compactly representing beams with large amounts of azimuthal symmetry in the pointing frame (e.g. a zenith-pointing dish).
.. important::
This method only changes the SHT decomposition basis of the beam.
Polarisation projections (the mapping from feed X/Y to Stokes
parameters) remain defined in the TIRS frame and are unaffected by
this rotation. Use mmax to truncate the azimuthal bandwidth of
the output when the beam is compact in m in the new basis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default π/2 (zenith). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (measured from North through East). Default π (South). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
mmax
|
int
|
If provided, truncate the output to this azimuthal bandlimit after
rotation. Must be ≤ |
None
|
Returns:
| Type | Description |
|---|---|
TIRSPowerBeam
|
A new TIRSPowerBeam with |
Source code in src/serval/containers.py
TIRSVoltageBeam
Bases: HarmonicContainer
Container for voltage beam alm data for a linearly polarised antenna in the TIRS frame.
The alm array has shape (2, n_freq, lmax+1, 2*mmax+1) where the
leading axis indexes the theta (0) and phi (1) spherical polarisation
components. Construct via from_ludwig3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
<dynamic>
|
frequencies_MHz
|
ndarray[tuple[Any, ...], dtype[float64]]
|
Frequency array in MHz. |
required |
alm
|
ndarray[tuple[Any, ...], dtype[complex128]]
|
Spherical harmonic coefficients of shape |
required |
polarisation
|
Literal['X', 'Y']
|
Feed polarisation axis. X is aligned with the EW direction; Y with NS. |
"X"
|
sht_basis
|
Literal['Pointing', 'TIRS']
|
Basis used for the spherical harmonic decomposition. |
"Pointing"
|
normalisation
|
Literal['unnormalised', 'power_integral', 'custom']
|
|
'unnormalised'
|
Source code in src/serval/containers.py
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 | |
apply_horizon(latitude, longitude, taper_width=0.0, apply_sqrt=True)
Apply a horizon mask to the voltage beam in map space.
Multiplies each polarisation component and frequency channel's
synthesised map by a mask that is 1 above the local horizon, tapers
smoothly to 0 over taper_width radians approaching the horizon, and
is exactly 0 below the horizon.
By default (apply_sqrt=True) the square root of the power-beam
horizon taper is applied, so that constructing a
TIRSPowerBeam from two voltage beams that have each had
apply_horizon called with identical arguments gives the same result
as calling apply_horizon on the resulting
TIRSPowerBeam.
Only supported for beams with sht_basis="TIRS".
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
Observer latitude in radians. |
required |
longitude
|
float
|
Observer longitude in radians. |
required |
taper_width
|
float
|
Angular width of the sin²-taper region in radians. Default 0 gives a sharp horizon cutoff. |
0.0
|
apply_sqrt
|
bool
|
If |
True
|
Returns:
| Type | Description |
|---|---|
TIRSVoltageBeam
|
New beam with horizon mask applied; |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/serval/containers.py
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 | |
clear_cache()
classmethod
from_airy(D_eff, lmax, mmax=None, *, frequencies_MHz, polarisation, latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, copol_phi_offset=0.0, cross_pol_factor=0.0, asymmetry_ratio=1.0, asymmetry_angle=0.0, apply_horizon=False, horizon_taper_kwargs=None, aberrate=False)
classmethod
Construct a TIRSVoltageBeam from an Airy disk beam model.
The co-pol voltage amplitude is \(2 J_1(x) / x\) where \(x = \pi D_\mathrm{eff} \sin\theta / \lambda\), the standard diffraction pattern for a uniformly-illuminated circular aperture. The power-beam FWHM is \(\approx 1.029 \, \lambda / D_\mathrm{eff}\). An optional elliptical asymmetry makes the effective aperture direction-dependent.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
D_eff
|
float
|
Effective dish diameter in metres. Sets the major-axis power-beam FWHM via \(\mathrm{FWHM} \approx 1.029 \, \lambda / D_\mathrm{eff}\). Along the minor axis the effective diameter is \(D_\mathrm{eff} / \mathrm{asymmetry\_ratio}\). |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
None
|
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
polarisation
|
(X, Y)
|
Feed polarisation. |
"X"
|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default \(\pi/2\). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (North through East). Default \(\pi\). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
copol_phi_offset
|
float
|
Offset between beam co-pol axis and \(\phi = 0\). Default 0.0. |
0.0
|
cross_pol_factor
|
float
|
Multiplicative factor relating cross-pol to co-pol. Default 0.0. |
0.0
|
asymmetry_ratio
|
float
|
Ratio of semi-major to semi-minor beam width (\(\geq 1\)). Along the major axis the aperture is \(D_\mathrm{eff}\); along the minor axis it is \(D_\mathrm{eff} / \mathrm{asymmetry\_ratio}\). Default 1.0. |
1.0
|
asymmetry_angle
|
float
|
Orientation of the major axis in the pointing frame, in radians measured from \(\phi = 0\). Default 0.0. |
0.0
|
apply_horizon
|
bool
|
Apply a horizon taper before the SHT. Default |
False
|
horizon_taper_kwargs
|
dict
|
Keyword arguments for the horizon taper. |
None
|
aberrate
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TIRSVoltageBeam
|
|
Source code in src/serval/containers.py
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 | |
from_cst_farfields(file_mapping, lmax, mmax=None, *, frequencies_MHz, polarisation, latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, copol_phi_offset=0.0, apply_horizon=False, horizon_taper_kwargs=None, aberrate=False, cst_kwargs=None)
classmethod
Construct a TIRSVoltageBeam from CST farfield export files.
Builds a CSTBeamInterpolator from the given files and passes it as the Ludwig-3 callable to from_ludwig3.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_mapping
|
dict[float, str]
|
|
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
None
|
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz at which to evaluate the beam. Must lie within
the range spanned by |
required |
polarisation
|
(X, Y)
|
Feed polarisation. |
"X"
|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default \(\pi/2\). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (North through East). Default \(\pi\). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
copol_phi_offset
|
float
|
Offset between beam co-pol axis and \(\phi = 0\). Default 0.0. |
0.0
|
apply_horizon
|
bool
|
Apply a horizon taper before the SHT. Default |
False
|
horizon_taper_kwargs
|
dict
|
Keyword arguments for the horizon taper. |
None
|
aberrate
|
bool
|
If |
False
|
cst_kwargs
|
dict
|
Extra keyword arguments forwarded to
CSTBeamInterpolator
(e.g. |
None
|
Returns:
| Type | Description |
|---|---|
TIRSVoltageBeam
|
|
Source code in src/serval/containers.py
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 | |
from_gaussian(D_eff, lmax, mmax=None, *, frequencies_MHz, polarisation, latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, copol_phi_offset=0.0, cross_pol_factor=0.0, asymmetry_ratio=1.0, asymmetry_angle=0.0, use_sin_theta=False, apply_horizon=False, horizon_taper_kwargs=None, aberrate=False)
classmethod
Construct a TIRSVoltageBeam from a Gaussian beam model.
The co-pol voltage amplitude is a Gaussian whose power-beam FWHM along the major axis is \(\approx 1.029 \, \lambda / D_\mathrm{eff}\), chosen to match the Airy-disk FWHM for a uniformly-illuminated circular aperture. An optional elliptical asymmetry stretches the beam along a specified axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
D_eff
|
float
|
Effective dish diameter in metres. Sets the major-axis power-beam FWHM via \(\mathrm{FWHM} \approx 1.029 \, \lambda / D_\mathrm{eff}\) (the Airy-disk FWHM for a uniformly-illuminated aperture). |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
None
|
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
polarisation
|
(X, Y)
|
Feed polarisation. |
"X"
|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default \(\pi/2\). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (North through East). Default \(\pi\). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
copol_phi_offset
|
float
|
Offset between beam co-pol axis and \(\phi = 0\). Default 0.0. |
0.0
|
cross_pol_factor
|
float
|
Multiplicative factor relating cross-pol to co-pol. Default 0.0 (no cross-polarisation). |
0.0
|
asymmetry_ratio
|
float
|
Ratio of semi-major to semi-minor FWHM (\(\geq 1\)). The major axis
FWHM equals the base FWHM from |
1.0
|
asymmetry_angle
|
float
|
Orientation of the major axis in the pointing frame, in radians measured from \(\phi = 0\). Default 0.0. |
0.0
|
use_sin_theta
|
bool
|
If |
False
|
apply_horizon
|
bool
|
Apply a horizon taper before the SHT. Default |
False
|
horizon_taper_kwargs
|
dict
|
Keyword arguments for the horizon taper. |
None
|
aberrate
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TIRSVoltageBeam
|
|
Source code in src/serval/containers.py
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 | |
from_ludwig3(ludwig3_callable, lmax, mmax=None, *, frequencies_MHz, polarisation, latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, copol_phi_offset=0.0, apply_horizon=False, horizon_taper_kwargs=None, aberrate=False)
classmethod
Construct a TIRSVoltageBeam from a Ludwig-3 beam callable.
Coordinate transform and polariastion projection computations are cached
(maxsize=1) so that repeated calls with the same pointing parameters
— e.g. a loop over many beam callables — are more efficient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ludwig3_callable
|
Callable
|
A function
Return shape: |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
None
|
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
polarisation
|
(X, Y)
|
Feed polarisation. For |
"X"
|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default \(\pi/2\) (zenith). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (North through East). Default \(\pi\) (South). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
copol_phi_offset
|
float
|
Offset angle in radians between the beam model's co-pol axis and SERVAL's \(\phi = 0\) reference (the zenith meridian). Positive values rotate the \(\phi = 0\) reference right-handed about the boresight. Default 0.0. |
0.0
|
apply_horizon
|
bool
|
If |
False
|
horizon_taper_kwargs
|
dict
|
Keyword arguments forwarded to the horizon taper: |
None
|
aberrate
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TIRSVoltageBeam
|
Voltage beam in the TIRS frame, |
Source code in src/serval/containers.py
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 | |
from_thetaphi(thetaphi_callable, lmax, mmax=None, *, frequencies_MHz, polarisation, latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, copol_phi_offset=0.0, apply_horizon=False, horizon_taper_kwargs=None, aberrate=False)
classmethod
Construct a TIRSVoltageBeam from a theta/phi beam callable.
A thin wrapper around from_ludwig3 that accepts a callable in the spherical \((\hat{\theta}, \hat{\phi})\) basis rather than the Ludwig-3 \((E_\mathrm{co}, E_\mathrm{cr})\) basis. The conversion used is
Here \(\phi\) is the pointing-frame azimuth measured from the co-pol
axis. If the theta/phi callable uses a different azimuth origin,
supply that offset via copol_phi_offset.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
thetaphi_callable
|
Callable
|
A function
Return shape: |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
mmax
|
int
|
Maximum spherical harmonic order. Defaults to |
None
|
frequencies_MHz
|
NDArray[float64]
|
Frequency array in MHz. |
required |
polarisation
|
(X, Y)
|
Feed polarisation. |
"X"
|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default \(\pi/2\). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (North through East). Default \(\pi\). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
copol_phi_offset
|
float
|
Azimuth, in the theta/phi callable's native pointing-frame coordinates, at which the Ludwig-3 co-pol axis lies. This same offset is passed through to from_ludwig3 so that the callable evaluation coordinates and the subsequent co/cr-to-TIRS projection use the same co-pol reference. Default 0.0. |
0.0
|
apply_horizon
|
bool
|
Apply a horizon taper before the SHT. Default |
False
|
horizon_taper_kwargs
|
dict
|
Keyword arguments for the horizon taper. |
None
|
aberrate
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
TIRSVoltageBeam
|
Voltage beam in the TIRS frame, |
Source code in src/serval/containers.py
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 | |
normalise(normalisation, power_integrals=None)
Return a new TIRSVoltageBeam with normalised alm coefficients.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
normalisation
|
(power_integral, custom)
|
Normalisation mode:
|
"power_integral"
|
power_integrals
|
ndarray of shape (n_freq,)
|
Required when |
None
|
Returns:
| Type | Description |
|---|---|
TIRSVoltageBeam
|
A new container with scaled |
Source code in src/serval/containers.py
power_integrals()
Per-frequency integral of the power pattern |E_theta|^2 + |E_phi|^2 over the unit sphere.
Uses Parseval's theorem: for orthonormal spherical harmonics the integral equals the sum of squared alm magnitudes over both polarisation components.
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Array of shape |
Source code in src/serval/containers.py
to_pointed_basis(latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0, mmax=None)
Rotate the SHT decomposition basis from TIRS to a pointing-aligned frame.
Useful for compactly representing beams with large amounts of azimuthal symmetry in the pointing frame (e.g. a zenith-pointing dish).
.. important::
This method only changes the SHT decomposition basis of the beam.
Polarisation projections (the mapping from feed X/Y to Stokes
parameters) remain defined in the TIRS frame and are unaffected by
this rotation. Use mmax to truncate the azimuthal bandwidth of
the output when the beam is compact in m in the new basis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
Observer latitude in the TIRS frame, in radians. |
required |
longitude
|
float
|
Observer longitude in the TIRS frame, in radians. |
required |
altitude
|
float
|
Pointing altitude above the horizon in radians. Default π/2 (zenith). |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians (measured from North through East). Default π (South). |
pi
|
boresight
|
float
|
Rotation about the pointing axis in radians. Default 0. |
0.0
|
mmax
|
int
|
If provided, truncate the output to this azimuthal bandlimit after
rotation. Must be ≤ |
None
|
Returns:
| Type | Description |
|---|---|
TIRSVoltageBeam
|
A new TIRSVoltageBeam with |
Source code in src/serval/containers.py
Visibilities
Container for drift-scan visibility and m-mode data.
Stores per-(baseline, beam) visibility output from the SERVAL pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frequencies_MHz
|
ndarray[tuple[Any, ...], dtype[float64]]
|
Frequency axis. |
required |
era_deg
|
ndarray[tuple[Any, ...], dtype[float64]]
|
Absolute Greenwich Earth Rotation Angle in degrees (longitude=0),
as defined by |
required |
vis
|
ndarray[tuple[Any, ...], dtype[complex128]]
|
Complex visibility timestream. |
required |
mmodes
|
ndarray[tuple[Any, ...], dtype[complex128]]
|
M-mode decomposition of the visibilities. Columns outside the set of
active m-values (see |
required |
m_values
|
ndarray[tuple[Any, ...], dtype[int64]]
|
The sky m-values that contribute non-zero entries to |
required |
metadata
|
dict
|
Arbitrary provenance information (beam attrs, integrator cache attrs, etc.). |
<class 'dict'>
|
sky_pol
|
Literal['I', 'Q', 'U', 'V']
|
Sky Stokes parameter this visibility stream projects onto. |
"I"
|
pol_product
|
Literal['XX', 'YY', 'XY', 'YX']
|
Correlator polarisation product of the two beams used to form this visibility. |
"XX"
|
ra_deg
|
ndarray[tuple[Any, ...], dtype[float64]] | None
|
|
None
|
ut1_time
|
ndarray[tuple[Any, ...], dtype[float64]] | None
|
|
None
|
Source code in src/serval/containers.py
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 | |
from_zarr_store(store_location, group_path='/')
classmethod
Load a Visibilities container from a zarr store.
vis and mmodes are kept as lazy zarr.Array objects;
data is read only when accessed.
Source code in src/serval/containers.py
resample(n_era)
Resample to a new ERA grid by padding or trimming in m-mode space.
Uses the stored m-mode decomposition to synthesise visibilities at a
different number of ERA samples without returning to the sky.
Upsampling zero-pads m-modes beyond the original Nyquist limit;
downsampling discards m-modes above the new Nyquist limit
(n_era - 1) // 2.
The output ERA count is always 2 * ((n_era - 1) // 2) + 1; for
odd n_era this equals n_era exactly. For even n_era the
asymmetric Nyquist bin is dropped and the output has n_era - 1
samples.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n_era
|
int
|
Desired number of output ERA samples. |
required |
Returns:
| Type | Description |
|---|---|
Visibilities
|
New container with resampled |
Source code in src/serval/containers.py
resample_to_ra(ra_deg, *, latitude, longitude, altitude=np.pi / 2, azimuth=np.pi)
Evaluate visibilities at CIRS Right Ascension positions.
Computes the ERA at which each RA transits the beam centre, then
evaluates the visibility timestream at those ERAs via NUDFT. The
mmodes are left unchanged — they remain the Fourier transform of
the original ERA-indexed stream.
The ERA-RA relationship has unit slope: as the Earth rotates by δ°, the CIRS RA of any TIRS-fixed direction increases by exactly δ°. The offset is determined solely by the beam pointing geometry.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra_deg
|
(ndarray, shape(n_t))
|
Target CIRS Right Ascension values in degrees. |
required |
latitude
|
float
|
Site geodetic latitude in radians. |
required |
longitude
|
float
|
Site geodetic longitude in radians. |
required |
altitude
|
float
|
Pointing altitude in radians, by default |
pi / 2
|
azimuth
|
float
|
Pointing azimuth in radians, by default |
pi
|
Returns:
| Type | Description |
|---|---|
Visibilities
|
New container with |
Source code in src/serval/containers.py
resample_to_times(times)
Evaluate visibilities at arbitrary observation times.
Converts the input times to the UT1 scale and delegates to
resample_to_ut1.
All time scales supported by
astropy.time.Time are accepted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
Time
|
Observation times at which to evaluate. |
required |
Returns:
| Type | Description |
|---|---|
Visibilities
|
New container with |
Source code in src/serval/containers.py
resample_to_ut1(ut1_jd)
Evaluate visibilities at UT1 times.
Converts each UT1 Julian date to an absolute Greenwich ERA using
ERFA's era00 function, then evaluates the visibility timestream at
those ERAs via NUDFT. The mmodes are left unchanged.
The container ERA axis is the absolute Greenwich ERA as defined by
ERFA: the same ERA value that erfa.era00(dj1, dj2) returns for the
corresponding UT1 Julian date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ut1_jd
|
(ndarray, shape(n_t))
|
UT1 Julian dates at which to evaluate. |
required |
Returns:
| Type | Description |
|---|---|
Visibilities
|
New container with |
Source code in src/serval/containers.py
setup_zarr_store(store_location, group_path='/', *, frequencies_MHz, era_deg, m_values, n_freq, n_era, chunks, sky_pol, pol_product, metadata=None)
classmethod
Create the zarr group structure with pre-allocated empty vis/mmodes arrays.
The vis and mmodes arrays are allocated but left unfilled; they
are written incrementally by the visibility generation pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store_location
|
str or Path
|
|
required |
group_path
|
str
|
|
'/'
|
frequencies_MHz
|
(ndarray, shape(n_freq))
|
|
required |
era_deg
|
(ndarray, shape(n_era))
|
|
required |
m_values
|
ndarray of int, shape (n_m,)
|
|
required |
n_freq
|
int
|
|
required |
n_era
|
int
|
|
required |
chunks
|
tuple[int, int]
|
Chunk shape |
required |
sky_pol
|
str
|
Sky Stokes parameter (written to group attrs). |
required |
pol_product
|
str
|
Correlator polarisation product (written to group attrs). |
required |
metadata
|
dict
|
Written to |
None
|
Source code in src/serval/containers.py
to_zarr_store(store_location, group_path='/', metadata=None)
Persist the container to a zarr store on disk.
Source code in src/serval/containers.py
alm_shape_validator(instance, attribute, value)
Validate that the last two axes of alm are compatible with lmax and mmax.
Source code in src/serval/containers.py
frequencies_MHz_validator(instance, attribute, value)
Validate that frequencies_MHz is a floating-point numpy ndarray.
Source code in src/serval/containers.py
lmax_validator(instance, attribute, value)
Validate that lmax is an integer greater than 1.
Source code in src/serval/containers.py
mmax_validator(instance, attribute, value)
Validate that mmax is a positive integer.
Source code in src/serval/containers.py
powerbeam_alm_validator(instance, attribute, value)
Validate that alm has shape (n_freq, lmax+1, 2*mmax+1) for TIRSPowerBeam.
Source code in src/serval/containers.py
skymodel_alm_validator(instance, attribute, value)
Validate alm shape and leading polarisation dimension for SkyModel.
Source code in src/serval/containers.py
tirsvbeam_alm_validator(instance, attribute, value)
Validate that alm has shape (2, n_freq, lmax+1, 2*mmax+1) for TIRSVoltageBeam.
Source code in src/serval/containers.py
batch_rotate_alm(alm, lmax, mmax, eulers_or_rotation)
Rotate a batch of SERVAL alm arrays using two calls to ducc0.sht.rotate_alm.
Converts the input to the ducc0 real-field decomposition, applies the rotation
in batch, and converts back. The output always has mmax = lmax because a
rotation generically populates all m-modes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm
|
NDArray[complex128]
|
SERVAL alm array of shape |
required |
lmax
|
int
|
Maximum degree. |
required |
mmax
|
int
|
Maximum order of the input. |
required |
eulers_or_rotation
|
tuple[float, float, float] | Rotation
|
Passive ZYZ Euler angles |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
SERVAL alm of shape |
Source code in src/serval/rotate.py
boresight_for_fixed_pol_ref(alt, az, ref_alt=np.pi / 2, ref_az=np.pi, ref_boresight=0.0)
Boresight angle that aligns the feed co-pol axis with a reference pointing orientation.
When a dish is tilted away from a nominal pointing direction, the ZYZ Euler
parameterisation induces an apparent rotation of the X/Y polarisation axes in TIRS.
This function computes the boresight correction that eliminates that rotation, so
that boresight = boresight_for_fixed_pol_ref(alt, az) + chi gives a pointing whose
feed orientation differs from the reference only by the controllable roll chi.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alt
|
float
|
Pointing altitude in radians. |
required |
az
|
float
|
Pointing azimuth in radians. |
required |
ref_alt
|
float
|
Reference pointing altitude in radians. Defaults to |
pi / 2
|
ref_az
|
float
|
Reference pointing azimuth in radians. Defaults to |
pi
|
ref_boresight
|
float
|
Reference boresight in radians. Defaults to |
0.0
|
Returns:
| Type | Description |
|---|---|
float
|
Boresight angle in radians to pass to :func: |
Source code in src/serval/rotate.py
cirs_to_cirs(source_epoch, target_epoch)
Return a passive rotation from CIRS at one epoch to CIRS at another.
Routes through GCRS using both CIO-based matrices: CIRS(source) \(\to\) GCRS \(\to\) CIRS(target).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_epoch
|
str
|
The source epoch string (e.g. |
required |
target_epoch
|
str
|
The target epoch string, parsed by |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A |
Source code in src/serval/rotate.py
diurnal_aberrate_tirs(n, latitude, longitude)
Apply diurnal-aberration to TIRS unit directions.
Transforms unit direction vector(s) \(\hat{n}\) in the TIRS frame to account for the special-relativistic aberration caused by Earth's diurnal rotation. The observer velocity \(\boldsymbol{\beta} = \mathbf{v}/c\) in TIRS is exactly constant (independent of ERA or epoch), given by \(\boldsymbol{\beta} = (-\omega r_y,\; \omega r_x,\; 0) / c\) where \((r_x, r_y)\) are the WGS84 coordinates of the observer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
NDArray[float64]
|
Unit direction vector(s) in the TIRS frame. Shape |
required |
latitude
|
float
|
Geodetic latitude in radians. |
required |
longitude
|
float
|
Geodetic longitude in radians. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Aberrated unit direction vector(s). Same shape as |
Source code in src/serval/rotate.py
enu_to_tirs(latitude, longitude)
Creates a rotation object for basis rotations from the ENU coordinate frame of an observer at the specified latitude and longitude to the TIRS frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
The latitude in radians. |
required |
longitude
|
float
|
The longitude in radians. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A Rotation object representing the ENU to TIRS basis rotation. |
Source code in src/serval/rotate.py
enu_to_zenith()
Provides a rotation object converting from the ENU basis to the local Zenith basis.
Returns:
| Type | Description |
|---|---|
Rotation
|
A Rotation object. |
Source code in src/serval/rotate.py
eulers_from_rotation(rotation)
Extracts the ZYZ Euler angles from a rotation object.
The convention used here and throughout is that of ZYZ passive (basis) rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotation
|
Rotation
|
A Rotation object. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the rotation. |
Source code in src/serval/rotate.py
frame_rotation_to_cirs(source_basis, epoch)
Return a passive rotation from a celestial coordinate frame to CIRS.
Dispatches to :func:icrs_to_cirs, :func:galactic_to_cirs, or
:func:cirs_to_cirs based on source_basis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_basis
|
``"ICRS"``, ``"Galactic"``, or ``"CIRS:<epoch>"``
|
The source coordinate frame. For CIRS input, append the old
epoch after a colon, e.g. |
required |
epoch
|
str
|
The target epoch string (e.g. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/serval/rotate.py
galactic_to_cirs(epoch)
Return a passive rotation from Galactic coordinates to CIRS.
The Galactic-to-ICRS rotation (from astropy) is composed with the CIO-based celestial-to-intermediate matrix. Aberration is not included.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
str
|
The target epoch string (e.g. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A |
Source code in src/serval/rotate.py
gcrs_to_cirs(epoch)
Creates a rotation object for basis rotations from the GCRS frame to CIRS.
Uses the IAU 2006/2000A CIO-based celestial-to-intermediate matrix
(via ERFA's c2i06a).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
str
|
The epoch string (e.g. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A |
Source code in src/serval/rotate.py
generate_telescope_wigner_ds(beam_lmax, beam_mmax, baseline_lmax, latitude, longitude, altitude, azimuth, baseline_enu)
Generates Wigner-D matrices for the TIRS to telescope pointing frame and T IRS to baseline frame basis rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
beam_lmax
|
int
|
The maximum degree of the beam Wigner-D matrix. |
required |
beam_mmax
|
int
|
The maximum order of m' for the beam Wigner-D matrix. |
required |
baseline_lmax
|
int
|
The maximum degree of the baseline Wigner-D matrix. |
required |
latitude
|
float
|
The latitude in radians. |
required |
longitude
|
float
|
The longitude in radians. |
required |
altitude
|
float
|
The altitude angle in radians. |
required |
azimuth
|
float
|
The azimuth angle in radians. |
required |
baseline_enu
|
tuple[float, float, float]
|
The baseline vector components in the ENU frame (east, north, up). |
required |
Returns:
| Type | Description |
|---|---|
tuple[NDArray[complex128], NDArray[complex128]]
|
The Wigner-D matrices for the TIRS to telescope pointing frame and TIRS to baseline frame basis rotations. |
Source code in src/serval/rotate.py
icrs_to_cirs(epoch)
Return a passive rotation from ICRS to CIRS at the given epoch.
Delegates to :func:gcrs_to_cirs as for the purposes of this code,
the GCRS to ICRS transformation is neglible, mainly aberration is
not ignored limiting the accuracy to ~20.5 arcsec.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
str
|
The target epoch string (e.g. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A |
Source code in src/serval/rotate.py
inv_eulers(eulers)
Provides the Euler angles corresponding to the inverse rotation of those given.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eulers
|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the rotation. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the inverse rotation. |
Source code in src/serval/rotate.py
itrs_enu_to_tirs_enu(geodetic_lat, geodetic_lon, enu, epoch)
Convert an ENU vector from the ITRS frame to its TIRS-frame ENU components.
Computes \(W^\top \mathbf{v}_\mathrm{ITRS}\) (the exact TIRS Cartesian vector) then
re-expresses it as ENU components in the TIRS frame at the polar-motion-corrected
(lat_tirs, lon_tirs). The result satisfies:
enu_to_tirs(lat_tirs, lon_tirs).apply(enu_tirs) == W^T @ enu_to_tirs(lat, lon).apply(enu)
so that passing (lat_tirs, lon_tirs, enu_tirs) to SERVAL functions that internally
call enu_to_tirs yields the physically correct TIRS
Cartesian vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geodetic_lat
|
float
|
Observer WGS84 geodetic latitude in radians. |
required |
geodetic_lon
|
float
|
Observer WGS84 geodetic longitude in radians. |
required |
enu
|
(array - like, shape(3))
|
ENU vector in the ITRS frame (e.g. baseline in metres). |
required |
epoch
|
Time
|
Epoch at which the IERS polar motion is evaluated. |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(3))
|
ENU components in the TIRS frame at |
Source code in src/serval/rotate.py
itrs_pointing_to_tirs_pointing(geodetic_lat, geodetic_lon, altitude, azimuth, boresight, epoch)
Convert an ITRS-frame pointing direction and boresight to their TIRS equivalents.
Converts (altitude, azimuth) by expressing the pointing unit vector in ITRS ENU,
applying itrs_enu_to_tirs_enu, and extracting
TIRS spherical coordinates. The boresight is corrected by tracking the ITRS
pointing-frame x-axis into TIRS ENU and extracting the equivalent angle — the same
technique used by boresight_for_fixed_pol_ref.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geodetic_lat
|
float
|
Observer WGS84 geodetic latitude in radians. |
required |
geodetic_lon
|
float
|
Observer WGS84 geodetic longitude in radians. |
required |
altitude
|
float
|
Pointing altitude in the ITRS ENU frame, in radians. |
required |
azimuth
|
float
|
Pointing azimuth (North through East) in the ITRS ENU frame, in radians. |
required |
boresight
|
float
|
Feed boresight rotation around the pointing axis in radians. |
required |
epoch
|
Time
|
Epoch at which the IERS polar motion is evaluated. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
|
Source code in src/serval/rotate.py
itrs_to_tirs(epoch)
Rotation from ITRS to TIRS at a given epoch, applying IERS polar motion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
epoch
|
Time
|
Epoch at which the IERS polar motion is evaluated. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
Rotation that maps ITRS Cartesian vectors to TIRS Cartesian vectors. |
Source code in src/serval/rotate.py
itrs_to_tirs_inputs(geodetic_lat, geodetic_lon, altitude, azimuth, boresight, baselines_enu, epoch)
Convert all ITRS observer inputs to their TIRS equivalents in one call.
Applies the IERS polar motion matrix \(W^\top\) to the site location, each baseline ENU vector, and the pointing direction.
Delegates to itrs_to_tirs_latlon, itrs_pointing_to_tirs_pointing, and itrs_enu_to_tirs_enu.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geodetic_lat
|
float
|
Observer WGS84 geodetic latitude in radians. |
required |
geodetic_lon
|
float
|
Observer WGS84 geodetic longitude in radians. |
required |
altitude
|
float
|
Pointing altitude in the ITRS ENU frame, in radians. |
required |
azimuth
|
float
|
Pointing azimuth (North through East) in the ITRS ENU frame, in radians. |
required |
boresight
|
float
|
Feed boresight rotation around the pointing axis, in radians. |
required |
baselines_enu
|
list of array-like, each shape (3,)
|
Baseline ENU vectors in the ITRS frame. |
required |
epoch
|
Time
|
Epoch at which the IERS polar motion is evaluated. |
required |
Returns:
| Type | Description |
|---|---|
tuple
|
|
Source code in src/serval/rotate.py
itrs_to_tirs_latlon(geodetic_lat, geodetic_lon, epoch)
TIRS geocentric latitude and longitude for an ITRS observer at a given epoch.
Applies the IERS polar motion matrix \(W = \mathrm{erfa.pom00}\) to the geodetic zenith direction in ITRS, then returns its TIRS spherical coordinates. Passing the returned angles to enu_to_tirs or tirs_to_zenith makes those functions consistent with Astropy's ITRS coordinate chain.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geodetic_lat
|
float
|
Observer WGS84 geodetic latitude in radians. |
required |
geodetic_lon
|
float
|
Observer WGS84 geodetic longitude in radians. |
required |
epoch
|
Time
|
Epoch at which the IERS polar motion is evaluated. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float]
|
|
Source code in src/serval/rotate.py
offset_pointing(offset_magnitude, offset_direction, offset_boresight=0.0, ref_alt=np.pi / 2, ref_az=np.pi, ref_boresight=0.0)
Convert a pointing offset to an absolute (alt, az, boresight).
The position angle offset_direction uses geographic North/East as reference,
which is well-defined at the zenith (over-the-top convention).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
offset_magnitude
|
float
|
Angular offset magnitude from the reference pointing, in radians. |
required |
offset_direction
|
float
|
Position angle of the offset in radians, measured from North (0) toward East (\(\pi/2\)). |
required |
offset_boresight
|
float
|
Boresight roll in radians, relative to the polarisation-stabilised reference.
|
0.0
|
ref_alt
|
float
|
Reference pointing altitude and azimuth in radians. Default: zenith (\(\pi/2\), \(\pi\)). |
pi / 2
|
ref_az
|
float
|
Reference pointing altitude and azimuth in radians. Default: zenith (\(\pi/2\), \(\pi\)). |
pi / 2
|
ref_boresight
|
float
|
Reference boresight in radians. Default: 0. |
0.0
|
Returns:
| Type | Description |
|---|---|
alt, az, boresight : tuple[float, float, float]
|
New pointing parameters in radians, suitable for :func: |
Notes
The (alt, az) computation uses the spherical law of cosines on the triangle formed by
the zenith P (alt = \(\pi/2\)), the reference pointing A, and the new pointing B.
The sides are the co-altitudes \(b = \pi/2 - \text{ref\_alt}\) and \(a = \pi/2 - \text{alt}\),
and the offset magnitude \(\rho\). The angle at A is the position angle \(\psi\)
(offset_direction), measured from the great circle toward the zenith (North) toward
increasing azimuth (East):
arctan2 handles the over-the-top case naturally.
Source code in src/serval/rotate.py
rotation_from_eulers(eulers, degrees=False)
Creates a rotation object from a set of Euler angles.
The convention used here and throughout is that of ZYZ passive (basis) rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
eulers
|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the rotation. |
required |
degrees
|
bool
|
Whether the input angles are in degrees, by default False. |
False
|
Returns:
| Type | Description |
|---|---|
Rotation
|
The Rotation object. |
Source code in src/serval/rotate.py
tirs_to_baseline_direc(latitude, longitude, east, north, up)
Creates a rotation object for basis rotations from the TIRS frame to a frame aligned with the direction of the baseline vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
The latitude in radians. |
required |
longitude
|
float
|
The longitude in radians. |
required |
east
|
float
|
The East component of the baseline vector. |
required |
north
|
float
|
The North component of the baseline vector. |
required |
up
|
float
|
The Up component of the baseline vector. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A Rotation object representing the TIRS to baseline direction frame basis rotation. |
Source code in src/serval/rotate.py
tirs_to_baseline_direc_eulers(latitude, longitude, east, north, up)
Returns the Euler angles for basis rotations from the TIRS frame to a frame aligned with the direction of the baseline vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
The latitude in radians. |
required |
longitude
|
float
|
The longitude in radians. |
required |
east
|
float
|
The East component of the baseline vector. |
required |
north
|
float
|
The North component of the baseline vector. |
required |
up
|
float
|
The Up component of the baseline vector. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the TIRS to baseline frame basis rotation. |
Source code in src/serval/rotate.py
tirs_to_cirs(era)
Creates a rotation object corresponding to the basis rotation from the TIRS frame to the CIRS frame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
era
|
float
|
The Earth Rotation Angle in radians. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A Rotation object representing the TIRS to CIRS basis rotation. |
Source code in src/serval/rotate.py
tirs_to_cirs_eulers(era)
Provides the Euler angles corresponding to the basis rotation from the TIRS frame to the CIRS frame.
The convention used here and throughout is that of ZYZ passive (basis) rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
era
|
float
|
The Earth Rotation Angle in radians. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the TIRS to CIRS basis rotation. |
Source code in src/serval/rotate.py
tirs_to_pointing(latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0)
Creates a rotation object for basis rotations from the TIRS frame to a frame aligned with the telescope pointing direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
The latitude in radians. |
required |
longitude
|
float
|
The longitude in radians. |
required |
altitude
|
float
|
The altitude angle in radians, by default np.pi / 2. |
pi / 2
|
azimuth
|
float
|
The azimuth angle in radians, by default np.pi. |
pi
|
boresight
|
float
|
The boresight angle in radians, by default 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
Rotation
|
A Rotation object representing the TIRS to telescope pointing frame basis rotation. |
Source code in src/serval/rotate.py
tirs_to_pointing_eulers(latitude, longitude, altitude=np.pi / 2, azimuth=np.pi, boresight=0.0)
Returns the Euler angles for basis rotations from the TIRS frame to a frame aligned with the telescope pointing direction.
The convention used here and throughout is that of ZYZ passive (basis) rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
The latitude in radians. |
required |
longitude
|
float
|
The longitude in radians. |
required |
altitude
|
float
|
The altitude angle in radians, by default np.pi / 2. |
pi / 2
|
azimuth
|
float
|
The azimuth angle in radians, by default np.pi. |
pi
|
boresight
|
float
|
The boresight angle in radians, by default 0.0. |
0.0
|
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the TIRS to telescope pointing basis rotation. |
Source code in src/serval/rotate.py
tirs_to_zenith(latitude, longitude)
Creates a rotation object for basis rotations from the TIRS frame to the local Zenith frame for an observer at a given latitude and longitude.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
The latitude in radians. |
required |
longitude
|
float
|
The longitude in radians. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A Rotation object representing the TIRS to local Zenith basis rotation. |
Source code in src/serval/rotate.py
tirs_to_zenith_eulers(latitude, longitude)
Returns the Euler angles for basis rotations from the TIRS frame to the local Zenith frame for an observer at a given latitude and longitude.
The convention used here and throughout is that of ZYZ passive (basis) rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
latitude
|
float
|
The latitude in radians. |
required |
longitude
|
float
|
The longitude in radians. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the TIRS to local Zenith basis rotation. |
Source code in src/serval/rotate.py
wigner_d(lmax, mprime_max, eulers_or_rotation)
Generates Wigner-D matrices up to a given lmax for specified Euler angles or a Rotation object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
The maximum degree of the Wigner-D matrices. |
required |
mprime_max
|
int
|
The maximum order of m' for the Wigner-D matrices. |
required |
eulers_or_rotation
|
tuple[float, float, float] | Rotation
|
The Euler angles (alpha, beta, gamma) specifying the rotation, or a Rotation object. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
An array of shape |
Source code in src/serval/rotate.py
zenith_to_baseline_direc(east, north, up)
Creates a rotation object for basis rotations from the local Zenith frame to a frame aligned with the direction of the baseline vector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
east
|
float
|
The East component of the baseline vector. |
required |
north
|
float
|
The North component of the baseline vector. |
required |
up
|
float
|
The Up component of the baseline vector. |
required |
Returns:
| Type | Description |
|---|---|
Rotation
|
A Rotation object representing the local Zenith to baseline direction frame basis rotation. |
Source code in src/serval/rotate.py
zenith_to_baseline_direc_eulers(east, north, up)
Returns the Euler angles for basis rotations from the local Zenith frame to a frame aligned with the direction of the baseline vector.
The convention used here and throughout is that of ZYZ passive (basis) rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
east
|
float
|
The East component of the baseline vector. |
required |
north
|
float
|
The North component of the baseline vector. |
required |
up
|
float
|
The Up component of the baseline vector. |
required |
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the local Zenith to baseline direction frame basis rotation. |
Source code in src/serval/rotate.py
zenith_to_pointing(altitude=np.pi / 2, azimuth=np.pi, boresight=0.0)
Creates a rotation object from the local Zenith frame to the to a frame aligned with the telescope pointing direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
altitude
|
float
|
The altitude angle in radians , by default np.pi / 2. |
pi / 2
|
azimuth
|
float
|
The azimuth angle in radians, by default np.pi. |
pi
|
boresight
|
float
|
The boresight angle in radians, by default 0. |
0.0
|
Returns:
| Type | Description |
|---|---|
Rotation
|
A Rotation object representing the local Zenith to telescope pointing frame basis rotation. |
Source code in src/serval/rotate.py
zenith_to_pointing_eulers(altitude=None, azimuth=None, boresight=None)
Returns the Euler angles for basis rotations from the local Zenith frame to a frame aligned with the telescope pointing direction.
The convention used here and throughout is that of ZYZ passive (basis) rotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
altitude
|
float
|
The altitude angle in radians, by default np.pi / 2. |
None
|
azimuth
|
float
|
The azimuth angle in radians, by default np.pi. |
None
|
boresight
|
float
|
The boresight angle in radians, by default 0.0. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[float, float, float]
|
The Euler angles (alpha, beta, gamma) specifying the local Zenith to pointing frame basis rotation. |
Source code in src/serval/rotate.py
Spherical Harmonic Transform Utilities (serval.sht.py)
alm_from_healpix(healpix_alm)
Transforms spherical harmonics coefficients from healpy format (1D) to standard Fourier order format (2D).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
healpix_alm
|
NDArray[complex128]
|
A spherical harmonics coefficients array in healpy format (1D). |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order (2D), in dense form. |
Source code in src/serval/sht.py
analysis(grid, threshold=SPARSE_THRESHOLD, conjugate=False)
Transforms a pyshtools grid to the corresponding spherical harmonics coefficients or their conjugates in standard Fourier order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
grid
|
SHGrid
|
A spherical harmonic grid object. |
required |
threshold
|
float
|
The threshold below which coefficients are set to zero. |
SPARSE_THRESHOLD
|
conjugate
|
bool
|
Whether to return the conjugate spherical harmonics coefficients. |
False
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
The spherical harmonics coefficients array or their conjugates in standard Fourier order, in dense form. |
Source code in src/serval/sht.py
array_synthesis(array_coeff)
Transfomrs spherical harmonics coefficients from a pyshtools array to a pyshtools grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array_coeff
|
SHCoeffs | NDArray[complex128]
|
A spherical harmonics coefficients array in pytshtools format. The array can be a pysh.SHCoeffs object or a stacked array. Its shape should be (2, lmax + 1, mmax + 1) or (lmax + 1, 2 * mmax + 1) respectively. |
required |
Returns:
| Type | Description |
|---|---|
SHGrid
|
A spherical harmonic grid object. |
Source code in src/serval/sht.py
batch_array_analysis(map_batch, lmax)
Batch-analyze complex DH grids to SERVAL alm arrays via pyshtools.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
map_batch
|
NDArray[complex128]
|
Complex grid data of shape |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
SERVAL alm array of shape |
Source code in src/serval/sht.py
batch_array_synthesis(alm_batch, lmax, nthreads=0)
Batch-synthesize complex SH alm arrays to complex DH grids via ducc0.
Uses ducc0.sht.experimental.synthesis with ntrans=2n (real and imaginary
components stacked) to replace n separate pyshtools synthesis calls.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm_batch
|
NDArray[complex128]
|
SERVAL alm array of shape |
required |
lmax
|
int
|
Maximum spherical harmonic degree. |
required |
nthreads
|
int
|
Number of threads for ducc0 (0 = all hardware threads). |
0
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
Complex grid data of shape |
Source code in src/serval/sht.py
broadcast_bandlimits(*coeffs, lmax=None)
Broadcasts a set of spherical harmonics coefficients to common bandlimits. These are either given or inferred from the maximum lmax among the inputs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
*coeffs
|
NDArray[complex128]
|
A variable set of spherical harmonics coefficients arrays in standard Fourier order. The shape or array i in the set should be (lmax_i + 1, 2 * mmax_i + 1) for each i. |
()
|
lmax
|
int | None
|
The target maximum spherical harmonic degree. If None, it is inferred from the maximum lmax among the input coefficients. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[NDArray[complex128], ...]
|
A tuple containing the input spherical harmonics coefficients arrays reshaped to the common target bandlimits. |
Source code in src/serval/sht.py
coeffs_from_array(array_coeffs, limited=False, lmax=None)
Transfomrs spherical harmonics coefficients from an array in standard Fourier order to a pyshtools SHCoeffs object. There is the option to set bandlimits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
array_coeffs
|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order. Its shape should be (lmax + 1, 2 * mmax + 1). |
required |
limited
|
bool
|
Whether to limit the pyshtools object to the inferred or specified lmax. |
False
|
lmax
|
int | None
|
The target maximum spherical harmonic degree. If None, it is inferred from the input coefficients lmax. |
None
|
Returns:
| Type | Description |
|---|---|
SHCoeffs
|
A spherical harmonics coefficients object in pyshtools format. Its shape will be (2, lmax + 1, mmax + 1). |
Source code in src/serval/sht.py
compute_mmodes(coeffs1, coeffs2)
Computes the mmodes between two spherical harmonics coefficients arrays. The relative formula is given by:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeffs1
|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order. Its shape should be (lmax1 + 1, 2 * mmax1 + 1). |
required |
coeffs2
|
NDArray[complex128]
|
A sspherical harmonics coefficients array in standard Fourier order. Its shape should be (lmax2 + 1, 2 * mmax2 + 1). |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
A spherical harmonics mmodes array resulting from the inner product of the input coefficients. Its shape will be (2 * max(mmax1, mmax2) + 1,). |
Source code in src/serval/sht.py
ducc0_to_serval_alm(aR, aI, lmax)
Convert the (aR, aI) pair from ducc0.sht.rotate_alm back to SERVAL format.
This is the inverse of :func:serval_to_ducc0_alm. The output always has
mmax = lmax because a rotation generically populates all m-modes.
The reconstruction follows:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
aR
|
NDArray[complex128]
|
Arrays of shape |
required |
aI
|
NDArray[complex128]
|
Arrays of shape |
required |
lmax
|
int
|
Maximum degree. Output |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
SERVAL alm of shape |
Source code in src/serval/sht.py
filter_coeffs(coeffs, threshold=SPARSE_THRESHOLD)
Filters spherical harmonics coefficients in standard Fourier order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeffs
|
NDArray[complex128]
|
A spherical harmonics coefficients object in standard Fourier order. Its shape should be (lmax + 1, 2 * mmax + 1). |
required |
threshold
|
float
|
The threshold below which coefficients are set to zero. |
SPARSE_THRESHOLD
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order. |
Source code in src/serval/sht.py
grid_template(lmax)
Creates a spherical harmonic grid object of degree lmax filled with complex zeros.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
The maximum spherical harmonic degree of the grid. |
required |
Returns:
| Type | Description |
|---|---|
SHGrid
|
A spherical harmonic grid object with data set to (complex) zeros. |
Source code in src/serval/sht.py
healpix_from_alm(serval_alm)
Transforms spherical harmonics coefficients from standard Fourier order format (2D)
to healpy format (1D). This is the inverse of :func:alm_from_healpix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
serval_alm
|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order (2D),
shape |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
A spherical harmonics coefficients array in healpy format (1D), containing only the m >= 0 entries with the Condon-Shortley phase included. |
Source code in src/serval/sht.py
make_conjugate(coeff)
Transforms spherical harmonics coefficients to their conjugate form.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeff
|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order. Its shape should be (lmax + 1, 2 * mmax + 1). |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
The conjugate spherical harmonics coefficients array in standard Fourier order, in dense form. |
Source code in src/serval/sht.py
ms_from_array(arr)
Creates a range of integers corresponding to the m values of spherical harmonics from -mmax to +mmax according to the order lmax of the input array.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
arr
|
NDArray[complex128]
|
Any array of shape compatible with spherical harmonics coefficients where the first dimension corresponds to lmax + 1. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[int_]
|
An array of integers representing the m values from -mmax to +mmax. |
Source code in src/serval/sht.py
nonzero_bandlimits(coeffs)
Computes the bandlimits lmax, mmax of spherical harmonics coefficients from an array based on the non-zero entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeff
|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order. Its shape should be (lmax + 1, 2 * mmax + 1). |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
A tuple containing the maximum spherical harmonic degree lmax and maximum order mmax based on the non-zero coefficients. |
Source code in src/serval/sht.py
serval_to_ducc0_alm(alm, lmax, mmax)
Convert SERVAL alm to the (aR, aI) pair expected by ducc0.sht.rotate_alm.
SERVAL stores complex SH coefficients in a dense (..., lmax+1, 2*mmax+1) array
indexed as alm[..., l, m + mmax]. ducc0.sht.rotate_alm internally
decomposes a complex field into two real fields whose m >= 0 triangular
coefficients are stored flat. This function performs that decomposition and
the associated normalization conversion (pyshtools ortho + csphase=1 → ducc0
internal 4Ï€ norm).
The decomposition follows the relation used by pyshtools' ducc0 backend:
with \(a_{R,\ell 0} = \mathrm{Re}(c_{\ell,0})\), \(a_{I,\ell 0} = \mathrm{Im}(c_{\ell,0})\). The normalization factors cancel between the ortho→4π conversion and the real-field reconstruction, yielding the compact expressions above.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm
|
NDArray[complex128]
|
SERVAL alm array of shape |
required |
lmax
|
int
|
Maximum degree. |
required |
mmax
|
int
|
Maximum order stored in alm (may be less than lmax). |
required |
Returns:
| Type | Description |
|---|---|
aR, aI : npt.NDArray[np.complex128]
|
Both have shape |
Source code in src/serval/sht.py
set_bandlimits(coeffs, lmax, mmax=None)
Reshapes spherical harmonics coefficients to given bandlimits.
Operates on the last two axes of coeffs, treating any preceding axes as
batch dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeffs
|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order.
The last two axes should have shape |
required |
lmax
|
int
|
The target maximum spherical harmonic degree. |
required |
mmax
|
int | None
|
The target maximum spherical harmonic order. If None, it is set equal to lmax. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
A spherical harmonics coefficients array reshaped to the target bandlimits. |
Source code in src/serval/sht.py
stack_ms(coeffs)
Reorganizes spherical harmonics coefficients from the pyshtools format to the standard Fourrier order.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeffs
|
NDArray[complex128]
|
A spherical harmonics coefficients array in pyshtools format. Its shape should be (2, lmax + 1, mmax + 1), where the first dimension corresponds to negative and positive m values. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order. Its shape will be (lmax + 1, 2 * mmax + 1), with m values ranging from -mmax to +mmax. |
Source code in src/serval/sht.py
threshold_bandlimits(coeffs, threshold=SPARSE_THRESHOLD)
Computes the bandlimits lmax, mmax of spherical harmonics coefficients from an array based on the non-zero entries, after setting the coefficients below a given threshold to zero.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeff
|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order. Its shape should be (lmax + 1, 2 * mmax + 1). |
required |
threshold
|
float
|
The threshold below which coefficients are set to zero. |
SPARSE_THRESHOLD
|
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
A tuple containing the maximum spherical harmonic degree lmax and maximum order mmax based on the filtered coefficients. |
Source code in src/serval/sht.py
unstack_ms(coeffs)
Reorganizes spherical harmonics coefficients from the standard Fourier order to the pyshtools format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coeffs
|
NDArray[complex128]
|
A spherical harmonics coefficients array in standard Fourier order. Its shape should be (lmax + 1, 2 * mmax + 1), with m values ranging from -mmax to +mmax. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
A spherical harmonics coefficients array in pyshtools format. Its shape will be (2, lmax + 1, mmax + 1), where the first dimension corresponds to negative and positive m values. |
Source code in src/serval/sht.py
General Utilities (serval.utils.py)
airy_pattern(freq, theta, phi, D_eff, asymmetry_ratio=1.0, asymmetry_angle=0.0, power=False, fwhm_fac=AIRY_FWHM_FACTOR)
Evaluate an Airy disk beam pattern in pointing-frame coordinates.
The voltage pattern is \(2 J_1(x) / x\) with
\(x = \pi \cdot \mathrm{AIRY\_FWHM\_FACTOR} \cdot D_\mathrm{eff} \sin\theta
/ (\mathrm{fwhm\_fac} \cdot \lambda)\), so the power-beam FWHM equals
\(\mathrm{fwhm\_fac} \cdot \lambda / D_\mathrm{eff}\) exactly in \(\sin\theta\).
Use gaussian_pattern with use_sin_theta=True
for a Gaussian whose FWHM is defined in the same \(\sin\theta\) coordinate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
freq
|
float or array_like
|
Frequency in MHz, broadcastable to |
required |
theta
|
array_like
|
Pointing-frame colatitude in radians, shape |
required |
phi
|
array_like
|
Pointing-frame azimuth in radians, shape |
required |
D_eff
|
float
|
Effective dish diameter in metres. |
required |
asymmetry_ratio
|
float
|
Ratio of semi-major to semi-minor aperture (\(\geq 1\)). Default 1.0. |
1.0
|
asymmetry_angle
|
float
|
Orientation of the major axis from \(\phi = 0\), in radians. Default 0.0. |
0.0
|
power
|
bool
|
If |
False
|
fwhm_fac
|
float
|
Power-beam FWHM in units of \(\lambda / D_\mathrm{eff}\). Default
|
AIRY_FWHM_FACTOR
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Beam pattern evaluated on the input grid. |
Source code in src/serval/utils.py
analytic_plane_wave_al(ells, kz)
Computes the analytic spherical harmonic coefficients of a plane wave propagating in the z-direction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ells
|
NDArray[int64]
|
The spherical harmonic degrees at which to evaluate the coefficients. |
required |
kz
|
NDArray[float64]
|
The wavevector magnitudes at which to evaluate the coefficients. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
The spherical harmonic coefficients of the plane wave at the specified degrees and wavevector magnitudes. |
Source code in src/serval/utils.py
bandlimited_random_plane_wave(lmax, template_grid, rng, threshold=SPARSE_THRESHOLD)
Generates a random band-limited plane wave on the sphere evaluated on the grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
The maximum spherical harmonic degree for band-limiting. |
required |
template_grid
|
SHGrid
|
A pyshtools SHGrid object that serves as a template for the output grid. |
required |
rng
|
Generator | None
|
An optional random number generator for reproducibility. If None, a new generator will be created. Default is None. |
required |
threshold
|
float
|
The threshold for determining the plane wave magnitude from the bandlimit. |
SPARSE_THRESHOLD
|
Returns:
| Type | Description |
|---|---|
tuple[SHGrid, NDArray[float64]]
|
A tuple containing the generated band-limited plane wave grid and the corresponding wavevector. |
Source code in src/serval/utils.py
gaussian_pattern(freq, theta, phi, D_eff, asymmetry_ratio=1.0, asymmetry_angle=0.0, power=False, fwhm_fac=AIRY_FWHM_FACTOR, use_sin_theta=False)
Evaluate a Gaussian beam pattern in pointing-frame coordinates.
The FWHM of the power beam along the major axis is \(\mathrm{fwhm\_fac} \cdot
\lambda / D_\mathrm{eff}\), exact in \(\theta\) by default. Setting
use_sin_theta=True replaces \(\theta\) with \(\sin\theta\) throughout, making
the FWHM exact in \(\sin\theta\) — directly comparable to
airy_pattern. An optional elliptical asymmetry
stretches the beam along a specified axis.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
freq
|
float or array_like
|
Frequency in MHz, broadcastable to |
required |
theta
|
array_like
|
Pointing-frame colatitude in radians, shape |
required |
phi
|
array_like
|
Pointing-frame azimuth in radians, shape |
required |
D_eff
|
float
|
Effective dish diameter in metres. |
required |
asymmetry_ratio
|
float
|
Ratio of semi-major to semi-minor beam width (\(\geq 1\)). Default 1.0. |
1.0
|
asymmetry_angle
|
float
|
Orientation of the major axis from \(\phi = 0\), in radians. Default 0.0. |
0.0
|
power
|
bool
|
If |
False
|
fwhm_fac
|
float
|
Power-beam FWHM in units of \(\lambda / D_\mathrm{eff}\). Default
|
AIRY_FWHM_FACTOR
|
use_sin_theta
|
bool
|
If |
False
|
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Beam pattern evaluated on the input grid. |
Source code in src/serval/utils.py
harmonic_point_source(ra_deg, dec_deg, lmax)
Generates band-limited spherical harmonic coefficients for a point source at given RA and Dec.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ra_deg
|
float
|
The right ascension of the point source in degrees. |
required |
dec_deg
|
float
|
The declination of the point source in degrees. |
required |
lmax
|
int
|
The maximum spherical harmonic degree. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
The band-limited spherical harmonic coefficients of the point source in standard Fourier order, shape (lmax+1, 2*lmax+1). |
Source code in src/serval/utils.py
integrals_from_alm(alm)
Compute the integral over the unit sphere for each frequency channel.
Reads the l=0, m=0 coefficient directly from SERVAL's Fourier-ordered alm array, consistent with the ortho+csphase=1 SHT convention.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm
|
(ndarray, shape(..., lmax + 1, 2 * mmax + 1))
|
Spherical harmonic coefficients in SERVAL Fourier format.
m=0 is at column index |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(...))
|
Integral of the function over the unit sphere per leading-axis element. Complex in general; real for real-valued beams. |
Source code in src/serval/utils.py
mmodes_to_visibilities(mmodes, m1max=None, ms=None)
Reconstruct a visibility timestream from m-mode amplitudes.
The output is the physical visibility timestream reconstructed from the
Fourier-series amplitudes in mmodes:
Internally this is evaluated via ifft(full_mmodes) multiplied by the
output length to undo NumPy's inverse-FFT normalisation, so that
:func:visibilities_to_mmodes and :func:mmodes_to_visibilities are true
inverses on a consistent ERA grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mmodes
|
NDArray[complex128]
|
M-mode amplitudes.
|
required |
m1max
|
int
|
Maximum absolute m-value of the output grid. Required when |
None
|
ms
|
array of int
|
M-values corresponding to the last axis of the sparse |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
Visibility timestream with shape |
Source code in src/serval/utils.py
plane_wave_bandlimits(k, threshold=SPARSE_THRESHOLD)
Computes the spherical harmonic bandlimits lmax, mmax required to represent a plane wave with wavevector k to a given threshold.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
k
|
NDArray[float64]
|
The wavevector of the plane wave. |
required |
threshold
|
float
|
The threshold for determining the bandlimits. Default is SPARSE_THRESHOLD. |
SPARSE_THRESHOLD
|
Returns:
| Type | Description |
|---|---|
tuple[int, int]
|
A tuple containing the maximum spherical harmonic degree lmax and maximum absolute order mmax required to represent the plane wave. |
Source code in src/serval/utils.py
plane_wave_mag_from_bandlimit(lmax, threshold=SPARSE_THRESHOLD)
Computes the maximum usable plane-wave wavenumber |k| that can be represented on a spherical-harmonic grid of bandlimit lmax.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
The maximum spherical harmonic degree for band-limiting. |
required |
threshold
|
float
|
The threshold for determining the plane wave magnitude from the bandlimit. |
SPARSE_THRESHOLD
|
Returns:
| Type | Description |
|---|---|
float
|
The maximum usable plane-wave wavenumber |k|. |
Source code in src/serval/utils.py
plane_waves(ks, template)
Produces a band-limited spherical plane wave evaluated on the grid from wavevectors ks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ks
|
list[NDArray[float64]]
|
A list of wavevector arrays. Each array should have shape (3,). |
required |
template
|
SHGrid
|
A pyshtools SHGrid object that serves as a template for the output grid. |
required |
Returns:
| Type | Description |
|---|---|
SHGrid
|
A pyshtools SHGrid object containing the plane wave data. |
Source code in src/serval/utils.py
plane_waves_integral(ks)
Computes the integral over the unit sphere of plane waves with wavevectors ks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ks
|
list[NDArray[float64]]
|
A list of wavevector arrays. Each array should have shape (..., 3), where ... represents any number of leading dimensions. |
required |
Returns:
| Type | Description |
|---|---|
float | NDArray[float64]
|
The integral of the product of plane waves over the unit sphere. The output shape is the broadcasted shape of the input wavevector arrays without the last dimension. |
Source code in src/serval/utils.py
plane_waves_mmodes(ks, mmax)
Computes the m-modes of a product of plane waves by rotating one of the k-vectors (the first one) through all azimuthal angles to create visibilities.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ks
|
list[NDArray[float64]]
|
A list of wavevector arrays. Each array should have shape (3,). |
required |
mmax
|
int
|
The maximum absolute m-mode index. |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
The m-modes of the product of plane waves, with shape (2 * mmax + 1,). |
Source code in src/serval/utils.py
pointed_theta_phi(lmax, latitude, longitude, altitude, azimuth, boresight)
Compute TIRS-grid coordinates expressed in the pointing frame.
For each point on the TIRS spherical harmonic grid (determined by
lmax), computes the colatitude and azimuth as seen in the frame
of the dish pointing direction. This is the coordinate map needed
to evaluate a beam pattern (defined in pointing coordinates) over
the whole sky grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
Band-limit of the spherical harmonic grid. |
required |
latitude
|
float
|
Geodetic latitude of the observer in radians. |
required |
longitude
|
float
|
Geodetic longitude of the observer in radians. |
required |
altitude
|
float
|
Altitude of the observer in metres. |
required |
azimuth
|
float
|
Dish azimuth in radians (North-through-East). |
required |
boresight
|
float
|
Boresight rotation angle in radians. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
pointing_theta |
NDArray[float64]
|
Colatitude in the pointing frame for every TIRS grid point,
shape |
pointing_phi |
NDArray[float64]
|
Azimuth in the pointing frame for every TIRS grid point,
shape |
Source code in src/serval/utils.py
power_law_sky(lmax, power_law_index=2.0, seed=None)
Generates a random sky realization with a power-law angular power spectrum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lmax
|
int
|
The maximum spherical harmonic degree. |
required |
power_law_index
|
float
|
The index of the power-law angular power spectrum. Default is 2.0. |
2.0
|
seed
|
int | None
|
The random seed for reproducibility. Default is None. |
None
|
Returns:
| Type | Description |
|---|---|
SHGrid
|
The generated random sky realization as a pyshtools spherical harmonic grid. |
Source code in src/serval/utils.py
visibilities_at_eras(mmodes, m_values, era_deg)
Evaluate a visibility timestream at arbitrary ERA positions via NUDFT.
Reconstructs visibilities at arbitrary Earth Rotation Angle values using the stored m-mode amplitudes. The evaluation is exact for band-limited signals (no aliasing up to the Nyquist m-value) and periodic with period 360°.
The relationship between m-modes and visibilities is::
vis(f, φ) = Σ_m A_m(f) · exp(2πi · m · φ / 360)
where A_m = mmodes[..., mmax + m] (fftshifted storage).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mmodes
|
(ndarray, shape(..., n_era))
|
M-mode array in fftshifted order — m=0 is at index |
required |
m_values
|
ndarray of int, shape (n_m,)
|
M-values of the non-zero entries in |
required |
era_deg
|
(ndarray, shape(n_t))
|
ERA values in degrees at which to evaluate. Values outside |
required |
Returns:
| Type | Description |
|---|---|
(ndarray, shape(..., n_t))
|
Reconstructed visibilities at the requested ERA positions. |
Source code in src/serval/utils.py
visibilities_to_mmodes(vis)
Compute per-sample m-mode amplitudes from a visibility timestream.
Applies an FFT along the last axis and normalises by n_times so the
returned coefficients are the Fourier-series amplitudes \(A_m\) satisfying
The output is fftshifted: index n_times // 2 + m corresponds to
m-mode m.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vis
|
NDArray[complex128]
|
Input visibilities with shape |
required |
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
M-mode amplitudes with shape |
Source code in src/serval/utils.py
Core Gaunt Coefficient Utilities (serval.gaunt.core.py)
gaunt_dot12(alm1, alm2, l3max, sum_m1=False, absm1_lower=None, absm1_upper=None)
Compute a projector for alm3 for the integral of the triple product of spherical harmonics by computing the Gaunt co-efficients in-place and sum-producting over l1, l2, m2 and m1 (if requested).
TODO add formula.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm1
|
NDArray[complex128]
|
Spherical harmonic co-efficients in l1, m1. |
required |
alm2
|
NDArray[complex128]
|
Spherical harmonic co-efficients in l2, m2. |
required |
l3max
|
int
|
Maximum l3 to compute co-efficients up to. |
required |
sum_m1
|
bool
|
If True, also sum over m1, otherwise return m1-modes for the m1 range specified, by default False |
False
|
absm1_lower
|
int | None
|
Lower limit in |m1| to use, by default None, ie. |m1| >= 0. |
None
|
absm1_upper
|
int | None
|
Upper limit in |m1| to use, by default None, ie. |m1| <= m1max = l1max. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
m1-mode alm3 projector as a numpy array of shape (Nm1, l3max+1, 2l3max+1) if sum_m1 is False or (l3max+1, 2l3max+1) is sum_m1 is True. |
Source code in src/serval/gaunt/core.py
gaunt_dot123(alm1, alm2, alm3, sum_m1=False, absm1_lower=None, absm1_upper=None)
Compute the integral of the triple product of spherical harmonics by computing the Gaunt co-efficients in-place and sum-producting over all harmonic degrees and orders except m1, unless requested.
TODO add formula.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm1
|
NDArray[complex128]
|
Spherical harmonic co-efficients in l1, m1. |
required |
alm2
|
NDArray[complex128]
|
Spherical harmonic co-efficients in l2, m2. |
required |
alm3
|
NDArray[complex128]
|
Spherical harmonic co-efficients in l3, m3. |
required |
sum_m1
|
bool
|
If True, also sum over m1, otherwise return m1-modes for the m1 range specified, by default False |
False
|
absm1_lower
|
int | None
|
Lower limit in |m1| to use, by default None, ie. |m1| >= 0. |
None
|
absm1_upper
|
int | None
|
Upper limit in |m1| to use, by default None, ie. |m1| <= m1max = l1max. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128] | float
|
Numpy array, shape (Nm1), of m1-modes or their sum if sum_m1 is True. |
Source code in src/serval/gaunt/core.py
gaunt_dot23(alm2, alm3, l1max, sum_m1=False, absm1_lower=None, absm1_upper=None)
Compute a projector for alm1 for the integral of the triple product of spherical harmonics by computing the Gaunt co-efficients in-place and sum-producting over l2, m2, l3, m3 and m1 (if requested).
TODO add formula.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alm2
|
NDArray[complex128]
|
Spherical harmonic co-efficients in l2, m2. |
required |
alm3
|
NDArray[complex128]
|
Spherical harmonic co-efficients in l3, m3. |
required |
l1max
|
int
|
Maximum l1 to compute co-efficients up to. |
required |
sum_m1
|
bool
|
If True, also sum over m1, otherwise return m1-modes for the m1 range specified, by default False |
False
|
absm1_lower
|
int | None
|
Lower limit in |m1| to use, by default None, ie. |m1| >= 0. |
None
|
absm1_upper
|
int | None
|
Upper limit in |m1| to use, by default None, ie. |m1| <= m1max = l1max. |
None
|
Returns:
| Type | Description |
|---|---|
NDArray[complex128]
|
m1-mode alm1 projector as a numpy array of shape (Nm1, l1max+1) if sum_m1 is False or (l1max+1,) is sum_m1 is True. |
Source code in src/serval/gaunt/core.py
integrator12_contract3(int12, contract3)
(m1 l3 m3) (l3 m3' m3) -> (m1 l3 m3')
Source code in src/serval/gaunt/core.py
single_gaunt(l1, l2, l3, m1, m2)
Computes a single Gaunt co-efficient for given harmonic degrees and orders. This uses Wigner-3j family algorithms so it is not efficient for computing many Gaunts co-efficients. Primarily for testing purposes m3 is determined by m1 + m2 + m3 = 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l1
|
int
|
Harmonic degree l1. |
required |
l2
|
int
|
Harmonic degree l2. |
required |
l3
|
int
|
Harmonic degree l3. |
required |
m1
|
int
|
Harmonic order m1. |
required |
m2
|
int
|
Harmonic order m2. |
required |
Returns:
| Type | Description |
|---|---|
float
|
Computed Gaunt co-efficient. |
Source code in src/serval/gaunt/core.py
wigner_3jj(l2, l3, m2, m3)
Compute the family of non-zero Wigner-3j terms for harmonic degrees l2 and l3 for harmonic degrees m1, m2, m3 = -m1 -m2.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l2
|
int
|
Harmonic degree l2. |
required |
l3
|
int
|
Harmonic degree l3. |
required |
m2
|
int
|
Harmonic order m2. |
required |
m3
|
int
|
Harmonic order m3. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, NDArray[float64]]
|
Tuple of first non-zero harmonic degree l1min and array of Wigner-3j values of length l1max - l1min. If there are no non-zero elements of the Wigner-3j family, returns (-1, np.array([])). |
Source code in src/serval/gaunt/core.py
wigner_3jj_000(l2, l3)
Compute the family of non-zero Wigner-3j terms for harmonic degrees l2 and l3 for harmonic degrees m1 = m2 = m3 = 0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l2
|
int
|
Harmonic degree l2. |
required |
l3
|
int
|
Harmonic degree l3. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, NDArray[float64]]
|
Tuple of first non-zero harmonic order l1min and array of Wigner-3j values of length l1max - l1min. If there are no non-zero elements of the Wigner-3j family, returns (-1, np.array([])). |
Source code in src/serval/gaunt/core.py
wigner_3jm(l1, l2, l3, m1)
Compute the family of Wigner-3j terms for harmonic degrees l1, l2 and l3 all non-zero terms with harmonic order m1.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
l1
|
int
|
Harmonic degree l1. |
required |
l2
|
int
|
Harmonic degree l2. |
required |
l3
|
int
|
Harmonic degree l3. |
required |
m1
|
int
|
Harmonic order m1. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, NDArray[float64]]
|
Tuple of first non-zero harmonic order m2min and array of Wigner-3j values of length l2max - l2min. If there are no non-zero elements of the Wigner-3j family, returns (-1, np.array([])). |