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

AbsComponent work #414

Merged
merged 9 commits into from
Oct 10, 2017
Merged

AbsComponent work #414

merged 9 commits into from
Oct 10, 2017

Conversation

profxj
Copy link
Contributor

@profxj profxj commented Oct 1, 2017

Started as a simple bug fix but worked into a
refactor of table_from_complist() and its opposite.

Modified docs, tests, and NB

@profxj profxj requested a review from ntejos October 1, 2017 22:55
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 71.785% when pulling e3e6bbd on uniq_bug_fix into 0df35cb on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 71.785% when pulling a6cbc6a on uniq_bug_fix into 0df35cb on master.

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.

Some comments for revision.

@@ -64,6 +64,11 @@ from the hard-drive::

::::

One may also generate a set of components from a larger
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it a set or a list?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

list; fixed

(mandatory column names include: `['RA', 'DEC', 'ion_name', 'z_comp', 'vmin', 'vmax']`)::
You can also create a list of components using an input `astropy.table.Table` object
(mandatory column names are
`['RA', 'DEC', 'ion_name', 'z_comp', 'vmin', 'vmax', 'Z', 'ion', 'Ej']`)::
Copy link
Contributor

Choose a reason for hiding this comment

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

Is ion_name mandatory?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

docs/abscomp.rst Outdated
to each corresponding AbsComponent in the `complist`. In this example, only those AbsLines expected to have rest-frame
equivalent widths larger than `0.01*u.AA` will be appended, but if you wish to include all of the available AbsLines
you can set `min_Wr=None`. Here, we have set `chk_sep=False` to avoid checking for coordinates because by construction the
This will look for transitions in the `LineList('ISM')` object and append those within
Copy link
Contributor

Choose a reason for hiding this comment

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

remove "within" in this line

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

docs/abscomp.rst Outdated
tab['ion_name'] = ['HI', 'HI', 'CIV', 'SiII', 'OVI']
tab['Z'] = [1,1,4,14,8]
tab['ion'] = [1,1,4,2,6]
tab['z_comp'] = [0.05, 0.0999, 0.1, 0.1001, 0.3]
Copy link
Contributor

Choose a reason for hiding this comment

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

Ej?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch

@@ -270,7 +271,7 @@ def complist_from_table(table):

Notes
-----
Mandatory column names: 'RA', 'DEC', 'ion_name', 'z_comp', 'vmin', 'vmax'
Mandatory column names: 'RA', 'DEC', 'ion_name', 'z', 'vmin', 'vmax'
Copy link
Contributor

Choose a reason for hiding this comment

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

should be z_comp, to differenciate from Z.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yup

else:
if table[key].unit is not None:
abscomp.attrib[key] *= table[key].unit
complist.append(abscomp)
Copy link
Contributor

Choose a reason for hiding this comment

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

Or check all units properly afterwards here... but cannot have column with wrong units in the output AbsComponent.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I follow this one.

@@ -360,29 +347,61 @@ def table_from_complist(complist):
Special columns: 'name', 'comment', 'logN', 'sig_logN', 'flag_logN'
See also complist_from_table()
"""
key_order = ['RA', 'DEC', 'name', 'z_comp', 'sig_z', 'Z', 'ion', 'Ej',
'vmin', 'vmax','ion_name', 'flag_N', 'logN', 'sig_logN',
'b','sig_b', 'specfile']
Copy link
Contributor

Choose a reason for hiding this comment

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

reliability should be included

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is introduced later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine. Please update the docstring accordingly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added

tab['ion'] = [icomp.Zion[1] for icomp in complist]

# . attributes
for attrib in ['zcomp', 'Ej', 'flag_N', 'logN', 'sig_logN']:
Copy link
Contributor

Choose a reason for hiding this comment

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

add reliability and comment here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

noted that these are required.

tab['name'] = [comp.name for comp in complist]
tab['reliability'] = [comp.reliability for comp in complist]
for key in ['comment', 'reliability']:
if hasattr(complist[0], key):
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of being separated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

comment and reliability are not required
so I prefer to separate them.

Copy link
Contributor

Choose a reason for hiding this comment

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

fine.

@@ -407,6 +426,7 @@ def iontable_from_components(components, ztbl=None, NHI_obj=None):
-------
iontbl : Table
"""
warnings.warn("It is likely this method will be Deprecated", DeprecationWarning)
Copy link
Contributor

Choose a reason for hiding this comment

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

Fine by me, do not think I have used this much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

k

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 71.803% when pulling 323710e on uniq_bug_fix into 9ff0b74 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 71.803% when pulling 323710e on uniq_bug_fix into 9ff0b74 on master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.05%) to 71.803% when pulling f1b0daf on uniq_bug_fix into 9ff0b74 on master.

@ntejos
Copy link
Contributor

ntejos commented Oct 10, 2017

I'm still not fully convinced with the units thing... I feel is important to have that check done.

@profxj
Copy link
Contributor Author

profxj commented Oct 10, 2017

I'm willing to have a warning thrown. But
that is far as I'll go. Compromise @ntejos ?

@ntejos
Copy link
Contributor

ntejos commented Oct 10, 2017

Sure, a warning should do. Fine to merge after the warning is implemented.

@profxj
Copy link
Contributor Author

profxj commented Oct 10, 2017

done. merging

@profxj profxj merged commit 211ffff into master Oct 10, 2017
@profxj profxj deleted the uniq_bug_fix branch October 10, 2017 20:40
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