Graphics Items Module

Module contents

class beautifuljason.graphics.AssignmentTableGraphicsItem(h5_group)

Bases: TableGraphicsItem

Represents an assignment table graphics item.

class ColumnID(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Column IDs

ASSIGNMENT = 7
ATOMS = 0
COMMENT = 6
EXPCOUPLINGS = 4
EXPSH = 1
PREDCOUPLINGS = 5
PREDERR = 3
PREDSH = 2
property data_id: str
Returns:

The data ID of the spectrum the assignment table belongs to.

Return type:

str

class beautifuljason.graphics.GraphicsItem(h5_group)

Bases: IDedObject

Represents a graphics item stored within an HDF5 group.

Parameters:

h5_group – The actual HDF5 group object.

class Annotation(h5_group)

Bases: H5Group

Represents an annotation stored within a graphics item.

class List(h5_group)

Bases: GroupList

Represents a list of annotations.

Parameters:

h5_group (h5py.Group) – The actual HDF5 group object.

class Type(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Enumeration representing the types of annotations.

LINE = 2
NONE = 0
RECT = 1
TEXT = 3
property arrow: bool | None
Returns:

True if the annotation has an arrow head, otherwise False. If not present, returns None.

Return type:

bool or None

property brush_color: ndarray[int32] | None
Returns:

The brush color of the annotation. If not present, returns None.

Return type:

numpy.ndarray of shape (5,) with dtype numpy.int32 or None

property end_pinned: bool | None
Returns:

True if the end of the annotation is pinned, otherwise False. If not present, returns None.

Return type:

bool or None

property font: Font | None
Returns:

The font of the annotation. If not present, returns None.

Return type:

base.Font or None

property html: str | None
Returns:

The HTML of the annotation. If not present, returns None.

Return type:

str or None

property line: ndarray[float64] | None
Returns:

The line of the annotation. If not present, returns None.

Return type:

numpy.ndarray of shape (4,) with dtype numpy.float64 or None

property local_coords: ndarray[float64]
Returns:

The local coordinates of the annotation.

Return type:

numpy.ndarray of shape (4,) with dtype numpy.float64

property pen_color: ndarray[int32] | None
Returns:

The pen color of the annotation. If not present, returns None.

Return type:

numpy.ndarray of shape (5,) with dtype numpy.int32 or None

property pen_style: int32 | None
Returns:

The pen style of the annotation. If not present, returns None.

Return type:

numpy.int32 or None

property pen_width: float64 | None
Returns:

The pen width of the annotation. If not present, returns None.

Return type:

numpy.float64 or None

property pinned: bool | None
Returns:

True if the annotation is pinned, otherwise False. If not present, returns None.

Return type:

bool or None

property pos
Returns:

The position of the annotation.

Return type:

numpy.ndarray of shape (2,) with dtype numpy.float64

property rect: ndarray[float64] | None
Returns:

The rectangle of the annotation. If not present, returns None.

Return type:

numpy.ndarray of shape (4,) with dtype numpy.float64 or None

property rotation: float64 | None
Returns:

The rotation of the annotation. If not present, returns None.

Return type:

numpy.float64 or None

property start_pinned: bool | None
Returns:

True if the start of the annotation is pinned, otherwise False. If not present, returns None.

Return type:

bool or None

property text: str | None
Returns:

The text of the annotation. If not present, returns None.

Return type:

str or None

property type: Type
Returns:

The type of the annotation.

Return type:

Type

property visible: bool
Returns:

True if the annotation is visible, otherwise False.

Return type:

bool

class Type(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Enumeration representing the types of graphics items.

ArrayedTable = 65547
AssignmentTable = 65546
Chart = 65548
Custom = 66536
Image = 65545
Molecule = 65540
NMRMultipletReport = 65542
NMRMultipletTable = 65541
NMRParamTable = 65544
NMRPeakTable = 65539
NMRSpectrum = 65538
Text = 65543
property annotations: List
Returns:

The list of annotations.

Return type:

Annotation.List

static create(class_, h5_group) GraphicsItem

Creates a new graphics item of the specified type.

Parameters:
  • class (GraphicsItem) – The class of the graphics item to create.

  • h5_group (h5py.Group) – The HDF5 group corresponding to the graphics item.

Returns:

The newly created graphics item.

Return type:

GraphicsItem

property linked_ids: list[str]

The list of linked IDs.

Getter:

Returns the list of linked IDs.

Return type:

list of str

Setter:

Sets the list of linked IDs.

Parameters:

new_linked_ids (list of str) – The new list of linked IDs.

property parent_item_id: str | None

The parent item ID.

Getter:

Returns the parent item ID.

Return type:

str or None if not present.

Setter:

Sets the parent item ID.

Parameters:

new_parent_item_id (str or None) – The new parent item ID.

property pos: ndarray[float64]

The position of the graphics item. X is at index 0, Y is at index 1 of the array.

Getter:

Returns the position of the graphics item.

Return type:

numpy.ndarray of shape (2,) with dtype numpy.float64

Setter:

Sets the position of the graphics item.

Parameters:

new_pos (Iterable of length 2 of numpy.float64) – The new position of the graphics item.

property rotation: float64

The rotation of the graphics item in degrees.

Getter:

Returns the rotation of the graphics item.

Return type:

numpy.float64

Setter:

Sets the rotation of the graphics item.

Parameters:

new_rotation (numpy.float64) – The new rotation of the graphics item.

property size: tuple[float64, float64]

The size of the graphics item. Width is at index 0, height is at index 1 of the tuple.

Getter:

Returns the size of the graphics item.

Return type:

tuple of length 2 of numpy.float64

Setter:

Sets the size of the graphics item.

Parameters:

new_size (Iterable of length 2 of numpy.float64) – The new size of the graphics item.

property type: Type
Returns:

The type of the graphics item.

Return type:

Type

property z_value: float64

The Z value of the graphics item.

Getter:

Returns the Z value of the graphics item.

Return type:

numpy.float64

Setter:

Sets the Z value of the graphics item.

Parameters:

new_zvalue (numpy.float64) – The new Z value of the graphics item.

class beautifuljason.graphics.GraphicsItemFactory

Bases: object

Factory class responsible for creating instances of GraphicsItem subclasses based on their type.

all_classes = {Type.NMRSpectrum: <class 'beautifuljason.graphics.NMRSpectrumGraphicsItem'>, Type.NMRPeakTable: <class 'beautifuljason.graphics.NMRPeakTableGraphicsItem'>, Type.Molecule: <class 'beautifuljason.graphics.MoleculeGraphicsItem'>, Type.NMRMultipletTable: <class 'beautifuljason.graphics.NMRMultipletTableGraphicsItem'>, Type.NMRMultipletReport: <class 'beautifuljason.graphics.NMRMultipletReportGraphicsItem'>, Type.Text: <class 'beautifuljason.graphics.TextGraphicsItem'>, Type.NMRParamTable: <class 'beautifuljason.graphics.NMRParamTableGraphicsItem'>, Type.Image: <class 'beautifuljason.graphics.ImageGraphicsItem'>, Type.AssignmentTable: <class 'beautifuljason.graphics.AssignmentTableGraphicsItem'>}

A mapping of GraphicsItem.Type to their respective class implementations.

static create(h5_group) GraphicsItem

Creates an instance of a GraphicsItem.Type subclass based on the type attribute of the provided h5 group.

Parameters:

h5_group (h5py.Group) – The h5 group containing the attributes and data for the graphics item.

Returns:

An instance of the appropriate GraphicsItem.Type subclass.

Return type:

GraphicsItem.Type

class beautifuljason.graphics.ImageGraphicsItem(h5_group)

Bases: GraphicsItem

Represents an image graphics item.

property image: Image
Returns:

The image data object.

Return type:

data.Image

property image_id: str
Returns:

The image data object ID.

Return type:

str

class beautifuljason.graphics.MoleculeGraphicsItem(h5_group)

Bases: GraphicsItem

Represents a molecule graphics item.

class DrawItem(h5_group)

Bases: IDedObject

Represents mulecule draw item.

class List(h5_group)

Bases: GroupList

Represents a list of draw items.

property auto_scale: float
Returns:

The auto scale.

Return type:

float

property bond_len_scale: float
Returns:

The bond length scale.

Return type:

float

property id: str
Returns:

The ID.

Return type:

str

property transform: Transform
Returns:

The transform.

Return type:

MoleculeGraphicsItem.Transform

property user_scale: float
Returns:

The user scale.

Return type:

float

class DrawStyle(h5_group)

Bases: H5Group

Represents a draw style.

class LabelType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Label types enumeration.

New in version 1.1.0.

AtomNum = 1
C13 = 128
C13Calc = 160
C13Diff = 192
C13Exp = 144
Calc = 32
Coord3D = 14
Diff = 64
Exp = 16
FlatCoord = 6
H1 = 256
H1Calc = 288
H1Diff = 320
H1Exp = 272
N15 = 512
N15Calc = 544
N15Diff = 576
N15Exp = 528
None_ = 0
StereoSign = 1024
XCoord = 2
YCoord = 4
ZCoord = 8
property atoms_in_color: bool
Getter:

Returns whether atoms are drawn in color.

Return type:

bool

Setter:

Sets whether atoms are drawn in color.

Parameters:

new_value (bool) – Indicates whether atoms are drawn in color.

property draw_internal_c: bool
Getter:

Returns whether internal carbon atoms are drawn.

Return type:

bool

Setter:

Sets whether internal carbon atoms are drawn.

Parameters:

new_value (bool) – Indicates whether internal carbon atoms are drawn.

property draw_labels: bool
Getter:

Returns whether labels are drawn.

Return type:

bool

Setter:

Sets whether labels are drawn.

Parameters:

new_value (bool) – Indicates whether labels are drawn.

property draw_terminal_c: bool
Getter:

Returns whether terminal carbon atoms are drawn.

Return type:

bool

Setter:

Sets whether terminal carbon atoms are drawn.

Parameters:

new_value (bool) – Indicates whether terminal carbon atoms are drawn.

property labels: int
Getter:

Returns the label type.

Return type:

int

Setter:

Sets the label type.

Parameters:

value (int) – The new label type.

Note

The label type is a combination of LabelType flags.

class EditMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Edit modes enumeration.

Auto = 1
Charge = 9
Create = 21
Delete = 7
Draw = 6
Edit = 8
Modify = 20
Move = 3
NONE = 0
Rotate2D = 4
Rotate3D = 5
Select = 2
Shift = 11
Stereo = 10
class Editor(h5_group)

Bases: H5Group

Represents an editor.

property allow_edit: bool
Returns:

Whether editing is allowed.

Return type:

bool

property allow_modify_atoms: bool
Returns:

Whether modifying atoms is allowed.

Return type:

bool

property allow_modify_bonds: bool
Returns:

Whether modifying bonds is allowed.

Return type:

bool

class Geometry(h5_group)

Bases: H5Group

Represents molecule geometry

property auto_scale: float
Returns:

The auto scale.

Return type:

float

property transform: Transform
Returns:

The transform.

Return type:

MoleculeGraphicsItem.Transform

property user_scale: float
Returns:

The user scale.

Return type:

float

class Transform(h5_group)

Bases: H5Group

Represents a coordinate transform.

property angle: float
Returns:

The angle.

Return type:

float

property scale_x: float
Returns:

The X scale.

Return type:

float

property scale_y: float
Returns:

The Y scale.

Return type:

float

property shift_x: float
Returns:

The X shift.

Return type:

float

property shift_y: float
Returns:

The Y shift.

Return type:

float

property active_atom_type: Type
Returns:

The active atom type.

Return type:

data.Molecule.Atom.Type

property active_bond_type: data.Molecule.Bond.Type
Returns:

The active bond type.

Return type:

data.Molecule.Bond.Type

property browse_edit_mode: EditMode
Returns:

The browse edit mode.

Return type:

EditMode

property draw_style: DrawStyle
Returns:

The draw style.

Return type:

DrawStyle

property editor: Editor
Returns:

The editor.

Return type:

Editor

property geometry: Geometry
Returns:

The geometry.

Return type:

Geometry

property items: List
Returns:

The molecule draw items.

Return type:

DrawItem.List

mol_data(id: int | str = 0) Molecule
Parameters:

id – The index or ID of the molecule.

Returns:

The molecule associated with the graphics item.

Return type:

data.Molecule

New in version 1.1.0.

property mol_data_list: list[Molecule]
Returns:

The list of molecules associated with the graphics item.

Return type:

list of data.Molecule

New in version 1.1.0.

property user_edit_mode: EditMode
Returns:

The user edit mode.

Return type:

EditMode

class beautifuljason.graphics.NMRMultipletReportGraphicsItem(h5_group)

Bases: GraphicsItem

Represents an NMR multiplet report graphics item.

class JournalTemplate(h5_group)

Bases: H5Group

Represents a journal template.

property js: str
Returns:

The j-values format string.

Return type:

str

property js_separator: str
Returns:

The j-values separator.

Return type:

str

property multiplet: str
Returns:

The multiplet format string.

Return type:

str

property multiplet_separator: str
Returns:

The multiplet separator.

Return type:

str

property report
Returns:

The report format string.

Return type:

str

builtin_formats = ['JACS', 'Angew. Chem.', 'Chem Nat Prod', 'Nature', 'RSC', 'Scientific Reports', 'Wiley']
property journal_format: str | None

The journal format name.

Getter:

Returns the journal format name.

Return type:

str | None

Setter:

Sets the journal format name.

Parameters:

new_format (str) – The new journal format name.

property journal_template: JournalTemplate | None
Returns:

The journal template.

Return type:

JournalTemplate | None

property report_text: str
Returns:

The report text.

Return type:

str

property spectrum_id: str
Returns:

The data ID of the spectrum the multiplet report correponds to.

Return type:

str

class beautifuljason.graphics.NMRMultipletTableGraphicsItem(h5_group)

Bases: NMRTableGraphicsItem

Represents an NMR multiplet table graphics item.

class ColumnID(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Column IDs

END0 = 6
END1 = 7
END2 = 8
J = 14
NORMALIZED = 13
OFFSET = 9
PEAKS_VOLUME = 15
POS0 = 0
POS1 = 1
POS2 = 2
SLOPE = 10
START0 = 3
START1 = 4
START2 = 5
SUM_INTEGRAL = 11
TYPE = 12
property data_id: str
Returns:

The data ID of the spectrum the multiplet table belongs to.

Return type:

str

class beautifuljason.graphics.NMRParamTableGraphicsItem(h5_group)

Bases: NMRTableGraphicsItem

NMR parameter table graphics item

class ColumnID(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Column IDs

NAME = 0
VALUE = 1
class Parameter(h5_group)

Bases: H5Group

Represents a parameter

class List(h5_group)

Bases: GroupList

Represents a list of parameters

property condition: str | None
Returns:

The condition string of the parameter.

Return type:

str | None

property id: str
Returns:

The UUID string of the parameter.

Return type:

str

property name: str
Returns:

The name of the parameter.

Return type:

str

property value: str
Returns:

The value of the parameter.

Return type:

str

property value_template: str | None
Returns:

The value template string of the parameter.

Return type:

str | None

property data_id: str
Returns:

The UUID string of the data that the table is associated with.

Return type:

str

property param_list: List
Returns:

The parameter list of the table.

Return type:

Parameter.List

set_defaults()

Setting default values on creating a parameter table item. Specifically, the horizontal header is hidden.

class beautifuljason.graphics.NMRPeakTableGraphicsItem(h5_group)

Bases: NMRTableGraphicsItem

Represents an NMR peak table graphics item.

class ColumnID(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Column IDs

HEIGHT = 3
HEIGHTERR = 14
KURTOSIS0 = 7
KURTOSIS0ERR = 16
KURTOSIS1 = 8
KURTOSIS2 = 9
LABEL = 12
POS0 = 0
POS0ERR = 13
POS1 = 1
POS2 = 2
TYPE = 11
VOLUME = 10
VOLUMEERR = 17
WIDTH0 = 4
WIDTH0ERR = 15
WIDTH1 = 5
WIDTH2 = 6
property data_id: str
Returns:

The data ID of the spectrum the peak table belongs to.

Return type:

str

class beautifuljason.graphics.NMRSpectrumGraphicsItem(h5_group)

Bases: GraphicsItem

Represents an NMR spectrum graphics item stored within an HDF5 group.

class PlotType2D(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

Enumeration representing the types of 2D plots.

CONTOURS = 1
HOR_STACK = 4
OVERLAPPED = 2
RASTER = 0
VER_STACK = 3
class Print1DMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: IntEnum

An enumeration that represents the different modes for printing 1D data.

  • ALL: Prints the data as a single line, displaying all points.

  • SKIP: Reduces the resolution by skipping some data points to provide a simplified view.

  • SPLIT: Divides the data into segments.

ALL = 0
SKIP = 1
SPLIT = 2
property active_bold: bool

Whether to show the active spectrum in bold.

Getter:

Returns True if the active spectrum is shown in bold, otherwise False.

Return type:

bool

Setter:

Sets whether to show the active spectrum in bold.

Parameters:

new_show (bool) – True if the active spectrum is to be shown in bold, otherwise False.

property antialiasing: bool

Whether to use antialiasing.

Getter:

Returns True if antialiasing is used, otherwise False.

Return type:

bool

Setter:

Sets whether to use antialiasing.

Parameters:

new_show (bool) – True if antialiasing is to be used, otherwise False.

property color_cont: bool

Whether to use color contours.

Getter:

Returns True if color contours are used, otherwise False.

Return type:

bool

Setter:

Sets whether to use color contours.

Parameters:

new_show (bool) – True if color contours are to be used, otherwise False.

property floor: float64

The 2D plot floor.

Getter:

Returns the 2D plot floor.

Return type:

numpy.float64

Setter:

Sets the 2D plot floor.

Parameters:

new_value (numpy.float64) – The new 2D plot floor.

property has_x_extra_ticks: bool

Whether to show extra ticks on the X axis.

Getter:

Returns True if extra ticks are shown on the X axis, otherwise False.

Return type:

bool

Setter:

Sets whether to show extra ticks on the X axis.

Parameters:

new_show (bool) – True if extra ticks are to be shown on the X axis, otherwise False.

property has_y_extra_ticks: bool

Whether to show extra ticks on the Y axis.

Getter:

Returns True if extra ticks are shown on the Y axis, otherwise False.

Return type:

bool

Setter:

Sets whether to show extra ticks on the Y axis.

Parameters:

new_show (bool) – True if extra ticks are to be shown on the Y axis, otherwise False.

property header: str

The header of the spectrum.

Getter:

Returns the header of the spectrum.

Return type:

str

Setter:

Sets the header of the spectrum.

Parameters:

new_header (str) – The new header of the spectrum.

Raises:

TypeError – If the new_header argument is not str or bytes.

property header_font: Font

The font of header.

Getter:

Returns the font of header.

Return type:

base.Font

Setter:

Sets the font of header.

Parameters:

new_font (base.Font) – The new font of header.

property integral_curve_color: str

The color of integral curve.

Getter:

Returns the color of integral curve.

Return type:

str

Setter:

Sets the color of integral curve.

Parameters:

new_color (str) – The new color of integral curve.

property integral_label_v_shift: float64

The vertical shift of integral label.

Getter:

Returns the vertical shift of integral label.

Return type:

numpy.float64

Setter:

Sets the vertical shift of integral label.

Parameters:

new_value (numpy.float64) – The new vertical shift of integral label.

property j_tree_label_font: Font

The font of J tree label.

Getter:

Returns the font of J tree label.

Return type:

base.Font

Setter:

Sets the font of J tree label.

Parameters:

new_font (base.Font) – The new font of J tree label.

property mix_fid_spec: bool

Whether to mix FID and spectra.

Getter:

Returns True if FID and spectra are mixed, otherwise False.

Return type:

bool

Setter:

Sets whether to mix FID and spectra.

Parameters:

new_show (bool) – True if FID and spectra are to be mixed, otherwise False.

property mult_intg_label_color: str

The color of multiplet integral label.

Getter:

Returns the color of multiplet integral label.

Return type:

str

Setter:

Sets the color of multiplet integral label.

Parameters:

new_color (str) – The new color of multiplet integral label.

property mult_intg_label_digits: int32

The number of digits of multiplet/integral label.

Getter:

Returns the number of digits of multiplet/integral label.

Return type:

numpy.int32

Setter:

Sets the number of digits of multiplet/integral label.

Parameters:

new_value (numpy.int32) – The new number of digits of multiplet/integral label.

property mult_intg_label_font: Font

The font of multiplet integral label.

Getter:

Returns the font of multiplet integral label.

Return type:

base.Font

Setter:

Sets the font of multiplet integral label.

Parameters:

new_font (base.Font) – The new font of multiplet integral label.

property mult_intg_pos_digits: int32

The number of digits of multiplet/integral position.

Getter:

Returns the number of digits of multiplet/integral position.

Return type:

numpy.int32

Setter:

Sets the number of digits of multiplet/integral position.

Parameters:

new_value (numpy.int32) – The new number of digits of multiplet/integral position.

property multi_plot_type_2d: PlotType2D

The plot type of 2D spectra when multiple spectra are present.

Getter:

Returns the plot type of 2D spectra.

Return type:

PlotType2D

Setter:

Sets the plot type of 2D spectra.

Parameters:

new_value (PlotType2D) – The new plot type of 2D spectra.

property multiplet_label_v_shift: float64

The vertical shift of multiplet label.

Getter:

Returns the vertical shift of multiplet label.

Return type:

numpy.float64

Setter:

Sets the vertical shift of multiplet label.

Parameters:

new_value (numpy.float64) – The new vertical shift of multiplet label.

property n_levels: int32

The number of contour levels.

Getter:

Returns the number of contour levels.

Return type:

numpy.int32

Setter:

Sets the number of contour levels.

Parameters:

new_value (numpy.int32) – The new number of contour levels.

property n_x_extra_ticks: int32

The number of extra ticks on the X axis.

Getter:

Returns the number of extra ticks on the X axis.

Return type:

numpy.int32

Setter:

Sets the number of extra ticks on the X axis.

Parameters:

new_value (numpy.int32) – The new number of extra ticks on the X axis.

property n_y_extra_ticks: int32

The number of extra ticks on the Y axis.

Getter:

Returns the number of extra ticks on the Y axis.

Return type:

numpy.int32

Setter:

Sets the number of extra ticks on the Y axis.

Parameters:

new_value (numpy.int32) – The new number of extra ticks on the Y axis.

property peak_label_font: Font

The font of peak label.

Getter:

Returns the font of peak label.

Return type:

base.Font

Setter:

Sets the font of peak label.

Parameters:

new_font (base.Font) – The new font of peak label.

property peak_shape_color: str

The color of peak shape.

Getter:

Returns the color of peak shape.

Return type:

str

Setter:

Sets the color of peak shape.

Parameters:

new_color (str) – The new color of peak shape.

property plot_1d_color: str

The color of 1D plot.

Getter:

Returns the color of 1D plot.

Return type:

str

Setter:

Sets the color of 1D plot.

Parameters:

new_color (str) – The new color of 1D plot.

property plot_1d_width: int32

The pen width of 1D plot.

Getter:

Returns the width of 1D plot.

Return type:

numpy.int32

Setter:

Sets the width of 1D plot.

Parameters:

new_value (numpy.int32) – The new width of 1D plot.

property plot_2d_color_gradient: bool

Whether to plot 2D color gradient.

Getter:

Returns True if 2D color gradient is plotted, otherwise False.

Return type:

bool

Setter:

Sets whether to plot 2D color gradient.

Parameters:

new_show (bool) – True if 2D color gradient is to be plotted, otherwise False.

property plot_2d_neg_color: str

The color of negative 2D plot.

Getter:

Returns the color of negative 2D plot.

Return type:

str

Setter:

Sets the color of negative 2D plot.

Parameters:

new_color (str) – The new color of negative 2D plot.

property plot_2d_pos_color: str

The color of positive 2D plot.

Getter:

Returns the color of positive 2D plot.

Return type:

str

Setter:

Sets the color of positive 2D plot.

Parameters:

new_color (str) – The new color of positive 2D plot.

property plot_2d_width: int32

The pen width of 2D plot.

Getter:

Returns the width of 2D plot.

Return type:

numpy.int32

Setter:

Sets the width of 2D plot.

Parameters:

new_value (numpy.int32) – The new width of 2D plot.

property plot_type_2d: PlotType2D

The plot type of 2D spectra.

Getter:

Returns the plot type of 2D spectra.

Return type:

PlotType2D

Setter:

Sets the plot type of 2D spectra.

Parameters:

new_value (PlotType2D) – The new plot type of 2D spectra.

property pos_neg: int32

Indicates the nature of the contour lines plotted on the 2D spectrum - whether they represent positive values, negative values, or both.

  • 0: Positive contour lines only

  • 1: Both positive and negative contour lines (bipolar)

  • 2: Negative contour lines only

Getter:

Returns the setting indicating which contour lines (positive/negative/both) are being plotted.

Return type:

numpy.int32

Setter:

Updates the setting for which contour lines (positive/negative/both) to plot.

Parameters:

new_value (numpy.int32) – Indicates whether to plot positive contours, negative contours, or both.

property print_line_width: int32

The line width of printed spectra.

Getter:

Returns the line width of printed spectra.

Return type:

numpy.int32

Setter:

Sets the line width of printed spectra.

Parameters:

new_value (numpy.int32) – The new line width of printed spectra.

property print_mode: Print1DMode

The print mode of 1D spectra.

Getter:

Returns the print mode of 1D spectra.

Return type:

Print1DMode

Setter:

Sets the print mode of 1D spectra.

Parameters:

new_value (Print1DMode) – The new print mode of 1D spectra.

property separation_inc: float64

Overlapped spectra separation increment.

Getter:

Returns the overlapped spectra separation increment.

Return type:

numpy.float64

Setter:

Sets the overlapped spectra separation increment.

Parameters:

new_value (numpy.float64) – The new overlapped spectra separation increment.

property show_header: bool

Whether to show the header.

Getter:

Returns True if the header is shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show the header.

Parameters:

new_show (bool) – True if the header is to be shown, otherwise False.

property show_integrals_multiplets: bool

Whether to show integrals/multiplets.

Getter:

Returns True if integrals/multiplets are shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show integrals/multiplets.

Parameters:

new_show (bool) – True if integrals/multiplets are to be shown, otherwise False.

property show_legend: bool

Whether to show the legend.

Getter:

Returns True if the legend is shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show the legend.

Parameters:

new_show (bool) – True if the legend is to be shown, otherwise False.

property show_peak_models: bool

Whether to show peak models.

Getter:

Returns True if peak models are shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show peak models.

Parameters:

new_show (bool) – True if peak models are to be shown, otherwise False.

property show_peak_residuals: bool

Whether to show peak residuals.

Getter:

Returns True if peak residuals are shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show peak residuals.

Parameters:

new_show (bool) – True if peak residuals are to be shown, otherwise False.

property show_peak_sum: bool

Whether to show peak sum.

Getter:

Returns True if peak sum is shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show peak sum.

Parameters:

new_show (bool) – True if peak sum is to be shown, otherwise False.

property show_peaks: bool

Whether to show peaks.

Getter:

Returns True if peaks are shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show peaks.

Parameters:

new_show (bool) – True if peaks are to be shown, otherwise False.

property show_x_axis: bool

Whether to show the X axis.

Getter:

Returns True if the X axis is shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show the X axis.

Parameters:

new_show (bool) – True if the X axis is to be shown, otherwise False.

property show_x_grid: bool

Whether to show the X grid.

Getter:

Returns True if the X grid is shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show the X grid.

Parameters:

new_show (bool) – True if the X grid is to be shown, otherwise False.

property show_y_axis: bool

Whether to show the Y axis.

Getter:

Returns True if the Y axis is shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show the Y axis.

Parameters:

new_show (bool) – True if the Y axis is to be shown, otherwise False.

property show_y_axis_2d: bool

Whether to show the Y axis of 2D spectra.

Getter:

Returns True if the Y axis of 2D spectra is shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show the Y axis of 2D spectra.

Parameters:

new_show (bool) – True if the Y axis of 2D spectra is to be shown, otherwise False.

property show_y_grid: bool

Whether to show the Y grid.

Getter:

Returns True if the Y grid is shown, otherwise False.

Return type:

bool

Setter:

Sets whether to show the Y grid.

Parameters:

new_show (bool) – True if the Y grid is to be shown, otherwise False.

spec_data(id: int | str = 0) NMRSpectrum | None

Gets spectrum data by ‘id’, where ‘id’ is either an index or UUID string.

Parameters:

id (int or str) – The index or UUID string of the spectrum data.

Returns:

The spectrum data.

Return type:

NMRSpectrum or None if not found.

property spec_data_list: list[NMRSpectrum]
Returns:

The list of spectra.

Return type:

list of data.NMRSpectrum

property tilt_inc: float64

Overlapped spectra tilt increment.

Getter:

Returns the overlapped spectra tilt increment.

Return type:

numpy.float64

Setter:

Sets the overlapped spectra tilt increment.

Parameters:

new_value (numpy.float64) – The new overlapped spectra tilt increment.

property x_axis_color: str

The color of X axis.

Getter:

Returns the color of X axis.

Return type:

str

Setter:

Sets the color of X axis.

Parameters:

new_color (str) – The new color of X axis.

property x_font: Font

The font of X axis.

Getter:

Returns the font of X axis.

Return type:

base.Font

Setter:

Sets the font of X axis.

Parameters:

new_font (base.Font) – The new font of X axis.

property x_ticks: int32

The number of ticks on the X axis.

Getter:

Returns the number of ticks on the X axis.

Return type:

numpy.int32

Setter:

Sets the number of ticks on the X axis.

Parameters:

new_value (numpy.int32) – The new number of ticks on the X axis.

property y_axis_color: str

The color of Y axis.

Getter:

Returns the color of Y axis.

Return type:

str

Setter:

Sets the color of Y axis.

Parameters:

new_color (str) – The new color of Y axis.

property y_axis_right: bool

Whether to show the Y axis on the right.

Getter:

Returns True if the Y axis is shown on the right, otherwise False.

Return type:

bool

Setter:

Sets whether to show the Y axis on the right.

Parameters:

new_show (bool) – True if the Y axis is to be shown on the right, otherwise False.

property y_font: Font

The font of Y axis.

Getter:

Returns the font of Y axis.

Return type:

base.Font

Setter:

Sets the font of Y axis.

Parameters:

new_font (base.Font) – The new font of Y axis.

property y_outside_labels: bool

Whether to draw labels on the left side of the Y axis.

Getter:

Returns True if labels are drawn on the left side of the Y axis, otherwise False.

Return type:

bool

Setter:

Sets whether to draw labels on the left side of the Y axis.

Parameters:

new_show (bool) – True if labels are to be drawn on the left side of the Y axis, otherwise False.

property y_ticks: int32

The number of ticks on the Y axis.

Getter:

Returns the number of ticks on the Y axis.

Return type:

numpy.int32

Setter:

Sets the number of ticks on the Y axis.

Parameters:

new_value (numpy.int32) – The new number of ticks on the Y axis.

class beautifuljason.graphics.NMRTableGraphicsItem(h5_group)

Bases: TableGraphicsItem

Base class for NMR data tables

property spec_data: NMRSpectrum | None
Returns:

The NMR spectrum data associated with the table.

Return type:

NMRSpectrum | None

class beautifuljason.graphics.TableGraphicsItem(h5_group)

Bases: GraphicsItem

Base class for table graphics items

class ColumnInfo(h5_group)

Bases: H5Group

Represents a column information of a table graphics item.

class List(h5_group)

Bases: GroupList

Represents a list of column information.

property col_id: int32 | None
Returns:

The ID of the column.

Return type:

numpy.int32 | None

property custom_id: str | None
Returns:

The custom UUID string of the column if it is a custom column.

Return type:

str | None

property custom_title: str | None
Returns:

The custom title of the column if it is a custom column.

Return type:

str | None

property digits: int32 | None
Returns:

The number of digits of the column.

Return type:

numpy.int32 | None

property text_alignment: int32 | None
Returns:

The text alignment of the column, which is a combination of Qt.AlignmentFlag values.

Return type:

numpy.int32 | None

property units: Units | None
Returns:

The units of the column.

Return type:

Units | None

class RowInfo(h5_group)

Bases: H5Group

Represents a row information of a table graphics item.

class List(h5_group)

Bases: GroupList

Represents a list of row information.

property column_ids: ndarray[int32]

The column IDs of the row.

Getter:

Returns the column IDs of the row.

Return type:

numpy.ndarray of numpy.int32

Setter:

Sets the column IDs of the row.

Parameters:

new_value (numpy.ndarray of numpy.int32) – The new column IDs of the row.

property custom_column_ids: ndarray[int32]

The custom column IDs of the row. Unlike the standard column IDs, the custom column IDs are negative integers.

Getter:

Returns the custom column IDs of the row.

Return type:

numpy.ndarray of numpy.int32

Setter:

Sets the custom column IDs of the row.

Parameters:

new_value (numpy.ndarray of numpy.int32) – The new custom column IDs of the row.

property custom_values: Iterable[Any] | None

The custom values of the row.

Getter:

Returns the custom values of the row.

Return type:

Iterable of Any | None

Setter:

Sets the custom values of the row.

Parameters:

new_value (Iterable of Any) – The new custom values of the row.

property fonts: ndarray[bytes_]

The fonts of the row.

Getter:

Returns the fonts of the row.

Return type:

numpy.ndarray of numpy.bytes_

Setter:

Sets the fonts of the row.

Parameters:

new_value (numpy.ndarray of numpy.bytes_) – The new fonts of the row.

property alternating_row_colors: bool

Indicates whether the table displays alternating row colors.

Getter:

Returns whether the table displays alternating row colors.

Return type:

bool

Setter:

Sets whether the table displays alternating row colors.

Parameters:

new_value (bool) – Indicates whether the table displays alternating row colors.

append_custom_row(row_id: str, values: Iterable[Any])

Appends a custom row to the table.

Parameters:
  • row_id (str) – The row ID.

  • values (Iterable of Any) – The values of the custom row.

Note

The number of values must be equal to the number of custom columns.

bjason_adjustments(require_group: bool = False) Group | None
Returns:

The ‘bjason_adjustments’ group.

Return type:

h5py.Group | None

property body_font: Font

The font of table body.

Getter:

Returns the font of table body.

Return type:

base.Font

Setter:

Sets the font of table body.

Parameters:

new_font (base.Font) – The new font of table body.

property column_label: bool

Indicates whether the table displays column labels.

Getter:

Returns whether the table displays column labels.

Return type:

bool

Setter:

Sets whether the table displays column labels.

Parameters:

new_value (bool) – Indicates whether the table displays column labels.

property columns: List
Returns:

The column information of the table.

Return type:

ColumnInfo.List

property custom_row_keys: Iterable[str]

The custom row keys of the table.

Getter:

Returns the custom row keys of the table.

Return type:

Iterable of str

Setter:

Sets the custom row keys of the table.

Parameters:

new_value (Iterable of str) – The new custom row keys of the table.

property custom_rows: List
Returns:

The custom rows of the table.

Return type:

RowInfo.List

property customized_columns: List
Returns:

The customized column information of the table.

Return type:

ColumnInfo.List

property data_id: str

The ID of the data that the table is associated with.

Raises:

NotImplementedError – Must be overridden in subclass.

get_custom_font(row_id: str, column_id: int) Font | None

Gets the custom font of a cell.

Parameters:
  • row_id (str) – The row ID.

  • column_id (int) – The column ID.

Returns:

The custom font of the cell.

Return type:

base.Font | None

get_custom_row(row_id: str) list[Any]

Gets the custom row of the table.

Parameters:

row_id (str) – The row ID.

Returns:

The custom row of the table.

Return type:

list of Any

get_custom_value(row_id: str, column_id: int) Any

Gets the custom value of a cell.

Parameters:
  • row_id (str) – The row ID.

  • column_id (int) – The column ID.

Returns:

The custom value of the cell.

Return type:

Any

property header_font: Font

The font of header.

Getter:

Returns the font of header.

Return type:

base.Font

Setter:

Sets the font of header.

Parameters:

new_font (base.Font) – The new font of header.

property horizontal_header: dict[str, Any]

Decodes QByteArray bytes to dict.

Returns:

The horizontal header information.

Return type:

dict of str to Any

property horizontal_header_visible: bool

Indicates whether the horizontal header is visible.

Getter:

Returns whether the horizontal header is visible.

Return type:

bool

Setter:

Sets whether the horizontal header is visible.

Parameters:

new_value (bool) – Indicates whether the horizontal header is visible.

logical_index(col_id: int) int

Converts a column ID to a logical index.

Parameters:

col_id (int) – The column ID.

Returns:

The logical index of the column.

Return type:

int

property page_split: bool

Indicates whether the table is split into pages.

Getter:

Returns whether the table is split into pages.

Return type:

bool

Setter:

Sets whether the table is split into pages.

Parameters:

new_value (bool) – Indicates whether the table is split into pages.

set_custom_font(row_id: str, column_id: int, font: Font | str)

Sets the custom font of a cell.

Parameters:
  • row_id (str) – The row ID.

  • column_id (int) – The column ID.

  • font (base.Font | str) – The new custom font of the cell.

set_custom_value(row_id: str, column_id: int, value: Any)

Sets the custom value of a cell.

Parameters:
  • row_id (str) – The row ID.

  • column_id (int) – The column ID.

  • value (Any) – The new custom value of the cell.

set_defaults()

Setting default values on creating a table item

property show_grid: bool

Indicates whether the table displays a grid.

Getter:

Returns whether the table displays a grid.

Return type:

bool

Setter:

Sets whether the table displays a grid.

Parameters:

new_value (bool) – Indicates whether the table displays a grid.

New in version 1.1.0.

property show_title: bool

Indicates whether the table displays a title.

Getter:

Returns whether the table displays a title.

Return type:

bool

Setter:

Sets whether the table displays a title.

Parameters:

new_value (bool) – Indicates whether the table displays a title.

New in version 1.1.0.

property title: str

The title of the table. Usually in HTML format, but can be plain text.

Getter:

Returns the title of the table.

Return type:

str

Setter:

Sets the title of the table.

Parameters:

new_value (str) – The new title of the table.

New in version 1.1.0.

property title_plain_text: str | None

The plain text version of the title of the table. The setter is not available. Use title instead. Returnns either the plain text version of the title or None if it is not available.

Getter:

Returns the plain text version of the title of the table.

Return type:

str

New in version 1.1.0.

property vertical_header_visible: bool

Indicates whether the vertical header is visible.

Getter:

Returns whether the vertical header is visible.

Return type:

bool

Setter:

Sets whether the vertical header is visible.

Parameters:

new_value (bool) – Indicates whether the vertical header is visible.

property visual_column_ids: tuple[int]

Defines visible columns and their order.

Getter:

Returns visible columns and their order.

Return type:

tuple of int

Setter:

Sets visible columns and their order.

Parameters:

column_ids (tuple of int) – The new visible columns and their order.

class beautifuljason.graphics.TextGraphicsItem(h5_group)

Bases: GraphicsItem

Represents a text graphics item.

property text: Text
Returns:

The text data object.

Return type:

data.Text

property text_id: str
Returns:

The text data object ID.

Return type:

str