The dynamic structure factor (DSF) describes electronic density correlations in a material, and is measured in X-ray Thomson scattering experiments. Physical models for the DSF that depend on material conditions, like temperature and density, can be fit to experimental data to infer these parameters. In the language of inverse problems, the DSF represents a forward model whereas the fitting of this forward model to the data is called the inverse problem. The goal of this project is to demonstrate a framework for inverting a specific DSF model for a given set of DSF data.
The specific model we consider is based on the Mermin dielectric function
In terms of scattering experiments,
We also wrote the Mermin dielectric in terms of
When using the Mermin dielectric to construct the DSF, we'll refer to this total model as the Mermin DSF model.
The accuracy of the Mermin DSF predictions relies crucially on the electron-ion collision frequency
Typically, inverse problems are ill-posed, meaning that, among other things,
the solution may not be unique. For example, inverting the DSF by minimizing a non-linear least-squares problem would only
return a single solution, not the potentially-many other collision frequencies consistent with the data. In this project,
we use Bayesian inference to obtain a posterior distribution for the collision frequency for a given set of DSF data. The highlight of this
approach is that, since we have a posterior distribution for
The primary reason to install this project is to reproduce my analysis, with the analysis taking place entirely within the provided jupyter notebooks. This has only been tested on Linux (Ubuntu 20.04).
NOTE: Most of the data files for the DSF data and existing collision frequency model data used in the analysis are not actually included in the repository. This is because most of this data is not mine (@twhentschel), and I'm unsure of the protocal of hosting this data on a site like Github. However, I would be happy to share this data for reasonable requests!
First, clone the repository
git clone https://github.com/twhentschel/invert-dsf.git
This creates a directory called invert-dsf
. Go into that directory and create an environment using the command
make create_environment
This defaults to a conda environment called invert-dsf
if conda
is installed. Otherwise, it uses virtualenv
to handle the environment. Next, test the environment
make test_environment
Now, activate the environment
conda activate invert-dsf
and then install the dependencies of the project with
make requirements
You can also run tests on the source code with
make test_src
You can see all of the make options by simply entering
make
Once we have the environment set up and activated, we can start running the notebooks. The notebooks are saved as markdown files using jupytext
to facilitate easier source control. To use the jupyter notebooks,
open jupyter lab
python -m jupyter lab
and open the markdown files with Notebook:
(to deactivate the conda environment, run conda deactivate
).
├── LICENSE
├── Makefile <- Makefile with commands like `make data` or `make train`
├── README.md <- The top-level README for developers using this project.
├── data
| ├── mcmc <- Posterior distriubtion data from MCMC sampling
│ ├── external <- Data from third party sources.
│ ├── processed <- The final, canonical data sets for analysis.
│ └── raw <- The original, immutable data dump.
│
├── docs <- A default Sphinx project; see sphinx-doc.org for details
│
├── notebooks <- Jupyter notebooks. Naming convention is a number (for ordering),
│ | the creator's initials, and a short `-` delimited description, e.g.
│ | `1.0-twh-initial-data-exploration`. Notebooks are converts to markdown using
| | `jupytext` to facilitate version control
| ├── exploratory <- notebooks containing initial explorations
| ├── tests <- visual tests of certain features
| └── reports <- notebooks containing polished analysis
│
├── references <- Data dictionaries, manuals, and all other explanatory materials.
│
├── reports <- Generated analysis as HTML, PDF, LaTeX, etc.
│ └── figures <- Generated graphics and figures to be used in reporting
│
├── requirements.txt <- The requirements file for reproducing the analysis environment, e.g.
│ generated with `pip freeze > requirements.txt`
├── setup.py <- Make this project pip installable with `pip install -e`
└── src <- Source code for use in this project.
├── __init__.py <- Makes src a Python module
│
├── data <- Scripts to download or generate data
│ └── make_dataset.py
│
├── inference <- Scripts to perform Bayesian inference.
| | Posterior samples stored in (project)/data/mcmc
│ ├── collision_models.py <- models for the collision frequency
| ├── probability_models.py <- models for probability and likelihood functions
│ └── mcmc_inference.py <- helper functions for MCMC inference
│
└── visualization <- Scripts to create exploratory and results oriented visualizations
└── visualize.py
Project based on the cookiecutter data science project template. #cookiecutterdatascience