GithubHelp home page GithubHelp logo

australiansynchrotron / sum-eiger-frames Goto Github PK

View Code? Open in Web Editor NEW
1.0 6.0 0.0 4.02 MB

Sum and analyse Eiger data for intensity statistics

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
science synchrotron beamline macromolecular-crystallography

sum-eiger-frames's Introduction

Sum and analyse Eiger data for intensity statistics

The purpose of this repo is to provide the scientific community with a package for analysing intensity statistics from data collected on Dectris Eiger detectors.

The package aims to

  • Take a diffuse scatter dataset in hdf5-format as input
  • Access the frames via ALBULA
  • Filter out pixels below and above thresholds
  • Sum all pixels on each frame and return the sums as a reduced dataset
  • Detrend the reduced data
  • Produce descriptice statistics
  • Plot the reduced dataset as an interactive Plotly graph

The app should ideally be run on a multi-core machine as summing a large number of frames (1000+) can be quite time consuming.

Most of the underlying discussion happened at the High Data-Rate Macromolecular Crystallography meeting 6-7 December 2018, Auckland, New Zealand.

Data collection procedure

A PDF of the procedure can be found here

Installation

pip install -r requirements.txt

Note that Redis is commented out from the requirements.txt file by default. If you already have a Redis NOSQL database up and running and want to use it for this application, go ahead and uncomment it before installing. The config.yaml file will also need to be updated with your local Redis IP address.

We have not integrated ALBULA into our Python library, but instead import it as a system call when needed. Update the config.yaml file with your local path. Also, because ALBULA currently only runs on legacy Python, the code is divided into a few files:

File Contents Python version
app.py Calls the other two files 3.6
sum_eiger_frames.py Reads in master file with albula, filters and sums pixels, writes out data as redis key or pickled file 2.7
plot_eiger_sums.py Reads in data from redis or file, detrends, calculates statistics, and plots data 3.6

Example run

Edit config.yaml

Ideally the only file you should need to edit to run the process.

in:
  master: /staff/eiger/data/speed_test_full_16M_master.h5
  start: 0                      #First frame to process
  end:   0                      #Last frame to process. Leave as 0 for all

filter:                         #Anything lower or higher than is masked out
  low:     0
  high: 4500

out:
  file: True                    #Write out results to file
  path: /tmp/                   #Needs trailing slash
  plot: True                    #Analyse and plot data
  redis: False                  #Post results to redis key
  prefix: summed_eiger_frames   #Redis key prefix
  expire: 1                     #redis key time-to-live in days

sys_settings:
  albula_path: /staff/eiger/dectris/albula/3.2/python/
  redis_ip: 10.108.24.9
  threads: 4
Run app.py
(venv) [daniel@SR03BM01MXDE01 sum-eiger-frames]$ ./app.py
[2018-12-19 13:01:27.916192] INFO: __main__: Reading in master file
[2018-12-19 13:01:33.135028] INFO: __main__: Running on 4 threads
[2018-12-19 13:01:33.199758] INFO: __main__: Processing frames 1 to 40000
[2018-12-19 13:01:49.357440] INFO: __main__: ...another 100 frames.
                          [...]
[2018-12-19 13:02:22.738184] INFO: __main__: ...another 100 frames.
[2018-12-19 13:02:37.771860] INFO: __main__: Output written to file /tmp/speed_test_full_16M_master.h5.pickle
[2018-12-19 12:59:03.744784] INFO: Plotter: Reading data from file.
[2018-12-19 12:59:03.746444] INFO: Plotter: Detrending data
[2018-12-19 12:59:03.791573] INFO: Plotter: Descriptive stats:
                  raw     detrended
  count  4.000000e+04  4.000000e+04
  mean   6.485052e+06  6.485052e+06
  std    8.944226e+03  8.884134e+03
  CV%    1.379207e-01  1.369940e-01  <--- Coefficient of variation i.e. std/mean*100
  min    6.448255e+06  6.447553e+06
  25%    6.478904e+06  6.478976e+06
  50%    6.484958e+06  6.484955e+06
  75%    6.491091e+06  6.491049e+06
  max    6.521028e+06  6.519827e+06
[2018-12-19 12:59:03.791881] INFO: Plotter: Data description saved as /tmp/speed_test_full_16M_master.h5.csv
[2018-12-19 12:59:08.574857] INFO: Plotter: Plot saved as /tmp/speed_test_full_16M_master.h5.html


Example output

image

Please make sure to inspect your data as there are events that will adversely affect the data quality. For instance, a top-up shot as seen below. image

Files generated
File Content
...master.h5.pickle Pickled list of intensity per frame
...master.h5.csv Descriptive statistics of dataset
...master.h5.html Plotly graph of raw and detrended data

sum-eiger-frames's People

Contributors

erikssod avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.