예제 #1
0
    def test_to_yt(self, tmpdir, grid_type):

        from yt.mods import ProjectionPlot

        g = self.grid[grid_type]
        g['density'] = []
        g['density'].append(self.density[grid_type])
        pf = g.to_yt()

        p = ProjectionPlot(pf, 'x', ["density"], center='c', origin='native')
        p.save(tmpdir.join('test.png').strpath)
예제 #2
0
    def test_to_yt(self, tmpdir, grid_type):

        from yt.mods import ProjectionPlot

        g = self.grid[grid_type]
        g['density'] = []
        g['density'].append(self.density[grid_type])
        pf = g.to_yt()

        p = ProjectionPlot(pf, 'x', ["density"], center='c', origin='native')
        p.save(tmpdir.join('test.png').strpath)
예제 #3
0
    def test_to_yt(self, tmpdir, grid_type):

        from yt.mods import ProjectionPlot

        g = self.grid[grid_type]
        g['density'] = []
        g['density'].append(self.density[grid_type])
        pf = g.to_yt()

        # TEMP: xfail due to bug in yt
        # https://bitbucket.org/yt_analysis/yt/pull-requests/2362/fix-type-issue-in-octree-construction/diff
        if grid_type == 'oct':
            pytest.xfail()

        p = ProjectionPlot(pf, 'x', ["density"], center='c', origin='native')
        p.save(tmpdir.join('test.png').strpath)
예제 #4
0
                Electron_Temperature=temp_e,
                Electron_Density=dens_e)


def _parse_plotout(path, domain_dims):
    data = {}
    lines = np.loadtxt(_valid_gridfile(path, 'plot.out'), dtype=np.float64)
    for lno in range(1, lines.shape[1]):
        data['Emission_Line_%i' % lno] = lines[:, lno].reshape(domain_dims)
    return data


def load_mocassin(path):
    if not os.path.isdir(path):
        raise OSError("%s is not a valid directory" % path)

    domain_dims, domain_edges = _parse_grid0(path)
    data = _parse_grid1(path, domain_dims)
    data.update(_parse_plotout(path, domain_dims))
    return load_uniform_grid(data, np.array(domain_dims), 1, bbox=domain_edges)


if __name__ == "__main__":
    pf = load_mocassin('/tmp/mokasyn')
    from yt.mods import ProjectionPlot
    c = pf.domain_center
    c[2] = 0.0
    for field in pf.h.field_list:
        slc = ProjectionPlot(pf, 'z', field, center=c)
        slc.save()