Skip to content

Commit

Permalink
Issue #0: Upgrade black formatting to 24.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark2000 committed Jan 30, 2024
1 parent f5b0e76 commit f662a86
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 54 deletions.
7 changes: 3 additions & 4 deletions src/bsk_rl/envs/agile_eos/bsk_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Basilisk dynamics models."""


from abc import ABC, abstractmethod
from typing import TYPE_CHECKING, Iterable, Optional

Expand Down
48 changes: 24 additions & 24 deletions src/bsk_rl/envs/general_satellite_tasking/simulation/fsw.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
20 changes: 11 additions & 9 deletions src/bsk_rl/envs/multisat_agile_eos/bsk_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/bsk_rl/envs/multisensor_eos/bsk_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 3 additions & 4 deletions src/bsk_rl/envs/simple_eos/bsk_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/bsk_rl/envs/small_body_science/bsk_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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])
)
),
),
)
Expand All @@ -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])
)
Expand Down

0 comments on commit f662a86

Please sign in to comment.