Data Structures Module
- class beautifuljason.data.Image(h5_group)
Bases:
IDedObjectRepresents an image data object /JasonDocument/General/Pixmaps/<N>
The image is stored in HDF5 format and can be accessed as a numpy array.
- property class_: bytes
- Returns:
The image class attribute.
- Return type:
bytes
- property depth: int
- Returns:
The image depth. 24 for RGB and 32 for RGBA
- Return type:
int
- property height: int
- Returns:
The image height.
- Return type:
int
- property interlace_mode: bytes
- Returns:
The image interlace mode attribute.
- Return type:
bytes
- property min_max_range: ndarray[uint8]
- Returns:
The image min max range attribute.
- Return type:
np.ndarrayofnp.uint8
- property pixmap: ndarray[uint8]
Added in version 1.1.0.
The image data.
- Returns:
The image data as a numpy array.
- Return type:
np.ndarrayofnp.uint8
- property subclass: bytes
- Returns:
The image subclass attribute.
- Return type:
bytes
- property version: bytes
- Returns:
The image version attribute.
- Return type:
bytes
- property width: int
- Returns:
The image width.
- Return type:
int
- class beautifuljason.data.Molecule(h5_group)
Bases:
IDedObjectRepresents a molecule data object from /JasonDocument/Molecules/Molecules/<N> groups.
- class Atom(h5_group)
Bases:
H5GroupRepresents an atom.
- class NuclType(*values)
Bases:
IntEnumNuclide types enumeration.
- Ag107 = 60
- Ag109 = 61
- Al27 = 18
- As75 = 43
- Au197 = 111
- B10 = 8
- B11 = 9
- Ba135 = 77
- Ba137 = 78
- Be9 = 7
- Bi209 = 117
- Br79 = 45
- Br81 = 46
- C13 = 10
- Ca43 = 26
- Cd111 = 62
- Cd113 = 63
- Cl35 = 22
- Cl37 = 23
- Co59 = 35
- Cr53 = 32
- Cs133 = 76
- Cu63 = 37
- Cu65 = 38
- Dy161 = 91
- Dy163 = 92
- Er167 = 94
- Eu151 = 86
- Eu153 = 87
- F19 = 14
- Fe57 = 34
- Ga69 = 40
- Ga71 = 41
- Gd155 = 88
- Gd157 = 89
- Ge73 = 42
- H1 = 1
- H2 = 2
- H3 = 3
- He3 = 4
- Hf177 = 100
- Hf179 = 101
- Hg199 = 112
- Hg201 = 113
- Ho165 = 93
- I127 = 73
- In113 = 64
- In115 = 65
- Ir191 = 108
- Ir193 = 109
- K39 = 24
- K41 = 25
- Kr83 = 47
- La138 = 79
- La139 = 80
- Li6 = 5
- Li7 = 6
- Lu175 = 98
- Lu176 = 99
- Mg25 = 17
- Mn55 = 33
- Mo95 = 54
- Mo97 = 55
- N14 = 11
- N15 = 12
- Na23 = 16
- Nb93 = 53
- Nd143 = 82
- Nd145 = 83
- Ne21 = 15
- Ni61 = 36
- O17 = 13
- Os187 = 106
- Os189 = 107
- P31 = 20
- Pb207 = 116
- Pd105 = 59
- Pr141 = 81
- Pt195 = 110
- Rb85 = 48
- Rb87 = 49
- Re185 = 104
- Re187 = 105
- Rh103 = 58
- Ru101 = 57
- Ru99 = 56
- S33 = 21
- Sb121 = 69
- Sb123 = 70
- Sc45 = 27
- Se77 = 44
- Si29 = 19
- Sm147 = 84
- Sm149 = 85
- Sn115 = 66
- Sn117 = 67
- Sn119 = 68
- Sr87 = 50
- Ta181 = 102
- Tb159 = 90
- Te123 = 71
- Te125 = 72
- Ti47 = 28
- Ti49 = 29
- Tl203 = 114
- Tl205 = 115
- Tm169 = 95
- U235 = 118
- Undef = 0
- V50 = 30
- V51 = 31
- W183 = 103
- Xe129 = 74
- Xe131 = 75
- Y89 = 51
- Yb171 = 96
- Yb173 = 97
- Zn67 = 39
- Zr91 = 52
- class Type(*values)
Bases:
IntEnumAtom elements enumeration.
- A = 152
- Ac = 89
- Ag = 47
- Al = 13
- Am = 95
- Ar = 18
- As = 33
- At = 85
- Au = 79
- B = 5
- Ba = 56
- Be = 4
- Bh = 107
- Bi = 83
- Bk = 97
- Br = 35
- C = 6
- Ca = 20
- Cd = 48
- Ce = 58
- Cf = 98
- Cl = 17
- Cm = 96
- Cn = 112
- Co = 27
- Cr = 24
- Cs = 55
- Cu = 29
- Db = 105
- Ds = 110
- Dy = 66
- El119 = 119
- El120 = 120
- El121 = 121
- El122 = 122
- El123 = 123
- El124 = 124
- El125 = 125
- El126 = 126
- El127 = 127
- El128 = 128
- El129 = 129
- El130 = 130
- El131 = 131
- El132 = 132
- El133 = 133
- El134 = 134
- El135 = 135
- El136 = 136
- El137 = 137
- El138 = 138
- El139 = 139
- El140 = 140
- El141 = 141
- El142 = 142
- El143 = 143
- El144 = 144
- El145 = 145
- El146 = 146
- El147 = 147
- El148 = 148
- El149 = 149
- El150 = 150
- Er = 68
- Es = 99
- Eu = 63
- F = 9
- FV = 151
- Fe = 26
- Fl = 114
- Fm = 100
- Fr = 87
- Ga = 31
- Gd = 64
- Ge = 32
- H = 1
- He = 2
- Hf = 72
- Hg = 80
- Ho = 67
- Hs = 108
- I = 53
- In = 49
- Ir = 77
- K = 19
- Kr = 36
- L = 154
- La = 57
- Li = 3
- Lr = 103
- Lu = 71
- Lv = 116
- Mc = 115
- Md = 101
- Mg = 12
- Mn = 25
- Mo = 42
- Mt = 109
- N = 7
- NL = 155
- NONE = 0
- Na = 11
- Nb = 41
- Nd = 60
- Ne = 10
- Nh = 113
- Ni = 28
- No = 102
- Np = 93
- O = 8
- Og = 118
- Os = 76
- P = 15
- Pa = 91
- Pb = 82
- Pd = 46
- Pm = 61
- Po = 84
- Pr = 59
- Pt = 78
- Pu = 94
- Q = 153
- Ra = 88
- Rb = 37
- Re = 75
- Rf = 104
- Rg = 111
- Rh = 45
- Rn = 86
- Ru = 44
- S = 16
- Sb = 51
- Sc = 21
- Se = 34
- Sg = 106
- Si = 14
- Sm = 62
- Sn = 50
- Sr = 38
- Ta = 73
- Tb = 65
- Tc = 43
- Te = 52
- Th = 90
- Ti = 22
- Tl = 81
- Tm = 69
- Ts = 117
- U = 92
- V = 23
- W = 74
- Xe = 54
- Y = 39
- Yb = 70
- Zn = 30
- Zr = 40
- property bonded_atom_numbers: ndarray[uint32]
- Returns:
The bonded atom numbers of the atom.
- Return type:
np.ndarrayofnp.uint32
- property bonded_atoms: list[Atom]
- Returns:
The bonded atoms of the atom.
- Return type:
listofMolecule.Atom
- property bonds: ndarray[uint32]
- Returns:
The bonds of the atom.
- Return type:
np.ndarrayofnp.uint32
- property charge: int | None
- Returns:
The charge of the atom.
- Return type:
int| None
- property isotope: int | None
- Returns:
The isotope of the atom.
- Return type:
int| None
- property nh: int
- Returns:
The number of hydrogen atoms attached to the atom.
- Return type:
int
- property valence: int | None
- Returns:
The valence of the atom.
- Return type:
int| None
- property x: float
- Returns:
The X coordinate of the atom.
- Return type:
float
- property y: float
- Returns:
The Y coordinate of the atom.
- Return type:
float
- property z: float | None
- Returns:
The Z coordinate of the atom if present.
- Return type:
float| None
- class Coupling(h5_group)
Bases:
H5GroupRepresents a j-coupling.
- property acount1: int
- Returns:
The number of identical atoms of the first coupling partner.
- Return type:
int
- property acount2: int
- Returns:
The number of identical atoms of the second coupling partner.
- Return type:
int
- property error_spheres: int
- Returns:
The error spheres of the coupling.
- Return type:
int
- property ignored_auto: bool
- Returns:
Whether the coupling is ignored automatically.
- Return type:
bool
- property ignored_user: bool
- Returns:
Whether the coupling is ignored by the user.
- Return type:
bool
- property is_exchangeable1: bool
- Returns:
Whether the first coupling partner is exchangeable.
- Return type:
bool
- property is_exchangeable2: bool
- Returns:
Whether the second coupling partner is exchangeable.
- Return type:
bool
- property jvalue: int
- Returns:
Number of bonds between the coupling partners.
- Return type:
int
- property mark1: str | None
- Returns:
The mark of the first coupling partner if present.
- Return type:
str| None
- property mark2: str | None
- Returns:
The mark of the second coupling partner if present.
- Return type:
str| None
- property n1: uint32
- Returns:
The first atom number of the coupling.
- Return type:
np.uint32
- property n2: uint32
- Returns:
The second atom number of the coupling.
- Return type:
np.uint32
- property value: ndarray[float64]
- Returns:
array of experimental and calculated J values of the coupling. The value at index 0 is the experimental J value.
- Return type:
np.ndarrayofnp.float64
- property value_error: ndarray[float64]
- Returns:
array of calculated J value errors of the coupling. The value at index 0, corresponding to the experimental J value, is -1.
- Return type:
np.ndarrayofnp.float64
- property value_method: ndarray[int32]
- Returns:
array of value calculation methods of the coupling.
- Return type:
np.ndarrayofnp.int32
- property value_spheres: int
- Returns:
The value spheres of the coupling.
- Return type:
int
- class Ring(h5_group)
Bases:
H5GroupRepresents a ring.
- class List(h5_group)
Bases:
GroupListRepresents a list of rings.
- Parameters:
h5_group (
h5py.Group) – The H5 group.
- property atoms: ndarray[uint32]
- Returns:
The atoms of the ring.
- Return type:
np.ndarrayofnp.uint32
- property is_aromatic: bool
- Returns:
Whether the ring is aromatic.
- Return type:
bool
- class Spectrum(h5_group)
Bases:
H5GroupRepresents a prediction spectrum.
- class Shift(h5_group)
Bases:
H5GroupRepresents a chemical shift.
- property acount: int
- Returns:
The number of identical atoms of the chemical shift.
- Return type:
int
- property error_spheres: int
- Returns:
The error spheres of the chemical shift.
- Return type:
int
- property ignored_auto: bool
- Returns:
Whether the chemical shift is ignored automatically.
- Return type:
bool
- property ignored_user: bool
- Returns:
Whether the chemical shift is ignored by the user.
- Return type:
bool
- property is_exchangeable: bool
- Returns:
Whether the chemical shift is exchangeable.
- Return type:
bool
- property mark: str | None
- Returns:
The mark of the chemical shift if present.
- Return type:
str| None
- property nh: int
- Returns:
The number of hydrogen atoms attached to the atom.
- Return type:
int
- property nums: ndarray[uint32]
- Returns:
The atom numbers of the chemical shift.
- Return type:
np.ndarrayofnp.uint32
- property value: ndarray[float64]
- Returns:
The experimental and calculated chemical shift values. The value at index 0 is the experimental chemical shift.
- Return type:
np.ndarrayofnp.float64
- property value_error: ndarray[float64]
- Returns:
The calculated chemical shift errors. The value at index 0, corresponding to the experimental chemical shift, is -1.
- Return type:
np.ndarrayofnp.float64
- property value_method: ndarray[int32]
- Returns:
The value calculation methods of the chemical shift.
- Return type:
np.ndarrayofnp.int32
- property value_spheres: int
- Returns:
The value spheres of the chemical shift.
- Return type:
int
- class Type(*values)
Bases:
IntEnumSpectrum types enumeration.
- ADEQUATE = 16
- APT = 4
- All = 28
- C13 = 27
- COLOC = 14
- COSY = 5
- Chrom = 23
- DEPT135 = 3
- DEPT45 = 24
- DEPT90 = 2
- H1 = 26
- H2BC = 15
- HETCOR = 12
- HMBC = 13
- HMQC = 10
- HSQC = 9
- HSQC_DEPT135 = 25
- HSQC_TOCSY = 11
- INADEQUATE = 17
- IR = 21
- Long_2D = 19
- Mass = 20
- NOESY = 7
- Near_2D = 18
- ROESY = 8
- STD = 1
- TOCSY = 6
- UV = 22
- Undef = 0
- property origin: int
- Returns:
The origin of the spectrum.
- Return type:
int
- property shifts: List
- Returns:
The chemical shifts of the spectrum.
- Return type:
Example Usage:
import beautifuljason as bjason # It is assumed that the 'example.jjh5' document contains a molecule. with bjason.Document('example.jjh5', mode='r') as doc: for pred_spec in doc.mol_data[0].spectra: print(f'Nucleus: {pred_spec.nucleus.name}') for shift in pred_spec.shifts: print(f' Atoms: {shift.nums}, Shift: {shift.value[0]} ppm')
- class Symmetry(h5_group)
Bases:
H5GroupRepresents atom symmetry.
- property items: Iterable[int]
- Returns:
The symmetry items.
- Return type:
Iterableofint
- property spectra: List
- Returns:
The prediction spectra of the molecule.
- Return type:
Example Usage:
import beautifuljason as bjason # It is assumed that the 'example.jjh5' document contains a molecule. with bjason.Document('example.jjh5', mode='r') as doc: for pred_spec in doc.mol_data[0].spectra: print(f'Nucleus: {pred_spec.nucleus.name}') for shift in pred_spec.shifts: print(f' Atoms: {shift.nums}, Shift: {shift.value[0]} ppm')
- class beautifuljason.data.NMREntry(h5_group)
Bases:
H5GroupRepresents an NMR entry encapsulated within an HDF5 group.
- Parameters:
h5_group (h5py.Group) – The actual HDF5 group object.
- property ndim
Retrieve the number of dimensions for the NMR data. Provided for convenience, as the value is not directly available in the HDF5 group.
- Returns:
Number of dimensions for the NMR data.
- Return type:
int
- class beautifuljason.data.NMRMultiplet(h5_group)
Bases:
IDedObjectRepresents an NMR multiplet stored within an HDF5 group.
- Parameters:
h5_group (h5py.Group) – The actual HDF5 group object.
- class List(h5_group)
Bases:
IDedObject,GroupListRepresents a list of NMR multiplets.
- Parameters:
h5_group (h5py.Group) – The actual HDF5 group object.
- property auto_baseline
- Returns:
True if the baseline is automatically calculated, otherwise False.
- Return type:
bool
- property integral_lvl
- Returns:
integral level of the multiplets.
- Return type:
float
- property integral_scale
- Returns:
integral scale of the multiplets.
- Return type:
float
- property integral_scale_scoped
- Returns:
array of scoped integral scales of the multiplets.
- Return type:
numpy.ndarrayofnumpy.float64or None
- property integral_tlt
- Returns:
integral tilt of the multiplets.
- Return type:
float
- property integral_total
- Returns:
total integral of the multiplets.
- Return type:
float
- property integral_vscale
- Returns:
integral vertical scale of the multiplets.
- Return type:
float
- property integral_vshift
- Returns:
integral vertical shift of the multiplets.
- Return type:
float
- property pos_units
- Returns:
A tuple of position units.
- Return type:
tupleofUnits
- class ShowType(*values)
Bases:
IntEnumEnumeration representing the types of display for the multiplet.
- Integral = 1
- Multiplet = 0
- _get_peaks(attr_name) list[NMRPeak]
- Parameters:
attr_name (
str) – The name of the attribute to retrieve the peaks from.- Returns:
The peaks associated with the attribute.
- Return type:
listofNMRPeak
- property all_peaks: list[NMRPeak]
- Returns:
All peaks found within the multiplet region, including those not associated with the multiplet.
- Return type:
listofNMRPeak
- property curve: ndarray[float64]
- Returns:
The curve data for the multiplet.
- Return type:
numpy.ndarraywith dtypenumpy.float64
- property flags: int32
- Returns:
The flags associated with the multiplet.
- Return type:
int
- property integral_scope: int32
- Returns:
The scope for the integral. Defaults to 0 if not specified in the HDF5 group.
- Return type:
numpy.int32
- property js: ndarray[float64]
- Returns:
The J values for the multiplet. If not present, returns an empty array.
- Return type:
numpy.ndarraywith dtypenumpy.float64
- property jtree
- Returns:
The J coupling tree data, represented as a list of dictionaries with ‘groups’ and ‘positions’ as keys.
- Return type:
listofdictwith keys ‘groups’ and ‘positions’
- property moments: ndarray[float64]
- Returns:
The moments associated with the multiplet.
- Return type:
numpy.ndarraywith dtypenumpy.float64
- property multiplets
- Returns:
The associated list of multiplets.
- Return type:
NMRMultiplet.Listor None if not present.
- property multiplicities: ndarray[int32]
- Returns:
The multiplicities for the multiplet. If not present, returns an empty array.
- Return type:
numpy.ndarraywith dtypenumpy.int32
- property multiplicities_str: str | None
- Returns:
The multiplicities for the multiplet as a string.
- Return type:
stror None if not present.
- property normalized_value
- Returns:
The normalized value of the multiplet.
- Return type:
numpy.float64
- property peaks: list[NMRPeak]
- Returns:
The peaks associated with the multiplet.
- Return type:
listofNMRPeak
Example Usage:
import beautifuljason as bjason # It is assumed that the 'example.jjh5' document contains a spectrum with multiplets. with bjason.Document('example.jjh5', mode='r') as doc: for multiplet in doc.nmr_data[0].multiplets: print(f'Pos: {multiplet.pos[0]}, Sum Integral: {multiplet.value_hz}') for peak in multiplet.peaks: print(f' Peak Pos: {peak.pos[0]}, Area: {peak.area}')
- property pos: ndarray[float64]
- Returns:
The position of the multiplet.
- Return type:
numpy.ndarrayof shape (3,) with dtypenumpy.float64
- property range: tuple[ndarray, ndarray, ndarray]
- Returns:
The multiplet range as a tuple of np.array objects.
- Return type:
tupleof shape (3,) ofnumpy.ndarraywith dtypenumpy.float64
- property value
- Returns:
The value of the multiplet.
- Return type:
numpy.float64
- property value_hz
- Returns:
The value in Hertz (Hz) of the multiplet.
- Return type:
numpy.float64
- property value_hz_factor
- Returns:
The factor to convert the value to Hertz (Hz). Defaults to 1.0 if not specified in the HDF5 group.
- Return type:
numpy.float64
- class beautifuljason.data.NMRPeak(h5_group)
Bases:
IDedObjectRepresents an NMR peak stored within an HDF5 group.
- Parameters:
h5_group (h5py.Group) – The actual HDF5 group object.
- class List(h5_group)
Bases:
IDedObject,GroupListRepresents a list of NMR peaks.
- Parameters:
h5_group (h5py.Group) – The actual HDF5 group object.
- class PeakClassification(*values)
Bases:
IntEnumEnumeration representing the classifications of peaks.
- C13Satellite = 4
- Compound = 0
- Contaminant = 1
- NMRSolvent = 2
- ReactionSolvent = 3
- SSSideband = 5
- class PeakType(*values)
Bases:
IntEnumEnumeration representing the types of peaks.
- GenLorentz = 1
- PseudoVoigt = 0
- property area: float64
Added in version 1.0.4.
- Returns:
The area of the peak.
- Return type:
numpy.float64
Note
Requires JASON 4.1 or later.
- property area_sigma: float64
Added in version 1.0.4.
- Returns:
The area sigma of the peak.
- Return type:
numpy.float64
Note
Requires JASON 4.1 or later.
- property classification: PeakClassification
The classification of the peak.
- Getter:
Returns the classification of the peak.
- Return type:
- Setter:
Sets the classification of the peak.
- Parameters:
new_classification (
PeakClassification) – The new classification of the peak.
- property height: float64
- Returns:
The height of the peak.
- Return type:
numpy.float64
- property label
The label of the peak.
- Getter:
Returns the label of the peak.
- Return type:
str- Setter:
Sets the label of the peak.
- Parameters:
new_label (
str) – The new label of the peak.
- property offset: float64
- Returns:
The offset of the peak.
- Return type:
numpy.float64
- property pos: ndarray[float64]
- Returns:
The position of the peak.
- Return type:
numpy.ndarrayof shape (3,) with dtypenumpy.float64
- property shape_par: ndarray[float64]
- Returns:
The shape parameter of the peak.
- Return type:
numpy.ndarrayof shape (3,) with dtypenumpy.float64
- property width: ndarray[float64]
- Returns:
The width of the peak.
- Return type:
numpy.ndarrayof shape (3,) with dtypenumpy.float64
- class beautifuljason.data.NMRProcessing(h5_group)
Bases:
IDedObjectRepresents an NMR processing step stored within an HDF5 group.
- Parameters:
h5_group – The actual HDF5 group object.
- class List(h5_group)
Bases:
GroupListRepresents a list of NMR processing steps.
- Parameters:
h5_group – The actual HDF5 group object.
- class EndType(*values)
Bases:
IntEnumEnumeration representing the types of endpoints.
- Full = 0
- Orig = 1
- postFT = 3
- preFT = 2
- property end_point_dim: int32
- Returns:
The dimension of the endpoint.
- Return type:
numpy.int32
- class Parameter(h5_group)
Bases:
H5GroupRepresents a parameter for an NMR processing step.
- property current_index: int32 | None
- Returns:
The current index for the parameter.
- Return type:
numpy.int32or None if not present.
- property decimals: int32 | None
- Returns:
The number of decimals for the parameter.
- Return type:
numpy.int32or None if not present.
- property max_value: Any | None
- Returns:
The maximum value for the parameter.
- Return type:
Anyor None if not present.
- property min_value: Any | None
- Returns:
The minimum value for the parameter.
- Return type:
Anyor None if not present.
- property name: str
- Returns:
The name of the parameter.
- Return type:
str
- property step: float64 | None
- Returns:
The step size for the parameter.
- Return type:
numpy.float64or None if not present.
- property tip: str
- Returns:
The tip for the parameter.
- Return type:
str
- property value: Any
- Returns:
The value of the parameter.
- Return type:
Any
- property value_type: QMetaType_Type
- Returns:
The type of the parameter.
- Return type:
base.QMetaType_Type
- class Type(*values)
Bases:
IntEnumEnumeration representing the types of processing steps.
- ATD = 33
- Abs = 8
- Apodize = 2
- CSSF = 19
- Compress = 37
- Cov = 41
- Custom = 39
- DC = 26
- DOSY = 24
- DTA = 25
- DcFID = 40
- DownSample = 45
- External = 14
- FT = 4
- Fiddle = 38
- Filter = 32
- Flatten = 12
- Lp = 3
- NUS = 15
- NextDim = 9
- NoiseGen = 34
- Normalize = 42
- PeakRef = 29
- Phase = 6
- PhaseFID = 23
- PolyBC = 11
- PrepIndir = 5
- ROSY = 36
- ReSample = 35
- Real = 13
- Reverse = 7
- Rot = 21
- Round = 44
- SGFilter2D = 18
- SGSmooth = 10
- Scale = 27
- Shear = 46
- Sim = 20
- Sub = 17
- Sum = 28
- Sym = 16
- T1Sup = 30
- Tilt = 47
- Unknown = 0
- ZF = 1
- bLP = 43
- fLP = 31
- iFT = 22
- property active: bool
- Returns:
True if the processing step is active, otherwise False.
- Return type:
bool
- property name: str
- Returns:
The name of the processing step.
- Return type:
str
- class beautifuljason.data.NMRSpecInfo(h5_group, ndim)
Bases:
H5GroupRepresents spectral information for an NMR dataset encapsulated within an HDF5 group.
- Parameters:
h5_group (h5py.Group) – The actual HDF5 group object.
ndim (
int) – The number of dimensions for the NMR data.
- get_orig_param(group_name, param_name)
Retrieve an original parameter value from a specified group within the OriginalParameters section of the HDF5 group. Original parameters are values imported directly from the original dataset without modification. For some vendors, parameters may include attributes written using the syntax param_name.attr_name. For example, the JEOL Delta X_FREQ parameter also includes X_FREQ.unts and X_FREQ.unts.str attributes.
- Parameters:
group_name (str) – Name of the group under ‘OriginalParameters’ to search in.
param_name (str) – Name of the parameter to retrieve.
- Returns:
Value of the specified parameter if found; None otherwise.
- Return type:
Any or None
Example Usage
import beautifuljason as bjason def extract_metadata(jdf_file: str) -> dict: jason = bjason.JASON() with jason.create_document(jdf_file) as doc: raw_spec_info = doc.nmr_data[0].raw_data.spec_info # Extract example metadata metadata = { "X_SWEEP": raw_spec_info.get_orig_param("parameters", "X_SWEEP"), "X_FREQ": raw_spec_info.get_orig_param("parameters", "X_FREQ") } return metadata
- get_param(param_name)
Retrieve a parameter value from the HDF5 group.
Unlike original parameters (see
get_orig_param()), these parameters are part of a predefined set that is populated using vendor data.- Parameters:
param_name (str) – Name of the parameter to retrieve.
- Returns:
Value of the specified parameter if found; None otherwise.
- Return type:
Any or None
Example Usage
import beautifuljason as bjason def extract_metadata(jdf_file: str) -> dict: jason = bjason.JASON() with jason.create_document(jdf_file) as doc: raw_spec_info = doc.nmr_data[0].raw_data.spec_info # Extract example metadata metadata = { "Title": bjason.utils.ensure_str(raw_spec_info.get_param("Title")), "Solvent": bjason.utils.ensure_str(raw_spec_info.get_param("Solvent")), "Temperature": raw_spec_info.get_param("Temperature") } return metadata
- property nuclides
Retrieve the nuclide information for each dimension of the NMR data. Provided for convenience, as the value is not readily accessible in the HDF5 group.
- Returns:
A tuple of nuclide strings for each dimension.
- Return type:
tuple
- class beautifuljason.data.NMRSpectrum(h5_group)
Bases:
NMREntry,IDedObjectRepresents an NMR spectrum stored within an HDF5 group.
- Parameters:
h5_group – The actual HDF5 group object.
- class List(h5_group)
Bases:
GroupListRepresents a list of NMR spectra.
- Parameters:
h5_group – The actual HDF5 group object.
- property multiplets: List
- Returns:
The associated list of multiplets.
- Return type:
Example Usage:
import beautifuljason as bjason # It is assumed that the 'example.jjh5' document contains a spectrum with multiplets. with bjason.Document('example.jjh5', mode='r') as doc: for multiplet in doc.nmr_data[0].multiplets: print(f'Pos: {multiplet.pos[0]}, Sum Integral: {multiplet.value_hz}')
- property peaks: List
- Returns:
The associated list of peaks.
- Return type:
NMRPeak.ListofNMRPeak.
Example Usage:
import beautifuljason as bjason # It is assumed that the 'example.jjh5' document contains a spectrum with peaks. with bjason.Document('example.jjh5', mode='r') as doc: for peak in doc.nmr_data[0].peaks: print(f'Pos: {peak.pos[0]}, Area: {peak.area}')
- property proc_list: List
- Returns:
The associated list of processing steps.
- Return type:
Example Usage:
import beautifuljason as bjason # It is assumed that the 'example.jjh5' document contains a spectrum. with bjason.Document('example.jjh5', mode='r') as doc: for proc in doc.nmr_data[0].proc_list: print(f'Name: {proc.name}') for param in proc.parameters: print(f' {param.name}({param.tip}): {param.value}')
- class beautifuljason.data.Text(h5_group)
Bases:
IDedObjectRepresents a text data object located at /JasonDocument/General/TextDocuments/<N>.
The text is stored as an HTML string.
- property html: str
The HTML text.
- Getter:
Returns the HTML text.
- Return type:
str- Setter:
Sets the HTML text.
- Parameters:
new_html (
str) – The new HTML text.