-
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.
modified: obstools/celestial_time.py modified: obstools/lmi_etc.py new file: obstools/tests/test_celestial_time.py new file: obstools/tests/test_lmi_etc.py new file: obstools/tests/test_utils.py modified: obstools/utils.py
- Loading branch information
Showing
6 changed files
with
208 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# pylint: disable=missing-function-docstring | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of LDTObserverTools. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# Created on 06-Nov-2024 | ||
# | ||
# @author: tbowers | ||
|
||
"""Celestial Time Utilities TEST Module | ||
""" | ||
|
||
import numpy as np | ||
import pytest | ||
|
||
from obstools import celestial_time | ||
|
||
|
||
def test_lst_midnight(): | ||
# Test the inputs / outputs | ||
utdates = ["2020-01-24", "2021-03-02", "2022-04-19", "2023-06-21", "2024-11-29"] | ||
lsts = celestial_time.lst_midnight(utdates) | ||
assert isinstance(lsts, np.ndarray) | ||
assert isinstance(lsts[0], str) | ||
assert len(lsts) == len(utdates) | ||
assert lsts[0] == "07:46:36" # LST at midnight on UT 2020-01-24 | ||
assert lsts[2] == "13:23:46" # LST at midnight on UT 2022-04-19 | ||
|
||
# Make sure the routine handles errors properly... | ||
# Bad Month | ||
with pytest.raises(ValueError): | ||
_ = celestial_time.lst_midnight(["2022-13-17"]) | ||
# Bad Day | ||
with pytest.raises(ValueError): | ||
_ = celestial_time.lst_midnight(["2022-03-83"]) | ||
# No "-" separator | ||
with pytest.raises(ValueError): | ||
_ = celestial_time.lst_midnight(["20210409"]) | ||
# Bad inputs (not list) | ||
with pytest.raises(ValueError): | ||
_ = celestial_time.lst_midnight("2024-11-07") |
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,63 @@ | ||
# pylint: disable=missing-function-docstring | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of LDTObserverTools. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# Created on 06-Nov-2024 | ||
# | ||
# @author: tbowers | ||
|
||
"""LMI Exposure Time Calculator TEST Module | ||
""" | ||
|
||
import numpy as np | ||
|
||
from obstools import lmi_etc | ||
|
||
|
||
def test_exptime_given_snr_mag(): | ||
pass | ||
|
||
|
||
def test_exptime_given_peak_mag(): | ||
pass | ||
|
||
|
||
def test_snr_given_exptime_mag(): | ||
pass | ||
|
||
|
||
def test_mag_given_snr_exptime(): | ||
pass | ||
|
||
|
||
def test_peak_counts(): | ||
pass | ||
|
||
|
||
def test_check_etc_inputs(): | ||
pass | ||
|
||
|
||
def test_counts_from_star_per_sec(): | ||
pass | ||
|
||
|
||
def test_get_band_specific_values(): | ||
pass | ||
|
||
|
||
def test_number_pixels(): | ||
pass | ||
|
||
|
||
def test_read_noise_contribution(): | ||
pass | ||
|
||
|
||
def test_sky_count_per_sec_per_ap(): | ||
pass |
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,80 @@ | ||
# pylint: disable=missing-function-docstring | ||
# -*- coding: utf-8 -*- | ||
# | ||
# This file is part of LDTObserverTools. | ||
# | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this | ||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# Created on 06-Nov-2024 | ||
# | ||
# @author: tbowers | ||
|
||
"""Utility TEST Module | ||
""" | ||
|
||
import numpy as np | ||
|
||
from obstools import utils | ||
|
||
|
||
def test_all_subclasses(): | ||
pass | ||
|
||
|
||
def test_check_float(): | ||
# Actual Float | ||
assert utils.check_float(3.14159) | ||
# Not a float | ||
assert not utils.check_float("This is a float!") | ||
# Integer, but convertable | ||
assert utils.check_float(1) | ||
# Boolean is convertable to a float | ||
assert utils.check_float(True) | ||
|
||
|
||
def test_first_moment_1d(): | ||
pass | ||
|
||
|
||
def test_flatten_comprehension(): | ||
pass | ||
|
||
|
||
def test_gaussfit(): | ||
pass | ||
|
||
|
||
def test_gaussian_function(): | ||
pass | ||
|
||
|
||
def test_good_poly(): | ||
pass | ||
|
||
|
||
def test_nearest_odd(): | ||
# Check return type and value | ||
nearest = utils.nearest_odd(1.5) | ||
assert isinstance(nearest, int) | ||
assert nearest == 1 | ||
# Nearest odd to an odd is itself | ||
assert utils.nearest_odd(5.0) == 5 | ||
# Rounds up from even integers | ||
assert utils.nearest_odd(4) == 5 | ||
assert utils.nearest_odd(4) != 3 | ||
# But, just under goes down... | ||
assert utils.nearest_odd(3.999999999) == 3 | ||
|
||
|
||
def test_set_std_tickparams(): | ||
pass | ||
|
||
|
||
def test_sinusoid(): | ||
pass | ||
|
||
|
||
def test_warn_and_return_zeros(): | ||
pass |
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