-
Notifications
You must be signed in to change notification settings - Fork 35
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
LLS: Some edits for the LLS GUI #103
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ | |
from linetools.analysis import absline as ltaa | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should you move lls.py to the IGM package instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not today and this needs to be done now. |
||
from linetools.lists.linelist import LineList | ||
from linetools.isgm.abssystem import AbsSystem, AbsSubSystem | ||
from linetools.isgm.abscomponent import AbsComponent | ||
from linetools.isgm import utils as ltiu | ||
from linetools.isgm.abssurvey import AbslineSurvey | ||
from linetools.abund import ions as ltai | ||
|
@@ -253,15 +254,20 @@ def get_ions(self, use_Nfile=False, idict=None, update_zvlim=True, linelist=None | |
else: | ||
raise ValueError("Need an option in get_ions") | ||
|
||
def fill_lls_lines(self, bval=20.*u.km/u.s): | ||
def fill_lls_lines(self, bval=20.*u.km/u.s, do_analysis=1): | ||
""" | ||
Generate an HI line list for an LLS. | ||
Goes into self.lls_lines | ||
|
||
Now generates a component too. | ||
Should have it check for an existing HI component.. | ||
|
||
Parameters | ||
---------- | ||
bval : float, optional | ||
Doppler parameter in km/s | ||
do_analysis : int, optional | ||
flag for analysis | ||
""" | ||
from linetools.lists import linelist as lll | ||
|
||
|
@@ -275,10 +281,12 @@ def fill_lls_lines(self, bval=20.*u.km/u.s): | |
aline.attrib['N'] = 10**self.NHI / u.cm**2 | ||
aline.attrib['b'] = bval | ||
aline.attrib['z'] = self.zabs | ||
# Could set RA and DEC too | ||
aline.attrib['RA'] = self.coord.ra | ||
aline.attrib['DEC'] = self.coord.dec | ||
aline.analy['vlim'] = self.vlim | ||
aline.analy['do_analysis'] = do_analysis | ||
aline.attrib['coord'] = self.coord | ||
self.lls_lines.append(aline) | ||
# Generate a component (should remove any previous HI) | ||
self.add_component(AbsComponent.from_abslines(self.lls_lines)) | ||
|
||
def flux_model(self, spec, smooth=0): | ||
""" Generate a LLS model given an input spectrum | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Module to run tests on generating AbsSystem | ||
|
||
from __future__ import print_function, absolute_import, division, unicode_literals | ||
|
||
# TEST_UNICODE_LITERALS | ||
|
||
import pytest | ||
from astropy import units as u | ||
from astropy.coordinates import SkyCoord | ||
import numpy as np | ||
|
||
from linetools.isgm.abscomponent import AbsComponent | ||
from linetools.isgm.abssystem import GenericAbsSystem, LymanAbsSystem | ||
from linetools.spectralline import AbsLine | ||
|
||
import pdb | ||
|
||
def test_list_of_abslines(): | ||
radec = SkyCoord(ra=123.1143*u.deg, dec=-12.4321*u.deg) | ||
# HI Lya, Lyb | ||
lya = AbsLine(1215.670*u.AA) | ||
lya.analy['vlim'] = [-300.,300.]*u.km/u.s | ||
lya.attrib['z'] = 2.92939 | ||
lyb = AbsLine(1025.7222*u.AA) | ||
lyb.analy['vlim'] = [-300.,300.]*u.km/u.s | ||
lyb.attrib['z'] = lya.attrib['z'] | ||
abscomp = AbsComponent.from_abslines([lya,lyb]) | ||
abscomp.coord = radec | ||
# SiII | ||
SiIItrans = ['SiII 1260', 'SiII 1304', 'SiII 1526', 'SiII 1808'] | ||
abslines = [] | ||
for trans in SiIItrans: | ||
iline = AbsLine(trans) | ||
iline.attrib['z'] = 2.92939 | ||
iline.analy['vlim'] = [-250.,80.]*u.km/u.s | ||
abslines.append(iline) | ||
# | ||
SiII_comp = AbsComponent.from_abslines(abslines) | ||
SiII_comp.coord = radec | ||
# Instantiate | ||
gensys = GenericAbsSystem.from_components([abscomp,SiII_comp]) | ||
# Now the list | ||
abslines = gensys.list_of_abslines() | ||
# Test | ||
assert len(abslines) == 6 | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Duplicate statements.