Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): truncate plate reader floating point results to third decimal place #16919

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

CaseyBatten
Copy link
Contributor

@CaseyBatten CaseyBatten commented Nov 20, 2024

Overview

Covers EXEC-1019

Ensure that the plate reader values are truncated to the third decimal place after being read during a protocol. This value should both be returned during a protocol run and as a part of the CSV file saved.

Test Plan and Hands on Testing

  • Run a plate reader protocol, ensure resulting value is truncated to the third decimal place in both the in-run dictionary result and the CSV file saved

Changelog

Added truncation formatting step to plate reader read result formatting method.

Review requests

Small change, anything look awry? Truncating to 5 characters total should cover us here because the plate reader only supports readings between 0 and 4 on a whole-number scale.

Risk assessment

Low - affects new behavior for 8.2 read result only.

@CaseyBatten CaseyBatten requested a review from vegano1 November 20, 2024 21:02
@CaseyBatten CaseyBatten requested a review from a team as a code owner November 20, 2024 21:02
Copy link
Contributor

@vegano1 vegano1 left a comment

Choose a reason for hiding this comment

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

Thank you.

@CaseyBatten CaseyBatten merged commit d1d9b87 into chore_release-8.2.0 Nov 20, 2024
27 checks passed
@CaseyBatten CaseyBatten deleted the truncate_plate_reader_values branch November 20, 2024 21:32
Comment on lines -1271 to +1274
well_map[well_key] = value
truncated_value = float(
"{:.5}".format(str(value))
) # Truncate the returned value to the third decimal place
well_map[well_key] = truncated_value
Copy link
Contributor

Choose a reason for hiding this comment

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

round(value, 3) instead of going back and forth to a str?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We didn't want to round the read results, we want the exact reading value from the reader but truncated to the third decimal place.

Copy link
Contributor

Choose a reason for hiding this comment

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

This does round, though.

>>> "{:.5}".format(123.45678)
'123.46'

It also goes to more than 3 decimal places if the integer part is too short:

>>> "{:.5}".format(1.23456)
'1.2346'

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