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

Class Guessing Implementation #74

Merged
merged 11 commits into from
Nov 5, 2018
Merged

Conversation

T-Nicholls
Copy link
Contributor

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.

@T-Nicholls T-Nicholls mentioned this pull request Oct 17, 2018
@willrogers
Copy link
Contributor

This is an excellent candidate for some unit tests - it will be easier to tweak the implementation once you have some tests.

@T-Nicholls
Copy link
Contributor Author

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.



@pytest.fixture
def rin():
rin = numpy.array(numpy.zeros((6, 1)), order='F')
return rin

@pytest.fixture(scope='session')
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@lfarv
Copy link
Contributor

lfarv commented Nov 4, 2018

Is this ready for merging ? I would like to take benefit of it !

@willrogers
Copy link
Contributor

This looks generally OK. I'm still not sure why you redefine the constants at the top of test_load_mat.py - you could just use the constants in the code. Otherwise we can merge this.

@T-Nicholls
Copy link
Contributor Author

Corrected.
Ready to merge

@willrogers willrogers merged commit d9522df into atcollab:master Nov 5, 2018
@T-Nicholls T-Nicholls deleted the classGuessing branch November 7, 2018 17:36
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.

None yet

3 participants