Provide a way in sunpy to make composite image maps that combine short and long exposure time images

Open
#6,727 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
data

Research direction

Read the proposed make_composite_image flow and the sunpy.map.Map entry point first. Define how short and long exposure images are normalized and combined, including saturated-pixel substitution and metadata handling; done means a composite map is produced for compatible images without the AIA-specific assumptions.

Written by the indexing model from the issue text.

Description

Discussion Feature Request map
Describe the feature

It would be nice to have a function that would make a composite map from short and long exposure time images that are close in time. Saturated pixels from the (exposure-time normalized) long exposure time image would be substituted with pixels from the (exposure-time normalized) short exposure time image. Care would have to be taken with the meta data, since two images are combined into one.

Proposed solution

Here is my (basic!) code to do this with AIA images if helpful (some things hardcoded for AIA).

import copy
def make_composite_image(file1,file2):
map1 = sunpy.map.Map(file1)
map2 = sunpy.map.Map(file2)

#check wavelengths are the same
if map1.wavelength.value == map2.wavelength.value:
    #check that there is a short exposure time
    if map1.exposure_time.value < 1.0 or map2.exposure_time.value < 1.0:
        if map1.exposure_time > map2.exposure_time:
            long_map = map1
            short_map = map2
        else: 
            long_map = map2
            short_map = map1

        saturated_indicies = (long_map.data > 4000).nonzero()
 
        composite_map = copy.deepcopy(long_map)
        composite_map.data[saturated_indicies] = short_map.data[saturated_indicies]

        return composite_map
    else: print("no short exposure time")
else: print("files need to be the same wavelength")
Dominant language
Python
Stars
1k
Forks
682
Avg merge
1d 17h
Merged PRs (30d)
17

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sunpy/sunpy

All issues in sunpy/sunpy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.