{ "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": [], "source": [ "import reciprocalspaceship as rs" ] }, { "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", "
FreeR_flagIMEANSIGIMEANI(+)SIGI(+)I(-)SIGI(-)N(+)N(-)
HKL
00414671.039622.205784671.039622.205784671.039622.2057841616
843273.7385107.595893273.7385107.595893273.7385107.595891616
1261367.567943.3525661367.567943.3525661367.567943.3525661616
16194158.55198.883824158.55198.883824158.55198.8838288
2082.49920875.71032052.49920875.71032052.49920875.710320511
\n", "
" ], "text/plain": [ " FreeR_flag IMEAN SIGIMEAN I(+) SIGI(+) I(-) \\\n", "H K L \n", "0 0 4 14 671.0396 22.205784 671.0396 22.205784 671.0396 \n", " 8 4 3273.7385 107.59589 3273.7385 107.59589 3273.7385 \n", " 12 6 1367.5679 43.352566 1367.5679 43.352566 1367.5679 \n", " 16 19 4158.55 198.88382 4158.55 198.88382 4158.55 \n", " 20 8 2.4992087 5.7103205 2.4992087 5.7103205 2.4992087 \n", "\n", " SIGI(-) N(+) N(-) \n", "H K L \n", "0 0 4 22.205784 16 16 \n", " 8 107.59589 16 16 \n", " 12 43.352566 16 16 \n", " 16 198.88382 8 8 \n", " 20 5.7103205 1 1 " ] }, "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 compute 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", "
FreeR_flagIMEANSIGIMEANI(+)SIGI(+)I(-)SIGI(-)N(+)N(-)dHKL
HKL
00414671.039622.205784671.039622.205784671.039622.20578416169.45245
843273.7385107.595893273.7385107.595893273.7385107.5958916164.726225
1261367.567943.3525661367.567943.3525661367.567943.35256616163.1508167
16194158.55198.883824158.55198.883824158.55198.88382882.3631124
2082.49920875.71032052.49920875.71032052.49920875.7103205111.8904899
\n", "
" ], "text/plain": [ " FreeR_flag IMEAN SIGIMEAN I(+) SIGI(+) I(-) \\\n", "H K L \n", "0 0 4 14 671.0396 22.205784 671.0396 22.205784 671.0396 \n", " 8 4 3273.7385 107.59589 3273.7385 107.59589 3273.7385 \n", " 12 6 1367.5679 43.352566 1367.5679 43.352566 1367.5679 \n", " 16 19 4158.55 198.88382 4158.55 198.88382 4158.55 \n", " 20 8 2.4992087 5.7103205 2.4992087 5.7103205 2.4992087 \n", "\n", " SIGI(-) N(+) N(-) dHKL \n", "H K L \n", "0 0 4 22.205784 16 16 9.45245 \n", " 8 107.59589 16 16 4.726225 \n", " 12 43.352566 16 16 3.1508167 \n", " 16 198.88382 8 8 2.3631124 \n", " 20 5.7103205 1 1 1.8904899 " ] }, "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.71 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.7.7" } }, "nbformat": 4, "nbformat_minor": 4 }