Rational

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

Holds a rational number as two Index

\[x = \frac{a}{b}\]

where \(a\) is the numerator and \(b\) is the denominator.

Overview

Method

readxml()

Read variable from file.

Method

savexml()

Saves variable to file.

Static Method

fromxml()

Create variable from file.

Index

d

Denominator

Index

n

Numerator

Operator

__add__()

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

Operator

__eq__()

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

Operator

__format__()

__format__(self, arg: str, /) -> str

Operator

__ge__()

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

Operator

__getstate__()

__getstate__(self) -> tuple[int, int]

Operator

__gt__()

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

Operator

__hash__()

Return hash(self).

Operator

__iadd__()

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

Operator

__imul__()

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

Operator

__init__()

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

Operator

__isub__()

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

Operator

__itruediv__()

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

Operator

__le__()

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

Operator

__lt__()

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

Operator

__mul__()

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

Operator

__ne__()

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

Operator

__radd__()

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

Operator

__repr__()

__repr__(self) -> str

Operator

__rmul__()

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

Operator

__rsub__()

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

Operator

__rtruediv__()

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

Operator

__setstate__()

__setstate__(self, arg: tuple[int, int], /) -> None

Operator

__str__()

__str__(self) -> str

Operator

__truediv__()

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

Constructors

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

Methods

readxml(self, file: str) str

Read variable from file.

Parameters:

file (str) – A file that can be read.

Raises:

RuntimeError – For any failure to read.

Returns:

file – The file path found (may differ from input due to environment variables).

Return type:

str

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

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, optional) – Type of file to save. See FileType for options. Defaults is “ascii”.

  • clobber (bool, optional) – Overwrite existing files or add new file with modified name? Defaults is True.

Raises:

RuntimeError – For any failure to write.

Returns:

file – The file saved. May differ from input.

Return type:

str

Static Methods

fromxml(file: str) pyarts3.arts.Rational

Create variable from file.

Parameters:

file (str) – A file that can be read

Raises:

RuntimeError – For any failure to read.

Returns:

artstype – The variable created from the file.

Return type:

T

Attributes

d: Index

Denominator

n: Index

Numerator

Operators

__add__(self, arg: int, /) pyarts3.arts.Rational
__add__(self, arg: pyarts3.arts.Rational, /) pyarts3.arts.Rational
__eq__(self, arg: int, /) bool
__eq__(self, arg: int, /) bool
__eq__(self, arg: pyarts3.arts.Rational, /) bool
__format__(self, arg: str, /) str
__ge__(self, arg: int, /) bool
__ge__(self, arg: int, /) bool
__ge__(self, arg: pyarts3.arts.Rational, /) bool
__getstate__(self) tuple[int, int]
__gt__(self, arg: int, /) bool
__gt__(self, arg: int, /) bool
__gt__(self, arg: pyarts3.arts.Rational, /) bool
__hash__()

Return hash(self).

__iadd__(self, arg: int, /) pyarts3.arts.Rational
__iadd__(self, arg: pyarts3.arts.Rational, /) pyarts3.arts.Rational
__imul__(self, arg: int, /) pyarts3.arts.Rational
__imul__(self, arg: pyarts3.arts.Rational, /) pyarts3.arts.Rational
__init__(self, n: int = 0, d: int = 1) None
__init__(self, arg: str, /) None
__init__(self) None
__init__(self, arg: pyarts3.arts.Rational) None
__isub__(self, arg: int, /) pyarts3.arts.Rational
__isub__(self, arg: pyarts3.arts.Rational, /) pyarts3.arts.Rational
__itruediv__(self, arg: int, /) pyarts3.arts.Rational
__itruediv__(self, arg: pyarts3.arts.Rational, /) pyarts3.arts.Rational
__le__(self, arg: int, /) bool
__le__(self, arg: int, /) bool
__le__(self, arg: pyarts3.arts.Rational, /) bool
__lt__(self, arg: int, /) bool
__lt__(self, arg: int, /) bool
__lt__(self, arg: pyarts3.arts.Rational, /) bool
__mul__(self, arg: int, /) pyarts3.arts.Rational
__mul__(self, arg: pyarts3.arts.Rational, /) pyarts3.arts.Rational
__ne__(self, arg: int, /) bool
__ne__(self, arg: int, /) bool
__ne__(self, arg: pyarts3.arts.Rational, /) bool
__radd__(self, arg: int, /) pyarts3.arts.Rational
__repr__(self) str
__rmul__(self, arg: int, /) pyarts3.arts.Rational
__rsub__(self, arg: int, /) pyarts3.arts.Rational
__rtruediv__(self, arg: int, /) pyarts3.arts.Rational
__setstate__(self, arg: tuple[int, int], /) None
__str__(self) str
__truediv__(self, arg: int, /) pyarts3.arts.Rational
__truediv__(self, arg: pyarts3.arts.Rational, /) pyarts3.arts.Rational