Coder Social home page Coder Social logo

minixs's Introduction

miniXS Calibration
==================

In order to calibrate the miniXS spectrometer, an energy value needs to be assigned to each pixel of the Pilatus camera. To do this, several exposures should be taken with the incident beam set to various energies within the range of the spectrometer. The elastically scattered beam will then show up on the camera as a thin arc for each crystal. From the respective energies of these arcs, we can fit a smooth function to assign energy values to all pixels on the camera face.

Ideally, the calibration data should be taken by setting up a 1-d scan that triggers the Pilatus. Lets assume we have a scan file named "calibration.0001" with 15 energy points evenly spaced over the range of the spectrometer. The corresponding are saved in files calibration_00001.tif through calibration_00015.tif.

Starting
--------
Load the calibrator user interface.

Choose a name for the calibration and enter it in the Dataset Name box.

Selecting input files
--------------------
Click "Read Energies..." and in the dialog that pops up click on the "..." button and select the calibration.0001 scan file.

The "Energy Column" dropdown is automatically filled in with the names of the columns. The first column containing 'energy' (case insensitive) in its name is automatically selected for you. If the incident beam energy values are in a different column, select it from the dropdown.

When you click "Ok", the energy values are added to the first column of the list.

Now click on "Select Exposures". Go to the directory containing the .tif files and click once on the first one (calibration_00001.tif). Scroll down so that the final one is visible (calibration_00015.tif). Hold down shift and click on it. The entire set should now be selected. Click "Open", and the filenames will be added to the second column of the list.

If needed, you can add more energies or exposures to the end of the list by repeating the above steps.

Viewing the calibration exposures
---------------------------------

As soon as at least one row in the list contains an energy and an exposure file name, the first exposure will be loaded an displayed below the list.

To the left of the exposure view is a set of filters than can be applied.

# explain filters

Slide the slider under the view to switch between the loaded exposures.

Selecting Crystal Boundaries
----------------------------

Before calibration can proceed, we need to define the boundaries of spectra from each individual crystal in the spectrometer.

To do so, click in the exposure view and drag to draw a rectangle. Once drawn, the rectangle can be moved by clicking inside it and dragging, or resized by clicking near one of its borders and dragging.

Calibrating and saving
----------------------

Click the large "Calibrate" button at the bottom. When finished, the calibration matrix will be displayed instead of the raw exposures.

Click File > Save to save the calibration matrix to a file ending in ".calib". 

XES Processing
==============

Emission exposures can be processed using the process_xes script.

First, a calibration matrix must have been created as described in the `miniXS Calibration` section.

A typical invocation is as follows:

    $ process_xes example.calib example.tif -o example.xes

It is also possible to combine multiple emission exposures by simply including multiple file names. e.g.

    $ process_xes example.calib example_0001.tif example_0002.tif -o example.xes

For more options, see
    $ process_xes -h

RIXS Processing
===============

RIXS data consists of a series of emission exposures taken with varying incident energy. To process RIXS, use the `process_rixs` script. For example:

    $ process_rixs example.calib --scans example_scan.0001 --exposures example_scan_*.tif -o example.rixs
If you have several identical scans that you wish to combine (e.g. a scan set on repeat and run overnight), you can do so with:

    $ process_rixs example.calib --scans example_scan.0001 example_scan.0002 --exposures example_scan1_*.tif example_scan2_*.tif -o example.rixs

Each scan must contain the same data points, and the exposures for the first scan must be listed in order followed by those from the second, etc.

minixs's People

Contributors

bmattern avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

pushkarlab

minixs's Issues

Layout error in minixs calibrator

I don't know if anyone is watching this, but I figure I'll leave this issue here to help anyone who comes along after me and sees this same problem.

Installing this package in 2016 (so python 2.7.10, wxpython 3.0.2), I see the following (and similar on Windows):

bruce@titanium [minixs](master) > ./bin/calibrator 
Traceback (most recent call last):
  File "./bin/calibrator", line 4, in <module>
    main()
  File "/home/bruce/source/minixs/lib/minixs/gui/calibrator/calibrator.py", line 71, in main
    app = CalibratorApp()
  File "/home/bruce/source/minixs/lib/minixs/gui/calibrator/calibrator.py", line 28, in __init__
    view = CalibratorView(None, ID_MAIN_FRAME, "miniXS Calibrator")
  File "/home/bruce/source/minixs/lib/minixs/gui/calibrator/calibrator_view.py", line 444, in __init__
    self.panel = CalibratorPanel(self, wx.ID_ANY)
  File "/home/bruce/source/minixs/lib/minixs/gui/calibrator/calibrator_view.py", line 401, in __init__
    panel = FilterPanel(self, wx.ID_ANY)
  File "/home/bruce/source/minixs/lib/minixs/gui/calibrator/calibrator_view.py", line 124, in __init__
    grid.Add(label, 0, wx.ALIGN_CENTER_VERTICAL)
  File "/usr/lib/python2.7/dist-packages/wx-3.0-gtk2/wx/_core.py", line 14453, in Add
    return _core_.Sizer_Add(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "Assert failure" failed at ../src/common/sizer.cpp(1401) in DoInsert(): too many items (13 > 2*6) in grid sizer (maybe you should omit the number of either rows or columns?)

This is solved by editing this line to read

    grid = wx.FlexGridSizer(0, 2, HPAD, VPAD)

Perhaps the syntax for the FlexGridSizer has changed since the calibrator was written...? I got my hint from here.

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.