ImageD11.indexing module#
- ImageD11.indexing.calc_drlv2(UBI, gv)#
Get the difference from being integer hkls UBI: ubi matrix gv: list of g-vectors returns drlv2 = (h_calc - h_int)^2
- class ImageD11.indexing.clogging#
Bases:
object- debug(*args)#
- error(*args)#
- info(*args)#
- log(*args)#
- warning(*args)#
- ImageD11.indexing.do_index(cf, dstol=0.005, hkl_tols=(0.01, 0.025, 0.05), fracs=(0.9, 0.7), cosine_tol=np.float64(0.004363309284746582), max_grains=1000, forgen=(), foridx=(), unitcell=None, **kwds)#
Does indexing from a columnfile (cf)
Returns a list of grains and the indexer object
The peaks used for indexing (on rings in foridx) are selected and put into indexer.colfile
The orientations in forgen are used to search orientations dstol, cosine_tol and max_grains are as usual (max grains is for each search).
There is a loop over “frac” then “hkl_tols” repeating indexing many times.
- ImageD11.indexing.find_omega_ranges(omega)#
This looks at self.omega and attempts to figure out coverage in degrees.
We round to 1 degree as this is only used for an approximate guess to numbers of peaks anyway
- ImageD11.indexing.index(colf, npk_tol=[(400, 0.01), (200, 0.02)], cosine_tol=np.float64(0.0017453283658982615), ds_tol=0.004, max_grains=1000, rmulmax=10, rings_to_use=None, maxpairs=None, log_level=3)#
Creates an indexer from a colfile Uses the unit cell from the colfile.parameters
Loops over pairs of rings with multiplicity less than rmulmax
npk_tol : list of (minpks, hkl_tol) to test cosine_tol : for finding pairs of peaks to make an orientation ds_tol : for assigning peaks to hkl rings in d*
rmulmax : max multiplicity of rings to use in ubi generation (indexer.find) rings_to_use : which rings to consider to ubi generation (default = all) maxpairs : how many pairs of rings to use for ubi generation
loglevel : like the logging module, but not
returns the indexer object
- class ImageD11.indexing.indexer(unitcell=None, gv=None, cosine_tol=0.002, minpks=10, hkl_tol=0.01, ring_1=1, ring_2=2, ds_tol=0.005, wavelength=-1, uniqueness=0.5, eta_range=0.0, max_grains=100)#
Bases:
objectA class for searching for orientation matrices
- assigntorings()#
Assign the g-vectors to hkl rings
- coverage()#
Compute the expected coverage of reciprocal space use the min/max obs values of xp/yp/omega to work out what was measured in the scan? No lambda or
- fight_over_peaks()#
Get the best ubis from those proposed Use all peaks (ring assigned or not)
- find()#
Dig out the potential hits
- friedelpairs(filename)#
Attempt to identify Freidel pairs
Peaks must be assigned to the same powder ring Peaks will be the closest thing to being 180 degrees apart
- getind(UBI, tol=None, drlv2tmp=None, labelstmp=None)#
Returns the indices of peaks in self.gv indexed by matrix UBI
- histogram_drlv_fit(UBI=None, bins=None)#
Generate a histogram of |drlv| for a ubi matrix For use in validation of grains
- loadpars(filename=None)#
- out_of_eta_range(eta)#
decide if an eta is going to be kept
- readgvfile(filename, quiet=False)#
- refine(UBI)#
Refine an orientation matrix and rescore it.
From Paciorek et al Acta A55 543 (1999) UB = R H-1
where: R = sum_n r_n h_n^t H = sum_n h_n h_n^t r = g-vectors h = hkl indices
- reset()#
To get a really clean indexer just create a new one (e.g. via __init__) This was added for the gui to help it forget what happened before but keep parameters as they were set
- saveindexing(filename, tol=None)#
Save orientation matrices
- FIXMErefactor this into something to do
grain by grain } peak by peak }
- savepars(filename=None)#
- saveubis(filename)#
Save the generated ubi matrices into a text file
- score(UBI, tol=None)#
Decide which are the best orientation matrices
- score_all_pairs(n=None, rmulmax=None, rings_to_use=None)#
Generate all the potential pairs of rings and go score them too
n = maximum number of pairs to try maxmult = max multiplicity of rings to use for generating pairs rings_to_use = the rings to use for generating ubis
- scorethem(fitb4=False)#
decide which trials listed in hits to keep
- updateparameters()#
- ImageD11.indexing.indexer_from_colfile(colfile, **kwds)#
- ImageD11.indexing.indexer_from_colfile_and_ucell(colfile, ucell, **kwds)#
Force a specific unitcell to be used, ensuring a wavelength is provided.
- ImageD11.indexing.mod_360(theta, target)#
Find multiple of 360 to add to theta to be closest to target
- ImageD11.indexing.myhistogram(data, bins)#
The numpy histogram api was changed So here is an api that will not change It is based on that from the old Numeric manual
- ImageD11.indexing.readubis(ubifile)#
read ubifile and return a list of ubi arrays
- ImageD11.indexing.refine(UBI, gv, tol, quiet=True)#
Refine an orientation matrix and rescore it.
- From Paciorek et al Acta A55 543 (1999)
UB = R H-1
- where:
R = sum_n r_n h_n^t H = sum_n h_n h_n^t r = g-vectors h = hkl indices
- ImageD11.indexing.ubi_fit_2pks(ubi, g1, g2)#
Refine a ubi matrix so it matches the pair of g-vectors supplied (almost) accounts for cell parameters not being quite right
- ImageD11.indexing.ubitoB(ubi)#
give the B matrix from ubi
- ImageD11.indexing.ubitoRod(ubi)#
TODO Testcases!!!
- ImageD11.indexing.ubitoU(ubi)#
convert ubi to Grainspotter style U The convention is B as being triangular, hopefully as Busing and Levy TODO - make some testcases please!!
- ImageD11.indexing.ubitocellpars(ubi)#
convert ubi matrix to unit cell
- ImageD11.indexing.write_ubi_file(filename, ubilist)#
save 3x3 matrices into file