Skip to content

An example of some code I wrote a few years ago, sliced out of a larger project so that I can show it to interviewers. Though I might tinker with it (the lack of tests/poor documentation is concerning... and it would be nice to make it a proper package), but for now I'm busy writing my thesis!

Notifications You must be signed in to change notification settings

CalumFreeman/FilterAnalysis_public

Repository files navigation

Purpose

This is an excerpt of code written for my own use to help choose which filters should be used on a set of X-ray diodes. The original code was written in 2022, however it is embedded within a project which I don't have permission to make public.

I made this repository so that I could submit the code to a job application that requested an example of code I'd written.

Background

The goal of the experiment which this code was written to help with was to extract the spectrum of an x-ray source (an X-pinch) using pin diodes. This code aids the choice of filters, and helps analyse experimental results.

The pin diodes provide a signal indicating the total energy deposited on them by x-rays, not the spectrum of those x-rays. To work out the spectrum, multiple diodes with different filters can be used, typically by using a number of "ross pairs". A ross pair are two filters which allow the same amount of photons through at most energies on the spectrum, but in some window the filters have different transmission. By subtracting the two filters from each other, the total energy deposited by photons in that energy range can be determined.

To analyse experimental results, a model of the X-pinch is used, this x-ray source has two components: a thermal source, and a k-alpha source. The thermal source is a broad maxwellian spectrum, and knowing this spectrum gives an estimate of the temperature of the x-pinch. The k-alpha source is a spectrally thin source with a known energy (depending on the wire material chosen for the X-pinch), however the intensity of this source relative to the thermal source must be determined by experiment. The thermal and k-alpha emission happen at different times, so it is possible to split them in the data from the x-ray diodes and analyse them separately.

Installation

Simply clone the repository into a folder, and run whichever script you want (see usage)

This project requires a python installation with matplotlib and numpy installed

If the cxro_cache is cleared, or a new material not in the cache is requested, then an internet connection is required.

Usage

There are a few example scripts which show how to use the code:

Running python filter_design.py will show an example filter design, plotting the transmission curves of each filter, before plotting the section of the spectrum sliced out by each ross pair.

Running python physics.py will show an example of an Xpinch spectrum, along with the expected diode responses for a given filter configuration.

About

An example of some code I wrote a few years ago, sliced out of a larger project so that I can show it to interviewers. Though I might tinker with it (the lack of tests/poor documentation is concerning... and it would be nice to make it a proper package), but for now I'm busy writing my thesis!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages