CARTA Backend
The backend component of CARTA
Loading...
Searching...
No Matches
carta::Stokes Class Reference

#include <Stokes.h>

Collaboration diagram for carta::Stokes:
[legend]

Static Public Member Functions

static CARTA::PolarizationType Get (int value)
 Retrieves the corresponding CARTA polarization type from an integer value.
 
static CARTA::PolarizationType Get (std::string name)
 Retrieves the corresponding CARTA polarization type from a string name.
 
static casacore::Stokes::StokesTypes ToCasa (CARTA::PolarizationType type)
 Converts a CARTA polarization type to the corresponding CASA Stokes type.
 
static bool ConvertFits (const int &in_stokes_value, int &out_stokes_value)
 Converts a FITS Stokes parameter value to its corresponding internal representation.
 
static std::string Name (CARTA::PolarizationType type)
 Retrieves the name of a given CARTA polarization type.
 
static std::string Description (CARTA::PolarizationType type)
 Retrieves a descriptive string for a given CARTA polarization type.
 
static bool IsComputed (int value)
 Determines if a given polarization type is a computed polarization.
 

Static Protected Attributes

static std::unordered_map< CARTA::PolarizationType, casacore::Stokes::StokesTypes > _to_casa
 Maps CARTA polarization types to CASA Stokes types.
 
static std::unordered_map< CARTA::PolarizationType, std::string > _description
 Provides human-readable descriptions for CARTA polarization types.
 

Member Function Documentation

◆ ConvertFits()

bool Stokes::ConvertFits ( const int &  in_stokes_value,
int &  out_stokes_value 
)
static

Converts a FITS Stokes parameter value to its corresponding internal representation.

Parameters
[in]in_stokes_valueThe input FITS Stokes parameter value.
[out]out_stokes_valueThe converted Stokes parameter value.
Returns
true if the conversion was successful, false if the input value is invalid.

This function maps a FITS Stokes parameter to a valid internal Stokes value. It supports conversion of standard Stokes parameters (1 to 4) and circular/linear polarization parameters (5 to 12 and -1 to -8).

Note
Valid FITS Stokes values:
  • 1 to 4 (directly assigned)
  • 5 to 12 and -1 to -8 (converted using out_stokes_value = -in_stokes_value + 4)
Here is the caller graph for this function:

◆ Description()

std::string Stokes::Description ( CARTA::PolarizationType  type)
static

Retrieves a descriptive string for a given CARTA polarization type.

Parameters
[in]typeThe polarization type for which to retrieve a description.
Returns
A descriptive string for the given polarization type.

This function returns a human-readable description of a CARTA::PolarizationType from the _description map. If the type is not found in the map, it falls back to returning the string representation of the polarization type.

Here is the caller graph for this function:

◆ Get() [1/2]

CARTA::PolarizationType Stokes::Get ( int  value)
static

Retrieves the corresponding CARTA polarization type from an integer value.

Parameters
valueThe integer representation of a CARTA::PolarizationType.
Returns
The corresponding CARTA::PolarizationType if valid, otherwise POLARIZATION_TYPE_NONE.

This function checks if the provided integer value is a valid CARTA::PolarizationType. If valid, it returns the corresponding enumeration value. Otherwise, it returns CARTA::PolarizationType::POLARIZATION_TYPE_NONE as a fallback.

Here is the caller graph for this function:

◆ Get() [2/2]

CARTA::PolarizationType Stokes::Get ( std::string  name)
static

Retrieves the corresponding CARTA polarization type from a string name.

Parameters
nameThe string representation of a CARTA::PolarizationType.
Returns
The corresponding CARTA::PolarizationType if parsing is successful, otherwise POLARIZATION_TYPE_NONE.

This function attempts to parse a given string into a CARTA::PolarizationType. If parsing is successful, it returns the corresponding enumeration value. If the name is invalid, it returns CARTA::PolarizationType::POLARIZATION_TYPE_NONE.

◆ IsComputed()

bool Stokes::IsComputed ( int  value)
static

Determines if a given polarization type is a computed polarization.

Parameters
[in]valueThe integer representation of a CARTA::PolarizationType.
Returns
true if the value corresponds to a computed polarization type, otherwise false.

This function checks whether the provided integer value corresponds to a computed polarization type (e.g., Ptotal, Plinear, PFtotal, PFlinear, Pangle).

Here is the caller graph for this function:

◆ Name()

std::string Stokes::Name ( CARTA::PolarizationType  type)
static

Retrieves the name of a given CARTA polarization type.

Parameters
[in]typeThe polarization type to retrieve the name for.
Returns
The string representation of the given polarization type.

This function returns the string representation of a CARTA::PolarizationType using the CARTA::PolarizationType_Name function.

◆ ToCasa()

casacore::Stokes::StokesTypes Stokes::ToCasa ( CARTA::PolarizationType  type)
static

Converts a CARTA polarization type to the corresponding CASA Stokes type.

Parameters
typeThe CARTA::PolarizationType to convert.
Returns
The corresponding casacore::Stokes::StokesTypes value.
Exceptions
std::out_of_rangeIf the provided type is not found in the mapping.

This function maps a CARTA::PolarizationType to its equivalent casacore::Stokes::StokesTypes using a predefined lookup table. If the provided type is not found in the mapping, an std::out_of_range exception may be thrown.

Here is the caller graph for this function:

Member Data Documentation

◆ _description

std::unordered_map< CARTA::PolarizationType, std::string > Stokes::_description
staticprotected
Initial value:
{{CARTA::PolarizationType::POLARIZATION_TYPE_NONE, "Unknown"},
{CARTA::PolarizationType::I, "Stokes I"}, {CARTA::PolarizationType::Q, "Stokes Q"}, {CARTA::PolarizationType::U, "Stokes U"},
{CARTA::PolarizationType::V, "Stokes V"}, {CARTA::PolarizationType::Ptotal, "Total polarization intensity"},
{CARTA::PolarizationType::Plinear, "Linear polarization intensity"},
{CARTA::PolarizationType::PFtotal, "Fractional total polarization intensity"},
{CARTA::PolarizationType::PFlinear, "Fractional linear polarization intensity"},
{CARTA::PolarizationType::Pangle, "Polarization angle"}}

Provides human-readable descriptions for CARTA polarization types.

This unordered map associates each CARTA::PolarizationType enumeration value with a corresponding descriptive string. It is used to provide user-friendly labels for polarization types in logs, UI displays, or reports.

◆ _to_casa

std::unordered_map< CARTA::PolarizationType, casacore::Stokes::StokesTypes > Stokes::_to_casa
staticprotected
Initial value:
{
{CARTA::PolarizationType::POLARIZATION_TYPE_NONE, casacore::Stokes::StokesTypes::Undefined},
{CARTA::PolarizationType::I, casacore::Stokes::StokesTypes::I}, {CARTA::PolarizationType::Q, casacore::Stokes::StokesTypes::Q},
{CARTA::PolarizationType::U, casacore::Stokes::StokesTypes::U}, {CARTA::PolarizationType::V, casacore::Stokes::StokesTypes::V},
{CARTA::PolarizationType::RR, casacore::Stokes::StokesTypes::RR}, {CARTA::PolarizationType::LL, casacore::Stokes::StokesTypes::LL},
{CARTA::PolarizationType::RL, casacore::Stokes::StokesTypes::RL}, {CARTA::PolarizationType::LR, casacore::Stokes::StokesTypes::LR},
{CARTA::PolarizationType::XX, casacore::Stokes::StokesTypes::XX}, {CARTA::PolarizationType::YY, casacore::Stokes::StokesTypes::YY},
{CARTA::PolarizationType::XY, casacore::Stokes::StokesTypes::XY}, {CARTA::PolarizationType::YX, casacore::Stokes::StokesTypes::YX},
{CARTA::PolarizationType::Ptotal, casacore::Stokes::StokesTypes::Ptotal},
{CARTA::PolarizationType::Plinear, casacore::Stokes::StokesTypes::Plinear},
{CARTA::PolarizationType::PFtotal, casacore::Stokes::StokesTypes::PFtotal},
{CARTA::PolarizationType::PFlinear, casacore::Stokes::StokesTypes::PFlinear},
{CARTA::PolarizationType::Pangle, casacore::Stokes::StokesTypes::Pangle}}

Maps CARTA polarization types to CASA Stokes types.

This unordered map provides a conversion between the CARTA::PolarizationType enumeration and the corresponding casacore::Stokes::StokesTypes enumeration. It is used to translate polarization representations between the two frameworks.


The documentation for this class was generated from the following files: