Rational

class pyarts.arts.Rational(*args, **kwargs)

Holds a rational number as two Index n / d

Overview

Method

readxml()

Read variable from file

Method

savexml()

Saves variable to file

Static Method

fromxml()

Create variable from file

Attribute

d

int Denominator

Attribute

n

int Numerator

Operator

__add__()

__add__(self, arg: pyarts.arts.Rational, /) -> pyarts.arts.Rational

Operator

__eq__()

__eq__(self, arg: pyarts.arts.Rational, /) -> bool

Operator

__ge__()

__ge__(self, arg: pyarts.arts.Rational, /) -> bool

Operator

__gt__()

__gt__(self, arg: pyarts.arts.Rational, /) -> bool

Operator

__hash__()

Return hash(self).

Operator

__iadd__()

__iadd__(self, arg: pyarts.arts.Rational, /) -> pyarts.arts.Rational

Operator

__imul__()

__imul__(self, arg: pyarts.arts.Rational, /) -> pyarts.arts.Rational

Operator

__isub__()

__isub__(self, arg: pyarts.arts.Rational, /) -> pyarts.arts.Rational

Operator

__itruediv__()

__itruediv__(self, arg: pyarts.arts.Rational, /) -> pyarts.arts.Rational

Operator

__le__()

__le__(self, arg: pyarts.arts.Rational, /) -> bool

Operator

__lt__()

__lt__(self, arg: pyarts.arts.Rational, /) -> bool

Operator

__mul__()

__mul__(self, arg: pyarts.arts.Rational, /) -> pyarts.arts.Rational

Operator

__ne__()

__ne__(self, arg: pyarts.arts.Rational, /) -> bool

Operator

__radd__()

__radd__(self, arg: int, /) -> pyarts.arts.Rational

Operator

__rmul__()

__rmul__(self, arg: int, /) -> pyarts.arts.Rational

Operator

__rsub__()

__rsub__(self, arg: int, /) -> pyarts.arts.Rational

Operator

__rtruediv__()

__rtruediv__(self, arg: int, /) -> pyarts.arts.Rational

Operator

__truediv__()

__truediv__(self, arg: pyarts.arts.Rational, /) -> pyarts.arts.Rational

Constructors

__init__(self, n: int = 0, d: int = 1) None
__init__(self, arg: str, /) None
__init__(self) None
__init__(self, arg: pyarts.arts.Rational) None

Overloaded function.

  1. __init__(self, n: int = 0, d: int = 1) -> None

Default rational

  1. __init__(self, arg: str, /) -> None

From str

  1. __init__(self) -> None

  2. __init__(self, arg: pyarts.arts.Rational) -> None

Methods

readxml(self, file: str) None

Read variable from file

Parameters:

file (str) – A file that can be read

On Error:

Throws RuntimeError for any failure to read

savexml(self, file: str, type: str = 'ascii', clobber: bool = True) None

Saves variable to file

Parameters:
  • file (str) – The path to which the file is written. Note that several of the options might modify the name or write more files

  • type (str) – Type of file to save. See FileType for options.

  • clobber (bool) – Overwrite existing files or add new file with modified name?

On Error:

Throws RuntimeError for any failure to save

Static Methods

fromxml(file: str) pyarts.arts.Rational

Create variable from file

Parameters:

file (str) – A file that can be read

On Error:

Throws RuntimeError for any failure to read

Attributes

d

int Denominator

n

int Numerator

Operators

__add__(self, arg: int, /) pyarts.arts.Rational
__add__(self, arg: pyarts.arts.Rational, /) pyarts.arts.Rational
__eq__(self, arg: int, /) bool
__eq__(self, arg: int, /) bool
__eq__(self, arg: pyarts.arts.Rational, /) bool
__ge__(self, arg: int, /) bool
__ge__(self, arg: int, /) bool
__ge__(self, arg: pyarts.arts.Rational, /) bool
__gt__(self, arg: int, /) bool
__gt__(self, arg: int, /) bool
__gt__(self, arg: pyarts.arts.Rational, /) bool
__hash__()

Return hash(self).

__iadd__(self, arg: int, /) pyarts.arts.Rational
__iadd__(self, arg: pyarts.arts.Rational, /) pyarts.arts.Rational
__imul__(self, arg: int, /) pyarts.arts.Rational
__imul__(self, arg: pyarts.arts.Rational, /) pyarts.arts.Rational
__isub__(self, arg: int, /) pyarts.arts.Rational
__isub__(self, arg: pyarts.arts.Rational, /) pyarts.arts.Rational
__itruediv__(self, arg: int, /) pyarts.arts.Rational
__itruediv__(self, arg: pyarts.arts.Rational, /) pyarts.arts.Rational
__le__(self, arg: int, /) bool
__le__(self, arg: int, /) bool
__le__(self, arg: pyarts.arts.Rational, /) bool
__lt__(self, arg: int, /) bool
__lt__(self, arg: int, /) bool
__lt__(self, arg: pyarts.arts.Rational, /) bool
__mul__(self, arg: int, /) pyarts.arts.Rational
__mul__(self, arg: pyarts.arts.Rational, /) pyarts.arts.Rational
__ne__(self, arg: int, /) bool
__ne__(self, arg: int, /) bool
__ne__(self, arg: pyarts.arts.Rational, /) bool
__radd__(self, arg: int, /) pyarts.arts.Rational
__rmul__(self, arg: int, /) pyarts.arts.Rational
__rsub__(self, arg: int, /) pyarts.arts.Rational
__rtruediv__(self, arg: int, /) pyarts.arts.Rational
__truediv__(self, arg: int, /) pyarts.arts.Rational
__truediv__(self, arg: pyarts.arts.Rational, /) pyarts.arts.Rational