diff --git a/src/bsk_rl/envs/agile_eos/bsk_sim.py b/src/bsk_rl/envs/agile_eos/bsk_sim.py index 47e34542..fb453c5c 100644 --- a/src/bsk_rl/envs/agile_eos/bsk_sim.py +++ b/src/bsk_rl/envs/agile_eos/bsk_sim.py @@ -868,10 +868,9 @@ def init_obs(self): mc.RPM * self.initial_conditions["maxSpeed"] ) # Stored charge - self.obs[ - 11, 0 - ] = self.powerMonitor.storedCharge_Init / self.initial_conditions.get( - "batteryStorageCapacity" + self.obs[11, 0] = ( + self.powerMonitor.storedCharge_Init + / self.initial_conditions.get("batteryStorageCapacity") ) # Initialize the full observations diff --git a/src/bsk_rl/envs/general_satellite_tasking/scenario/communication.py b/src/bsk_rl/envs/general_satellite_tasking/scenario/communication.py index f43718b8..0c20349f 100644 --- a/src/bsk_rl/envs/general_satellite_tasking/scenario/communication.py +++ b/src/bsk_rl/envs/general_satellite_tasking/scenario/communication.py @@ -91,9 +91,9 @@ def reset(self) -> None: self.los_logs[sat_1] = {} msg_index = sat_1.dynamics.los_comms_ids.index(sat_2.id) - logger = self.los_logs[sat_1][ - sat_2 - ] = sat_1.dynamics.losComms.accessOutMsgs[msg_index].recorder() + logger = self.los_logs[sat_1][sat_2] = ( + sat_1.dynamics.losComms.accessOutMsgs[msg_index].recorder() + ) sat_1.simulator.AddModelToTask( sat_1.dynamics.task_name, logger, ModelPriority=586 diff --git a/src/bsk_rl/envs/general_satellite_tasking/simulation/dynamics.py b/src/bsk_rl/envs/general_satellite_tasking/simulation/dynamics.py index e8265dd6..75b3f7c6 100644 --- a/src/bsk_rl/envs/general_satellite_tasking/simulation/dynamics.py +++ b/src/bsk_rl/envs/general_satellite_tasking/simulation/dynamics.py @@ -1,6 +1,5 @@ """Basilisk dynamics models.""" - from abc import ABC, abstractmethod from typing import TYPE_CHECKING, Iterable, Optional diff --git a/src/bsk_rl/envs/general_satellite_tasking/simulation/fsw.py b/src/bsk_rl/envs/general_satellite_tasking/simulation/fsw.py index 6bb33047..7f5b536d 100644 --- a/src/bsk_rl/envs/general_satellite_tasking/simulation/fsw.py +++ b/src/bsk_rl/envs/general_satellite_tasking/simulation/fsw.py @@ -352,18 +352,18 @@ def __init__(self, fsw, priority=97) -> None: # noqa: D107 def _create_module_data(self) -> None: """Set up momentum dumping and thruster control.""" # Momentum dumping configuration - self.thrDesatControl = ( - self.fsw.thrDesatControl - ) = thrMomentumManagement.thrMomentumManagement() + self.thrDesatControl = self.fsw.thrDesatControl = ( + thrMomentumManagement.thrMomentumManagement() + ) self.thrDesatControl.ModelTag = "thrMomentumManagement" self.thrDump = self.fsw.thrDump = thrMomentumDumping.thrMomentumDumping() self.thrDump.ModelTag = "thrDump" # Thruster force mapping configuration - self.thrForceMapping = ( - self.fsw.thrForceMapping - ) = thrForceMapping.thrForceMapping() + self.thrForceMapping = self.fsw.thrForceMapping = ( + thrForceMapping.thrForceMapping() + ) self.thrForceMapping.ModelTag = "thrForceMapping" def _init_objects(self, **kwargs) -> None: @@ -472,9 +472,9 @@ def __init__(self, fsw, priority=90) -> None: # noqa: D107 super().__init__(fsw, priority) def _create_module_data(self) -> None: - self.trackingError = ( - self.fsw.trackingError - ) = attTrackingError.attTrackingError() + self.trackingError = self.fsw.trackingError = ( + attTrackingError.attTrackingError() + ) self.trackingError.ModelTag = "trackingError" def _init_objects(self, **kwargs) -> None: @@ -498,9 +498,9 @@ def __init__(self, fsw, priority=80) -> None: # noqa: D107 def _create_module_data(self) -> None: # Attitude controller configuration - self.mrpFeedbackControl = ( - self.fsw.mrpFeedbackControl - ) = mrpFeedback.mrpFeedback() + self.mrpFeedbackControl = self.fsw.mrpFeedbackControl = ( + mrpFeedback.mrpFeedback() + ) self.mrpFeedbackControl.ModelTag = "mrpFeedbackControl" # add module that maps the Lr control torque into the RW motor torques @@ -593,9 +593,9 @@ def _create_module_data(self) -> None: self.locPoint.ModelTag = "locPoint" # SimpleInstrumentController configuration - self.insControl = ( - self.fsw.insControl - ) = simpleInstrumentController.simpleInstrumentController() + self.insControl = self.fsw.insControl = ( + simpleInstrumentController.simpleInstrumentController() + ) self.insControl.ModelTag = "instrumentController" def _init_objects(self, **kwargs) -> None: @@ -703,9 +703,9 @@ def _create_module_data(self) -> None: self.locPoint.ModelTag = "locPoint" # scanningInstrumentController configuration - self.insControl = ( - self.fsw.insControl - ) = scanningInstrumentController.scanningInstrumentController() + self.insControl = self.fsw.insControl = ( + scanningInstrumentController.scanningInstrumentController() + ) self.insControl.ModelTag = "instrumentController" @default_args(imageAttErrorRequirement=0.01, imageRateErrorRequirement=None) @@ -778,15 +778,15 @@ def __init__(self, fsw, priority=80) -> None: # noqa: D107 def _create_module_data(self) -> None: # Attitude controller configuration - self.mrpSteeringControl = ( - self.fsw.mrpSteeringControl - ) = mrpSteering.mrpSteering() + self.mrpSteeringControl = self.fsw.mrpSteeringControl = ( + mrpSteering.mrpSteering() + ) self.mrpSteeringControl.ModelTag = "mrpSteeringControl" # Rate servo - self.servo = ( - self.fsw.servo - ) = rateServoFullNonlinear.rateServoFullNonlinear() + self.servo = self.fsw.servo = ( + rateServoFullNonlinear.rateServoFullNonlinear() + ) self.servo.ModelTag = "rateServo" # add module that maps the Lr control torque into the RW motor torques diff --git a/src/bsk_rl/envs/multisat_agile_eos/bsk_sim.py b/src/bsk_rl/envs/multisat_agile_eos/bsk_sim.py index fd4b0afb..bd1ddeaf 100644 --- a/src/bsk_rl/envs/multisat_agile_eos/bsk_sim.py +++ b/src/bsk_rl/envs/multisat_agile_eos/bsk_sim.py @@ -781,9 +781,9 @@ def run_sim(self, action, return_obs=True): int(self.current_tgt_indices[idx][int(action[idx]) - 3]) ] if self.target_indexing == "local" - else int(action[idx] - 3) - if self.target_indexing == "global" - else -1 + else ( + int(action[idx] - 3) if self.target_indexing == "global" else -1 + ) ) if self.renew_tasks or self.prev_target[idx] != global_tgt: @@ -1343,13 +1343,15 @@ def communicate(self): connectivity = np.array( [ [ - any( - self.losLogs[sc_idx][comm_idx].hasAccess[ - -int(self.step_duration / self.dynRate) : - ] + ( + any( + self.losLogs[sc_idx][comm_idx].hasAccess[ + -int(self.step_duration / self.dynRate) : + ] + ) + if comm_idx != sc_idx + else False ) - if comm_idx != sc_idx - else False for comm_idx in range(self.n_spacecraft) ] for sc_idx in range(self.n_spacecraft) diff --git a/src/bsk_rl/envs/multisensor_eos/bsk_sim.py b/src/bsk_rl/envs/multisensor_eos/bsk_sim.py index f75da751..8dd4be6c 100644 --- a/src/bsk_rl/envs/multisensor_eos/bsk_sim.py +++ b/src/bsk_rl/envs/multisensor_eos/bsk_sim.py @@ -147,9 +147,9 @@ def set_env_dynamics(self): self.central_body = 1 body_name = self.initial_conditions.get("central_body") gravBodies = self.gravFactory.createBodies(["sun", body_name]) - gravBodies[ - body_name - ].isCentralBody = True # ensure this is the central gravitational body + gravBodies[body_name].isCentralBody = ( + True # ensure this is the central gravitational body + ) self.mu = gravBodies[body_name].mu self.radEquator = gravBodies[body_name].radEquator diff --git a/src/bsk_rl/envs/simple_eos/bsk_sim.py b/src/bsk_rl/envs/simple_eos/bsk_sim.py index 22418a74..f63c682b 100644 --- a/src/bsk_rl/envs/simple_eos/bsk_sim.py +++ b/src/bsk_rl/envs/simple_eos/bsk_sim.py @@ -757,10 +757,9 @@ def set_dynamics(self): mc.RPM * 6000 ) # Stored charge - self.obs[ - 11, 0 - ] = self.powerMonitor.storedCharge_Init / self.initial_conditions.get( - "batteryStorageCapacity" + self.obs[11, 0] = ( + self.powerMonitor.storedCharge_Init + / self.initial_conditions.get("batteryStorageCapacity") ) # Initialize the full observations diff --git a/src/bsk_rl/envs/small_body_science/bsk_sim.py b/src/bsk_rl/envs/small_body_science/bsk_sim.py index 08ffb7f3..d667afe9 100644 --- a/src/bsk_rl/envs/small_body_science/bsk_sim.py +++ b/src/bsk_rl/envs/small_body_science/bsk_sim.py @@ -1487,7 +1487,7 @@ def setup_viz(self): self.vizInterface = vizSupport.enableUnityVisualization( self, self.dynTaskName, - self.scObject + self.scObject, # , saveFile=fileName ) self.vizInterface.settings.showSpacecraftLabels = 1 diff --git a/tests/unittest/envs/general_satellite_tasking/scenario/test_satellites.py b/tests/unittest/envs/general_satellite_tasking/scenario/test_satellites.py index 73c986ba..58836789 100644 --- a/tests/unittest/envs/general_satellite_tasking/scenario/test_satellites.py +++ b/tests/unittest/envs/general_satellite_tasking/scenario/test_satellites.py @@ -213,9 +213,11 @@ def test_calculate_windows(self): x=np.arange(0, 100, 2), y=np.array([[t - 50.0, 0.0, 2.0] for t in np.arange(0, 100, 2)]), side_effect=( # noqa: E731 - lambda t: np.array([[ti - 50.0, 0.0, 2.0] for ti in t]) - if isinstance(t, Iterable) - else np.array([t - 50.0, 0.0, 2.0]) + lambda t: ( + np.array([[ti - 50.0, 0.0, 2.0] for ti in t]) + if isinstance(t, Iterable) + else np.array([t - 50.0, 0.0, 2.0]) + ) ), ), ) @@ -232,8 +234,8 @@ def test_calculate_windows(self): ) def test_find_elevation_roots(self): - interp = ( # noqa: E731 - lambda t: np.array([[ti, 0.0, 2.0] for ti in t]) + interp = lambda t: ( # noqa: E731 + np.array([[ti, 0.0, 2.0] for ti in t]) if isinstance(t, Iterable) else np.array([t, 0.0, 2.0]) )