GithubHelp home page GithubHelp logo

x3py's Introduction

x3py

Python 3 library for accessing and manipulating LCLS data.

The idea is to create a thin (= minimum overhead) layer that can be used as building block. For a more feature rich library please use https://github.com/htlemke/ixppy

Basic usage:

from x3py import x3py
d = x3py.Dataset(filenames); # by default it checks the timestamp of all detectors and set filters to have 
d.ipm3.sum[:]; # get all shots (will be automatically cached)
d.cspad[:20]; # first 20 shots (no caching)

# create filters
xoff = x.ipm3.sum[:]<0.01
# add a filter takes only couple of millisecond
d.addFilter("xoff",xoff); # will define a filter for every detector
# access filtered data
d.cspad.filter.xoff[:10]; # take the first 10 xray off images
# the call above might be less convenient than reading a big chunk and selecting shots afterwards depending on the way the file is written, for example if chunking and compression are used

# check correlations
def mean(img):  return img.mean(-1).mean(-1).mean(-1)
shots = np.randon.random_integers(0,d.imp3.sum.time[:].shape[0],200)
avImg = np.asarray( [mean(d.cspad.data(i)) for i in shots] )
mon   = d.ipm3.sum[shots]
plt.plot(mon,avImg,"o"); # check that there are no missing shots (i.e. that x and y still correlates"

# read EPICS
d.epics.definePVs()
d.epics.pvname
# every PV can be transformed into an Abstractact Detector Instance
d.epics.pvname.defineDet()

If available a cython version of the eventmatching time stamp will be used (defaulting to a numpy vesion if unavailable). To compile it: python3 setup.py build_ext --inplace

x3py's People

Contributors

marcocamma avatar

Stargazers

 avatar

Watchers

James Cloos avatar  avatar  avatar

x3py's Issues

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.