Skip to content

Commit

Permalink
Merge pull request #29 from arjunsavel/test_utils_more
Browse files Browse the repository at this point in the history
Test utils more
  • Loading branch information
arjunsavel authored Aug 18, 2024
2 parents 741880a + 29a2be2 commit b08fb54
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 1 deletion.
56 changes: 56 additions & 0 deletions src/scope/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,59 @@ def test_gaussian_shifted_blue(self):
wav_max_shifted = eval_wave[np.argmax(shifted_flux)]
wav_max = eval_wave[np.argmax(interped_flux)]
assert wav_max_shifted < wav_max


class TestCrossingTime(unittest.TestCase):
"""
tests the exposure time calculation.
"""

period = 1.80988198
mstar = 1.458
e = 0.000
inc = 89.623
mplanet = 0.894
rstar = 1.756
peri = 0
b = 0.027
R = 45000
pix_per_res = 3.3
plot = False

def test_crossing_time_moremassive_star(self):
"""
in a greater potential well, the crossing time is shorter.
"""
low_mass_time, _, _, _ = calc_crossing_time()

high_mass_time, _, _, _ = calc_crossing_time(mstar=10 * self.mstar)
assert low_mass_time > high_mass_time

def test_crossing_time_moremassive_star(self):
"""
on a longer period for the same star, the crossing time is longer.
"""
short_period_time, _, _, _ = calc_crossing_time()

long_period_time, _, _, _ = calc_crossing_time(period=10 * self.period)
assert short_period_time < long_period_time

def test_crossing_time_pixel_per_res(self):
"""
more pixels per resolution element, shorter time to cross the pixels.
"""
_, few_pixels_per_element, _, _ = calc_crossing_time()

_, many_pixels_per_element, _, _ = calc_crossing_time(
pix_per_res=10 * self.pix_per_res
)
assert many_pixels_per_element < few_pixels_per_element

def test_crossing_time_resolution(self):
"""
higher resolution, shorter crossing time.
"""
low_resolution_time, _, _, _ = calc_crossing_time()

high_resolution_time, _, _, _ = calc_crossing_time(R=10 * self.R)
assert high_resolution_time < low_resolution_time
2 changes: 1 addition & 1 deletion src/scope/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def calc_doppler_shift(eval_wave, template_wave, template_flux, v):
return shifted_flux


def calc_exposure_time(
def calc_crossing_time(
period=1.80988198,
mstar=1.458,
e=0.000,
Expand Down

0 comments on commit b08fb54

Please sign in to comment.