Skip to content

Conversation

@snbianco
Copy link
Collaborator

@snbianco snbianco commented Feb 25, 2025

More generalization stuff!!! Only one more to go after this 🎉

A few notes:

  • Since the current implementation is so TESS-specific, I chose to make a concrete class, TessCubeCutout that inherits from abstract CubeCutout. I think I moved all the TESS-specific logic into the child class, but I may have missed some pieces.
  • I followed the pattern set by the image cutout classes and included an inner class, CubeCutoutInstance, that has helpful attributes for each singular cutout.
  • You'll notice that I changed around some of the errors on the other classes. I think I've settled on using InvalidInputError for invalid inputs that require little to no processing (not a valid option, not the right data type, etc.). InvalidQueryError will be for calls that do some processing on "valid" inputs, but ultimately fail due to some issue (no data, out of footprint, etc.)

@snbianco snbianco closed this Feb 25, 2025
@snbianco snbianco reopened this Feb 25, 2025
@snbianco snbianco force-pushed the Cube-Cutout branch 2 times, most recently from a4cd398 to 9fbb5a0 Compare March 9, 2025 18:50
@snbianco snbianco marked this pull request as ready for review March 9, 2025 19:03
@snbianco snbianco requested review from AlexReedy and havok2063 March 10, 2025 18:17
havok2063
havok2063 previously approved these changes Mar 21, 2025
Copy link
Contributor

@havok2063 havok2063 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good to me.

Comment on lines 266 to 273
@abstractmethod
def _build_tpf(self, cube_fits: fits.HDUList, cutout: 'CubeCutoutInstance') -> fits.HDUList:
"""
Build the cutout target pixel file (TPF).
This method is abstract and should be defined in subclasses.
"""
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will CubeCutout be used as the parent for any non-TESS cube cutout classes, e.g. JWST or MaNGA cubes? If so, maybe this should be moved to TessCubeCutout, or moved into some intermediate TessBase class if it needs to be an abstractmethod.


return cutout_hdu_list

def cube_cut(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To mirror fits_cut and img_cut, should this be made into a convenience function?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to take it out of CubeFactory or add another function entirely? I chose not to take it out of CubeFactory because it wouldn't be backwards compatible.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking of taking it out of the class into its own function, but that was primarily to standardize the astrocut API. If you need to keep it for backwards compatibility, that's fine. In that case, we may want to create a wrapper cube_cut function.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this idea! New commit adds a stand-alone cube_cut function.

@snbianco
Copy link
Collaborator Author

Sorry, I messed up the rebase 😭 This should be the last commit if the CI passes.

@havok2063 havok2063 self-requested a review March 24, 2025 15:35
@snbianco snbianco merged commit ac89db9 into main Mar 24, 2025
11 checks passed
@snbianco snbianco deleted the Cube-Cutout branch March 24, 2025 15:56
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.

3 participants