{
"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",
" FreeR_flag | \n",
" IMEAN | \n",
" SIGIMEAN | \n",
" I(+) | \n",
" SIGI(+) | \n",
" I(-) | \n",
" SIGI(-) | \n",
" N(+) | \n",
" N(-) | \n",
"
\n",
" \n",
" H | \n",
" K | \n",
" L | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" 4 | \n",
" 14 | \n",
" 661.29987 | \n",
" 21.953098 | \n",
" 661.29987 | \n",
" 21.953098 | \n",
" 661.29987 | \n",
" 21.953098 | \n",
" 16 | \n",
" 16 | \n",
"
\n",
" \n",
" 8 | \n",
" 4 | \n",
" 3229.649 | \n",
" 105.980934 | \n",
" 3229.649 | \n",
" 105.980934 | \n",
" 3229.649 | \n",
" 105.980934 | \n",
" 16 | \n",
" 16 | \n",
"
\n",
" \n",
" 12 | \n",
" 6 | \n",
" 1361.8672 | \n",
" 43.06085 | \n",
" 1361.8672 | \n",
" 43.06085 | \n",
" 1361.8672 | \n",
" 43.06085 | \n",
" 16 | \n",
" 16 | \n",
"
\n",
" \n",
" 16 | \n",
" 19 | \n",
" 4124.393 | \n",
" 196.89108 | \n",
" 4124.393 | \n",
" 196.89108 | \n",
" 4124.393 | \n",
" 196.89108 | \n",
" 8 | \n",
" 8 | \n",
"
\n",
" \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 16 | \n",
" 559.33685 | \n",
" 8.6263 | \n",
" 559.33685 | \n",
" 8.6263 | \n",
" 559.33685 | \n",
" 8.6263 | \n",
" 64 | \n",
" 64 | \n",
"
\n",
" \n",
"
\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",
" FreeR_flag | \n",
" IMEAN | \n",
" SIGIMEAN | \n",
" I(+) | \n",
" SIGI(+) | \n",
" I(-) | \n",
" SIGI(-) | \n",
" N(+) | \n",
" N(-) | \n",
" dHKL | \n",
"
\n",
" \n",
" H | \n",
" K | \n",
" L | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
" | \n",
"
\n",
" \n",
" \n",
" \n",
" 0 | \n",
" 0 | \n",
" 4 | \n",
" 14 | \n",
" 661.29987 | \n",
" 21.953098 | \n",
" 661.29987 | \n",
" 21.953098 | \n",
" 661.29987 | \n",
" 21.953098 | \n",
" 16 | \n",
" 16 | \n",
" 9.452475 | \n",
"
\n",
" \n",
" 8 | \n",
" 4 | \n",
" 3229.649 | \n",
" 105.980934 | \n",
" 3229.649 | \n",
" 105.980934 | \n",
" 3229.649 | \n",
" 105.980934 | \n",
" 16 | \n",
" 16 | \n",
" 4.7262373 | \n",
"
\n",
" \n",
" 12 | \n",
" 6 | \n",
" 1361.8672 | \n",
" 43.06085 | \n",
" 1361.8672 | \n",
" 43.06085 | \n",
" 1361.8672 | \n",
" 43.06085 | \n",
" 16 | \n",
" 16 | \n",
" 3.150825 | \n",
"
\n",
" \n",
" 16 | \n",
" 19 | \n",
" 4124.393 | \n",
" 196.89108 | \n",
" 4124.393 | \n",
" 196.89108 | \n",
" 4124.393 | \n",
" 196.89108 | \n",
" 8 | \n",
" 8 | \n",
" 2.3631186 | \n",
"
\n",
" \n",
" 1 | \n",
" 0 | \n",
" 1 | \n",
" 16 | \n",
" 559.33685 | \n",
" 8.6263 | \n",
" 559.33685 | \n",
" 8.6263 | \n",
" 559.33685 | \n",
" 8.6263 | \n",
" 64 | \n",
" 64 | \n",
" 34.13254 | \n",
"
\n",
" \n",
"
\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
}