Exemplo n.º 1
0
    def testScannableSetup(self):
        ilfe = EnergyScannableLinearArbitrary(name='idd_lin_fe_energy',
            id_gap_scannable=self.idd_gap, 
            id_rowphase1_scannable=self.idd_rowphase1,
            id_rowphase2_scannable=self.idd_rowphase2, 
            id_rowphase3_scannable=self.idd_rowphase3, 
            id_rowphase4_scannable=self.idd_rowphase4, 
            id_jawphase_scannable=self.idd_jawphase, 
            pgm_energy_scannable=self.pgm_energy,
            pol_angle_scannable_name='idd_lin_fe_angle', 
            angle_min_Deg=0., angle_max_Deg=180., angle_threshold_Deg=26., 
            energy_min_eV=690., energy_max_eV=730.,
            gap_from_energy=Poly([7.52167, 0.01389], power0first=True),
            rowphase1_from_energy=-15.4, rowphase2_from_energy=0.,
            rowphase3_from_energy=15.4, rowphase4_from_energy=0,
            jawphase_from_energy=None, gap_from_angle=None,
            rowphase1_from_angle=None, rowphase2_from_angle=None,
            rowphase3_from_angle=None, rowphase4_from_angle=None,
            jawphase_from_angle=Poly([-116./7.5, 1./7.5], power0first=True))

        self.assertEquals(repr(self.idd_lin_fe_energy), repr(ilfe))

        self.assertEqual('idd_lin_fe_energy', self.idd_lin_fe_energy.name)
        self.assertEqual(list(self.idd_lin_fe_energy.inputNames), ['idd_lin_fe_energy'])
        self.assertEqual(list(self.idd_lin_fe_energy.extraNames), [u'idd_lin_fe_angle', u'idd_gap', u'idd_rowphase1', u'idd_rowphase2', u'idd_rowphase3', u'idd_rowphase4', u'idd_jawphase', u'pgm_energy', u'diff_energy'])
        self.assertEqual(list(self.idd_lin_fe_energy.outputFormat), [u'%f', u'%f', u'%f', u'%f', u'%f', u'%f', u'%f', u'%f', u'%f', u'%f'])

        self.assertEqual('idd_lin_fe_angle', self.idd_lin_fe_angle.name)
        self.assertEqual(list(self.idd_lin_fe_angle.inputNames), ['idd_lin_fe_angle'])
        self.assertEqual(list(self.idd_lin_fe_angle.extraNames), [u'idd_lin_fe_energy', u'idd_gap', u'idd_rowphase1', u'idd_rowphase2', u'idd_rowphase3', u'idd_rowphase4', u'idd_jawphase', u'pgm_energy', u'diff_energy'])
        self.assertEqual(list(self.idd_lin_fe_angle.outputFormat), [u'%f', u'%f', u'%f', u'%f', u'%f', u'%f', u'%f', u'%f', u'%f', u'%f'])
Exemplo n.º 2
0
    def setUp(self):
        # Initialise these as local, so the example code looks the same
        # as it will in localstation or a user script.
        (idd_gap, idd_rowphase1, idd_rowphase2, idd_rowphase3, idd_rowphase4,
         idd_jawphase, pgm_energy) = self.setUpMocks()

        ################### Start Example configuration ###################  

        idd_lin_fe_energy = EnergyScannableLinearArbitrary('idd_lin_fe_energy',
            idd_gap, idd_rowphase1, idd_rowphase2, idd_rowphase3, idd_rowphase4, 
            idd_jawphase, pgm_energy, 'idd_lin_fe_angle',
            angle_min_Deg=0., angle_max_Deg=180., angle_threshold_Deg=26., 
            energy_min_eV=690., energy_max_eV=730.,
            #gap = 7.52167 + 0.01389 * energy_eV
            gap_from_energy=Poly([7.52167, 0.01389], power0first=True),
            rowphase1_from_energy=-15.4, rowphase2_from_energy=0.,
            rowphase3_from_energy=15.4, rowphase4_from_energy=0,
            # jawphase = ( alpha_real - 116. ) / 7.5
            jawphase_from_angle=Poly([-116./7.5, 1./7.5], power0first=True))

        idd_lin_fe_angle = PolarisationAngleScannable('idd_lin_fe_angle',
            idd_lin_fe_energy)
        #################### End Example configuration ####################  

        self.idd_lin_fe_energy = idd_lin_fe_energy
        self.idd_lin_fe_angle = idd_lin_fe_angle
Exemplo n.º 3
0
    def testEquivalence(self):
        poly = Poly(power0first=True, coeffs=[0])

        self.assertEquals(repr(self.poly), repr(poly))

        poly = Poly([0])

        self.assertEquals(repr(self.poly), repr(poly))
Exemplo n.º 4
0
    def testScannableSetup(self):
        ilhe = EnergyScannablePoly(
            'idd_lin_hor_energy',
            self.idd_gap,
            self.idd_rowphase1,
            self.idd_rowphase2,
            self.idd_rowphase3,
            self.idd_rowphase4,
            self.idd_jawphase,
            self.pgm_energy,
            gap=16,
            rowphase1=0,
            rowphase2=0,
            rowphase3=0,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    3.3502671895516406e-41, -5.0443866954149711e-37,
                    3.4803215641954580e-33, -1.4580246046390974e-29,
                    4.1431184271800654e-26, -8.4487057979195192e-23,
                    1.2756618081729026e-19, -1.4503475672160905e-16,
                    1.2502244299182579e-13, -8.1604278898212417e-11,
                    3.9951747689787648e-08, -1.4390652672680635e-05,
                    3.6880906351653684e-03, -6.3450605014502259e-01,
                    6.5540526156906154e+01, -3.0647533992737303e+03
                ]))

        self.assertEquals(repr(self.idd_lin_hor_energy), repr(ilhe))

        self.assertEqual('idd_lin_hor_energy', self.idd_lin_hor_energy.name)
        self.assertEqual(list(self.idd_lin_hor_energy.inputNames),
                         ['idd_lin_hor_energy'])
        self.assertEqual(list(self.idd_lin_hor_energy.extraNames), [
            'idd_gap', 'idd_rowphase1', 'idd_rowphase2', 'idd_rowphase3',
            'idd_rowphase4', 'idd_jawphase', 'pgm_energy', 'diff_energy'
        ])
        self.assertEqual(
            list(self.idd_lin_hor_energy.outputFormat),
            ['%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f'])

        ilve = EnergyScannablePoly(
            'idd_lin_ver_energy',
            self.idd_gap,
            self.idd_rowphase1,
            self.idd_rowphase2,
            self.idd_rowphase3,
            self.idd_rowphase4,
            self.idd_jawphase,
            self.pgm_energy,
            gap=16,
            rowphase1=24,
            rowphase2=0,
            rowphase3=24,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    5.7872984268363729e-40, -9.6927773095637603e-36,
                    7.4982177899089000e-32, -3.5528632008418775e-28,
                    1.1527662093156713e-24, -2.7121091920521087e-21,
                    4.7781854501432704e-18, -6.4172005413018581e-15,
                    6.6219983201434882e-12, -5.2490014435732980e-09,
                    3.1691535622688745e-06, -1.4309597792932307e-03,
                    4.6765853517087802e-01, -1.0442119397102638e+02,
                    1.4242875040183506e+04, -8.9460467908767762e+05
                ]))

        self.assertEquals(repr(self.idd_lin_ver_energy), repr(ilve))

        self.assertEqual('idd_lin_hor_energy', self.idd_lin_hor_energy.name)
        self.assertEqual(list(self.idd_lin_hor_energy.inputNames),
                         ['idd_lin_hor_energy'])
        self.assertEqual(list(self.idd_lin_hor_energy.extraNames), [
            'idd_gap', 'idd_rowphase1', 'idd_rowphase2', 'idd_rowphase3',
            'idd_rowphase4', 'idd_jawphase', 'pgm_energy', 'diff_energy'
        ])
        self.assertEqual(
            list(self.idd_lin_hor_energy.outputFormat),
            ['%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f'])

        icpe = EnergyScannablePoly(
            'idd_circ_pos_energy',
            self.idd_gap,
            self.idd_rowphase1,
            self.idd_rowphase2,
            self.idd_rowphase3,
            self.idd_rowphase4,
            self.idd_jawphase,
            self.pgm_energy,
            gap=16,
            rowphase1=15.1724,
            rowphase2=0,
            rowphase3=15.1724,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    1.9348427564961812e-40, -3.1126995721309230e-36,
                    2.3047622879259613e-32, -1.0412681219138865e-28,
                    3.2081024655562872e-25, -7.1352299398740346e-22,
                    1.1827360301838759e-18, -1.4868981155109573e-15,
                    1.4284943075718623e-12, -1.0481476204057386e-09,
                    5.8225647884164763e-07, -2.4036499938966973e-04,
                    7.1349214643820852e-02, -1.4372449558778261e+01,
                    1.7564915878491570e+03, -9.8177319470976290e+04
                ]))

        self.assertEquals(repr(self.idd_circ_pos_energy), repr(icpe))

        self.assertEqual('idd_circ_pos_energy', self.idd_circ_pos_energy.name)
        self.assertEqual(list(self.idd_circ_pos_energy.inputNames),
                         ['idd_circ_pos_energy'])
        self.assertEqual(list(self.idd_circ_pos_energy.extraNames), [
            'idd_gap', 'idd_rowphase1', 'idd_rowphase2', 'idd_rowphase3',
            'idd_rowphase4', 'idd_jawphase', 'pgm_energy', 'diff_energy'
        ])
        self.assertEqual(
            list(self.idd_circ_pos_energy.outputFormat),
            ['%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f'])

        icne = EnergyScannablePoly(
            'idd_circ_neg_energy',
            self.idd_gap,
            self.idd_rowphase1,
            self.idd_rowphase2,
            self.idd_rowphase3,
            self.idd_rowphase4,
            self.idd_jawphase,
            self.pgm_energy,
            gap=16,
            rowphase1=-15.1724,
            rowphase2=0,
            rowphase3=-15.1724,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    7.2663310131321569e-43, -1.0175127616060827e-37,
                    1.4214278244059263e-33, -9.4388200887468604e-30,
                    3.8351579795646889e-26, -1.0581689343594696e-22,
                    2.0916183094103308e-19, -3.0497195398509381e-16,
                    3.3285639917557250e-13, -2.7303600657863037e-10,
                    1.6739050602639844e-07, -7.5457697253971458e-05,
                    2.4242927611627316e-02, -5.2460103475433995e+00,
                    6.8435482439065288e+02, -4.0611673888060664e+04
                ]))

        self.assertEquals(repr(self.idd_circ_neg_energy), repr(icne))

        self.assertEqual('idd_circ_neg_energy', self.idd_circ_neg_energy.name)
        self.assertEqual(list(self.idd_circ_neg_energy.inputNames),
                         ['idd_circ_neg_energy'])
        self.assertEqual(list(self.idd_circ_neg_energy.extraNames), [
            'idd_gap', 'idd_rowphase1', 'idd_rowphase2', 'idd_rowphase3',
            'idd_rowphase4', 'idd_jawphase', 'pgm_energy', 'diff_energy'
        ])
        self.assertEqual(
            list(self.idd_circ_neg_energy.outputFormat),
            ['%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f', '%f'])
Exemplo n.º 5
0
    def setUp(self):
        # Initialise these as local, so the example code looks the same
        # as it will in localstation or a user script.
        (idd_gap, idd_rowphase1, idd_rowphase2, idd_rowphase3, idd_rowphase4,
         idd_jawphase, pgm_energy) = self.setUpMocks()

        ################### Start Example configuration ###################
        # Linear horizontal polarisation
        idd_lin_hor_energy = EnergyScannablePoly(
            'idd_lin_hor_energy',
            idd_gap,
            idd_rowphase1,
            idd_rowphase2,
            idd_rowphase3,
            idd_rowphase4,
            idd_jawphase,
            pgm_energy,
            gap=16,
            rowphase1=0,
            rowphase2=0,
            rowphase3=0,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    3.3502671895516406e-41, -5.0443866954149711e-37,
                    3.4803215641954580e-33, -1.4580246046390974e-29,
                    4.1431184271800654e-26, -8.4487057979195192e-23,
                    1.2756618081729026e-19, -1.4503475672160905e-16,
                    1.2502244299182579e-13, -8.1604278898212417e-11,
                    3.9951747689787648e-08, -1.4390652672680635e-05,
                    3.6880906351653684e-03, -6.3450605014502259e-01,
                    6.5540526156906154e+01, -3.0647533992737303e+03
                ]))

        # Linear Vertical polarisation
        idd_lin_ver_energy = EnergyScannablePoly(
            'idd_lin_ver_energy',
            idd_gap,
            idd_rowphase1,
            idd_rowphase2,
            idd_rowphase3,
            idd_rowphase4,
            idd_jawphase,
            pgm_energy,
            gap=16,
            rowphase1=24,
            rowphase2=0,
            rowphase3=24,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    5.7872984268363729e-40, -9.6927773095637603e-36,
                    7.4982177899089000e-32, -3.5528632008418775e-28,
                    1.1527662093156713e-24, -2.7121091920521087e-21,
                    4.7781854501432704e-18, -6.4172005413018581e-15,
                    6.6219983201434882e-12, -5.2490014435732980e-09,
                    3.1691535622688745e-06, -1.4309597792932307e-03,
                    4.6765853517087802e-01, -1.0442119397102638e+02,
                    1.4242875040183506e+04, -8.9460467908767762e+05
                ]))

        # Positive circular polarisation
        idd_circ_pos_energy = EnergyScannablePoly(
            'idd_circ_pos_energy',
            idd_gap,
            idd_rowphase1,
            idd_rowphase2,
            idd_rowphase3,
            idd_rowphase4,
            idd_jawphase,
            pgm_energy,
            gap=16,
            rowphase1=15.1724,
            rowphase2=0,
            rowphase3=15.1724,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    1.9348427564961812e-40, -3.1126995721309230e-36,
                    2.3047622879259613e-32, -1.0412681219138865e-28,
                    3.2081024655562872e-25, -7.1352299398740346e-22,
                    1.1827360301838759e-18, -1.4868981155109573e-15,
                    1.4284943075718623e-12, -1.0481476204057386e-09,
                    5.8225647884164763e-07, -2.4036499938966973e-04,
                    7.1349214643820852e-02, -1.4372449558778261e+01,
                    1.7564915878491570e+03, -9.8177319470976290e+04
                ]))

        # Negative circular polarisation
        idd_circ_neg_energy = EnergyScannablePoly(
            'idd_circ_neg_energy',
            idd_gap,
            idd_rowphase1,
            idd_rowphase2,
            idd_rowphase3,
            idd_rowphase4,
            idd_jawphase,
            pgm_energy,
            gap=16,
            rowphase1=-15.1724,
            rowphase2=0,
            rowphase3=-15.1724,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    7.2663310131321569e-43, -1.0175127616060827e-37,
                    1.4214278244059263e-33, -9.4388200887468604e-30,
                    3.8351579795646889e-26, -1.0581689343594696e-22,
                    2.0916183094103308e-19, -3.0497195398509381e-16,
                    3.3285639917557250e-13, -2.7303600657863037e-10,
                    1.6739050602639844e-07, -7.5457697253971458e-05,
                    2.4242927611627316e-02, -5.2460103475433995e+00,
                    6.8435482439065288e+02, -4.0611673888060664e+04
                ]))

        #################### End Example configuration ####################

        self.idd_lin_hor_energy = idd_lin_hor_energy
        self.idd_lin_ver_energy = idd_lin_ver_energy
        self.idd_circ_pos_energy = idd_circ_pos_energy
        self.idd_circ_neg_energy = idd_circ_neg_energy
Exemplo n.º 6
0
 def setUp(self):
     self.poly = Poly(power0first=True, coeffs=[3, 2, 1])
Exemplo n.º 7
0
 def setUp(self):
     self.poly = Poly([])
Exemplo n.º 8
0
    def setUp(self):
        # Initialise these as local, so the example code looks the same
        # as it will in localstation or a user script.
        (idu_gap, idu_rowphase1, idu_rowphase2, idu_rowphase3, idu_rowphase4,
         idu_jawphase, idd_gap, idd_rowphase1, idd_rowphase2, idd_rowphase3,
         idd_rowphase4, idd_jawphase, pgm_energy) = self.setUpMocks()

        ################### Start Example configuration ###################
        # Positive circular polarisation
        idu_circ_pos_energy = EnergyScannable(
            'idu_circ_pos_energy',
            idu_gap,
            idu_rowphase1,
            idu_rowphase2,
            idu_rowphase3,
            idu_rowphase4,
            idu_jawphase,
            pgm_energy,
            gap=16,
            rowphase1=15.1724,
            rowphase2=0,
            rowphase3=15.1724,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    1.9348427564961812e-40, -3.1126995721309230e-36,
                    2.3047622879259613e-32, -1.0412681219138865e-28,
                    3.2081024655562872e-25, -7.1352299398740346e-22,
                    1.1827360301838759e-18, -1.4868981155109573e-15,
                    1.4284943075718623e-12, -1.0481476204057386e-09,
                    5.8225647884164763e-07, -2.4036499938966973e-04,
                    7.1349214643820852e-02, -1.4372449558778261e+01,
                    1.7564915878491570e+03, -9.8177319470976290e+04
                ]))

        # Negative circular polarisation
        idd_circ_neg_energy = EnergyScannable(
            'idd_circ_neg_energy',
            idd_gap,
            idd_rowphase1,
            idd_rowphase2,
            idd_rowphase3,
            idd_rowphase4,
            idd_jawphase,
            pgm_energy,
            gap=16,
            rowphase1=-15.1724,
            rowphase2=0,
            rowphase3=-15.1724,
            rowphase4=0,
            jawphase_poly=Poly(
                power0first=False,
                coeffs=[
                    7.2663310131321569e-43, -1.0175127616060827e-37,
                    1.4214278244059263e-33, -9.4388200887468604e-30,
                    3.8351579795646889e-26, -1.0581689343594696e-22,
                    2.0916183094103308e-19, -3.0497195398509381e-16,
                    3.3285639917557250e-13, -2.7303600657863037e-10,
                    1.6739050602639844e-07, -7.5457697253971458e-05,
                    2.4242927611627316e-02, -5.2460103475433995e+00,
                    6.8435482439065288e+02, -4.0611673888060664e+04
                ]))

        id_circ_energy = EnergyScannablePair('id_circ_energy',
                                             idu_circ_pos_energy,
                                             idd_circ_neg_energy)

        #################### End Example configuration ####################

        self.idu_circ_pos_energy = idu_circ_pos_energy
        self.idd_circ_neg_energy = idd_circ_neg_energy
        self.id_circ_energy = id_circ_energy
Exemplo n.º 9
0
 def __init__(self, name, idu_jawphase, idd_jawphase, smode, pol, jawphase_from_angle=Poly([-120./7.5, 1./7.5], power0first=True), angle_threshold_deg = 30.0):
     self.setName(name)
     self.setInputNames([name])
     self.setExtraNames([])
     self.setOutputFormat(["%f"])
     
     self.idu_jawphase = idu_jawphase
     self.idd_jawphase = idd_jawphase
     self.smode = smode
     self.pol = pol
     self.jawphase_from_angle = jawphase_from_angle
     self.angle_threshold_deg = angle_threshold_deg
     
     #cached data
     self.jawphase = None
     self.angle_deg = None
Exemplo n.º 10
0
#####
from calibrations.mode_polarisation_energy_instances import smode, pol, energy_s, energy_pol, setBeamHarmonicsOrder, initialisation  # @UnusedImport
from calibrations.energy_polarisation_class import ROW_PHASE_MOTOR_TOLERANCE  # @UnusedImport
from calibrations.xraysource import X_RAY_SOURCE_MODES
from calibrations.energy_polarisation_class import X_RAY_POLARISATIONS
idd, idu, unknown = X_RAY_SOURCE_MODES
pc, nc, lh, lv, la, lh3, unknown = X_RAY_POLARISATIONS
initialisation()

from calibrations.linearArbitraryAngle import LinearArbitraryAngle
laa = LinearArbitraryAngle("laa",
                           idu_jawphase,
                           idd_jawphase,
                           smode,
                           pol,
                           jawphase_from_angle=Poly([-120. / 7.5, 1. / 7.5],
                                                    power0first=True),
                           angle_threshold_deg=30.0)

from scannable.continuous.continuous_energy_scannables_new import energy, energy_controller, mcs16, mcs17, mcs18, mcs19, mcs20, mcs21, mcs22, mcs23  # @UnusedImport
from scan.cvscan import cvscan  # @UnusedImport
alias('cvscan')

print
print "*" * 80
#DiffCalc
print "import DIFFCALC support for I10"
from rasor.scannable.ThArea import thArea  # @UnusedImport
from rasor.scannable.TthArea import tthArea  # @UnusedImport
try:
    from startup.i10 import *  # @UnusedWildImport
except: