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

Transition lookup by Zion tuple #422

Merged
merged 3 commits into from
Oct 19, 2017

Conversation

jnburchett
Copy link
Collaborator

Make LineList.all_transitions and LineList.strongest_transitions accept Zion tuple, e.g., (8,6)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 71.746% when pulling 85a0026 on jnburchett:linelist_ions_4real into 44f0e74 on linetools:master.

@profxj profxj requested a review from ntejos October 18, 2017 11:25
Copy link
Contributor

@profxj profxj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good.
Need to add a test
And update docs (not doc string)

Copy link
Contributor

@ntejos ntejos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my comment regarding duplication of code. I also think it would be good to have a test added and update the documentation (.rst) accordingly.

@@ -595,6 +597,9 @@ def all_transitions(self, line, debug=False):
elif isinstance(line, Quantity): # Rest wavelength (with units)
data = self.__getitem__(line)
return self.all_transitions(data['name'])
elif isinstance(line, tuple): # Zion input
data = self.__getitem__(line)
return self.all_transitions(data['name'][0].split(' ')[0])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems duplication of code. You could simply replace current line 597:

elif isinstance(line, Quantity): -> elif isinstance(line, (tuple, Quantity)):.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, but then I still have test whether 'line' is a tuple because of the differences between lines 599 and 602.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spliting of name should be done in current line 596...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only if all_transitions returns just 1 transition...

Copy link
Contributor

@ntejos ntejos Oct 19, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see. I would prefer avoid duplication of code, so maybe the solution is to have the code check whether the output is dict (implying 1 transition) or Table (implying >1 transition).

@jnburchett
Copy link
Collaborator Author

We cool, @profxj and @ntejos ?

@profxj
Copy link
Contributor

profxj commented Oct 19, 2017 via email

@jnburchett
Copy link
Collaborator Author

The other examples around it are MgII, CIII, and HI!!! I'm merging.

@jnburchett jnburchett merged commit 30fb209 into linetools:master Oct 19, 2017
@coveralls
Copy link

Coverage Status

Coverage increased (+0.007%) to 71.782% when pulling b133b9f on jnburchett:linelist_ions_4real into 44f0e74 on linetools:master.

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

4 participants