Skip to content

Commit

Permalink
Fixing linter errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
craiglagegit committed Nov 8, 2024
1 parent 2640d34 commit 6135abe
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions python/lsst/summit/utils/tmaUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

MOUNT_IMAGE_WARNING_LEVEL = 0.01 # this determines the colouring of the cells in the table, yellow for this
MOUNT_IMAGE_BAD_LEVEL = 0.05 # and red for this
HARDPOINT_FORCE_WARNING_LEVEL = 500.0 # this determines the colouring of the cells in the table, yellow for this
HARDPOINT_FORCE_WARNING_LEVEL = 500.0 # for colouring of the cells in the table, yellow for this
HARDPOINT_FORCE_BAD_LEVEL = 1000.0 # and red for this


Expand Down Expand Up @@ -220,9 +220,8 @@ def getM1M3HardpointDataForEvent(
postPadding: float = 0,
) -> tuple[pd.DataFrame]:
"""Get the data for the M1M3 hardpoint telemetry for a given TMAEvent.
During slews, the M1M3 mirror moves in response to the accelerations.
The hardpoint forces need to stay within accepted limits to prevent
The hardpoint forces need to stay within accepted limits to prevent
long term cracking on the mirror.
Parameters
Expand Down Expand Up @@ -253,8 +252,8 @@ def getM1M3HardpointDataForEvent(
)

# Add a column with the absolute max force
maxForce = [np.nanmax([abs(hardpointData.iloc[i][f'measuredForce{j}'])
for j in range(6)]) for i in range(len(hardpointData))]
maxForce = [np.nanmax([abs(hardpointData.iloc[i][f'measuredForce{j}'])
for j in range(6)]) for i in range(len(hardpointData))]

hardpointData["maxForce"] = maxForce

Expand Down Expand Up @@ -348,7 +347,7 @@ def plotEvent(
Plots the axis motion profiles for the given event, with optional padding
at the start and end of the event. If the data is provided via the
azimuthData and elevationData parameters, it will be used, otherwise it
will be queried from the EFD. For slews, the M1M3 hardpoint forces are
will be queried from the EFD. For slews, the M1M3 hardpoint forces are
also plotted. Similarly, it will query the EFD if the hardpoint forces
are not provided.
Expand Down Expand Up @@ -455,12 +454,6 @@ def getPlotTime(time: pd.Timestamp | Time | datetime.datetime) -> datetime.datet
client, event, prePadding=prePadding, postPadding=postPadding
)

if event.type == TMAState.SLEWING and hardpointData is None:
hardpointData = getM1M3HardpointDataForEvent(
client, event, prePadding=prePadding, postPadding=postPadding
)
assert hardpointData is not None

assert azimuthData is not None
assert elevationData is not None

Expand Down Expand Up @@ -566,12 +559,18 @@ def getPlotTime(time: pd.Timestamp | Time | datetime.datetime) -> datetime.datet
metadataWriter(dayObs=event.dayObs, mdDict=rowData)

elif event.type == TMAState.SLEWING:
if hardpointData is None:
hardpointData = getM1M3HardpointDataForEvent(
client, event, prePadding=prePadding, postPadding=postPadding
)
assert hardpointData is not None

Check failure on line 567 in python/lsst/summit/utils/tmaUtils.py

View workflow job for this annotation

GitHub Actions / call-workflow / lint

W293

blank line contains whitespace
# Calculate Max hardpoint force
maxForce = np.nanmax(hardpointData['maxForce'].values)
assert ax1p5 is not None
for hp_index in range(6):
ax1p5.plot(
hardpointData[f'measuredForce{hp_index}'],
hardpointData[f"measuredForce{hp_index}"],
label=f"HP_{hp_index}",
c=lineColors[colorCounter % nColors],
)
Expand All @@ -593,14 +592,15 @@ def getPlotTime(time: pd.Timestamp | Time | datetime.datetime) -> datetime.datet
ax1p5.set_ylim(-1000.0, 1000.0)
ax1p5.set_yticks([-500, 0.0, 500])
ax1p5.legend()
ax1p5.text(0.1, 0.9, f"Max HP force = {maxForce:.1f} N", transform=ax1p5.transAxes)
ax1p5.text(0.1, 0.9, f"Max HP force = {maxForce:.1f} N",
transform=ax1p5.transAxes)

if metadataWriter is not None:
md = {"HP Max force": f"{maxForce:.2f}"}
flagKey = "_Max HP Force"
if image_impact_rms > HARDPOINT_FORCE_BAD_LEVEL:
if maxForce > HARDPOINT_FORCE_BAD_LEVEL:
md.update({flagKey: "bad"})
elif image_impact_rms > HARDPOINT_FORCE_WARNING_LEVEL:
elif maxForce > HARDPOINT_FORCE_WARNING_LEVEL:
md.update({flagKey: "warning"})

rowData = {event.seqNum: md}
Expand Down

0 comments on commit 6135abe

Please sign in to comment.