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

warning added for density file readin outside tabulated range #121

Merged
merged 1 commit into from
Apr 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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