Skip to content

Add get_healpix_pixel to accept HealpixPixel objects or tuples and change functions to use it#81

Merged
smcguire-cmu merged 6 commits intomainfrom
sean/healpix-pixel-parameter-decorator
Apr 18, 2023
Merged

Add get_healpix_pixel to accept HealpixPixel objects or tuples and change functions to use it#81
smcguire-cmu merged 6 commits intomainfrom
sean/healpix-pixel-parameter-decorator

Conversation

@smcguire-cmu
Copy link
Copy Markdown
Contributor

So a thing that came up in the last pull request I made was that we could be using the HealpixPixel class as inputs to the methods instead of order and pixel. I wasn't sure if it was nicer to have the object or not, since you have to initialize it if you have order and pixel which is a bit cumbersome. I'm not sure if this is a nice solution or completely horrible, but I wanted to be able to accept both easily, so I made a decorator that you can apply to a function with a HealpixPixel argument and it will then accept either a HealpixPixel object or a tuple of (order, pixel). It works by inspecting the function arguments then checking if the argument is a tuple, and then converting to a HealpixPixel if it is.

There's a few other minor things in here as well. A few more test cases for the PixelTreeBuilder, and I ran black formatting to help with linting which has apparently also changed formatting in a few other files in the paths and pixel margin code.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2023

Codecov Report

Merging #81 (4fa4bcc) into main (3702621) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main      #81      +/-   ##
==========================================
+ Coverage   99.71%   99.73%   +0.01%     
==========================================
  Files          23       24       +1     
  Lines         706      747      +41     
==========================================
+ Hits          704      745      +41     
  Misses          2        2              
Impacted Files Coverage Δ
src/hipscat/catalog/catalog_parameters.py 100.00% <ø> (ø)
src/hipscat/io/paths.py 100.00% <100.00%> (ø)
src/hipscat/io/write_metadata.py 100.00% <100.00%> (ø)
src/hipscat/pixel_math/__init__.py 100.00% <100.00%> (ø)
src/hipscat/pixel_math/healpix_pixel_convertor.py 100.00% <100.00%> (ø)
src/hipscat/pixel_math/margin_bounding.py 100.00% <100.00%> (ø)
src/hipscat/pixel_math/pixel_margins.py 100.00% <100.00%> (ø)
src/hipscat/pixel_tree/pixel_node.py 96.15% <100.00%> (+0.59%) ⬆️
src/hipscat/pixel_tree/pixel_tree.py 100.00% <100.00%> (ø)
src/hipscat/pixel_tree/pixel_tree_builder.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@smcguire-cmu smcguire-cmu merged commit deecbdf into main Apr 18, 2023
@smcguire-cmu smcguire-cmu changed the title Add healpix_pixel_decorator to accept HealpixPixel objects or tuples and change functions to use it Add get_healpix_pixel to accept HealpixPixel objects or tuples and change functions to use it Apr 18, 2023
@smcguire-cmu
Copy link
Copy Markdown
Contributor Author

The decision was made to change the decorator to a function to apply within the method

@smcguire-cmu smcguire-cmu deleted the sean/healpix-pixel-parameter-decorator branch January 3, 2024 21:32
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