Skip to content
This repository was archived by the owner on Dec 15, 2020. It is now read-only.
This repository was archived by the owner on Dec 15, 2020. It is now read-only.

make _get_slices a public function #29

Closed

Description

@hamogu

Currently, the name of array_utils._get_slices indicates that this is a private function and should not be used by the user.
Why is that so?

I propose to expose this function publically. There are two functions that use _get_slices, but they are essentially very thin wrappers around the _get_slices functionality.
They allow to extract or add (add_array_2d and extract_array_2d) using the slices from _get_slices. However, there are other uses for _get_slices:

  • assign a value to a subregion (e.g. to mask it)
  • use the slices to address a related array of same size as the data array (e.g. a mask array)
  • extract the overlapping part of a 2d array, even if it only partially overlaps (extract_array_2d will raise an Exception in this case.)

I have use cases for all three options in PSF phometry with masked values. I need to keep a mask in snyc with the data (my masks are calculated and do not come with the data, so it is more logical to use them separately instead of an NDData object, even when that works) and I need to do PSF photometry, even if the PSF only partially overlaps with the image.

We could either write wrappers for those uses, too, or we could just rename _get_slices to get_slices.

Activity

  1. keflavich commented on Oct 2, 2014

    @keflavich

    👍, this looks like a generally useful function. Renaming sounds like a reasonable approach. If you go ahead and make that PR, it would be nice to include a few of these use cases as new Examples.

  2. cdeil commented on Dec 2, 2014

    @cdeil
    Member

    Related issue: #40
    I think we haven't found a good API for slices = sub-images = cutouts yet ... see my comment here:
    #40 (comment)

  3. added a commit that references this issue on Dec 12, 2014
  4. added a commit that references this issue on Dec 14, 2014
  5. astrofrog commented on Dec 14, 2014

    @astrofrog
    Member

    Fixed by #42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions