From 8ddf4247c17258bde792b2ef3eb24bb36b87d098 Mon Sep 17 00:00:00 2001 From: Andrew Fullard Date: Wed, 8 May 2024 16:33:12 -0400 Subject: [PATCH] black --- tardis/transport/montecarlo/base.py | 4 +++- tardis/transport/montecarlo/formal_integral.py | 4 +--- .../montecarlo/tests/test_cuda_formal_integral.py | 4 +--- .../montecarlo/tests/test_numba_formal_integral.py | 14 ++++---------- tardis/transport/montecarlo/tests/test_packet.py | 4 +++- tardis/transport/montecarlo/tests/test_vpacket.py | 4 +++- 6 files changed, 15 insertions(+), 19 deletions(-) diff --git a/tardis/transport/montecarlo/base.py b/tardis/transport/montecarlo/base.py index 9caef29fa39..38dedc6ee86 100644 --- a/tardis/transport/montecarlo/base.py +++ b/tardis/transport/montecarlo/base.py @@ -126,7 +126,9 @@ def initialize_transport_state( opacity_state=opacity_state, ) - transport_state.enable_full_relativity = self.montecarlo_configuration.ENABLE_FULL_RELATIVITY + transport_state.enable_full_relativity = ( + self.montecarlo_configuration.ENABLE_FULL_RELATIVITY + ) transport_state.integrator_settings = self.integrator_settings transport_state._integrator = FormalIntegrator( simulation_state, plasma, self diff --git a/tardis/transport/montecarlo/formal_integral.py b/tardis/transport/montecarlo/formal_integral.py index 012557cfc89..cbab15d0a08 100644 --- a/tardis/transport/montecarlo/formal_integral.py +++ b/tardis/transport/montecarlo/formal_integral.py @@ -184,9 +184,7 @@ def numba_formal_integral( # calculate e-scattering optical depth to grid cell boundary Jkkp = 0.5 * (Jred_lu[pJred_lu] + Jblue_lu[pJblue_lu]) - zend = ( - time_explosion / C_INV * (1.0 - nu_end / nu) - ) # check + zend = time_explosion / C_INV * (1.0 - nu_end / nu) # check escat_contrib += ( (zend - zstart) * escat_op * (Jkkp - I_nu[p_idx]) ) diff --git a/tardis/transport/montecarlo/tests/test_cuda_formal_integral.py b/tardis/transport/montecarlo/tests/test_cuda_formal_integral.py index cda6664d2f5..69d50825864 100644 --- a/tardis/transport/montecarlo/tests/test_cuda_formal_integral.py +++ b/tardis/transport/montecarlo/tests/test_cuda_formal_integral.py @@ -130,9 +130,7 @@ def time_explosion(): not GPUs_available, reason="No GPU is available to test CUDA function" ) @pytest.mark.parametrize(["p", "p_loc"], [(0.0, 0), (0.5, 1), (1.0, 2)]) -def test_calculate_z_cuda( - formal_integral_geometry, time_explosion, p, p_loc -): +def test_calculate_z_cuda(formal_integral_geometry, time_explosion, p, p_loc): """ Initializes the test of the cuda version against the numba implementation of the diff --git a/tardis/transport/montecarlo/tests/test_numba_formal_integral.py b/tardis/transport/montecarlo/tests/test_numba_formal_integral.py index 55ff1a755bd..2bc89946c73 100644 --- a/tardis/transport/montecarlo/tests/test_numba_formal_integral.py +++ b/tardis/transport/montecarlo/tests/test_numba_formal_integral.py @@ -68,7 +68,7 @@ def formal_integral_geometry(request): @pytest.fixture(scope="function") def time_explosion(): - return 1 / c.c.cgs.value + return 1 / c.c.cgs.value @pytest.mark.parametrize("p", [0.0, 0.5, 1.0]) @@ -89,16 +89,12 @@ def test_calculate_z(formal_integral_geometry, time_explosion, p): @pytest.mark.parametrize("p", [0, 0.5, 1]) -def test_populate_z_photosphere( - formal_integral_geometry, time_explosion, p -): +def test_populate_z_photosphere(formal_integral_geometry, time_explosion, p): """ Test the case where p < r[0] That means we 'hit' all shells from inside to outside. """ - integrator = formal_integral.FormalIntegrator( - time_explosion, None, None - ) + integrator = formal_integral.FormalIntegrator(time_explosion, None, None) func = formal_integral.populate_z size = len(formal_integral_geometry.r_outer) r_inner = formal_integral_geometry.r_inner @@ -121,9 +117,7 @@ def test_populate_z_shells(formal_integral_geometry, time_explosion, p): """ Test the case where p > r[0] """ - integrator = formal_integral.FormalIntegrator( - time_explosion, None, None - ) + integrator = formal_integral.FormalIntegrator(time_explosion, None, None) func = formal_integral.populate_z size = len(formal_integral_geometry.r_inner) diff --git a/tardis/transport/montecarlo/tests/test_packet.py b/tardis/transport/montecarlo/tests/test_packet.py index 8175fab3bb2..5e99c4d0278 100644 --- a/tardis/transport/montecarlo/tests/test_packet.py +++ b/tardis/transport/montecarlo/tests/test_packet.py @@ -233,7 +233,9 @@ def test_trace_packet( set_seed_fixture, ): set_seed_fixture(1963) - packet.initialize_line_id(verysimple_opacity_state, verysimple_time_explosion) + packet.initialize_line_id( + verysimple_opacity_state, verysimple_time_explosion + ) distance, interaction_type, delta_shell = r_packet_transport.trace_packet( packet, verysimple_time_explosion, diff --git a/tardis/transport/montecarlo/tests/test_vpacket.py b/tardis/transport/montecarlo/tests/test_vpacket.py index 05ab01016dc..43906cf642e 100644 --- a/tardis/transport/montecarlo/tests/test_vpacket.py +++ b/tardis/transport/montecarlo/tests/test_vpacket.py @@ -117,7 +117,9 @@ def test_trace_vpacket_volley( # Set seed because of RNG in trace_vpacket np.random.seed(1) - packet.initialize_line_id(verysimple_opacity_state, verysimple_time_explosion) + packet.initialize_line_id( + verysimple_opacity_state, verysimple_time_explosion + ) vpacket.trace_vpacket_volley( packet,