Skip to content

Commit

Permalink
lynting iteration
Browse files Browse the repository at this point in the history
  • Loading branch information
scfleming committed Jan 16, 2025
1 parent 4430c8d commit d308938
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 16 deletions.
4 changes: 2 additions & 2 deletions astronify/series/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def test_pitchmap():
assert "center_pitch" in my_pitchmapper.pitch_map_args.keys()
assert my_pitchmapper.pitch_map_args["zero_point"] == "mean"

with pytest.warns(InputWarning): # setting with bad arg
with pytest.warns(InputWarning): # setting with bad arg
my_pitchmapper.pitch_map_args = {
"pitch_range": [100, 10000],
"center_pitch": 440,
Expand All @@ -50,7 +50,7 @@ def my_map_func(data): # dummy function
data = np.array(data)
return data / 2

with pytest.warns(InputWarning): # because of different args
with pytest.warns(InputWarning): # because of different args
my_pitchmapper.pitch_map_func = my_map_func

assert (my_pitchmapper([1, 1]) == [0.5, 0.5]).all()
Expand Down
3 changes: 1 addition & 2 deletions astronify/simulator/add_flare_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import numpy as np


def add_flare_signal(fluxes, flare_time, flare_amp, flare_halfwidth):
"""
Model is based on Davenport et al.
Expand Down Expand Up @@ -102,7 +101,7 @@ def add_flare_signal(fluxes, flare_time, flare_amp, flare_halfwidth):
decay_fluxes = 0.6890 * np.exp(-1.600 * t12_decay_indices) + 0.3030 * np.exp(
-0.2783 * t12_decay_indices
)

# Insert these fluxes into the correct location in our light curve.
# Note: the above index range is correct, but in Python you need to go one
# extra when slicing, hence 6*flare_halfwidth-1+1 = 6*flare_halfwidth...
Expand Down
9 changes: 4 additions & 5 deletions astronify/simulator/add_transit_signal.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


def add_transit_signal(
fluxes, transit_depth, transit_period, transit_start, transit_width):
fluxes, transit_depth, transit_period, transit_start, transit_width):
"""
:param fluxes: Array of fluxes to add the transit signal to.
:type fluxes: numpy.ndarray
Expand Down Expand Up @@ -39,16 +39,15 @@ def add_transit_signal(
transit_indexes = np.zeros(n_fluxes)

# Get the set of start indexes.
start_indexes = np.arange(transit_start, n_fluxes + 1, transit_period,
dtype=int)
start_indexes = np.arange(transit_start, n_fluxes + 1, transit_period, dtype=int)
# Set transit indexes to 1.
for st_ind in start_indexes:
if st_ind + transit_width < fluxes.size:
transit_indexes[st_ind : st_ind+transit_width + 1] = 1
transit_indexes[st_ind : st_ind + transit_width + 1] = 1
else:
transit_indexes[st_ind:] = 1

# Set the flux values of the transit indexes to the transit depth.
fluxes[np.where(transit_indexes == 1)] *= (1.0 - (transit_depth / 100.0))
fluxes[np.where(transit_indexes == 1)] *= 1.0 - (transit_depth / 100.0)

return fluxes
4 changes: 3 additions & 1 deletion astronify/simulator/check_flare_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def check_flare_params(n_fluxes, flare_time, flare_amp):
" in the simulated light curve."
" Number of fluxes = "
+ str(n_fluxes)
+ ", flare time requested is " + str(flare_time) + "."
+ ", flare time requested is "
+ str(flare_time)
+ "."
)

# Flare time index must be greater than or equal to zero.
Expand Down
3 changes: 1 addition & 2 deletions astronify/simulator/check_transit_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ def check_transit_params(n_fluxes, transit_period, transit_start, transit_width)
raise argparse.ArgumentTypeError(
"The transit start must be greater than"
" or equal to zero, start"
" index requested is " +
str(transit_start) + "."
" index requested is " + str(transit_start) + "."
)

# The transit period must be greater than the transit duration (width).
Expand Down
1 change: 0 additions & 1 deletion astronify/simulator/sim_lc_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class SimLcConfig:
"""
Class that holds the default configuration parameters
Expand Down
4 changes: 2 additions & 2 deletions astronify/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
# functions.


from .pitch_mapping import * # noqa: F403
from .pitch_mapping import * # noqa: F403

__all__ = ["data_to_pitch"] # noqa: F405
__all__ = ["data_to_pitch"] # noqa: F405
2 changes: 1 addition & 1 deletion astronify/utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class InvalidInputError(Exception):
"""
Exception to be issued when user input is incorrect in a
Exception to be issued when user input is incorrect in a
way that prevents the function from running.
"""

Expand Down

0 comments on commit d308938

Please sign in to comment.