MaskCollection Class
@DanRyanIrish is already working on this.
Since Apr 7, 2020.
Assessment
This issue has not been assessed yet.
Description
Description
Currently, the NDCube.mask implementation is simply a boolean array. However I there may be many components to a mask and in some cases users may want to keep them separate, e.g. parts of the CCD not illuminated, dusk in the optical path, cosmic rays hits, and also feature masks, e.g. active region, of flare.
Is there currently a class out there, e.g. MaskCollection, that can store all these components and return a master mask which is a combination of them all a a subset of them. If not, implementing one might not be so hard.
Proposed implementation
MaskCollectioninherits fromdict.- Mask components are stored as boolean arrays or
Maskobjects where:Mask.maskis a boolean arrayMask.metais a dictionary-like including a description/info entry giving more info on what the mask represents.
MaskCollection.mask_and(masks)is a method returning a logical AND combination ofmaskswhich is a list ofkeyvalues of masks within the collection.MaskCollection.mask_or(masks): same asMaskCollection.mask_and(masks)except that a logical OR combination is returned.MaskCollection.maskis a property returning a combined mask using the conditions defined inMaskCollection._mask_defaults.MaskCollection._mask_defaults: a **kwargs-like dictionary defining how theMaskCollection.maskis computed.MaskCollection._mask_defaults.masks:listofkeynames of masks to be combined.MaskCollection._mask_defaults.func(): The function via which the masks are to be combined.- Must take
MaskCollection._mask_defaults.masksas the input. - Can be as simple as
self.mask_or()or a complicated combination combining different masks differently. - Default is
self.mask_or
- Must take
MaskCollection.set_mask_defaults(masks=None, func=None): a method allowing users to set the defaults inMaskCollection._mask_defaults.
Additional context
- Dominant language
- Python
- Stars
- 49
- Forks
- 56
- Avg merge
- 5h 54m
- Merged PRs (30d)
- 9
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from sunpy/ndcube
-
Bug
Difficulty 4/5 3-5 days Newbie friendliness 38/100
-
Bug
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Feature Request
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
Feature Request
Difficulty 4/5 3-5 days Newbie friendliness 42/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bancolombia/sentinel#23 ·
-
test md OpenCI
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
bug client
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100