Skip to content

Expose STARBackend.channel_measure_temperature()#908

Open
BioCam wants to merge 1 commit intoPyLabRobot:mainfrom
BioCam:expose-STARBackend-channel-temperature-sensors
Open

Expose STARBackend.channel_measure_temperature()#908
BioCam wants to merge 1 commit intoPyLabRobot:mainfrom
BioCam:expose-STARBackend-channel-temperature-sensors

Conversation

@BioCam
Copy link
Collaborator

@BioCam BioCam commented Feb 25, 2026

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds public measurement helpers to the Hamilton STAR liquid handling backend so callers can query pipetting-channel temperature readings directly from firmware.

Changes:

  • Added STARBackend.channel_measure_temperature(channel_idx) to query a single channel’s temperature via the RM firmware command.
  • Added STARBackend.channels_measure_temperatures() to query all channels and return a list of temperatures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

)

resp = await self.send_command(
module=STARBackend.channel_id(channel_idx),
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use self.channel_id(channel_idx) instead of STARBackend.channel_id(channel_idx) here to avoid hard-coding the base class and to stay consistent with nearby channel-specific helpers (e.g. channel_request_y_minimum_spacing). This also keeps the method override-friendly if a subclass ever customizes channel addressing.

Suggested change
module=STARBackend.channel_id(channel_idx),
module=self.channel_id(channel_idx),

Copilot uses AI. Check for mistakes.
Comment on lines +1609 to +1642
async def channel_measure_temperature(self, channel_idx: int) -> float:
"""Measure the temperature of a single channel.

Args:
channel_idx: The channel index to query (0-indexed).

Returns:
The temperature reading as a float.
"""

if not (0 <= channel_idx < self.num_channels):
raise ValueError(
f"channel_idx must be between 0 and {self.num_channels - 1}, got {channel_idx}."
)

resp = await self.send_command(
module=STARBackend.channel_id(channel_idx),
command="RM",
fmt="rm####",
)
return round(resp["rm"] / 100.0, 2)

async def channels_measure_temperatures(self) -> List[float]:
"""Measure the temperature of all channels.

Returns:
A list of temperature readings as floats, one per channel, ordered by channel index.
"""

temperatures: List[float] = []
for idx in range(self.num_channels):
temperature = await self.channel_measure_temperature(channel_idx=idx)
temperatures.append(temperature)
return temperatures
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New public measurement helpers (channel_measure_temperature / channels_measure_temperatures) don’t appear to be covered by tests. Since this backend has an extensive STAR_tests.py, please add unit tests that validate the generated command (module/command/fmt) and that the returned value correctly converts the firmware integer (e.g. rm0234 -> 2.34).

Copilot uses AI. Check for mistakes.
@rickwierenga
Copy link
Member

all report exactly 20.0C, so I don't think this works

@BioCam
Copy link
Collaborator Author

BioCam commented Feb 25, 2026

all report exactly 20.0C, so I don't think this works

ahh sad, our AC is set to 20C which is why I thought it was returning the correct values

If it doesn't return the correct values then the firmware command is not working and I will close the PR - I will test with different AC conditions and ask some more people to test in their labs before doing so

@rickwierenga
Copy link
Member

our labs can't be both exactly 20.0C on all channels 😅

@BioCam
Copy link
Collaborator Author

BioCam commented Feb 26, 2026

yes, that is what I am saying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants