Exemplo n.º 1
0
 def new(self, parameters):
     self.clear()
     # pylint: disable=pointless-string-statement
     """Accepts several ways to spell new cell params."""
     lattice = parameters.pop('lattice', None)
     if lattice is not None:
         try:
             parameters['a'], parameters['b'], parameters['c'] = lattice
         except Exception:
             self.log.warning('invalid lattice spec ignored, should be '
                              '[a, b, c]')
     angles = parameters.pop('angles', None)
     if angles is not None:
         try:
             parameters['alpha'], parameters['beta'], \
                 parameters['gamma'] = angles
         except Exception:
             self.log.warning('invalid angles spec ignored, should be '
                              '[alpha, beta, gamma]')
     self.a = parameters.pop('a', None)
     if self.a is None:
         if 'cell' not in parameters:
             self.log.warning('using dummy lattice constant of 5 A')
         self.a = 5.0
     self.b = parameters.pop('b', self.a)
     self.c = parameters.pop('c', self.a)
     self.alpha = parameters.pop('alpha', 90.0)
     self.beta = parameters.pop('beta', 90.0)
     self.gamma = parameters.pop('gamma', 90.0)
     self.bravais = parameters.pop('bravais', 'P')
     self.laue = parameters.pop('laue', '1')
     Sample.new(self, parameters)
Exemplo n.º 2
0
 def new(self, parameters):
     """Accepts several ways to spell new cell params."""
     lattice = parameters.pop('lattice', None)
     if lattice is not None:
         try:
             parameters['a'], parameters['b'], parameters['c'] = lattice
         except Exception:
             self.log.warning('invalid lattice spec ignored, should be '
                              '[a, b, c]')
     angles = parameters.pop('angles', None)
     if angles is not None:
         try:
             parameters['alpha'], parameters['beta'], \
                 parameters['gamma'] = angles
         except Exception:
             self.log.warning('invalid angles spec ignored, should be '
                              '[alpha, beta, gamma]')
     a = parameters.pop('a', None)
     if a is None:
         if 'cell' not in parameters:
             self.log.warning('using dummy lattice constant of 5 A')
         a = 5.0
     b = parameters.pop('b', a)
     c = parameters.pop('c', a)
     alpha = parameters.pop('alpha', 90.0)
     beta = parameters.pop('beta', 90.0)
     gamma = parameters.pop('gamma', 90.0)
     # TODO: map spacegroup/bravais/laue with triple-axis
     bravais = parameters.pop('bravais', 'P')
     laue = parameters.pop('laue', '1')
     if 'cell' not in parameters:
         parameters['cell'] = [a, b, c, alpha, beta, gamma, bravais, laue]
     Sample.new(self, parameters)
Exemplo n.º 3
0
 def clear(self):
     Sample.clear(self)
     self.lattice = [2 * pi, 2 * pi, 2 * pi]
     self.angles = [90, 90, 90]
     self.orient1 = [1, 0, 0]
     self.orient2 = [0, 1, 0]
     self.psi0 = 0.0
     self.spacegroup = 1  # primitive triclinic, all reflexes allowed
     self.mosaic = 0.5
Exemplo n.º 4
0
 def _applyParams(self, number, parameters):
     """Apply sample parameters.
     """
     Sample._applyParams(self, number, parameters)
     if 'length' in parameters:
         self.length = parameters['length']
     if 'thickness' in parameters:
         self.thickness = parameters['thickness']
     if 'height' in parameters:
         self.height = parameters['height']
     if 'm' in parameters:
         self.m = parameters['m']
     if 'alfa' in parameters:
         self.alfa = parameters['alfa']
     if 'waviness' in parameters:
         self.waviness = parameters['waviness']
     if 'rflfile' in parameters:
         self.rflfile = parameters['rflfile']
Exemplo n.º 5
0
 def clear(self):
     """Clear experiment-specific information."""
     Sample.clear(self)
     self.cell = SXTalCell.fromabc(5)
     self.peaklists = {}
     self.poslists = {}
Exemplo n.º 6
0
 def _applyParams(self, number, parameters):
     Sample._applyParams(self, number, parameters)
     if 'cell' in parameters:
         self.cell = parameters['cell']
Exemplo n.º 7
0
 def _applyParams(self, number, parameters):
     """Apply sample parameters."""
     NicosSample._applyParams(self, number, parameters)
     self.sampleid = parameters.get('id')
Exemplo n.º 8
0
 def clear(self):
     """Clear experiment-specific information."""
     NicosSample.clear(self)
     self.sampleid = None
Exemplo n.º 9
0
 def _applyParams(self, number, parameters):
     if number > 0:
         # move sample changer to new position!
         sc = session.getDevice('SampleChanger')
         sc.maw(number)
     NicosSample._applyParams(self, number, parameters)
Exemplo n.º 10
0
 def new(self, parameters):
     if self.samplenumber is None:
         NicosSample.new(self, parameters)
     else:
         self.set(self.samplenumber, parameters)
         self._applyParams(self.samplenumber, parameters)
Exemplo n.º 11
0
 def _applyParams(self, number, parameters):
     Sample._applyParams(self, number, parameters)
     for key, value in parameters.items():
         if key in ['lattice', 'angles', 'orient1', 'orient2', 'psi0',
                    'spacegroup', 'mosaic']:
             setattr(self, key, value)
Exemplo n.º 12
0
 def clear(self):
     """Clear experiment-specific information."""
     Sample.clear(self)
     self.ubmatrix = None
     for rfl in self._attached_reflists:
         rfl.clear()
Exemplo n.º 13
0
 def _applyParams(self, number, parameters):
     Sample._applyParams(self, number, parameters)