pyuvdata icon indicating copy to clipboard operation
pyuvdata copied to clipboard

Add LocationParameter.frame

Open aelanman opened this issue 3 years ago • 1 comments

Description

Removes the telescope_frame UVParameter and instead makes frame an attribute of the LocationParameter class. Default behavior is still to assume everything is ITRS unless otherwise specified.

Motivation and Context

Coordinate transformations need to be aware of the frame XYZ coordinates are defined in. Several internal automated transformations (like XYZ to spherical) implicitly assumed ITRS coordinates. To provide support for lunar surface positions, these changes make the LocationParameter more general.

Types of changes

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Documentation change (documentation changes only)
  • [ ] Version change
  • [ ] Build or continuous integration change

Checklist:

  • [x] I have read the contribution guide.
  • [x] My code follows the code style of this project.

New feature checklist:

  • [x] I have added or updated the docstrings associated with my feature using the numpy docstring format.
  • [ ] I have updated the tutorial to highlight my new feature (if appropriate).
  • [ ] I have added tests to cover my new feature.
  • [x] All new and existing tests pass.
  • [ ] I have updated the CHANGELOG.

Breaking change checklist:

  • [ ] I have updated the docstrings associated with my change using the numpy docstring format.
  • [ ] I have updated the tutorial to reflect my changes (if appropriate).
  • [ ] My change includes backwards compatibility and deprecation warnings (if possible).
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests pass.
  • [ ] I have updated the CHANGELOG.

Documentation change checklist:

  • [ ] Any updated docstrings use the numpy docstring format.
  • [ ] If this is a significant change to the readme or other docs, I have checked that they are rendered properly on ReadTheDocs. (you may need help to get this branch to build on RTD, just ask!)

Version change checklist:

  • [ ] I have updated the CHANGELOG to put all the unreleased changes under the new version (leaving the unreleased section empty).
  • [ ] I have noted any dependency changes since the last version and will update the conda package build accordingly.

Build or continuous integration change checklist:

  • [ ] If required or optional dependencies have changed (including version numbers), I have updated the readme to reflect this.
  • [ ] If this is a new CI setup, I have added the associated badge to the readme and to references/make_index.py (if appropriate).

aelanman avatar Oct 25 '22 02:10 aelanman

Codecov Report

Merging #1218 (d34f5f8) into main (ba9c2ca) will increase coverage by 0.00%. The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1218   +/-   ##
=======================================
  Coverage   99.93%   99.93%           
=======================================
  Files          33       33           
  Lines       18058    18064    +6     
=======================================
+ Hits        18047    18053    +6     
  Misses         11       11           
Impacted Files Coverage Δ
pyuvdata/uvdata/uvdata.py 100.00% <ø> (ø)
pyuvdata/parameter.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update ba9c2ca...d34f5f8. Read the comment docs.

codecov[bot] avatar Oct 25 '22 02:10 codecov[bot]

I can't comment on the line because it's not changed, but it looks like we somehow lost coverage for line 825 of parameter.py

bhazelton avatar Nov 02 '22 16:11 bhazelton

@bhazelton Currently, acceptable_range for a location parameter can only be set to None if the frame is also set to None. The default frame is itrs which causes the acceptable_range to default to the range near the Earth radius.

I think the behavior we want is, ultimately, for the acceptable_range to default according to the frame, unless the user specifically sets the keyword. Unfortunately, the case of acceptable_range = None is interpreted as both the user "deactivating" the acceptability check and the user not setting it.

To avoid this, I'm setting the default value to -1 in the function definition as a way to check if the user is setting the keyword. If it's -1, the constructor will set a default range according to the frame. If not, it will pass along what the user set.

So the behavior should be:

  1. param = LocationParameter(..., acceptable_range=None) --> param.acceptable_range = None
  2. param = LocationParameter(..., frame = 'mcmf' ) --> param.acceptable_range = (1717100.0, 1757100.0)
  3. param = LocationParameter(... ) --> param.acceptable_range = (6.35e6, 6.39e6)
  4. param = LocationParameter(..., frame = 'itrs' ) --> param.acceptable_range = (6.35e6, 6.39e6)
  5. param = LocationParameter(..., frame = 'other' ) --> param.acceptable_range = None

aelanman avatar Nov 02 '22 20:11 aelanman