Giter Site home page Giter Site logo

xrd-plot's Introduction

xrd-plot

Angular app for plotting x-ray powder diffraction data from text files and exporting as SVG.

Demo

Try it here

Screenshot

screenshot

Usage

Import diffraction patterns expects experimental X-ray diffraction data from a text file with a 2-theta column (x) and an intensity column (y), while Import X-ray PDFs expects powder diffraction file (PDF) reference data (a text file as above, but with individual peak positions and intensities rather than the full range of 2-theta).

Examples of diffraction pattern and PDF reference data files for quartz are loaded by default for demonstration purposes, since I can't share my actual data. The raw text files are also provided in the data directory of this repo.

Colors are randomly chosen and can be changed via color-picker by clicking the color boxes. Multiple diffraction patterns or PDF can be loaded at once. Figures can be saved as SVG for further editing as vector graphics in Illustrator or Inkscape. The plot adjusts if the browser window is resized.

This is purely a front-end app, so data is only loaded locally into the browser, not sent to a server.

About

I was looking for a way to get X-ray diffraction data from text files into Inkscape so I could plot vector figures. While there are surely simpler ways to accomplish this, I thought it would be an interesting challenge to try to do it with javascript since I'd been learning Node and Angular and was looking for opportunities for useful small projects.

Although this involved a lot more boilerplate than a Python script, it was much more conducive to introducing interactive dynamic elements such as vertical scaling controlled by a slider or changing colors with a color picker. Once the basic structure was set up, it was easy to see how new dynamic functionality could be introduced.

Technologies used

  • Angular.js
  • D3.js
  • Grunt.js
  • Jade
  • Sass
  • Bootstrap

(D3.js is used as an Angular service to convert the data to SVG paths but is not used for data binding)

xrd-plot's People

Contributors

adamstone avatar

Stargazers

 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.