@@ -1718,82 +1718,82 @@ def __init__(self, ome_eta):
17181718 self .etas = ome_eta .etas
17191719 self .omegas = ome_eta .omegas
17201720 return
1721-
1721+
17221722
17231723
17241724# not ready # class BaseEtaOme(object):
17251725# not ready # """
1726- # not ready # eta-ome map base class derived from new YAML config
1727- # not ready #
1726+ # not ready # eta-ome map base class derived from new YAML config
1727+ # not ready #
17281728# not ready # ...for now...
1729- # not ready #
1729+ # not ready #
17301730# not ready # must provide:
1731- # not ready #
1731+ # not ready #
17321732# not ready # self.dataStore
17331733# not ready # self.planeData
1734- # not ready # self.iHKLList
1735- # not ready # self.etaEdges # IN RADIANS
1734+ # not ready # self.iHKLList
1735+ # not ready # self.etaEdges # IN RADIANS
17361736# not ready # self.omeEdges # IN RADIANS
17371737# not ready # self.etas # IN RADIANS
17381738# not ready # self.omegas # IN RADIANS
1739- # not ready #
1739+ # not ready #
17401740# not ready # This wrapper will provide all but dataStore.
17411741# not ready # """
17421742# not ready # def __init__(self, cfg, reader=None, eta_step=None):
17431743# not ready # """
1744- # not ready # currently, reader has to be None *OLD* class type until fixed with new imageIO;
1744+ # not ready # currently, reader has to be None *OLD* class type until fixed with new imageIO;
17451745# not ready # if None, then the frame_cache.npz specified by the config must exist
17461746# not ready # """
17471747# not ready # self.cfg = cfg
17481748# not ready # self.instr_cfg = get_instrument_parameters(cfg)
1749- # not ready #
1749+ # not ready #
17501750# not ready # # currently hard-coded to do reader from npz frame cache
17511751# not ready # # kwarg *MUST* be 'new' style reader
17521752# not ready # if reader is None:
17531753# not ready # self.__reader = get_frames(reader, self.cfg)
17541754# not ready # else:
17551755# not ready # self.__reader = reader
1756- # not ready #
1756+ # not ready #
17571757# not ready # # set eta_step IN DEGREES
17581758# not ready # if eta_step is None:
17591759# not ready # self._eta_step = self.cfg.image_series.omega.step
17601760# not ready # else:
1761- # not ready # self._eta_step = abs(eta_step) # just in case negative...
1762- # not ready #
1761+ # not ready # self._eta_step = abs(eta_step) # just in case negative...
1762+ # not ready #
17631763# not ready # material_list = cPickle.load(open(cfg.material.definitions, 'r'))
17641764# not ready # material_names = [material_list[i].name for i in range(len(material_list))]
17651765# not ready # material_dict = dict(zip(material_names, material_list))
17661766# not ready # self.planeData = material_dict[cfg.material.active].planeData
1767- # not ready #
1767+ # not ready #
17681768# not ready # self._iHKLList = None
1769- # not ready #
1769+ # not ready #
17701770# not ready # self._etaEdges = None
17711771# not ready # self._omeEdges = None
17721772# not ready # self._etas = None
17731773# not ready # self._omegas = None
1774- # not ready #
1774+ # not ready #
17751775# not ready # return
1776- # not ready #
1776+ # not ready #
17771777# not ready # @property
17781778# not ready # def iHKLList(self):
17791779# not ready # return self._iHKLList
17801780# not ready # @iHKLList.getter
17811781# not ready # def iHKLList(self, ids=None):
17821782# not ready # """
1783- # not ready # ids must be a list
1783+ # not ready # ids must be a list
17841784# not ready # """
17851785# not ready # if ids is not None:
17861786# not ready # assert hasattr(ids, '__len__'), "ids must be a list or list-like object"
1787- # not ready #
1788- # not ready # # start with all available
1787+ # not ready #
1788+ # not ready # # start with all available
17891789# not ready # active_hkls = range(pd.hkls.shape[1])
17901790# not ready # # check cfg file
17911791# not ready # temp = cfg.find_orientations.orientation_maps.active_hkls
17921792# not ready # # override if spec'd explicitly in cfg
17931793# not ready # active_hkls = active_hkls if temp == 'all' else temp
17941794# not ready # # override with hkls from command line, if specified
17951795# not ready # return ids if ids is not None else active_hkls
1796- # not ready #
1796+ # not ready #
17971797# not ready # @property
17981798# not ready # def omegas(self):
17991799# not ready # return self._omegas
@@ -1806,53 +1806,53 @@ def __init__(self, ome_eta):
18061806# not ready # ome_start = self.__reader[1][0]
18071807# not ready # ome_step = self.__reader[1][1]
18081808# not ready # return ome_step*(num.arange(num_ome) + 0.5) + ome_start
1809- # not ready #
1809+ # not ready #
18101810# not ready # @property
18111811# not ready # def eta_step(self):
18121812# not ready # return self._eta_step
1813- # not ready #
1813+ # not ready #
18141814# not ready # @property
18151815# not ready # def etas(self):
18161816# not ready # return self._etas
18171817# not ready # @etas.getter
18181818# not ready # def etas(self):
18191819# not ready # """
18201820# not ready # range is forced to be [-180, 180] for now, so step must be positive
1821- # not ready #
1821+ # not ready #
18221822# not ready # step is same as omega unless specified (in degrees)
18231823# not ready # """
18241824# not ready # num_eta = int(360/float(abs(self.eta_step)))
18251825# not ready # return num.radians(self.eta_step)*(num.arange(num_eta) + 0.5) - num.pi
1826- # not ready #
1826+ # not ready #
18271827# not ready # @property
18281828# not ready # def omeEdges(self):
18291829# not ready # return self._omeEdges
18301830# not ready # @omeEdges.getter
18311831# not ready # def omeEdges(self):
18321832# not ready # ome_step = self.omegas[1] - self.omegas[0] # same as self.__reader[1][1]
18331833# not ready # return num.hstack([self.omegas - 0.5*ome_step, self.omegas[-1] + 0.5*ome_step])
1834- # not ready #
1834+ # not ready #
18351835# not ready # @property
18361836# not ready # def etaEdges(self):
18371837# not ready # return self._etaEdges
18381838# not ready # @etaEdges.getter
18391839# not ready # def etaEdges(self):
18401840# not ready # return num.hstack([self.etas - 0.5*eta_step, self.etas[-1] + 0.5*eta_step])
1841- # not ready #
1841+ # not ready #
18421842# not ready # class EtaOmeMaps(BaseEtaOme):
18431843# not ready # """
18441844# not ready # """
18451845# not ready # def __init__(self, cfg, reader=None, eta_step=None,
1846- # not ready # omega=0., tVec_s=num.zeros(3),
1846+ # not ready # omega=0., tVec_s=num.zeros(3),
18471847# not ready # npdiv=2):
1848- # not ready #
1848+ # not ready #
18491849# not ready # # first init the base class
18501850# not ready # super( EtaOmeMaps, self ).__init__(cfg, reader=reader, eta_step=eta_step)
1851- # not ready #
1851+ # not ready #
18521852# not ready # # grac relevant tolerances for patches
18531853# not ready # tth_tol = num.degrees(self.planeData.tThWidth)
18541854# not ready # eta_tol = num.degrees(abs(self.etas[1]-self.etas[0]))
1855- # not ready #
1855+ # not ready #
18561856# not ready # # grab distortion
18571857# not ready # if instr_cfg['detector']['distortion']['function_name'] is None:
18581858# not ready # distortion = None
@@ -1863,35 +1863,35 @@ def __init__(self, ome_eta):
18631863# not ready # )
18641864# not ready # # stack parameters
18651865# not ready # detector_params = num.hstack([
1866- # not ready # instr_cfg['detector']['transform']['tilt_angles'],
1866+ # not ready # instr_cfg['detector']['transform']['tilt_angles'],
18671867# not ready # instr_cfg['detector']['transform']['t_vec_d'],
1868- # not ready # instr_cfg['oscillation_stage']['chi'],
1869- # not ready # instr_cfg['oscillation_stage']['t_vec_s'],
1868+ # not ready # instr_cfg['oscillation_stage']['chi'],
1869+ # not ready # instr_cfg['oscillation_stage']['t_vec_s'],
18701870# not ready # ])
18711871# not ready # pixel_pitch = instr_cfg['detector']['pixels']['size']
18721872# not ready # chi = self.instr_cfg['oscillation_stage']['chi'] # in DEGREES
1873- # not ready #
1873+ # not ready #
18741874# not ready # # 6 detector affine xform parameters
18751875# not ready # rMat_d = makeDetectorRotMat(detector_params[:3])
18761876# not ready # tVec_d = detector_params[3:6]
1877- # not ready #
1877+ # not ready #
18781878# not ready # # 'dummy' sample frame rot mat
18791879# not ready # rMats_s = makeOscillRotMat(num.radians([chi, omega]))
1880- # not ready #
1880+ # not ready #
18811881# not ready # # since making maps for all eta, must hand trivial crystal params
18821882# not ready # rMat_c = np.eye(3)
18831883# not ready # tVec_c = np.zeros(3)
1884- # not ready #
1884+ # not ready #
18851885# not ready # # make angle arrays for patches
18861886# not ready # neta = len(self.etas)
18871887# not ready # nome = len(reader[0])
1888- # not ready #
1888+ # not ready #
18891889# not ready # # make full angs list
18901890# not ready # angs = [num.vstack([tth*num.ones(neta),
18911891# not ready # etas,
18921892# not ready # num.zeros(nome)])
18931893# not ready # for tth in self.planeData.getTTh()]
1894- # not ready #
1894+ # not ready #
18951895# not ready # """SET MAPS CONTAINER AS ATTRIBUTE"""
18961896# not ready # self.dataStore = num.zeros((len(angs), nome, neta))
18971897# not ready # for i_ring in range(len(angs)):
@@ -1900,7 +1900,7 @@ def __init__(self, ome_eta):
19001900# not ready # xydet_ring = xfcapi.gvecToDetectorXY(gVec_ring_l,
19011901# not ready # rMat_d, rMat_s, rMat_c,
19021902# not ready # tVec_d, tVec_s, tVec_c)
1903- # not ready #
1903+ # not ready #
19041904# not ready # if distortion is not None:
19051905# not ready # det_xy = distortion[0](xydet_ring,
19061906# not ready # distortion[1],
@@ -1909,15 +1909,15 @@ def __init__(self, ome_eta):
19091909# not ready # rMat_d, rMat_s,
19101910# not ready # tVec_d, tVec_s, tVec_c,
19111911# not ready # distortion=distortion)
1912- # not ready #
1912+ # not ready #
19131913# not ready # patches = make_reflection_patches(self.instr_cfg,
19141914# not ready # angs[i_ring].T[:, :2], ang_ps,
19151915# not ready # omega=None,
19161916# not ready # tth_tol=tth_tol, eta_tol=eta_tol,
19171917# not ready # distortion=distortion,
19181918# not ready # npdiv=npdiv, quiet=False,
19191919# not ready # compute_areas_func=gutil.compute_areas)
1920- # not ready #
1920+ # not ready #
19211921# not ready # for i in range(nome):
19221922# not ready # this_frame = num.array(reader[0][i].todense())
19231923# not ready # for j in range(neta):
@@ -3464,14 +3464,14 @@ def simulateGVecs(pd, detector_params, grain_params,
34643464 # first find valid G-vectors
34653465 angList = num .vstack (xfcapi .oscillAnglesOfHKLs (full_hkls [:, 1 :], chi , rMat_c , bMat , wlen , vInv = vInv_s ))
34663466 allAngs , allHKLs = _filter_hkls_eta_ome (full_hkls , angList , eta_range , ome_range )
3467-
3467+
34683468 if len (allAngs ) == 0 :
34693469 valid_ids = []
3470- valid_hkl = []
3471- valid_ang = []
3472- valid_xy = []
3470+ valid_hkl = []
3471+ valid_ang = []
3472+ valid_xy = []
34733473 ang_ps = []
3474- else :
3474+ else :
34753475 #...preallocate for speed...?
34763476 det_xy , rMat_s = _project_on_detector_plane (allHKLs [:, 1 :], allAngs , bMat ,
34773477 rMat_d , rMat_c , chi ,
@@ -3494,11 +3494,11 @@ def simulateGVecs(pd, detector_params, grain_params,
34943494
34953495
34963496def simulateLauePattern (hkls , bMat ,
3497- rmat_d , tvec_d ,
3498- panel_dims , panel_buffer = 5 ,
3497+ rmat_d , tvec_d ,
3498+ panel_dims , panel_buffer = 5 ,
34993499 minEnergy = 8 , maxEnergy = 24 ,
35003500 rmat_s = num .eye (3 ),
3501- grain_params = None ,
3501+ grain_params = None ,
35023502 distortion = None ):
35033503
35043504 # parse energy ranges
@@ -3517,7 +3517,7 @@ def simulateLauePattern(hkls, bMat,
35173517 if grain_params is None :
35183518 grain_params = num .atleast_2d ([0. , 0. , 0. , 0. , 0. , 0. , 1. , 1. , 1. , 0. , 0. , 0. ])
35193519 n_grains = len (grain_params )
3520-
3520+
35213521 # dummy translation vector... make input
35223522 tvec_s = num .zeros ((3 , 1 ))
35233523
@@ -3526,14 +3526,14 @@ def simulateLauePattern(hkls, bMat,
35263526
35273527 # unit G-vectors in crystal frame
35283528 ghat_c = mutil .unitVector (num .dot (bMat , hkls ))
3529-
3529+
35303530 # pre-allocate output arrays
35313531 xy_det = num .nan * num .ones ((n_grains , nhkls_tot , 2 ))
35323532 hkls_in = num .nan * num .ones ((n_grains , 3 , nhkls_tot ))
35333533 angles = num .nan * num .ones ((n_grains , nhkls_tot , 2 ))
35343534 dspacing = num .nan * num .ones ((n_grains , nhkls_tot ))
35353535 energy = num .nan * num .ones ((n_grains , nhkls_tot ))
3536-
3536+
35373537 """
35383538 LOOP OVER GRAINS
35393539 """
@@ -3564,20 +3564,20 @@ def simulateLauePattern(hkls, bMat,
35643564 tvec_d , tvec_s , tvec_c
35653565 )
35663566 tth_eta = num .vstack (tth_eta ).T
3567-
3567+
35683568 # warp measured points
35693569 if distortion is not None :
35703570 if len (distortion ) == 2 :
35713571 dpts = distortion [0 ](dpts , distortion [1 ], invert = True )
3572-
3572+
35733573 # plane spacings and energies
35743574 dsp = 1. / mutil .columnNorm (num .dot (bMat , dhkl ))
35753575 wlen = 2 * dsp * num .sin (0.5 * tth_eta [:, 0 ])
35763576
35773577 # find on spatial extent of detector
3578- xTest = num .logical_and (dpts [0 , :] >= - 0.5 * panel_dims [1 ] + panel_buffer ,
3578+ xTest = num .logical_and (dpts [0 , :] >= - 0.5 * panel_dims [1 ] + panel_buffer ,
35793579 dpts [0 , :] <= 0.5 * panel_dims [1 ] - panel_buffer )
3580- yTest = num .logical_and (dpts [1 , :] >= - 0.5 * panel_dims [0 ] + panel_buffer ,
3580+ yTest = num .logical_and (dpts [1 , :] >= - 0.5 * panel_dims [0 ] + panel_buffer ,
35813581 dpts [1 , :] <= 0.5 * panel_dims [0 ] - panel_buffer )
35823582
35833583 onDetector = num .logical_and (xTest , yTest )
@@ -3840,7 +3840,7 @@ def make_reflection_patches(instr_cfg, tth_eta, ang_pixel_size,
38403840 pass
38413841
38423842 areas = compute_areas_func (xy_eval_vtx , conn )
3843-
3843+
38443844 # EVALUATION POINTS
38453845 # * for lack of a better option will use centroids
38463846 tth_eta_cen = gutil .cellCentroids ( num .atleast_2d (gVec_angs_vtx [:, :2 ]), conn )
0 commit comments