GithubHelp home page GithubHelp logo

sfx_utils's Introduction

sfx

Miscellaneous functions for aiding calibration during SFX experiments at LCLS.

Contributing

This repository is the centralized location to discuss and share calibration files, documentation, scripts and code for SFX analysis.

See Discussions above for a forum experience. Contribute or check Wiki above for tutorials and tips, shared experience, etc.

For contributing code and script, please don't push to the main branch directly. Rather, work in a specific branch for the task at hand, and make a pull request (PR) so it can be safely merged into the main branch after the person you assign as a reviewer does the code review (if necessary).

More importantly, have fun! If you have any questions, feel free to post a new issue or just reach out directly to someone else on the team.

Etiquette

Before you start working on contribution, please make sure your local main branch is up-to-date. Create a new branch from it, add or edit, then push a pull request.

To create your local repository (from this GitHub hosted remote repository):

$ git clone [email protected]:lcls-users/sfx.git

To update your local main branch:

$ git checkout main
$ git pull

Now you can create a new branch that will be up to date with the current (remote) main branch:

$ git checkout -b my-new-branch
$ ... do stuff ..
$ git add <the files that you have been working on>
$ git commit -m "Hey everyone, I have been working on those files to do this and that"
$ git push origin my-new-branch

At this point, checkout the repo on GitHub and create a Pull Request (like this one). Once merged, the main branch will be updated with your work!

sfx_utils's People

Contributors

fredericpoitevin avatar sbotha89 avatar

Watchers

 avatar

sfx_utils's Issues

Diagnostic statistics per-run

We'd like to pull out the following statistics per event and plot their trajectory over the course of a given run:

  • total intensity
  • minimum intensity
  • maximum intensity
  • median intensity
    By default, we assume that we're examining the calibrated images.

Unit of detector pixel values?

I believe they are in keV in the assembled image, would be nice to check what they are otherwise - and document it somewhere.

If indeed in keV, it would be nice to document how to convert into "photons" and vice-versa.

MemoryError when making a powder over too many images

self.powder = np.amax(self.psi.get_images(n_images), axis=0)

geom_opt.opt_distance(plot=True, n_images=40000)
---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
/tmp/ipykernel_25483/1338048410.py in <module>
----> 1 geom_opt.opt_distance(plot=True, n_images=40000)

~/sfx_utils/sfx_utils/geom_opt.py in opt_distance(self, sample, n_images, center, plot)
     61         """
     62         if self.powder is None:
---> 63             self.powder = self.compute_powder(n_images)
     64 
     65         if sample == 'AgBehenate':

~/sfx_utils/sfx_utils/geom_opt.py in compute_powder(self, n_images, ptype)
     31         """
     32         if ptype == 'max':
---> 33             self.powder = np.amax(self.psi.get_images(n_images), axis=0)
     34         elif ptype == 'mean':
     35             self.powder = np.mean(self.psi.get_images(n_images), axis=0)

~/sfx_utils/sfx_utils/psana_interface.py in get_images(self, num_images, assemble)
     65             images = np.zeros((num_images, 
     66                                self.det.image_xaxis(self.run).shape[0],
---> 67                                self.det.image_yaxis(self.run).shape[0]))
     68         else:
     69             images = np.zeros((num_images,) + self.det.shape())

MemoryError: Unable to allocate 826. GiB for an array with shape (40000, 1666, 1664) and data type float64

Intensity distribution trajectory

In addition to information about intensity statistics during a run, it would be helpful to get a visual display of how intensity is distributed in range and in time. This would allow to quickly identify calibration issues, and to identify regime changes during collection that would help for example pinpoint events where the detector could have been at risk of being damaged.

An idea could be to populate an array for each run intensity_distribution(n_events, n_intensity_bins) that could be displayed in the form of a colored table as sketched below.

Considerations on binning:

  • The data array could have a finer binning with coarser binning being possible upon plotting (e.g. using plt.hexbin()).
  • Several binning strategies could also be explored: linear or symlog.

image

Random extra thought: a similar plot for the whole experiment (with runs on the X-axis) might also be very useful for experiment summaries.

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.