-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
midwayfalts Split up WINTER generator Alphabetise error stack More sorting Select dome flats Select dome flats working Nanfill midwayfalts midwayfalts Split up WINTER generator More sorting Select dome flats Select dome flats working Nanfill
- Loading branch information
1 parent
35b8519
commit 6188838
Showing
7 changed files
with
166 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
""" | ||
Module for filling NaN values in an image | ||
""" | ||
|
||
import logging | ||
|
||
import numpy as np | ||
|
||
from mirar.data import ImageBatch | ||
from mirar.processors.base_processor import BaseImageProcessor | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class NanFiller(BaseImageProcessor): | ||
""" | ||
Processor to fill image nans | ||
""" | ||
|
||
base_key = "nanfill" | ||
|
||
def __str__(self): | ||
return "Processor to pad masked image regions with the median." | ||
|
||
def _apply_to_images( | ||
self, | ||
batch: ImageBatch, | ||
) -> ImageBatch: | ||
|
||
for image in batch: | ||
data = image.get_data() | ||
data[np.isnan(data)] = np.nanmedian(data) | ||
image.set_data(data) | ||
|
||
return batch |