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

[Bug] - map2loop allows incorrect arguments to be passed to the set_sampler function #155

Open
1 of 4 tasks
ayLa-e opened this issue Nov 28, 2024 · 2 comments
Open
1 of 4 tasks
Assignees
Labels
bug Something isn't working
Milestone

Comments

@ayLa-e
Copy link
Contributor

ayLa-e commented Nov 28, 2024

Version

m2l version= 3.1.13

Bug Description

map2loop allows users to pass a sampler rather than a decimator as an argument to the proj.set_sampler function as shown below:

proj.set_sampler(Datatype.STRUCTURE, SamplerSpacing(100.0))

In this example the argument should be SamplerDecimator(1) not SamplerSpacing(100.0)

This produces a "KeyError: 'layerID' " runtime error message when run and will prevent structural data from being input into the project file.

Minimal reproducible example

Using the following line of code to set the structural samplers for map2loop:

proj.set_sampler(Datatype.STRUCTURE, SamplerSpacing(100.0))

Expected Behavior

Passing the wrong argument type should result in an exception with an appropriate error message to notify users of their mistake.

Actual Behavior

The user is not currently notified, other than receiving a cryptic python "KeyError: 'layerID' " error message.

Additional Context

No response

Environment

Windows Version 10.0.22621.3593, Anaconda, Jupyter notebook

Severity

  • Low
  • Medium
  • High
  • Critical
@ayLa-e ayLa-e added the bug Something isn't working label Nov 28, 2024
AngRodrigues added a commit that referenced this issue Nov 28, 2024
@AngRodrigues AngRodrigues self-assigned this Nov 28, 2024
@AngRodrigues AngRodrigues added this to the v3.2 milestone Nov 28, 2024
@lachlangrose
Copy link
Member

I think this could be fixed by separating the samplers for lines and points then doing a class check on the sampler type. I never understood why lines and points used the same class name as they are different problems.

@AngRodrigues
Copy link
Member

I think this could be fixed by separating the samplers for lines and points then doing a class check on the sampler type. I never understood why lines and points used the same class name as they are different problems.

A quick fix for the bug described in this issue has been added in #156
It's a good idea to separate lines and points; will add that to a feature request to work on in the future.

AngRodrigues added a commit that referenced this issue Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants