Skip to content

Code refactor - #21

Draft
Kitchi wants to merge 12 commits into
masterfrom
discover_csv
Draft

Code refactor#21
Kitchi wants to merge 12 commits into
masterfrom
discover_csv

Conversation

@Kitchi

@Kitchi Kitchi commented Mar 13, 2023

Copy link
Copy Markdown
Collaborator

Refactoring the mammoth class in zernike.py to be more modular, and added several unit and integration tests. This PR is still active, the goal is to be able to discover the path of the coefficient CSV files internally without passing it into the command line, with the ability to override the default with a command line argument.

I am opening the PR now for discussion on the refactor so further changes can be made as necessary.

Kitchi added 12 commits January 12, 2023 20:10
The code to parse the CSV files and images already exists, but are
primarily contained within the zernikeBeam class. They do not belong
there, so I've started with moving the CSV file parsing into it's own
class, and will follow with the image parsing.

This also opens up the ability to auto-discover the location of the CSV
file, since that will require knowledge of which telescope made the
input image and selecting accordingly. Currently that logic gets setup
after initializing the zernikeBeam class, which requires an input CSV
- so it becomes a chicken and egg problem unless the image parser is
broken out into it's own class.
Decoupling the disk IO and manipulating the resulting dataframe.
The earlier commit did not have any setter methods for the attributes,
which has been fixed. Added some checks to test if the input is in the
right format.
Added unit tests for CSVParser.

Added pytest as a requirement in pyproject.toml
Bugfixes in the plumber command line script to account for changes to
CSVParser.
The parsing logic has been moved from the independent function within
`image.py` into the `ImageParser` class in `parsing.py`. The `image.py`
module has been removed.

The `ImageParser` class has also been incorporated into the command
line `plumber` script.
This was previously in the zernikeBeam class, but does not belong there.

Refactored the plumber command line script, and other associated backend
modules (`parsing.py` and `zernike.py`) to reflect the addition of this
new class.
The telescope type was not being determined correctly, leading to
incorrect dish diameters and hence image sizes.

This is now fixed, and has been verified to produce the right beams for
MeerKAT.
Uses a frozen version of the CSV file to test against a template image
that is known to be correct for Stokes I. The template image lives in
plumber-data/ which is a submodule to this repo, and must be checked out
for the tests to work.
test_sky was using the wrong relative path for the plumber-data repo,
updated it.
Made some changes to `src/plumber/telescopy.py` to rename functions to
be more appropriate, fixed `src/plumber/scripts/plumber.py` to reflect
these changes, and added `test_metadata.py` to test the
`TelescopeInfo()` class.
@Kitchi Kitchi added the enhancement New feature or request label Mar 13, 2023
@Kitchi
Kitchi requested a review from preshanth March 13, 2023 12:34
@preshanth
preshanth marked this pull request as draft October 10, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant