Codestyle
This commit is contained in:
parent
c7867a910f
commit
3a7dd4e3cf
@ -53,7 +53,7 @@ class SpmSim(SpmBase):
|
||||
|
||||
def _simFrame(self):
|
||||
"""Generator to simulate a jumping gaussian"""
|
||||
# define normalized 2D gaussian
|
||||
# Define normalized 2D gaussian
|
||||
def gaus2d(x=0, y=0, mx=0, my=0, sx=1, sy=1):
|
||||
return np.exp(-((x - mx)**2. / (2. * sx**2.) + (y - my)**2. / (2. * sy**2.)))
|
||||
|
||||
|
@ -9,7 +9,8 @@ IMPORTANT: Virtual monochromator axes should be implemented already in EPICS!!!
|
||||
|
||||
import numpy as np
|
||||
from math import isclose
|
||||
from ophyd import EpicsSignal, EpicsSignalRO, EpicsMotor, PseudoPositioner, PseudoSingle, Device, Component, Kind
|
||||
from ophyd import (EpicsSignal, EpicsSignalRO, EpicsMotor, PseudoPositioner,
|
||||
PseudoSingle, Device, Component, Kind)
|
||||
from ophyd.pseudopos import pseudo_position_argument, real_position_argument
|
||||
from ophyd.sim import SynAxis, Syn2DGauss
|
||||
|
||||
@ -111,13 +112,21 @@ class MonoDccm(PseudoPositioner):
|
||||
"""WARNING: We have an overdefined system! Not sure if common crystal movement is reliable without retuning"""
|
||||
if abs(pseudo_pos.energy-self.energy.position) > 0.0001 and abs(pseudo_pos.en1-self.en1.position) < 0.0001 and abs(pseudo_pos.en2-self.en2.position) < 0.0001:
|
||||
# Probably the common energy was changed
|
||||
return self.RealPosition(th1=-180.0*e2a(pseudo_pos.energy)/3.141592, th2=180.0*e2a(pseudo_pos.energy)/3.141592)
|
||||
return self.RealPosition(
|
||||
th1=-180.0 * e2a(pseudo_pos.energy) / 3.141592,
|
||||
th2=180.0 * e2a(pseudo_pos.energy) / 3.141592
|
||||
)
|
||||
else:
|
||||
# Probably the individual axes was changes
|
||||
return self.RealPosition(th1=-180.0*e2a(pseudo_pos.en1)/3.141592, th2=180.0*e2a(pseudo_pos.en2)/3.141592)
|
||||
return self.RealPosition(
|
||||
th1=-180.0 * e2a(pseudo_pos.en1 / 3.141592,
|
||||
th2=180.0 * e2a(pseudo_pos.en2) / 3.141592
|
||||
)
|
||||
|
||||
@real_position_argument
|
||||
def inverse(self, real_pos):
|
||||
return self.PseudoPosition(en1=-a2e(3.141592*real_pos.th1/180.0),
|
||||
return self.PseudoPosition(
|
||||
en1=-a2e(3.141592 * real_pos.th1 / 180.0),
|
||||
en2=a2e(3.141592 * real_pos.th2 / 180.0),
|
||||
energy=-a2e(3.141592*real_pos.th1/180.0))
|
||||
energy=-a2e(3.141592 * real_pos.th1 / 180.0)
|
||||
)
|
||||
|
@ -20,13 +20,13 @@ class SlitH(PseudoPositioner):
|
||||
|
||||
@pseudo_position_argument
|
||||
def forward(self, pseudo_pos):
|
||||
'''Run a forward (pseudo -> real) calculation'''
|
||||
"""Run a forward (pseudo -> real) calculation"""
|
||||
return self.RealPosition(x1=pseudo_pos.cenx-pseudo_pos.gapx/2,
|
||||
x2=pseudo_pos.cenx+pseudo_pos.gapx/2)
|
||||
|
||||
@real_position_argument
|
||||
def inverse(self, real_pos):
|
||||
'''Run an inverse (real -> pseudo) calculation'''
|
||||
"""Run an inverse (real -> pseudo) calculation"""
|
||||
return self.PseudoPosition(cenx=(real_pos.x1+real_pos.x2)/2,
|
||||
gapx=real_pos.x2-real_pos.x1)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user