Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hippke committed Jan 15, 2019
1 parent d05764c commit c17aa10
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/source/Changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ The versioning scheme is: major.minor.revision
Version 1.0.14. (planned)
------------------------------

:Added to the return values: ``results.transit_depths_uncertainties``
:Added: To the return values: ``results.transit_depths_uncertainties``
:Changed: period_grid limited to physically plausible values to avoid generating empty or extremely large grids




Expand Down
5 changes: 5 additions & 0 deletions transitleastsquares/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,11 @@ def period_grid(
)

number_of_periods = numpy.size(periods[selected_index])

if number_of_periods > 10**6:
text = "period_grid generates a very large grid (" + str(number_of_periods) + "). Recommend to check physical plausibility for stellar mass, radius, and time series duration."
warnings.warn(text)

if number_of_periods < MINIMUM_GRID_SIZE:
if time_span < 5 * SECONDS_PER_DAY:
time_span = 5 * SECONDS_PER_DAY
Expand Down
17 changes: 17 additions & 0 deletions transitleastsquares/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,25 @@
numpy.testing.assert_equal(len(periods), 1716)
print('Test passed: period_grid')

periods = period_grid(
R_star=0.1, # R_sun
M_star=1, # M_sun
time_span=1000, # days
period_min=0,
period_max=999,
oversampling_factor=3)
numpy.testing.assert_equal(len(periods), 4308558)
print('Test passed: period_grid')


# Duration grid
periods = period_grid(
R_star=1, # R_sun
M_star=1, # M_sun
time_span=20, # days
period_min=0,
period_max=999,
oversampling_factor=3)
durations = get_duration_grid(periods, log_step=1.05, shortest=2)
numpy.testing.assert_almost_equal(max(durations), 0.12)
numpy.testing.assert_almost_equal(min(durations), 0.011618569353576557)
Expand Down

0 comments on commit c17aa10

Please sign in to comment.