Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
F
finesse3
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 81
    • Issues 81
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 5
    • Merge Requests 5
  • Requirements
    • Requirements
    • List
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • finesse
  • finesse3
  • Issues
  • #133

Closed
Open
Opened May 13, 2020 by Sean Leavey@sean-leaveyMaintainer

It's confusing that Rc sometimes returns tuple, sometimes a value

The Rc model parameter of surfaces (i.e. Mirror and Beamsplitter) sometimes returns a single number and sometimes a tuple, depending on whether Rcx and Rcy are the same within tolerance:

    @property
    def Rc(self):
        """The radius of curvature of the mirror in metres. If the
        mirror is astigmatic this is a tuple of the tangential and
        sagittal radii of curvature.

        :getter: Returns the radius of curvature of the mirror in metres (a
                 tuple of values if the mirror is astigmatic).

        :setter: Sets the radius of curvature.

        Examples
        --------
        The following sets the radii of curvature of an object `obj`, which
        is a sub-instance of `Surface`, in both directions to 2.5 m:

        >>> obj.Rc = 2.5

        Whilst this would set the radius of curvature in the x-direction (tangential
        plane) to 2.5 and the radius of curvature in the y-direction (sagittal plane)
        to 2.7:

        >>> obj.Rc = (2.5, 2.7)
        """
        if np.isclose(self.Rcx.value, self.Rcy.value):
            return self.Rcx
        return (self.Rcx, self.Rcy)

It's worth thinking about whether this is the way this should work. This is potentially confusing to users, for instance if they write some code and test that it works for the Rc values they try but later find it doesn't work when some other Rc values are used. You don't want some long running code to fail because of an unexpectedly different data type like this. This also causes extra work for our tests because we have to check the data type before comparing.

I like that the property lets the Rc value get set either as single number or a tuple with two representing x and y, but maybe it should return a tuple of x and y values in all circumstances. If users really want a particular axis they can use Rcx and Rcy.

The same issue applies to some of Cavity's properties too.

To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
Alpha 1
Milestone
Alpha 1
Assign milestone
Time tracking
None
Due date
None
Reference: finesse/finesse3#133