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

Make the width contain units and add start/end functions #386

Merged
merged 1 commit into from Sep 1, 2021

Conversation

cquiroz
Copy link
Collaborator

@cquiroz cquiroz commented Sep 1, 2021

A Band's width has no units. It should be nanometers

Signed-off-by: Carlos Quiroz <carlos.quiroz@noirlab.edu>
Copy link
Contributor

@rpiaggio rpiaggio left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@swalker2m swalker2m left a comment

Choose a reason for hiding this comment

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

Seems good to me. 👍 Can't believe we had a loose Int in our model like that!

@cquiroz
Copy link
Collaborator Author

cquiroz commented Sep 1, 2021

Yeah. I was a bit surprised too

@cquiroz cquiroz merged commit b541d3e into master Sep 1, 2021
@cquiroz cquiroz deleted the mag-band-width branch September 1, 2021 20:53
) extends Product with Serializable {
require(center.toPicometers.value >= width.value / 2)

def end: Wavelength = Wavelength(center.toPicometers + (width.value.value / 2).withRefinedUnit[Positive, Nanometer])
Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big deal here, but I think you can avoid stripping the units off width for the division and then adding them back on by center.toPicometers + width / 2.withRefinedUnit[Positive, Unitless].

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes you can see
erikerlandson/coulomb#211

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.

None yet

4 participants