Polarization

Conventions

When specifying a polarization angle (PA) it is important to specify the direction of the source and the convention used. All of this is necessary to reconstruct the polarization vector –i.e. the direction of the electric field.

A polarization convention is defined by a set of (px,py) unit vectors (a basis) that define a plane at each location on the sphere s = [x,y,z]. The location s is always normal to the polarization plane defined by (px,py). The polarization angle increases from px to py.

Cosipy supports two major convention constructions: orthographic and stereographic. These are named after the corresponding conformal projection transformation.

In addition for the overall construction prescription, a polarization convention fully defined by the reference frame and whether the polarization angle increases clockwise or counter-clockwise when looking at the source.

Orthographic

This the regular polarization convention prescription found in the literature, where the px,py are aligned with the meridians and parallels, and one of them always points towards an arbitrary reference vector. For eample, the following figure corresponds to orthographic convention in ICRS coordinates, pointing towards the North-pole and counter-clockwise when looking at the source (only one quadrant is plotted for easier visualization):

OrthographicConvention(ref_vector = SkyCoord(ra = 0*u.deg, dec = 90*u.deg, frame = 'icrs'), clockwise = False)
OrthographicZ convention / IAU

This matches the IAU convention and can be also called by name:

PolarizationConvention.get_convention("IAU")

Other special conventions of the orthographic family that can also be called by name are MEGAlibs RelativeX/Y/Z, where the -py vector points towards the reference vector (as opposed to px):

MEGAlib RelativeZ MEGAlib RelativeX MEGAlib RelativeY

Stereographic

An issue of the orthographic projection is that it is not well-defined at the location of the reference vector and its antipodal direction. This can cause issues due to numerical errors when construction a detector response near those locations. The stereographic convention is meant to solve this issue by describing the polarization angle in spacecraft coordinates with only a single undefined location at -z, where the effective area is almost null. Due to the hairy ball theorem it is impossible to obtain a convention where the polarization basis vector have a smooth transition and with undefined locations.

Near the z-axis, it is very similar to using an orthographic convention with +x as the reference vector, and it deviates near and below the equator:

Stereographic

Converting from one convention and/or frame to another

Use the transform_to function:

pa_inertial =  PolarizationAngle(20*u.deg, source_direction, convention = 'IAU')

pa2_sc = pa.transform_to('RelativeX', attitude = Attitude.from_rotvec([0,10,0]*u.deg))

print(pa2_sc.angle.degree)

Results in 161.95. Note that in addition to accounting for the difference polarization reference vector, it also transforms from one reference frame to another on the fly.

Classes

class cosipy.polarization.PolarizationConvention[source]
classmethod register(name)[source]
classmethod get_convention(name, *args, **kwargs)[source]
get_convention_registered_name(convention_class)[source]

Opposite of get_convention. Returns None if not found.

property frame

Astropy coordinate frame

get_basis_local(source_vector: numpy.ndarray)[source]

Get the px,py unit vectors that define the polarization plane on this convention, and in the convention’s frame.

Polarization angle increments from px to py.

Parameters:

source_vector (np.ndarray) – Unit cartesian vector. Shape (3,N)

Returns:

px,py – Polarization angle increases from px to py. pz is always the opposite of the source direction –i.e. in the direction of the particle.

Return type:

np.ndarray

get_basis(source_direction: astropy.coordinates.SkyCoord, *args, **kwargs)[source]

Get the px,py unit vectors that define the polarization plane on this convention. Polarization angle increments from px to py.

Parameters:

source_direction (SkyCoord) – The direction of the source

Returns:

px,py – Polarization angle increases from px to py. pz is always the opposite of the source direction –i.e. in the direction of the particle.

Return type:

SkyCoord

class cosipy.polarization.OrthographicConvention(ref_vector: ~typing.Optional[~typing.Union[astropy.coordinates.SkyCoord, numpy.ndarray.<class 'float'>]] = None, frame: ~typing.Optional[astropy.coordinates.BaseCoordinateFrame] = None, clockwise: bool = False)[source]
property ref_vector
property is_clockwise

When looking at the source

property frame

Astropy coordinate frame

get_basis_local(source_vector: numpy.ndarray)[source]

Get the px,py unit vectors that define the polarization plane on this convention, and in the convention’s frame.

Polarization angle increments from px to py.

Parameters:

source_vector (np.ndarray) – Unit cartesian vector. Shape (3,N)

Returns:

px,py – Polarization angle increases from px to py. pz is always the opposite of the source direction –i.e. in the direction of the particle.

Return type:

np.ndarray

class cosipy.polarization.StereographicConvention(clockwise: bool = False, attitude: scoords.Attitude = None)[source]
property frame

Astropy coordinate frame

get_basis_local(source_vector: numpy.ndarray.<class 'float'>)[source]

source_vector already in SC coordinates as a vector

Parameters:

source_vector ((3,N)) –

Returns:

px,py

Return type:

Basis vector. (2,N). Also in SC coordinates

class cosipy.polarization.IAUPolarizationConvention[source]
class cosipy.polarization.PolarizationAngle(angle, source: astropy.coordinates.SkyCoord = None, convention='iau', *args, **kwargs)[source]
property angle
property convention
property source
property vector

Direction of the electric field vector

transform_to(convention, *args, **kwargs)[source]
classmethod from_scattering_direction(psichi, source_coord, convention)[source]

Calculate the azimuthal scattering angle of a scattered photon.

Parameters:
Returns:

azimuthal_scattering_angle – Azimuthal scattering angle

Return type:

cosipy.polarization.PolarizationAngle

class cosipy.polarization.PolarizationAxis(*args: Any, **kwargs: Any)[source]

Defines a polarization axis compatible with PolarizationAngle.

Parameters: edges (array-like):

Bin edges. Can be a Quantity array or PolarizationAngle

conventionPolarizationConvention

Convention defining the polarization basis in the polarization plane (for which the source direction is normal). Overrides the convention of “edges”, if a PolarizationAngle object was provided

label (str): Label for axis. If edges is an Axis object, this will

override its label

unit (unit-like): Unit for axis (will override unit of edges) copy (bool): True if edge array should be distinct from passed-in

edges; if False, will use same edge array if possible

*args, **kwargs

Passed to convention class.

property convention
find_bin(value, right=False)[source]
interp_weights(values)[source]
interp_weights_edges(values)[source]
property lower_bounds
property upper_bounds
property bounds
property lo_lim
property hi_lim
property edges
property centers