{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Quickstart \n", "\n", "Load reflection data and preview the ``rs.DataSet`` object." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.9.9\n" ] } ], "source": [ "import reciprocalspaceship as rs\n", "print(rs.__version__)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
FreeR_flagIMEANSIGIMEANI(+)SIGI(+)I(-)SIGI(-)N(+)N(-)
HKL
00414661.2998721.953098661.2998721.953098661.2998721.9530981616
843229.649105.9809343229.649105.9809343229.649105.9809341616
1261361.867243.060851361.867243.060851361.867243.060851616
16194124.393196.891084124.393196.891084124.393196.8910888
10116559.336858.6263559.336858.6263559.336858.62636464
\n", "
" ], "text/plain": [ " FreeR_flag IMEAN SIGIMEAN I(+) SIGI(+) I(-) \\\n", "H K L \n", "0 0 4 14 661.29987 21.953098 661.29987 21.953098 661.29987 \n", " 8 4 3229.649 105.980934 3229.649 105.980934 3229.649 \n", " 12 6 1361.8672 43.06085 1361.8672 43.06085 1361.8672 \n", " 16 19 4124.393 196.89108 4124.393 196.89108 4124.393 \n", "1 0 1 16 559.33685 8.6263 559.33685 8.6263 559.33685 \n", "\n", " SIGI(-) N(+) N(-) \n", "H K L \n", "0 0 4 21.953098 16 16 \n", " 8 105.980934 16 16 \n", " 12 43.06085 16 16 \n", " 16 196.89108 8 8 \n", "1 0 1 8.6263 64 64 " ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dataset = rs.read_mtz(\"data/HEWL_SSAD_24IDC.mtz\")\n", "dataset.head()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The above table should look familiar to Python users that have experience with ``pandas``. The``rs.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](https://gemmi.readthedocs.io/en/latest/)." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "print(dataset.cell)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n" ] } ], "source": [ "print(dataset.spacegroup)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To illustrate using the unit cell parameter information, let's determine the highest resolution reflection in the dataset:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
FreeR_flagIMEANSIGIMEANI(+)SIGI(+)I(-)SIGI(-)N(+)N(-)dHKL
HKL
00414661.2998721.953098661.2998721.953098661.2998721.95309816169.452475
843229.649105.9809343229.649105.9809343229.649105.98093416164.7262373
1261361.867243.060851361.867243.060851361.867243.0608516163.150825
16194124.393196.891084124.393196.891084124.393196.89108882.3631186
10116559.336858.6263559.336858.6263559.336858.6263646434.13254
\n", "
" ], "text/plain": [ " FreeR_flag IMEAN SIGIMEAN I(+) SIGI(+) I(-) \\\n", "H K L \n", "0 0 4 14 661.29987 21.953098 661.29987 21.953098 661.29987 \n", " 8 4 3229.649 105.980934 3229.649 105.980934 3229.649 \n", " 12 6 1361.8672 43.06085 1361.8672 43.06085 1361.8672 \n", " 16 19 4124.393 196.89108 4124.393 196.89108 4124.393 \n", "1 0 1 16 559.33685 8.6263 559.33685 8.6263 559.33685 \n", "\n", " SIGI(-) N(+) N(-) dHKL \n", "H K L \n", "0 0 4 21.953098 16 16 9.452475 \n", " 8 105.980934 16 16 4.7262373 \n", " 12 43.06085 16 16 3.150825 \n", " 16 196.89108 8 8 2.3631186 \n", "1 0 1 8.6263 64 64 34.13254 " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "dataset.compute_dHKL(inplace=True)\n", "dataset.head()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1.70 angstroms\n" ] } ], "source": [ "print(f\"{dataset.dHKL.min():.2f} angstroms\")" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.8.5" } }, "nbformat": 4, "nbformat_minor": 4 }