PhysicsSphericalVectorField

class discO.utils.PhysicsSphericalVectorField(points: BaseRepresentation, vf_phi, vf_theta=None, vf_r=None, frame: CoordinateFrame | SkyCoord | str | None = None, copy: bool = False)[source]

Bases: BaseVectorField

PhysicsSpherical Vector Field.

Attributes Summary

T

Return an instance with the data transposed.

attr_classes

components

A tuple with the in-order names of the coordinate components.

frame

info

Container for meta information like name, description, format.

isscalar

ndim

The number of dimensions of the instance and underlying arrays.

phi

points

r

shape

The shape of the instance and underlying arrays.

size

The size of the object, as calculated from its shape.

theta

vf_phi

Component 'vf_phi' of the VectorField.

vf_r

Component 'vf_r' of the VectorField.

vf_theta

Component 'vf_theta' of the VectorField.

Methods Summary

copy(*args, **kwargs)

Return an instance containing copies of the internal data.

diagonal(*args, **kwargs)

Return an instance with the specified diagonals.

flatten(*args, **kwargs)

Return a copy with the array collapsed into one dimension.

from_cartesian(other)

Convert field from 3D Cartesian coordinates to the desired class.

from_field(vectorfield)

Create a new instance of this vectorfield from another one.

get_name()

Name of the representation or differential.

norm()

Vector norm.

ravel(*args, **kwargs)

Return an instance with the array collapsed into one dimension.

represent_as(other_class)

Convert coordinates to another representation.

reshape(*args, **kwargs)

Returns an instance containing the same data with a new shape.

scale_factors()

Scale factors for each component's direction.

squeeze(*args, **kwargs)

Return an instance with single-dimensional shape entries removed.

swapaxes(*args, **kwargs)

Return an instance with the given axes interchanged.

take(indices[, axis, out, mode])

Return a new instance formed from the elements at the given indices.

to_cartesian()

Convert the field to 3D rectangular cartesian coordinates.

transpose(*args, **kwargs)

Return an instance with the data transposed.

unit_vectors()

Cartesian unit vectors in the direction of each component.

Attributes Documentation

T

Return an instance with the data transposed.

Parameters are as for T. All internal data are views of the data of the original.

attr_classes = {'vf_phi': <class 'astropy.units.quantity.Quantity'>, 'vf_r': <class 'astropy.units.quantity.Quantity'>, 'vf_theta': <class 'astropy.units.quantity.Quantity'>}
components

A tuple with the in-order names of the coordinate components.

frame
info

Container for meta information like name, description, format. This is required when the object is used as a mixin column within a table, but can be used as a general way to store meta information.

isscalar
ndim

The number of dimensions of the instance and underlying arrays.

phi
points
r
shape

The shape of the instance and underlying arrays.

Like shape, can be set to a new shape by assigning a tuple. Note that if different instances share some but not all underlying data, setting the shape of one instance can make the other instance unusable. Hence, it is strongly recommended to get new, reshaped instances with the reshape method.

Raises:
ValueError

If the new shape has the wrong total number of elements.

AttributeError

If the shape of any of the components cannot be changed without the arrays being copied. For these cases, use the reshape method (which copies any arrays that cannot be reshaped in-place).

size

The size of the object, as calculated from its shape.

theta
vf_phi

Component ‘vf_phi’ of the VectorField.

vf_r

Component ‘vf_r’ of the VectorField.

vf_theta

Component ‘vf_theta’ of the VectorField.

Methods Documentation

copy(*args, **kwargs)

Return an instance containing copies of the internal data.

Parameters are as for copy().

diagonal(*args, **kwargs)

Return an instance with the specified diagonals.

Parameters are as for diagonal(). All internal data are views of the data of the original.

flatten(*args, **kwargs)

Return a copy with the array collapsed into one dimension.

Parameters are as for flatten().

classmethod from_cartesian(other)

Convert field from 3D Cartesian coordinates to the desired class.

Parameters:
otherCartesianVectorField

The object to convert into this vector field.

Returns:
BaseVectorField

A new Vector Field object that is this class’ type.

classmethod from_field(vectorfield)

Create a new instance of this vectorfield from another one.

Parameters:
vectorfieldBaseVectorField instance

The presentation that should be converted to this class.

classmethod get_name()

Name of the representation or differential.

In lower case, with any trailing ‘representation’ or ‘differential’ removed. (E.g., ‘spherical’ for SphericalRepresentation or SphericalDifferential.)

norm() Quantity

Vector norm.

The norm is the standard Frobenius norm, i.e., the square root of the sum of the squares of all components with non-angular units.

Note that any associated differentials will be dropped during this operation.

Returns:
normastropy.units.Quantity

Vector norm, with the same shape as the representation.

ravel(*args, **kwargs)

Return an instance with the array collapsed into one dimension.

Parameters are as for ravel(). Note that it is not always possible to unravel an array without copying the data. If you want an error to be raise if the data is copied, you should should assign shape (-1,) to the shape attribute.

represent_as(other_class)

Convert coordinates to another representation.

If the instance is of the requested class, it is returned unmodified. By default, conversion is done via cartesian coordinates.

Parameters:
other_classBaseVectorField subclass

The type of representation to turn the coordinates into.

reshape(*args, **kwargs)

Returns an instance containing the same data with a new shape.

Parameters are as for reshape(). Note that it is not always possible to change the shape of an array without copying the data (see reshape() documentation). If you want an error to be raise if the data is copied, you should assign the new shape to the shape attribute (note: this may not be implemented for all classes using NDArrayShapeMethods).

scale_factors() Dict[str, Quantity]

Scale factors for each component’s direction.

Given unit vectors \(\hat{e}_c\) and scale factors \(f_c\), a change in one component of \(\delta c\) corresponds to a change in representation of \(\delta c \times f_c \times \hat{e}_c\).

Returns:
scale_factorsdict of Quantity

The keys are the component names.

squeeze(*args, **kwargs)

Return an instance with single-dimensional shape entries removed.

Parameters are as for squeeze(). All internal data are views of the data of the original.

swapaxes(*args, **kwargs)

Return an instance with the given axes interchanged.

Parameters are as for swapaxes(): axis1, axis2. All internal data are views of the data of the original.

take(indices, axis=None, out=None, mode='raise')

Return a new instance formed from the elements at the given indices.

Parameters are as for take(), except that, obviously, no output array can be given.

to_cartesian()

Convert the field to 3D rectangular cartesian coordinates.

Returns:
CartesianVectorField

This object, converted

transpose(*args, **kwargs)

Return an instance with the data transposed.

Parameters are as for transpose(). All internal data are views of the data of the original.

unit_vectors() Dict[str, BaseRepresentation]

Cartesian unit vectors in the direction of each component.

Given unit vectors \(\hat{e}_c\) and scale factors \(f_c\), a change in one component of \(\delta c\) corresponds to a change in representation of \(\delta c \times f_c \times \hat{e}_c\).

Returns:
unit_vectorsdict of CartesianRepresentation

The keys are the component names.