Class MaskedPrintOption
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
NumPy's numpy.ma.masked_print_option: the mutable, process-global object controlling how masked
elements are DISPLAYED and whether that display happens at all. Reach for it to change the two-character
-- placeholder (set_display(string)) or to turn the placeholder off entirely
(enable(bool)) so masked slots print their FILL value instead — the two ways NumPy lets you tune
a masked repr globally.
It is a single shared instance behind masked_print_option — mutating it (like NumPy's module global) changes every subsequent ToString(), so it is a global side effect: set it back if you only meant a local change.
public sealed class MaskedPrintOption
- Inheritance
-
MaskedPrintOption
- Inherited Members
Remarks
Methods
ToString()
Renders as the display token, matching NumPy's str(masked_print_option).
public override string ToString()
Returns
- string
The current display string.
display()
The current masked-slot token (NumPy's display()).
public string display()
Returns
- string
The display string, e.g.
--.
enable(bool)
Turns the masked-slot substitution on or off (NumPy's enable(shrink=1); the parameter is
named shrink in NumPy but simply sets the enabled flag).
public void enable(bool shrink = true)
Parameters
shrinkboolTrue enables the
--substitution (default); false makes masked slots print their fill value.
enabled()
Whether the masked-slot substitution is active (NumPy's enabled()). When false, a masked
print substitutes the array's FILL value at masked slots and prints numeric-aligned (the
filled(fill_value) path) instead of showing display().
public bool enabled()
Returns
set_display(string)
Replaces the masked-slot token (NumPy's set_display). Affects all later masked prints —
a GLOBAL change, since there is one shared option object.
public void set_display(string s)
Parameters
sstringThe new token (any string; NumPy does not validate it).