示例#1
0
    def _cylindrical_z_component(field, data):
        """The cylindrical z component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
        return get_cyl_z_component(vectors, normal)
    def _cylindrical_z_component(field, data):
        """The cylindrical z component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
        return get_cyl_z_component(vectors, normal)
示例#3
0
    def _cylindrical_radius_component(field, data):
        """The cylindrical radius component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
        theta = resize_vector(data["index", 'cylindrical_theta'], vectors)
        return get_cyl_r_component(vectors, theta, normal)
示例#4
0
    def _spherical_phi_component(field, data):
        """The spherical phi component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
        phi = resize_vector(data["index", "spherical_phi"], vectors)
        return get_sph_phi_component(vectors, phi, normal)
示例#5
0
 def _radial(field, data):
     normal = data.get_field_parameter("normal")
     vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
     theta = data['index', 'spherical_theta']
     phi = data['index', 'spherical_phi']
     rv = get_sph_r_component(vectors, theta, phi, normal)
     # Now, anywhere that radius is in fact zero, we want to zero out our
     # return values.
     rv[np.isnan(theta)] = 0.0
     return rv
示例#6
0
    def _cylindrical_theta_component(field, data):
        """The cylindrical theta component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
        theta = data["index", 'cylindrical_theta'].copy()
        theta = np.tile(theta, (3, ) + (1, ) * len(theta.shape))
        return get_cyl_theta_component(vectors, theta, normal)
    def _cylindrical_radius_component(field, data):
        """The cylindrical radius component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn),
                                "bulk_%s" % basename)
        theta = resize_vector(data["index", 'cylindrical_theta'], vectors)
        return get_cyl_r_component(vectors, theta, normal)
    def _spherical_phi_component(field, data):
        """The spherical phi component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn),
                                "bulk_%s" % basename)
        phi = resize_vector(data["index", "spherical_phi"], vectors)
        return get_sph_phi_component(vectors, phi, normal)
def test_obtain_rv_vec():
    ds = fake_random_ds(64, nprocs=8, fields=_fields, 
           negative = [False, True, True, True])

    dd = ds.all_data()

    vels = obtain_rv_vec(dd)

    assert_array_equal(vels[0,:], dd['velocity_x'])
    assert_array_equal(vels[1,:], dd['velocity_y'])
    assert_array_equal(vels[2,:], dd['velocity_z'])
    def _cylindrical_theta_component(field, data):
        """The cylindrical theta component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn),
                                "bulk_%s" % basename)
        theta = data["index", 'cylindrical_theta'].copy()
        theta = np.tile(theta, (3,) + (1,)*len(theta.shape))
        return get_cyl_theta_component(vectors, theta, normal)
示例#11
0
def test_obtain_rv_vec():
    ds = fake_random_ds(64,
                        nprocs=8,
                        fields=_fields,
                        negative=[False, True, True, True])

    dd = ds.all_data()

    vels = obtain_rv_vec(dd)

    assert_array_equal(vels[0, :], dd['velocity_x'])
    assert_array_equal(vels[1, :], dd['velocity_y'])
    assert_array_equal(vels[2, :], dd['velocity_z'])
示例#12
0
    def _spherical_radius_component(field, data):
        """The spherical radius component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
        theta = data['index', 'spherical_theta']
        phi = data['index', 'spherical_phi']
        rv = get_sph_r_component(vectors, theta, phi, normal)
        # Now, anywhere that radius is in fact zero, we want to zero out our
        # return values.
        rv[np.isnan(theta)] = 0.0
        return rv
    def _spherical_radius_component(field, data):
        """The spherical radius component of the vector field

        Relative to the coordinate system defined by the *normal* vector,
        *center*, and *bulk_* field parameters.
        """
        normal = data.get_field_parameter("normal")
        vectors = obtain_rv_vec(data, (xn, yn, zn),
                                "bulk_%s" % basename)
        theta = data['index', 'spherical_theta']
        phi = data['index', 'spherical_phi']
        rv = get_sph_r_component(vectors, theta, phi, normal)
        # Now, anywhere that radius is in fact zero, we want to zero out our
        # return values.
        rv[np.isnan(theta)] = 0.0
        return rv
示例#14
0
 def _cylindrical_tangential(field, data):
     normal = data.get_field_parameter("normal")
     vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
     theta = data["index", 'cylindrical_theta'].copy()
     theta = np.tile(theta, (3, ) + (1, ) * len(theta.shape))
     return get_cyl_theta_component(vectors, theta, normal)
示例#15
0
 def _cylindrical_radial(field, data):
     normal = data.get_field_parameter("normal")
     vectors = obtain_rv_vec(data, (xn, yn, zn), "bulk_%s" % basename)
     theta = resize_vector(data["index", 'cylindrical_theta'], vectors)
     return get_cyl_r_component(vectors, theta, normal)