From f9d444cbaad3da876d2c1b47316fc984aec6a75b Mon Sep 17 00:00:00 2001 From: jurjen93 Date: Thu, 17 Oct 2024 21:01:23 +0200 Subject: [PATCH 1/2] refactor --- .gitignore | 3 +++ README.md | 12 +++++++++-- ds9_helpers/split_polygon_facets.py | 2 +- h5_helpers/overwrite_table.py | 31 --------------------------- ms_helpers/applycal.py | 2 +- ms_helpers/remove_flagged_stations.py | 2 +- pyproject.toml | 3 +-- subtract/subtract_with_wsclean.py | 2 +- 8 files changed, 18 insertions(+), 39 deletions(-) delete mode 100644 h5_helpers/overwrite_table.py diff --git a/.gitignore b/.gitignore index 3aad4aac..b063d14f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ +#package +build +lofar_helpers.egg-info # csv files *.csv #text files diff --git a/README.md b/README.md index 9043d186..29c39e1f 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,16 @@ Some of these scripts have been integrated in data reduction pipelines as well. You are free to use the scripts for your own work. Clone the repo with: ```git clone https://github.com/jurjen93/lofar_helpers.git``` \ -If you are only interested in ```h5_merger.py```, use:\ -```wget "https://raw.githubusercontent.com/jurjen93/lofar_helpers/master/h5_merger.py"``` +Or install with: ```pip install -v git+https://github.com/jurjen93/lofar_helpers.git``` \ +Installing gives you the following command line functionalities: +- split_polygon_facets +- crop_nan_boundaries +- cut_fits_with_region +- close_h5 +- concat_with_dummies +- remove_flagged_stations +- applycal +- subtract_with_wsclean #### Contact Let me know if you have any issues or suggestions for improvements. diff --git a/ds9_helpers/split_polygon_facets.py b/ds9_helpers/split_polygon_facets.py index 34f5435f..089dfe05 100644 --- a/ds9_helpers/split_polygon_facets.py +++ b/ds9_helpers/split_polygon_facets.py @@ -120,7 +120,7 @@ def point_in_polygon(point, poly_reg): def parse_args(): """Argument parser""" - parser = ArgumentParser(description='Split facet file with multiple polygons into multiple files per facet (Values standard in degrees)') + parser = ArgumentParser(description='Split multi-facet region file with polygon regions out into multiple region files') parser.add_argument('--reg', help='region file', type=str, required=True) parser.add_argument('--h5', help='h5 file to write directions from', type=str, required=True) parser.add_argument('--extra_boundary', help='make polygons with extra boundaries', type=float, default=0.) diff --git a/h5_helpers/overwrite_table.py b/h5_helpers/overwrite_table.py deleted file mode 100644 index 9b7c9250..00000000 --- a/h5_helpers/overwrite_table.py +++ /dev/null @@ -1,31 +0,0 @@ -import numpy as np -import tables -import sys - -def overwrite_table(h5, table, new_arr): - """ - Overwrite h5 source or antenna table - - :param h5: h5parm table - :param table: table name (antenna or source) - :param new_arr: new values - """ - - T = tables.open_file(h5, 'r+') - - ss = T.root._f_get_child('sol000') - ss._f_get_child(table)._f_remove() - if table == 'source': - values = np.array(new_arr, dtype=[('name', 'S128'), ('dir', ' Date: Thu, 17 Oct 2024 21:02:12 +0200 Subject: [PATCH 2/2] refactor --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 29c39e1f..81e414d1 100644 --- a/README.md +++ b/README.md @@ -9,9 +9,10 @@ I have tried to write them such they can be used for more general use-cases as w Some of these scripts have been integrated in data reduction pipelines as well. You are free to use the scripts for your own work. -Clone the repo with: ```git clone https://github.com/jurjen93/lofar_helpers.git``` \ -Or install with: ```pip install -v git+https://github.com/jurjen93/lofar_helpers.git``` \ -Installing gives you the following command line functionalities: +Clone the repo with: ```git clone https://github.com/jurjen93/lofar_helpers.git``` + +Or install with: ```pip install -v git+https://github.com/jurjen93/lofar_helpers.git``` +This gives you the following command line functionalities: - split_polygon_facets - crop_nan_boundaries - cut_fits_with_region