Skip to content

Commit

Permalink
Merge pull request #121 from ssim/change_innerboundary
Browse files Browse the repository at this point in the history
warning added for density file readin outside tabulated range
  • Loading branch information
wkerzendorf committed Apr 14, 2014
2 parents bd88c4e + 488100a commit 75a7968
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Bugfixes
- warning added to documentation since plasma is out of date (temp
solution only) #108
- fix to binary search to deal with packets at end of line list
- warning added for density file readin outside tabulated range


New Features
^^^^^^^^^^^^
Expand Down
8 changes: 7 additions & 1 deletion tardis/io/model_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import pandas as pd
from astropy import units as u

import logging
# Adding logging support
logger = logging.getLogger(__name__)

from tardis.util import parse_quantity

Expand Down Expand Up @@ -37,7 +40,7 @@ def read_density_file(density_filename, density_filetype, time_explosion, v_inne

if v_inner_boundary > v_outer_boundary:
raise ConfigurationError('v_inner_boundary > v_outer_boundary ({0:s} > {1:s}). unphysical!'.format(v_inner_boundary, v_outer_boundary))

if not np.isclose(v_inner_boundary, 0.0) and v_inner_boundary > v_inner[0]:

if v_inner_boundary > v_outer[-1]:
Expand All @@ -48,13 +51,16 @@ def read_density_file(density_filename, density_filetype, time_explosion, v_inne
else:
inner_boundary_index = None
v_inner_boundary = v_inner[0]
logger.warning("v_inner_boundary requested too small for readin file. Boundary shifted to match file.")

if not np.isinf(v_outer_boundary) and v_outer_boundary < v_outer[-1]:
outer_boundary_index = v_outer.searchsorted(v_outer_boundary) + 1
else:
outer_boundary_index = None
v_outer_boundary = v_outer[-1]
logger.warning("v_outer_boundary requested too large for readin file. Boundary shifted to match file.")


v_inner = v_inner[inner_boundary_index:outer_boundary_index]
v_inner[0] = v_inner_boundary

Expand Down

0 comments on commit 75a7968

Please sign in to comment.