From d308938f880ef88d7f29c3b6e8b84af53812c5ed Mon Sep 17 00:00:00 2001 From: Scott Fleming Date: Wed, 15 Jan 2025 22:37:57 -0500 Subject: [PATCH] lynting iteration --- astronify/series/tests/test_series.py | 4 ++-- astronify/simulator/add_flare_signal.py | 3 +-- astronify/simulator/add_transit_signal.py | 9 ++++----- astronify/simulator/check_flare_params.py | 4 +++- astronify/simulator/check_transit_params.py | 3 +-- astronify/simulator/sim_lc_config.py | 1 - astronify/utils/__init__.py | 4 ++-- astronify/utils/exceptions.py | 2 +- 8 files changed, 14 insertions(+), 16 deletions(-) diff --git a/astronify/series/tests/test_series.py b/astronify/series/tests/test_series.py index 853da66..31e451f 100644 --- a/astronify/series/tests/test_series.py +++ b/astronify/series/tests/test_series.py @@ -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, @@ -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() diff --git a/astronify/simulator/add_flare_signal.py b/astronify/simulator/add_flare_signal.py index a5fae33..9daf461 100644 --- a/astronify/simulator/add_flare_signal.py +++ b/astronify/simulator/add_flare_signal.py @@ -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. @@ -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... diff --git a/astronify/simulator/add_transit_signal.py b/astronify/simulator/add_transit_signal.py index 2c9cf33..015ff6f 100644 --- a/astronify/simulator/add_transit_signal.py +++ b/astronify/simulator/add_transit_signal.py @@ -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 @@ -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 diff --git a/astronify/simulator/check_flare_params.py b/astronify/simulator/check_flare_params.py index 1dba79c..e719411 100644 --- a/astronify/simulator/check_flare_params.py +++ b/astronify/simulator/check_flare_params.py @@ -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. diff --git a/astronify/simulator/check_transit_params.py b/astronify/simulator/check_transit_params.py index 3afc087..61d19d5 100644 --- a/astronify/simulator/check_transit_params.py +++ b/astronify/simulator/check_transit_params.py @@ -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). diff --git a/astronify/simulator/sim_lc_config.py b/astronify/simulator/sim_lc_config.py index 2522dd2..d766de3 100644 --- a/astronify/simulator/sim_lc_config.py +++ b/astronify/simulator/sim_lc_config.py @@ -1,4 +1,3 @@ - class SimLcConfig: """ Class that holds the default configuration parameters diff --git a/astronify/utils/__init__.py b/astronify/utils/__init__.py index 59f574b..eb0f7e9 100644 --- a/astronify/utils/__init__.py +++ b/astronify/utils/__init__.py @@ -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 diff --git a/astronify/utils/exceptions.py b/astronify/utils/exceptions.py index 4a64880..e6a81d9 100644 --- a/astronify/utils/exceptions.py +++ b/astronify/utils/exceptions.py @@ -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. """