Skip to content

Instantly share code, notes, and snippets.

hmparanjape /
Last active Aug 28, 2015
Scripts for Manipulation and Analysis of High Energy Diffraction Images (GE2 files)
# Miscellaneous Diffraction Image Processing Commands
# This file defines aliases for several common image processing
# functions for GE2 diffraction images. This uses ImageMagick
# program, which is typically available on all Linux and Mac
# systems -
# Copy the contents of this file to the bottom of ~/.bashrc
# Run from terminal: source ~/.bashrc
# After this, following commands should be available
# 1. Convert TIFF to GE. Saves input.ge2
hmparanjape / moving_diffraction_patterns.m
Created Aug 10, 2015
A MATLAB script to create 2D line patterns inspired by far-field high energy x-ray diffraction.
View moving_diffraction_patterns.m
%% Moving diffraction patterns
% A MATLAB-based program to generate high energy x-ray diffraction inspired
% line art.
% Enter various parameters in the INPUT section. The meaning of each
% parameter is described below. Then run this script. It will produce a
% plot with the line patterns.
% The basic concept behind the pattern generation is this -
# Display files numbers from an ff directory
# Add this function to ~/.bashrc
function show_ff_data() {
# Find all directories with name ff and loop over them
find "$@" -not -empty -name "ff" -print | while read f; do
# Show directory name
echo "$f"
# Get size of all contents in the directory (in bytes)
tot_byte_size=$(du -b "$f")
# By default du prints the folder name too. Strip that.
View example_config_reconstruction.yml
analysis_name: RUBY_SWEEP_0 # defaults to analysis
## working directory defaults to current working directory
## all relative paths specified herein are assumed to be in the working_dir
## any files not in working_dir should be specified with an absolute path
multiprocessing: 1 # "all", or "half", or -1 means all but one, defaults to -1
View example_config_caking.yml
analysis_name: NiTi_9 # defaults to analysis
multiprocessing: -1 # "all", or "half", or -1 means all but one, defaults to -1
definitions: material_niti
active: NiTi
hmparanjape /
Created Jul 9, 2015
Make MP4 movie from a PNG image sequence
# Create an MP4 movie from the image sequence.
# Specify
# -framerate N = frames/sec
# -i FILENAMES = image file path and names. %04d says that the numbering for images is fixed width (width = 4) and zeros are used for padding
ffmpeg -framerate 11 -i image_directory/image_stem_%04d.png -c:v libx264 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" movie_name.mp4
# Ideally this should play well on OS X, Windows and Linux. Uploads to Youtube.
hmparanjape / DIC_2d_aggregate_strain_force_data.m
Created Jul 7, 2015
Aggregate and visualize load-strain data from spec log and NCORR DIC calculation
View DIC_2d_aggregate_strain_force_data.m
% Where are ncorr result files located
strain_result_mat_directory = 'X:\stebner-252-1\HEA_tension\DIC_post';
% List of ncorr result mat files in the correct order
strain_result_mat_files = { ...
'strain_2d_1', ...
'strain_2d_2' ...
ignore_these_many_DIC_results_at_the_start = 2;
ignore_these_many_DIC_results_at_the_end = 0;
% Aggregate the strain stuff
hmparanjape / DIC_2d_get_stress_from_spec.m
Created Jul 7, 2015
Obtain load/displacement data from CHESS/APS spec log file
View DIC_2d_get_stress_from_spec.m
spec_file_dir = 'X:\stebner-252-1\HEA_tension';
spec_log_file_name = 'spec.log';
DIC_image_dir = 'X:\stebner-252-1\301lss_rams2t_1\dic_post\raw_images';
cross_section_area = 1;
log_file = fopen(fullfile(spec_file_dir, spec_log_file_name), 'r');
image_file_numbers = [];
force = [];
displacement = [];
newimages = [];
hmparanjape / DIC_2d_strain_visualization.m
Created Jul 7, 2015
Visualize 2D strain obtained using NCORR
View DIC_2d_strain_visualization.m
% 2D DIC strain analysis
% 1. Run handles_ncorr = ncorr
% 2. Save the data and load the MAT file
% 3. Run this
num_of_dic_images = numel(current_save);
% exx = 2D distribution of xx strain component in the ROI
exx = cell(num_of_dic_images,1);
You can’t perform that action at this time.