Exemple #1
0
def test_add_ion_fraction_fields_to_amr_ds():
    """
    Test to add various ion fields
    """
    ds = fake_amr_ds(fields=("density", "velocity_x", "velocity_y",
                             "velocity_z", "temperature", "metallicity"))
    ad = ds.all_data()
    add_ion_fraction_field('O', 6, ds)
    field = ('gas', 'O_p5_ion_fraction')
    assert field in ds.derived_field_list
    assert isinstance(ad[field], np.ndarray)

    dirpath = tempfile.mkdtemp()
    SlicePlot(ds, 'x', field).save(dirpath)
    shutil.rmtree(dirpath)
Exemple #2
0
def test_add_ion_fraction_field_to_grid_ds():
    """
    Test to add various ion fields
    """
    ds = fake_random_ds(8,
                        fields=("density", "velocity_x", "velocity_y",
                                "velocity_z", "temperature", "metallicity"),
                        units=('g/cm**3', 'cm/s', 'cm/s', 'cm/s', 'K', ''))
    ftype = 'stream'
    ad = ds.all_data()
    add_ion_fraction_field('O', 6, ds, ftype='stream')
    field = ('stream', 'O_p5_ion_fraction')
    assert field in ds.derived_field_list
    assert isinstance(ad[field], np.ndarray)

    dirpath = tempfile.mkdtemp()
    SlicePlot(ds, 'x', field).save(dirpath)
    shutil.rmtree(dirpath)