Code Monkey home page Code Monkey logo

bent-laue-xray-optics's Introduction

BLXO (Bent Laue X-ray Optics)

Installation

Option 1

pip install blxo

Option 2

Download the repository. Import the blxo folder as a python package.

How to use it

  1. Define a monochromator with your parameters.

    Example:

from blxo import *
mono = mc.BentLaueMono(chi=np.radians(4.4671),theta=np.radians(8.99),nu=0.2,t=0.3,r=2000,p=22000) # Length unit is mm. Angle unit is radians.
  1. Get the interested properties from the monochromator.

    1. Quasi-mono beam
    qmb = mono.qmb
    # Quasi-mono beam width (mm)
    width = qmb['width']
    # Quasi-mono beam footlength (mm)
    footlength = qmb['foot_length']
    # Energy spread of the QMB in terms of angle (rad)
    ang_spread = qmb['angular_spread']
    1. Resolutions
    # Energy resolution
    mono.energy_resolution
    # Energy resolution in terms of angle
    mono.angle_resolution
    1. Optimal focus-to-detector distance
    mono.f2d_optimal
    1. Calculators for magic condition
    from blxo import *
    # Expect the result to be zero when the magic condition is met.
    # Magic condition function in terms of angle
    mc_angle_misalignment = mc.magic_condition_angles(chi=np.radians(4.4671),theta=np.radians(8.99),nu=0.2,t=0.3,r=2000,p=22000)
    # `mc_angle_misalignment` is expected to be zero (or zero enough) when the magic condition is met.
    
    # Magic condition function in terms of foci
    mc_focus_misalignment = mc.magic_condition_foci(chi=np.radians(4.4671),theta=np.radians(8.99),nu=0.2,t=0.3,r=2000,p=22000) # Thickness (t) is not a factor in the calculation, but a called module requires it for some other functions. So just give it any number.
    1. Others
    mono.lengths.geo_focus()
    mono.lengths.single_ray_focus()

bent-laue-xray-optics's People

Contributors

darwinqii avatar

Watchers

 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.