-
Notifications
You must be signed in to change notification settings - Fork 31
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
Class Guessing Implementation #74
Conversation
This is an excellent candidate for some unit tests - it will be easier to tweak the implementation once you have some tests. |
I think this is complete. Please ignore my comment about all elements having length, I realise now that they only do after element creation. My comment concerning the misidentifying skew quadrupoles is still valid though. I will remove both comments on my next commit. |
pyat/test/conftest.py
Outdated
|
||
|
||
@pytest.fixture | ||
def rin(): | ||
rin = numpy.array(numpy.zeros((6, 1)), order='F') | ||
return rin | ||
|
||
@pytest.fixture(scope='session') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need these fixtures? Can't you just use load_mat.CLASSES
in the tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried it and it didn't work...I can't remember why though. I'll take another look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apologies, it doesn't work with pytest.mark.parametrize or passing it as an argument without fixtures. It does however work if you just define it at the top of the file and then don't pass it as an argument to the tests. I'll commit this change as it's simpler than using fixtures.
Is this ready for merging ? I would like to take benefit of it ! |
This looks generally OK. I'm still not sure why you redefine the constants at the top of |
Corrected. |
Lots of basic logic to hopefully better identify element Classes. This function will misidentify rather than not identify a class, though it is unlikely that this will have an effect on the essential functions or twiss data of the ring. The sanitisation function should also catch most PassMethod/Class incompatibilities that would otherwise raise an error during atpass.