Skip to content

Do we want to split resampleParams into two parameters? #69

Closed

Description

@alexhroom

Currently resampleParams is a two item list (default [0.7, 50]), representing a minimum angle (in units 1/pi) and number of points used in resampling. This is very unintuitive and difficult for the user to tell what these parameters represent. If we split them into two parameters, named e.g. resampleMinAngle and resampleNPoints, then we get the following benefits:

  • easier to document and understand what these parameters are from a user point-of-view
  • easier to input in both GUI (min angle can be a float spinbox and npoints an int) and in scripts
  • easier to validate (in Python, can let Pydantic handle it entirely and also add handling to ensure n-points is an int)
  • do not have to write specialised GUI code just to handle a 2-item list once in the Controls tab

Please comment any thoughts, problems, or alternatives?

Activity

  1. alexhroom commented on Sep 2, 2024

    @alexhroom
    CollaboratorAuthor

    conclusion from discussion in meeting: yes

  2. alexhroom commented on Sep 3, 2024

    @alexhroom
    CollaboratorAuthor

    @arwelHughes there's a discrepancy between MATLAB and Python on how the min angle is validated:

    in MATLAB an error is thrown if (val < 0 || val > 1), so values between 0 and 1 (inclusive) are acceptable
    in Python an error is thrown if not 0 < val < 1 so 0 and 1 are excluded.

    I was just wondering which one you thought would be the correct range? do 0 and 1 both make sense as min angles?

  3. arwelHughes commented on Sep 3, 2024

    @arwelHughes
  4. alexhroom commented on Sep 3, 2024

    @alexhroom
    CollaboratorAuthor

    @arwelHughes this is in the function set.resampleParams in the controlsClass, in particular see lines 94-103:

            function set.resampleParams(obj,val)
                if length(val) ~= 2
                    throw(exceptions.invalidValue('resampleParams must have length of 2'));
                end
    
    
                validateNumber(val, 'resampleParams must be a number array');
    
    
                if (val(1) < 0 || val(1) > 1)
                    throw(exceptions.invalidValue('resampleParams(0) must be between 0 and 1'));
                end

    which it seems Stephen wrote according to git blame. sorry for lack of clarity - was asking more from a "are 0 or 1 sensible values for this parameter" perspective so that I can make it consistent between the two, rather than asking for you to explain something you'd written!

  5. arwelHughes commented on Sep 3, 2024

    @arwelHughes
  6. alexhroom commented on Sep 6, 2024

    @alexhroom
    CollaboratorAuthor

    decided on 0 < minAngle <= 1 via looking at the algorithm: the algorithm resamples if the (smaller) angle between the line segments $(x_{n-1}, x_n)$ and $(x_n, x_{n+1})$ is strictly less than minAngle, which means 0 is not a sensible value (it just won't do any resampling at all). on the other hand if minAngle is 1, it means it will resample all points.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions