{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Time-Resolved Difference Map \n", "\n", "Time-resolved crystallography experiments make use of X-ray diffraction to monitor structural changes in a crystalline sample. Such experiments typically use a pump-probe setup where atomic motions are induced by a \"pump\" (often some sort of a laser pulse) and then are monitored using a probe X-ray pulse. Due to the need for an X-ray pulse with a short time duration, it is most common to conduct time-resolved diffraction experiments using an XFEL or using a Laue (pink beam) beamline at a synchrotron in order to achieve the desired X-ray intensity. \n", "\n", "A common methodology for investigating structural changes in time-resolved experiments is using difference maps between structure factor amplitudes collected with and without a perturbation. These $(|F_{On}| - |F_{Off}|)$ maps may be noisy due to systematic errors or scaling artifacts, and have historically been weighted based on the magnitude of the difference signal and/or the error estimates associated with the measured values. \n", "\n", "Photoactive yellow protein (PYP) is a model system in time-resolved crystallography due to the trans-cis isomerization of its chromophore which occurs upon absorption of blue light. Here, we will use `reciprocalspaceship` to produce a weighted difference map of PYP to investigate the structural changes that occur 2ms after illumination with blue light. This dataset was collected at the [BioCARS Laue beamline APS-14-ID](https://biocars.uchicago.edu/) from a PYP crystal with $P 6_3$ symmetry, and were processed using Precognition (Renz Research, Inc.), a software suite for Laue data processing. This data was collected and provided by Marius Schmidt and Vukica Šrajer." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import seaborn as sns\n", "sns.set_context(\"notebook\", font_scale=1.4)\n", "import numpy as np" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import reciprocalspaceship as rs" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.8.9\n" ] } ], "source": [ "print(rs.__version__)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "### Load `On` and `Off` PYP DataSets \n", "\n", "The `.hkl` files used in this example came directly from Precognition and contain scaled, merged structure amplitudes (**F**) and associated errors (**SigF**). Precognition uses a different convention for the reciprocal space asymmetric unit (ASU) than CCP4/Phenix, so we will map all reflections to the ASU. " ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "def load(hkl, cell=(66.9, 66.9, 40.8, 90.0, 90.0, 120.0), sg=173):\n", " \"\"\"\n", " Load HKL file from Precognition and map reflections to the reciprocal space ASU.\n", " \"\"\"\n", " dataset = rs.read_precognition(hkl, *cell, sg=sg)\n", " dataset.hkl_to_asu(inplace=True)\n", " dataset.drop(columns=\"M/ISYM\", inplace=True)\n", " return dataset" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "off = load(\"data/PYP_varEll_2sig_off_1.6A.hkl\")\n", "on = load(\"data/PYP_varEll_2sig_2ms_1.6A.hkl\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Since difference maps can only be made with Fourier magnitudes that were measured in both datasets, we will subset the datasets to their common Miller indices." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "pyp = off.merge(on, left_index=True, right_index=True, suffixes=(\"_off\", \"_on\"))" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", " | \n", " | \n", " | F_off | \n", "SigF_off | \n", "F_on | \n", "SigF_on | \n", "
---|---|---|---|---|---|---|
H | \n", "K | \n", "L | \n", "\n", " | \n", " | \n", " | \n", " |
0 | \n", "1 | \n", "2 | \n", "56.646 | \n", "0.036 | \n", "75.991 | \n", "0.032 | \n", "
3 | \n", "89.061 | \n", "0.03 | \n", "89.667 | \n", "0.031 | \n", "||
4 | \n", "95.419 | \n", "0.048 | \n", "93.886 | \n", "0.047 | \n", "||
5 | \n", "160.466 | \n", "0.038 | \n", "162.553 | \n", "0.035 | \n", "||
6 | \n", "77.869 | \n", "0.075 | \n", "79.139 | \n", "0.083 | \n", "