-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added moon masker for night pipeline
- Loading branch information
1 parent
56cd1a5
commit 104cbe3
Showing
11 changed files
with
58 additions
and
46 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,6 +77,8 @@ modules: | |
cloud_map: | ||
threshold: 5.5 | ||
|
||
moon_apparent_size: 10.0 | ||
|
||
coverage_info: | ||
zenith_altitude: 80 | ||
|
||
|
28 changes: 0 additions & 28 deletions
28
pyobs_cloudcover/pipeline/night/cloud_coverage_calculator/coverage_change_calculator.py
This file was deleted.
Oops, something went wrong.
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,18 @@ | ||
import datetime | ||
|
||
import numpy as np | ||
from cloudmap_rs import SkyPixelQuery, AltAzCoord | ||
|
||
from astroplan import Observer | ||
|
||
|
||
class MoonMasker: | ||
def __init__(self, moon_apparent_size: float, observer: Observer): | ||
self._moon_apparent_size = moon_apparent_size | ||
self._observer = observer | ||
|
||
def __call__(self, sky_query: SkyPixelQuery, obs_time: datetime.datetime) -> SkyPixelQuery: | ||
moon_alt_az = self._observer.moon_altaz(obs_time) | ||
sky_query.mask_radius(AltAzCoord(moon_alt_az.alt.rad, moon_alt_az.az.rad), np.deg2rad(self._moon_apparent_size)) | ||
|
||
return sky_query |
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
25 changes: 12 additions & 13 deletions
25
tests/unit/pipeline/night/cloud_coverage_calculator/test_coverage_change_calculator.py
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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
import numpy as np | ||
|
||
from pyobs_cloudcover.pipeline.night.cloud_coverage_calculator.coverage_change_calculator import \ | ||
CoverageChangeCalculator | ||
from pyobs_cloudcover.cloud_info_calculator.coverage_change_calculator import CoverageChangeCalculator | ||
|
||
|
||
def test_fist(): | ||
cloud_map = np.ones((2, 2)) | ||
calculator = CoverageChangeCalculator(threshold=0.5) | ||
def test_first(): | ||
cloud_map = [True, True, False] | ||
calculator = CoverageChangeCalculator() | ||
assert calculator(cloud_map) is None | ||
|
||
|
||
def test_call_nan_filter(): | ||
calculator = CoverageChangeCalculator(threshold=0.5) | ||
calculator._last_map = np.identity(2) | ||
calculator = CoverageChangeCalculator() | ||
calculator._last_map = [True, True, False, False] | ||
|
||
cloud_map = np.ones((2, 2)) | ||
cloud_map[0, 0] = np.nan | ||
cloud_map = [None, True, True, True] | ||
|
||
assert calculator(cloud_map) == 2/3 | ||
|
||
|
||
def test_multi_call(): | ||
calculator = CoverageChangeCalculator(threshold=0.5) | ||
calculator(np.ones((2, 2))) | ||
assert calculator(np.identity(2)) == 0.5 | ||
assert calculator(np.zeros((2, 2))) == 0.5 | ||
calculator = CoverageChangeCalculator() | ||
calculator([True, True, False, False]) | ||
assert calculator([False, True, False, True]) == 0.5 | ||
assert calculator([True, True, True, True]) == 0.5 |