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

Add convenience min, max properties to FieldMesh #80

Merged

Conversation

ChristopherMayes
Copy link
Owner

@ChristopherMayes ChristopherMayes commented Oct 23, 2024

It also refactors some of the convenience methods in FieldMesh:

  • add FieldMesh.xmin, FieldMesh.ymin, etc.
  • add FieldMesh.xmax, FieldMesh.ymax, etc.
  • add setters for these.

@ChristopherMayes ChristopherMayes changed the title Enable impact emfield cartesian offsets and tilt Add convenience min, max properties to FieldMesh Oct 23, 2024
dtheta = _create_delta_property("theta")

# Maxs
def _create_max_property(name):
Copy link
Contributor

Choose a reason for hiding this comment

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

These property-creating helper functions don't have to live in the class body, just so you know

Copy link
Owner Author

Choose a reason for hiding this comment

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

thanks, changed.

return property(getter, setter)

# Create max properties dynamically
xmax = _create_max_property("x")
Copy link
Contributor

Choose a reason for hiding this comment

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

While you're refactoring these, you might consider adding on a doc for each attribute. That could help with future documentation efforts.

https://docs.python.org/3/library/functions.html#property

property(..., doc="...")

Copy link
Owner Author

@ChristopherMayes ChristopherMayes Oct 23, 2024

Choose a reason for hiding this comment

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

added

self.attrs["gridOriginOffset"] = tuple(mins)

return property(
getter, setter, doc=f"Mesh minimim in {name}. This can also be set."
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
getter, setter, doc=f"Mesh minimim in {name}. This can also be set."
getter, setter, doc=f"Mesh minimum in {name}. This can also be set."

Copy link
Owner Author

Choose a reason for hiding this comment

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

Fixed

@ChristopherMayes ChristopherMayes merged commit 33064e2 into master Oct 23, 2024
14 checks passed
@ChristopherMayes ChristopherMayes deleted the enable_impact_-emfield_cartesian_offsets_and_tilt branch October 26, 2024 17:05
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.

2 participants