Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions hexrd/findorientations.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ def generate_orientation_fibers(eta_ome, threshold, seed_hkl_ids, fiber_ndiv):
## Labeling of spots from seed hkls ##
############################################

ii = 0
jj = fiber_ndiv
qfib = []
labels = []
numSpots = []
Expand All @@ -101,9 +99,9 @@ def generate_orientation_fibers(eta_ome, threshold, seed_hkl_ids, fiber_ndiv):
## Generate discrete fibers from labels ##
############################################

qfib_tmp = np.empty((4, fiber_ndiv*sum(numSpots)))

for i in range(len(pd_hkl_ids)):
ii = 0
qfib_tmp = np.empty((4, fiber_ndiv*numSpots[i]))
for ispot in range(numSpots[i]):
if not np.isnan(coms[i][ispot][0]):
ome_c = eta_ome.omeEdges[0] \
Expand All @@ -114,20 +112,22 @@ def generate_orientation_fibers(eta_ome, threshold, seed_hkl_ids, fiber_ndiv):
gVec_s = xrdutil.makeMeasuredScatteringVectors(
tTh[pd_hkl_ids[i]], eta_c, ome_c
)

qfib_tmp[:, ii:jj] = rot.discreteFiber(
pd.hkls[:, pd_hkl_ids[i]].reshape(3, 1),
gVec_s,
B=bMat,
ndiv=fiber_ndiv,
invert=False,
csym=csym
)[0]
ii = jj
jj += fiber_ndiv
tmp = mutil.uniqueVectors(
rot.discreteFiber(
pd.hkls[:, pd_hkl_ids[i]].reshape(3, 1),
gVec_s,
B=bMat,
ndiv=fiber_ndiv,
invert=False,
csym=csym
)[0]
)
jj = ii + tmp.shape[1]
qfib_tmp[:, ii:jj] = tmp
ii += tmp.shape[1]
pass
pass
qfib.append(mutil.uniqueVectors(qfib_tmp))
qfib.append(qfib_tmp[:, :ii])
pass
return np.hstack(qfib)

Expand Down Expand Up @@ -352,4 +352,3 @@ def find_orientations(cfg, hkls=None, profile=False):
# obselete # if cfg.find_orientations.extract_measured_g_vectors:
# obselete # raise NotImplementedError('TODO: implement extract gvecs')
# obselete # #extract_measured_g_vectors(cfg)

5 changes: 5 additions & 0 deletions hexrd/xrd/detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@
NCOLS = 2048
PIXEL = 0.2

# vert
#NROWS = 2048
#NCOLS = 2048
#PIXEL = 0.0045

# pscam
#NROWS = 2671
#NCOLS = 4008
Expand Down
11 changes: 10 additions & 1 deletion hexrd/xrd/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ def detectorXYToGvec(xy_det,
rMat_d, rMat_s,
tVec_d, tVec_s, tVec_c,
distortion=(dFunc_ref, dParams_ref),
beamVec=bVec_ref, etaVec=eta_ref):
beamVec=bVec_ref, etaVec=eta_ref,
output_ref=False):
"""
Takes a list cartesian (x, y) pairs in the detector coordinates and calculates
the associated reciprocal lattice (G) vectors and (bragg angle, azimuth) pairs
Expand Down Expand Up @@ -273,11 +274,19 @@ def detectorXYToGvec(xy_det,
tTh = np.arccos(np.dot(bHat_l.T, dHat_l)).flatten()
eta = np.arctan2(dHat_e[1, :], dHat_e[0, :]).flatten()

# angles for reference frame
dHat_ref_l = unitVector(P2_l)
dHat_ref_e = np.dot(rMat_e.T, dHat_ref_l)
tTh_ref = np.arccos(np.dot(bHat_l.T, unitVector(P2_l))).flatten()
eta_ref = np.arctan2(dHat+ref_e[1, :], dHat_ref_e[0, :]).flatten()

# get G-vectors by rotating d by 90-theta about b x d (numpy 'cross' works on row vectors)
n_g = unitVector(np.cross(bHat_l.T, dHat_l.T).T)

gVec_l = rotate_vecs_about_axis(0.5 * (np.pi - tTh), n_g, dHat_l)

if output_ref:
return (tTh_ref, eta_ref), (tTh, eta), gVec_l
return (tTh, eta), gVec_l

def oscillAnglesOfHKLs(hkls, chi, rMat_c, bMat, wavelength,
Expand Down
184 changes: 94 additions & 90 deletions share/calibrate_from_single_crystal.ipynb

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions share/example_calibration.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
calibration_crystal:
grain_id: 0
inv_stretch: [1.0000059040292837, 0.9999738183256959, 1.0000126480715623, 2.5554636751865275e-05,
1.8161682189944448e-05, -4.231458326489244e-07]
orientation: [0.6690652732668282, -0.9867626510443996, 0.7368794659890479]
position: [0.002789313619905806, -8.48919662546517e-05, 0.0029522147559835]
inv_stretch: [1.0, 1.0, 1.0, 0.0, 0.0, 0.0]
orientation: [0.6690346914271271, -0.9869288733543594, 0.7369599629623789]
position: [0.0004548754772660814, -4.149496451448677e-06, 0.0032386599395495467]
detector:
distortion:
function_name: GE_41RT
parameters: [-1.05744106e-05, -7.46544641e-05, -0.000495262465, 2.0, 4.0, 2.0]
parameters: [-1.17664823e-05, -7.52004138e-05, -0.000495704535, 2.0, 4.0, 2.0]
id: GE
pixels:
columns: 2048
rows: 2048
size: [0.2, 0.2]
saturation_level: 14000
transform:
t_vec_d: [-1.444787514997142, -3.234136171449198, -1050.676181428589]
tilt_angles: [0.000715272463, -0.0031218473, -0.002275628265961305]
t_vec_d: [-1.446574406787204, -3.2335905554228175, -1050.6773464083435]
tilt_angles: [0.0006399776154511326, -0.0031010546756005974, -0.0022520647676930825]
oscillation_stage:
chi: -0.0008158290648173493
chi: -0.0008964328296020562
t_vec_s: [0.0, 0.0, 0.0]

56 changes: 26 additions & 30 deletions share/example_config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
analysis_name: sweep0 # defaults to analysis
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
#working_dir:
#working_dir:

multiprocessing: all # "all", or "half", or -1 means all but one, defaults to -1

Expand All @@ -13,23 +13,21 @@ material:

image_series:
file:
stem: RUBY_%04d # can include relative or absolute path
ids: [4537, 4538] # or can use globs: ["*2[4-9]"]
stem: images/RUBY_%04d # can include relative or absolute path
ids: [0] # or can use globs: ["*2[4-9]"]
images:
start: 2
#stop: 1440
#step: 1
start: 0
omega:
start: -60.0
step: 0.25
stop: 60.0
dark: RUBY_4537_medianDark
flip: v # ~, v, h, hv, vh, cw, ccw
#dark: ~
#flip: ~ # ~, v, h, hv, vh, cw, ccw

instrument:
parameters: ge_detector.yml
parameters: example_calibration.yml
detector: # this section is only needed to convert old files to the new spec
parameters_old: ge_rad.par # the old detector spec, produced by the GUI
parameters_old: ge_ceo2.par # the old detector spec, produced by the GUI
pixels: # this section required to convert from old detector spec
rows: 2048
columns: 2048
Expand All @@ -40,29 +38,29 @@ find_orientations:
# A file name must be specified. If it doesn't exist, one will be created
file: eta-omega.cpl

threshold: 15
#bin_frames: 1 # defaults to 1
threshold: 1
bin_frames: 1 # defaults to 1

## "all", or a list of hkl orders used to find orientations
## defaults to all orders listed in the material definition
#active_hkls: [0,1,2,3]

## either search full quaternian grid, or seed search based on sparse
## either search full quaternion grid, or seed search based on sparse
## orientation maps
#use_quaternian_grid: some/file/name # defaults to seeded search
seed_search: # this section is ignored if use_quaternian_grid is defined
hkl_seeds: [0,1] # hkls ids to use, must be defined for seeded search
# fiber_step: 0.5 # degrees, defaults to ome tolerance
#use_quaternion_grid: some/file/name # defaults to seeded search
seed_search: # this section is ignored if use_quaternion_grid is defined
hkl_seeds: [0,1,2] # hkls ids to use, must be defined for seeded search
fiber_step: 0.5 # degrees, defaults to ome tolerance

threshold: 5 # defaults to 1

omega:
tolerance: 1.0 # in degrees, defaults to 2x ome step

## specify the branch cut, in degrees. The range must be 360 degrees.
## defaults to ["image_series:omega:start", "image_series:omega:start"+-360]
## depending on sign of "image_series:omega:step"
period: [-180, 180] # in degrees, defaults to full 360 starting at "ome start"
## specify the branch cut, in degrees. The range must be 360 degrees.
## defaults to ["image_series:omega:start", "image_series:omega:start"+-360]
## depending on sign of "image_series:omega:step"
period: [-180, 180] # in degrees, defaults to full 360 starting at "ome start"

eta:
tolerance: 1.0 # in degrees, defaults to 2x ome step
Expand All @@ -73,22 +71,20 @@ find_orientations:
completeness: 0.51 # completeness threshold
#algorithm: fclusterdata # defaults to dbscan

#extract_measured_g_vectors: true # defaults to false

fit_grains:
do_fit: true # if false, extracts grains but doesn't fit. defaults to true

#estimate: multiruby/grains.out # defaults to None
estimate: RUBY_SWEEP_0/grains.out # defaults to None

#npdiv: 1 # number of polar pixel grid subdivisions, defaults to 2
npdiv: 3 # number of polar pixel grid subdivisions, defaults to 2

panel_buffer: 10 # don't fit spots within this many pixels from edge

threshold: 15
threshold: 1

tolerance:
tth: [0.2, 0.1] # tolerance lists must be identical length
eta: [2.0, 2.0]
omega: [1.0, 1.0]
eta: [2.0, 0.5]
omega: [1.0, 0.25]

tth_max: 15 # true, false, or a non-negative value, defaults to true
tth_max: 15.25 # true, false, or a non-negative value, defaults to true
17 changes: 0 additions & 17 deletions share/instrument_cal.yml

This file was deleted.