Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ins compatibility #121

Merged
merged 29 commits into from
Oct 16, 2023
Merged

Ins compatibility #121

merged 29 commits into from
Oct 16, 2023

Conversation

mwilensky768
Copy link
Owner

@mwilensky768 mwilensky768 commented Sep 22, 2023

This PR fixes a critical issue, which is that the UVFlag class from pyuvdata has shifted enough that the child class, INS is no longer compatible. In particular, the UVFlag constructor call signature has 0 positional arguments, which is a major change compared to when INS was originally defined. This results in a complete inability to read objects, since UVFlag.read calls UVFlag.init() with an empty signature before reading. This basic functionality is restored, along with a significant but minor refactor.

Description

The INS constructor had to be completely refactored. In particular, I have allowed for an empty call signature. What this does is preserves some INS-specific attributes and then calls the UVFlag constructor using the arguments that are passed. If the call signature is empty, this will empty the object except for the INS-specific attributes that are required to properly calculate e.g. the metric_ms attribute. This happens whenever UVFlag.read is called, in which case there is no way to preserve these attributes if read is called from a previously instantiated object. For this reason, SSINS raise a NotImplementedError if the user tries to call INS.read from an object that is already full constructed.

To handle a non-empty call signature, we overrode read and from_uvdata. These basically start with some checks to establish whether these are safe calls by the user, call the UVFlag method, and then do the INS extras, preserving INS-specific attributes where necessary. We made a few ("private") helper methods to make this type of thing a bit more modular.

We also refactored the SS class a bit, mostly to keep up with some new required attributes in UVData objects. Since it was related to I/O, I decided to include it in this PR even though it's a little out of scope technically.

This all is API-preserving, although a particular version of pyuvdata will be required if reading files that were written without telescope names (mostly very old files).

Checklist:

Main Code Body Checklist:

  • Add or update docstring related to code change
  • Add a unit test that verifies the efficacy of the code
  • Write a tutorial if the feature would be useful to others to use
  • Update CHANGELOG.md

Scripts Checklist:

  • Add useful help strings for any arguments that are parsed
  • Manually check that the script runs and gives proper results
  • Update CHANGELOG.md

@codecov-commenter
Copy link

codecov-commenter commented Sep 22, 2023

Codecov Report

Attention: 3 lines in your changes are missing coverage. Please review.

Comparison is base (e95b824) 100.00% compared to head (209fce0) 99.66%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##            master     #121      +/-   ##
===========================================
- Coverage   100.00%   99.66%   -0.34%     
===========================================
  Files            8        8              
  Lines          881      908      +27     
===========================================
+ Hits           881      905      +24     
- Misses           0        3       +3     
Files Coverage Δ
SSINS/sky_subtract.py 99.41% <91.66%> (-0.59%) ⬇️
SSINS/incoherent_noise_spectrum.py 99.31% <97.70%> (-0.69%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mwilensky768 mwilensky768 merged commit 56660cc into master Oct 16, 2023
20 checks passed
@mwilensky768 mwilensky768 deleted the ins_compatibility branch October 16, 2023 18:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants