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

Custom Density File Interaction with YAML v_inner_boundary #908

Closed
marxwillia opened this issue Mar 26, 2019 · 2 comments
Closed

Custom Density File Interaction with YAML v_inner_boundary #908

marxwillia opened this issue Mar 26, 2019 · 2 comments
Assignees

Comments

@marxwillia
Copy link
Contributor

As previously noted in Issue #807 the structure of custom density files is very easily misinterpreted. When a custom density file is specified, the first line specifies the inner boundary velocity and density (the density within the inner boundary is not used, and therefore a placeholder value can be specified).

Consider an example custom density file:

0        9500        9e-16
1        10500        6e-16
2         12000        2e-17

If the user does not specify inner and outer velocities in the configuration YAML file, then this custom density file will set up a TARDIS grid with only 2 layers. The first line sets the inner boundary velocity = 9500, and the density within the inner boundary is ignored (so 9e-16 could be replaced with a placeholder value). The outer boundary velocity will be set to 12000.

However, the user may specify the inner and outer boundary velocities in the configuration YAML file IN ADDITION to the custom density file. These will only have an effect if the user specified values fall WITHIN the velocity range specified in the custom density file. Otherwise, TARDIS completely ignores the user specified boundary velocities. This can result in the following misinterpretation:

The user may specify the custom density file from above, in addition to setting v_inner_boundary = 8900 in the YAML config file. The user may expect that by explicitly setting v_inner_boundar = 8900, that this combined with the custom density file will result in a TARDIS grid with three zones:

zone 1: 8900 < v < 9500
zone 2: 9500 < v < 10500
zone 3: 10500 < v < 12000

However this is wrong. Because the user specified inner boundary is not within the velocity range of the custom density file, then v_inner_boundary = 8900 will be ignored, and the TARDIS grid will only be two zones:

zone 1: 9500 < v < 10500
zone 2: 10500 < v < 12000

The documentation page on custom density files needs to be updated to be clearer about this issue: https://tardis.readthedocs.io/en/latest/examples/densitycust.html

@marxwillia
Copy link
Contributor Author

In the case where the user specifies a boundary velocity that is ignored by TARDIS due to the custom density file, the Radial1DModel v_boundary_inner attribute setter could provide a helpful message to the user. Currently it quietly ignores the user specified boundary velocity:

tardis/tardis/model/base.py

Lines 225 to 239 in 592cc80

@v_boundary_inner.setter
def v_boundary_inner(self, value):
if value is not None:
value = u.Quantity(value, self.v_boundary_inner.unit)
if value > self.v_boundary_outer:
raise ValueError('v_boundary_inner must not be higher than '
'v_boundary_outer.')
if value > self.raw_velocity[-1]:
raise ValueError('v_boundary_inner is outside of '
'the model range.')
if value <= self.raw_velocity[0]:
value = None
self._v_boundary_inner = value
# Invalidate the cached cut-down velocity array
self._velocity = None

I think a message inserted between these two lines would be helpful:

tardis/tardis/model/base.py

Lines 235 to 236 in 592cc80

if value <= self.raw_velocity[0]:
value = None

@wkerzendorf
Copy link
Member

Is this done @marxwillia

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

No branches or pull requests

2 participants