def doRead(self, maxage=0): mono, ana, phi, psi = self._attached_mono, self._attached_ana, \ self._attached_phi, self._attached_psi # read out position monovalue = to_k(mono.read(maxage), mono.unit) if self.scanmode == 'DIFF': hkl = self._attached_cell.angle2hkl( [monovalue, monovalue, phi.read(maxage), psi.read(maxage)], self.axiscoupling) ny = 0 else: anavalue = to_k(ana.read(maxage), ana.unit) hkl = self._attached_cell.angle2hkl( [monovalue, anavalue, phi.read(maxage), psi.read(maxage)], self.axiscoupling) ny = self._attached_cell.cal_ny(monovalue, anavalue) if self.energytransferunit == 'meV': ny *= THZ2MEV pos = [hkl[0], hkl[1], hkl[2], ny] return pos
def ho_spurions(kf=None, dEmin=0, dEmax=20): """Calculation of elastic spurions due to higher order neutrons. *kf* is the final wavevector to use for calculation. *dEmin* and *dEmax* are the minimum and maximum energy transfer to list. """ instr = session.instrument if kf is None: ana = instr._attached_ana kf = to_k(ana.read(), ana.unit) session.log.info('calculation of potential weak spurions due to higher ' 'harmonic ki / kf combinations') session.log.info('calculated for kf = %6.3f A-1', kf) for line in check_ho_spurions(kf, dEmin, dEmax): session.log.info(line)
def writeData(self, fp, image): mon = self.sink._attached_monitor timer = self.sink._attached_timer mono = self.sink._attached_mono write = fp.write write('''\ <measurement_file> <instrument_name>MIRA</instrument_name> <location>Forschungsreaktor Muenchen II - FRM2</location> <measurement_data> <Sample_Detector>%d</Sample_Detector> <wavelength>%.2f</wavelength> <lifetime>%.3f</lifetime> <beam_monitor>%d</beam_monitor> <resolution>1024</resolution> <detector_value>\n''' % (self.sink._attached_sampledet.read(), from_k(to_k(mono.read(), mono.unit), 'A'), timer.read()[0], mon.read()[0])) h, w = image.shape if self.sink._format is None or self.sink._format[0] != image.shape: p = [] for _x in range(w): for fx in range(1024 // w): for _y in range(h): for fy in range(1024 // h): if fx % 4 == 0 and fy % 4 == 0: p.append('%f ') else: p.append('0 ') p.append('\n') self.sink._format = (image.shape, ''.join(p)) filled = np.repeat(np.repeat(image, 256 // w, 0), 256 // h, 1) if filled.shape == (256, 256): write(self.sink._format[1] % tuple(filled.ravel() / 4.)) write('''\ </detector_value> </measurement_data> </measurement_file> ''')
def doRead(self, maxage=0): tas = self._attached_tas ki = to_k(tas._attached_mono.read(maxage), tas._attached_mono.unit) kf = to_k(tas._attached_ana.read(maxage), tas._attached_ana.unit) phi = tas._attached_phi.read(maxage) return sqrt(ki**2 + kf**2 - 2*ki*kf*cos(radians(phi)))
def doStart(self, lam): tas = self._attached_tas if self._start(to_k(lam, 'A')): tas.log.info('scan mode is now %s at %s', self.scanmode, self.format(lam, unit=True))
def doRead(self, maxage=0): mono = self._attached_base return 2 * pi / to_k(mono.read(maxage), mono.unit)
def doStart(self, pos_e): tas = self._attached_tas if self._start(to_k(pos_e, tas.energytransferunit)): tas.log.info('scan mode is now %s at %s', self.scanmode, self.format(pos_e, unit=True))
def doRead(self, maxage=0): mono = self._attached_base return from_k(to_k(mono.read(maxage), mono.unit), self._attached_tas.energytransferunit)
def doRead(self, maxage=0): base = self._attached_base return to_k(base.read(maxage), base.unit)