Skip to content

Commit

Permalink
Merge pull request #30 from jurjen93/refactor
Browse files Browse the repository at this point in the history
Refactor
  • Loading branch information
jurjen93 authored Oct 17, 2024
2 parents b7420d6 + d17396f commit 82c9039
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 40 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#package
build
lofar_helpers.egg-info
# csv files
*.csv
#text files
Expand Down
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,18 @@ 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``` \
If you are only interested in ```h5_merger.py```, use:\
```wget "https://raw.githubusercontent.com/jurjen93/lofar_helpers/master/h5_merger.py"```
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
- 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.
Expand Down
2 changes: 1 addition & 1 deletion ds9_helpers/split_polygon_facets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.)
Expand Down
31 changes: 0 additions & 31 deletions h5_helpers/overwrite_table.py

This file was deleted.

2 changes: 1 addition & 1 deletion ms_helpers/applycal.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def run(self):
def parse_args():
"""Argument parser"""

parser = ArgumentParser(description='Applycal on MS with H5')
parser = ArgumentParser(description='Apply h5parm on MeasurementSet')
parser.add_argument('msin', nargs='+', type=str, help='input measurement set')
parser.add_argument('--msout', type=str, default='.', help='output measurement set')
parser.add_argument('--h5', type=str, help='h5 calibration', required=True)
Expand Down
2 changes: 1 addition & 1 deletion ms_helpers/remove_flagged_stations.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def parse_args():
Parse input arguments
"""

parser = ArgumentParser(description='MS stacking')
parser = ArgumentParser(description='Remove stations from the MS that are fully flagged')
parser.add_argument('msin', type=str, help='Input Measurement Set')
parser.add_argument('--msout', type=str, default=None, help='Output Measurement Set')
parser.add_argument('--overwrite', action='store_true', help='Overwrite input Measurement Set')
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
name = "lofar_helpers"
version = "1.0.0"
description = "LOFAR helper scripts and tools"
dependencies = []
dependencies = ["numpy","tables","losoto","shapely","python-casacore","pyregion","astropy","pandas"]

[project.scripts]
split_polygon_facets = "ds9_helpers.split_polygon_facets:main"
Expand All @@ -17,7 +17,6 @@ concat_with_dummies = "ms_helpers.concat_with_dummies:main"
remove_flagged_stations = "ms_helpers.remove_flagged_stations:main"
applycal = "ms_helpers.applycal:main"
subtract_with_wsclean = "subtract.subtract_with_wsclean:main"
h5_merger = "h5_merger:main"

[tool.setuptools]
packages = ["ds9_helpers", "fits_helpers", "h5_helpers", "ms_helpers", "subtract"]
2 changes: 1 addition & 1 deletion subtract/subtract_with_wsclean.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def parse_args():
"""
Command line argument parser
"""
parser = ArgumentParser(description='Subtract region with WSClean')
parser = ArgumentParser(description='Subtract or predict region with WSClean')
parser.add_argument('--mslist', nargs='+', help='measurement sets', required=True)
parser.add_argument('--region', type=str, help='region file')
parser.add_argument('--output_name', type=str, help='name of output files (default is model image name)')
Expand Down

0 comments on commit 82c9039

Please sign in to comment.