[yt-dev] Issue #1035: defining a bounding box causes units problems in tipsy data sets (yt_analysis/yt)

Desika Narayanan issues-reply at bitbucket.org
Tue Jun 23 10:46:43 PDT 2015


New issue 1035: defining a bounding box causes units problems in tipsy data sets
https://bitbucket.org/yt_analysis/yt/issue/1035/defining-a-bounding-box-causes-units

Desika Narayanan:

Hey All,

FYI, this may be related to [PR # 1524](https://bitbucket.org/yt_analysis/yt/pull-request/1524/added-functionality-for-a-bounding_box-for/diff)

 If I run the following on the tipsy data set:

```
import yt
import numpy as np

fname = 'TipsyGalaxy/galaxy.00300'


boxsize = 100
bbox = [[-boxsize,boxsize],
        [-boxsize,boxsize],
        [-boxsize,boxsize]]


ds = yt.load(fname,bounding_box=bbox)
ds.index



px = yt.ProjectionPlot(ds,"z",('deposit', 'Gas_density'),center='m')
px.save('junk.z.png')
```

I'll get an image back out that has the galaxy as 50 cm big!   However, if I run the same code but replace the load command with:

```
ds = yt.load(fname)
```

then no problem.

Another way this manifests itself is if I load with the bounding_box set in the load command, then:

```
In [11]: ds.length_unit
Out[11]: 1.0 kpc

In [12]: ds.domain_left_edge
Out[12]: YTArray([-100., -100., -100.]) code_length

In [13]: ds.domain_left_edge.in_units('kpc')
Out[13]: YTArray([ -3.24077929e-20,  -3.24077929e-20,  -3.24077929e-20]) kpc
```

I've looked through frontends/tipsy/data_structures and can't seem to figure what's doing this.

Again, this might not be related to this PR, but it sure seems similar.





More information about the yt-dev mailing list