utils.py
This module contains utility functions that are used by the pipeline during the processing of a run.
add_new_many_to_one_relations(row)
¶
This handles the relation information being created from the many_to_one function in advanced association. It is a lot simpler than the one_to_many case as it purely just adds the new relations to the relation column, taking into account if it is already a list of relations or not (i.e. no previous relations).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row | Series | The relation information Series from the association dataframe. Only the columns ['related_skyc1', 'new_relations'] are required. | required |
Returns:
Type | Description |
---|---|
List[int] | The new related field for the source in question, containing the appended ids. |
Source code in vast_pipeline/pipeline/utils.py
517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 |
|
add_new_one_to_many_relations(row, advanced=False, source_ids=None)
¶
This handles the relation information being created from the one_to_many functions in association.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row | Series | The relation information Series from the association dataframe. Only the columns ['related_skyc1', 'source_skyc1'] are required for advanced, these are instead called ['related', 'source'] for basic. | required |
advanced | bool | Whether advanced association is being used which changes the names of the columns involved. | False |
source_ids | Optional[DataFrame] | A dataframe that contains the other ids to append to related for each original source. +----------------+--------+ | source_skyc1 | 0 | |----------------+--------| | 122 | [5542] | | 254 | [5543] | | 262 | [5544] | | 405 | [5545] | | 656 | [5546] | +----------------+--------+ | None |
Returns:
Type | Description |
---|---|
List[int] | The new related field for the source in question, containing the appended ids. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
add_run_to_img(pipeline_run, img)
¶
Add a pipeline run to an Image (and corresponding SkyRegion) in the db
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pipeline_run | Run | Pipeline run object you want to add. | required |
img | Image | Image object you want to add to. | required |
Returns:
Type | Description |
---|---|
None | None |
Source code in vast_pipeline/pipeline/utils.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
backup_parquets(p_run_path)
¶
Backups up all the existing parquet files in a pipeline run directory. Backups are named with a '.bak' suffix in the pipeline run directory.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p_run_path | str | The path of the pipeline run where the parquets are stored. | required |
Returns:
Type | Description |
---|---|
None | None |
Source code in vast_pipeline/pipeline/utils.py
1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 |
|
calc_ave_coord(grp)
¶
Calculates the average coordinate of the grouped by sources dataframe for each unique group, along with defining the image and epoch list for each unique source (group).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grp | DataFrame | The current group dataframe (unique source) of the grouped by dataframe being acted upon. | required |
Returns:
Type | Description |
---|---|
Series | A pandas series containing the average coordinate along with the image and epoch lists. |
Source code in vast_pipeline/pipeline/utils.py
732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 |
|
check_primary_image(row)
¶
Checks whether the primary image of the ideal source dataframe is in the image list for the source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row | Series | Input dataframe row, with columns ['primary'] and ['img_list']. | required |
Returns:
Type | Description |
---|---|
bool | True if primary in image list else False. |
Source code in vast_pipeline/pipeline/utils.py
892 893 894 895 896 897 898 899 900 901 902 903 904 |
|
create_measurement_pairs_arrow_file(p_run)
¶
Creates a measurement_pairs.arrow file using the parquet outputs of a pipeline run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p_run | Run | Pipeline model instance. | required |
Returns:
Type | Description |
---|---|
None | None |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
create_measurements_arrow_file(p_run)
¶
Creates a measurements.arrow file using the parquet outputs of a pipeline run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p_run | Run | Pipeline model instance. | required |
Returns:
Type | Description |
---|---|
None | None |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
create_temp_config_file(p_run_path)
¶
Creates the temp config file which is saved at the beginning of each run.
It is to avoid issues created by users changing the config while the run is running.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p_run_path | str | The path of the pipeline run of the config to be copied. | required |
Returns:
Type | Description |
---|---|
None | None |
Source code in vast_pipeline/pipeline/utils.py
1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 |
|
cross_join(left, right)
¶
A convenience function to merge two dataframes.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
left | DataFrame | The base pandas DataFrame to merge. | required |
right | DataFrame | The pandas DataFrame to merge to the left. | required |
Returns:
Type | Description |
---|---|
DataFrame | The resultant merged DataFrame. |
Source code in vast_pipeline/pipeline/utils.py
542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 |
|
get_create_img(band_id, image)
¶
Function to fetch or create the Image and Sky Region objects for an image.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
band_id | int | The integer database id value of the frequency band of the image. | required |
image | SelavyImage | The image object. | required |
Returns:
Type | Description |
---|---|
Image | The resulting image django ORM object. |
bool |
|
Source code in vast_pipeline/pipeline/utils.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 |
|
get_create_img_band(image)
¶
Return the existing Band row for the given FitsImage. An image is considered to belong to a band if its frequency is within some tolerance of the band's frequency. Returns a Band row or None if no matching band.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image | FitsImage | The image Django ORM object. | required |
Returns:
Type | Description |
---|---|
Band | The band Django ORM object. |
Source code in vast_pipeline/pipeline/utils.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
get_create_p_run(name, path, description=None, user=None)
¶
Get or create a pipeline run in db, return the run django object and a flag True/False if has been created or already exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name | str | The name of the pipeline run. | required |
path | str | The system path to the pipeline run folder which contains the configuration file and where outputs will be saved. | required |
description | str | An optional description of the pipeline run. | None |
user | User | The Django user that launched the pipeline run. | None |
Returns:
Type | Description |
---|---|
Run | The pipeline run object. |
bool | Whether the pipeline run already existed ('True') or not ('False'). |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
get_create_skyreg(image)
¶
This creates a Sky Region object in Django ORM given the related image object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
image | Image | The image Django ORM object. | required |
Returns:
Type | Description |
---|---|
SkyRegion | The sky region Django ORM object. |
Source code in vast_pipeline/pipeline/utils.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
|
get_df_memory_usage(df)
¶
This function calculates the memory usage of a pandas dataframe and logs it.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df | The pandas dataframe to calculate the memory usage of. | required |
Returns:
Type | Description |
---|---|
The pandas dataframe memory usage in MB |
Source code in vast_pipeline/pipeline/utils.py
1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 |
|
get_eta_metric(row, df, peak=False)
¶
Calculates the eta variability metric of a source. Works on the grouped by dataframe using the fluxes of the associated measurements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row | Dict[str, float] | Dictionary containing statistics for the current source. | required |
df | DataFrame | The grouped by sources dataframe of the measurements containing all the flux and flux error information, | required |
peak | bool | Whether to use peak_flux for the calculation. If False then the integrated flux is used. | False |
Returns:
Type | Description |
---|---|
float | The calculated eta value. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
get_image_list_diff(row)
¶
Calculate the difference between the ideal coverage image list of a source and the actual observed image list. Also checks whether an epoch does in fact contain a detection but is not in the expected 'ideal' image for that epoch.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
row | Series | The row from the sources dataframe that is being iterated over. | required |
Returns:
Type | Description |
---|---|
Union[List[str], int] | A list of the images missing from the observed image list. |
Union[List[str], int] | A '-1' integer value if there are no missing images. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
get_names_and_epochs(grp)
¶
Convenience function to group together the image names, epochs and datetimes into one list object which is then returned as a pandas series. This is necessary for easier processing in the ideal coverage analysis.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
grp | DataFrame | A group from the grouped by sources DataFrame. | required |
Returns:
Type | Description |
---|---|
Series | Pandas series containing the list object that contains the lists of the image names, epochs and datetimes. |
Source code in vast_pipeline/pipeline/utils.py
869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 |
|
get_parallel_assoc_image_df(images, skyregion_groups)
¶
Merge the sky region groups with the images and skyreg_ids.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
images | List[Image] | A list of the Image objects. | required |
skyregion_groups | DataFrame | The sky region group of each skyregion id. +----+----------------+ | | skyreg_group | |----+----------------| | 2 | 1 | | 3 | 1 | | 1 | 2 | +----+----------------+ | required |
Returns:
Type | Description |
---|---|
DataFrame | Dataframe containing the merged images and skyreg_id and skyreg_group (see source code for output format). |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
get_rms_noise_image_values(rms_path)
¶
Open the RMS noise FITS file and compute the median, max and min rms values to be added to the image model and then used in the calculations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rms_path | str | The system path to the RMS FITS image. | required |
Returns:
Type | Description |
---|---|
float | The median value of the RMS image. |
float | The minimum value of the RMS image. |
float | The maximum value of the RMS image. |
Raises:
Type | Description |
---|---|
IOError | Raised when the RMS FITS file cannot be found. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
get_src_skyregion_merged_df(sources_df, images_df, skyreg_df, n_cpu=0, max_partition_mb=15)
¶
Analyses the current sources_df to determine what the 'ideal coverage' for each source should be. In other words, what images is the source missing in when it should have been seen.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sources_df | DataFrame | The output of the association step containing the measurements associated into sources. | required |
images_df | DataFrame | Contains the images of the pipeline run. I.e. all image objects for the run loaded into a dataframe. | required |
skyreg_df | DataFrame | Contains the sky regions of the pipeline run. I.e. all sky region objects for the run loaded into a dataframe. | required |
n_cpu | int | The desired number of workers for Dask | 0 |
max_partition_mb | int | The desired maximum size (in MB) of the partitions for Dask. | 15 |
Returns:
Type | Description |
---|---|
DataFrame | DataFrame containing missing image information (see source code for dataframe format). |
Source code in vast_pipeline/pipeline/utils.py
907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 |
|
get_total_memory_usage()
¶
This function gets the current memory usage and returns a string.
Returns:
Type | Description |
---|---|
A float containing the current resource usage. |
Source code in vast_pipeline/pipeline/utils.py
1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 |
|
group_skyregions(df)
¶
Logic to group sky regions into overlapping groups. Returns a dataframe containing the sky region id as the index and a column containing a list of the sky region group number it belongs to.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df | DataFrame | A dataframe containing all the sky regions of the run. Only the 'id', 'centre_ra', 'centre_dec' and 'xtr_radius' columns are required. +------+-------------+--------------+--------------+ | id | centre_ra | centre_dec | xtr_radius | |------+-------------+--------------+--------------| | 2 | 319.652 | 0.0030765 | 6.72488 | | 3 | 319.652 | -6.2989 | 6.7401 | | 1 | 21.8361 | -73.121 | 7.24662 | +------+-------------+--------------+--------------+ | required |
Returns:
Type | Description |
---|---|
DataFrame | The sky region group of each skyregion id. +----+----------------+ | | skyreg_group | |----+----------------| | 2 | 1 | | 3 | 1 | | 1 | 2 | +----+----------------+ |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
groupby_funcs(df)
¶
Performs calculations on the unique sources to get the lightcurve properties. Works on the grouped by source dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df | DataFrame | The current iteration dataframe of the grouped by sources dataframe. | required |
Returns:
Type | Description |
---|---|
Series | Pandas series containing the calculated metrics of the source. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
log_total_memory_usage()
¶
This function gets the current memory usage and logs it.
Returns:
Type | Description |
---|---|
None |
Source code in vast_pipeline/pipeline/utils.py
1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 |
|
parallel_groupby(df, n_cpu=0, max_partition_mb=15)
¶
Performs the parallel source dataframe operations to calculate the source metrics using Dask and returns the resulting dataframe.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df | DataFrame | The sources dataframe produced by the previous pipeline stages. | required |
n_cpu | int | The desired number of workers for Dask | 0 |
max_partition_mb | int | The desired maximum size (in MB) of the partitions for Dask. | 15 |
Returns:
Type | Description |
---|---|
DataFrame | The source dataframe with the calculated metric columns. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
parallel_groupby_coord(df, n_cpu=0, max_partition_mb=15)
¶
This function uses Dask to perform the average coordinate and unique image and epoch lists calculation. The result from the Dask compute is returned which is a dataframe containing the results for each source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df | DataFrame | The sources dataframe produced by the pipeline. | required |
n_cpu | int | The desired number of workers for Dask | 0 |
max_partition_mb | int | The desired maximum size (in MB) of the partitions for Dask. | 15 |
Returns:
Type | Description |
---|---|
DataFrame | The resulting average coordinate values and unique image and epoch lists for each unique source (group). |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
prep_skysrc_df(images, perc_error=0.0, duplicate_limit=None, ini_df=False)
¶
Initialise the source dataframe to use in association logic by reading the measurement parquet file and creating columns. When epoch based association is used it will also remove duplicate measurements from the list of sources.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
images | List[Image] | A list holding the Image objects of the images to load measurements for. | required |
perc_error | float | A percentage flux error to apply to the flux errors of the measurements. Defaults to 0. | 0.0 |
duplicate_limit | Optional[Angle] | The separation limit of when a source is considered a duplicate. Defaults to None in which case 2.5 arcsec is used in the 'remove_duplicate_measurements' function (usual ASKAP pixel size). | None |
ini_df | bool | Boolean to indicate whether these sources are part of the initial source list creation for association. If 'True' the source ids are reset ready for the first iteration. Defaults to 'False'. | False |
Returns:
Type | Description |
---|---|
DataFrame | The measurements of the image(s) with some extra values set ready for association and duplicates removed if necessary. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
reconstruct_associtaion_dfs(images_df_done, previous_parquet_paths)
¶
This function is used with add image mode and performs the necessary manipulations to reconstruct the sources_df and skyc1_srcs required by association.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
images_df_done | DataFrame | The images_df output from the existing run (from the parquet). | required |
previous_parquet_paths | Dict[str, str] | Dictionary that contains the paths for the previous run parquet files. Keys are 'images', 'associations', 'sources', 'relations' and 'measurement_pairs'. | required |
Returns:
Type | Description |
---|---|
DataFrame | The reconstructed |
DataFrame | The reconstructed |
Source code in vast_pipeline/pipeline/utils.py
1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 |
|
remove_duplicate_measurements(sources_df, dup_lim=None, ini_df=False)
¶
Remove perceived duplicate sources from a dataframe of loaded measurements. Duplicates are determined by their separation and whether this distances is within the 'dup_lim'.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sources_df | DataFrame | The loaded measurements from two or more images. | required |
dup_lim | Optional[Angle] | The separation limit of when a source is considered a duplicate. Defaults to None in which case 2.5 arcsec is used (usual ASKAP pixel size). | None |
ini_df | bool | Boolean to indicate whether these sources are part of the initial source list creation for association. If 'True' the source ids are reset ready for the first iteration. Defaults to 'False'. | False |
Returns:
Type | Description |
---|---|
DataFrame | The input sources_df with duplicate sources removed. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|
write_parquets(images, skyregions, bands, run_path)
¶
This function saves images, skyregions and bands to parquet files. It also returns a DataFrame containing containing the information of the sky regions associated with the current run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
images | List[Image] | list of image Django ORM objects. | required |
skyregions | List[SkyRegion] | list sky region Django ORM objects. | required |
bands | List[Band] | list of band Django ORM objects. | required |
run_path | str | directory to save parquets to. | required |
Returns:
Type | Description |
---|---|
DataFrame | Sky regions as pandas DataFrame. |
Source code in vast_pipeline/pipeline/utils.py
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 |
|