This page was generated from docs/examples/0_quickstart.ipynb. Interactive online version: Binder badge.

Quickstart

Load reflection data and preview the rs.DataSet object.

[1]:
import reciprocalspaceship as rs
print(rs.__version__)
0.9.9
[2]:
dataset = rs.read_mtz("data/HEWL_SSAD_24IDC.mtz")
dataset.head()
[2]:
FreeR_flag IMEAN SIGIMEAN I(+) SIGI(+) I(-) SIGI(-) N(+) N(-)
H K L
0 0 4 14 661.29987 21.953098 661.29987 21.953098 661.29987 21.953098 16 16
8 4 3229.649 105.980934 3229.649 105.980934 3229.649 105.980934 16 16
12 6 1361.8672 43.06085 1361.8672 43.06085 1361.8672 43.06085 16 16
16 19 4124.393 196.89108 4124.393 196.89108 4124.393 196.89108 8 8
1 0 1 16 559.33685 8.6263 559.33685 8.6263 559.33685 8.6263 64 64

The above table should look familiar to Python users that have experience with pandas. Thers.DataSet objects also store unit cell and spacegroup information as attributes. These attributes are stored as gemmi objects. For more information on the gemmi Python library, please see their documentation.

[3]:
print(dataset.cell)
<gemmi.UnitCell(79.3439, 79.3439, 37.8099, 90, 90, 90)>
[4]:
print(dataset.spacegroup)
<gemmi.SpaceGroup("P 43 21 2")>

To illustrate using the unit cell parameter information, let’s determine the highest resolution reflection in the dataset:

[5]:
dataset.compute_dHKL(inplace=True)
dataset.head()
[5]:
FreeR_flag IMEAN SIGIMEAN I(+) SIGI(+) I(-) SIGI(-) N(+) N(-) dHKL
H K L
0 0 4 14 661.29987 21.953098 661.29987 21.953098 661.29987 21.953098 16 16 9.452475
8 4 3229.649 105.980934 3229.649 105.980934 3229.649 105.980934 16 16 4.7262373
12 6 1361.8672 43.06085 1361.8672 43.06085 1361.8672 43.06085 16 16 3.150825
16 19 4124.393 196.89108 4124.393 196.89108 4124.393 196.89108 8 8 2.3631186
1 0 1 16 559.33685 8.6263 559.33685 8.6263 559.33685 8.6263 64 64 34.13254
[6]:
print(f"{dataset.dHKL.min():.2f} angstroms")
1.70 angstroms