pydicom.valuerep.DSdecimal

class pydicom.valuerep.DSdecimal(val)

Store value for an element with VR ‘DS’ as decimal.Decimal.

Notes

If constructed from an empty string, returns the empty string, not an instance of this class.

__init__(val)

Store the original string if one given, for exact write-out of same value later. E.g. if set '1.23e2', Decimal would write '123', but DS will use the original.

Methods

__init__(val) Store the original string if one given, for exact write-out of same value later.
adjusted Return the adjusted exponent of the number.
as_integer_ratio() Return a pair of integers, whose ratio is exactly equal to the original Decimal and with a positive denominator.
as_tuple Return a tuple representation of the number.
canonical Return the canonical encoding of the argument.
compare Compare self to other.
compare_signal Identical to compare, except that all NaNs signal.
compare_total Compare two operands using their abstract representation rather than their numerical value.
compare_total_mag Compare two operands using their abstract representation rather than their value as in compare_total(), but ignoring the sign of each operand.
conjugate Return self.
copy_abs Return the absolute value of the argument.
copy_negate Return the negation of the argument.
copy_sign Return a copy of the first operand with the sign set to be the same as the sign of the second operand.
exp Return the value of the (natural) exponential function e**x at the given number.
fma Fused multiply-add.
from_float Class method that converts a float to a decimal number, exactly.
is_canonical Return True if the argument is canonical and False otherwise.
is_finite Return True if the argument is a finite number, and False if the argument is infinite or a NaN.
is_infinite Return True if the argument is either positive or negative infinity and False otherwise.
is_nan Return True if the argument is a (quiet or signaling) NaN and False otherwise.
is_normal Return True if the argument is a normal finite non-zero number with an adjusted exponent greater than or equal to Emin.
is_qnan Return True if the argument is a quiet NaN, and False otherwise.
is_signed Return True if the argument has a negative sign and False otherwise.
is_snan Return True if the argument is a signaling NaN and False otherwise.
is_subnormal Return True if the argument is subnormal, and False otherwise.
is_zero Return True if the argument is a (positive or negative) zero and False otherwise.
ln Return the natural (base e) logarithm of the operand.
log10 Return the base ten logarithm of the operand.
logb For a non-zero number, return the adjusted exponent of the operand as a Decimal instance.
logical_and Return the digit-wise ‘and’ of the two (logical) operands.
logical_invert Return the digit-wise inversion of the (logical) operand.
logical_or Return the digit-wise ‘or’ of the two (logical) operands.
logical_xor Return the digit-wise ‘exclusive or’ of the two (logical) operands.
max Maximum of self and other.
max_mag Similar to the max() method, but the comparison is done using the absolute values of the operands.
min Minimum of self and other.
min_mag Similar to the min() method, but the comparison is done using the absolute values of the operands.
next_minus Return the largest number representable in the given context (or in the current default context if no context is given) that is smaller than the given operand.
next_plus Return the smallest number representable in the given context (or in the current default context if no context is given) that is larger than the given operand.
next_toward If the two operands are unequal, return the number closest to the first operand in the direction of the second operand.
normalize Normalize the number by stripping the rightmost trailing zeros and converting any result equal to Decimal(‘0’) to Decimal(‘0e0’).
number_class Return a string describing the class of the operand.
quantize Return a value equal to the first operand after rounding and having the exponent of the second operand.
radix Return Decimal(10), the radix (base) in which the Decimal class does all its arithmetic.
remainder_near Return the remainder from dividing self by other.
rotate Return the result of rotating the digits of the first operand by an amount specified by the second operand.
same_quantum Test whether self and other have the same exponent or whether both are NaN.
scaleb Return the first operand with the exponent adjusted the second.
shift Return the result of shifting the digits of the first operand by an amount specified by the second operand.
sqrt Return the square root of the argument to full precision.
to_eng_string Convert to an engineering-type string.
to_integral Identical to the to_integral_value() method.
to_integral_exact Round to the nearest integer, signaling Inexact or Rounded as appropriate if rounding occurs.
to_integral_value Round to the nearest integer without signaling Inexact or Rounded.

Attributes

imag
original_string
real