Commit 6662919d authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

config bug fixes

parent 2de01d18
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -29,8 +29,9 @@ M2 = -2.709 # [m] sample to monitor2 distance

# 2. Limits
# min, max scattering angle
MIN_PHI = 2.5          # degrees
MIN_PHI =  3.0          # degrees
MAX_PHI = dict(zip(INST_POSITIONS,[29.0,42.0,56.0,79.5])) # degrees
PHI_LIMS = (3.0, 79.5)

# wavelenth bandwitdh
# now computed based on Ltot
@@ -54,11 +55,13 @@ NYCHAN = 32 # number of detector channels (vertical direction)
H_FAC  = sqrt(log(2.0)/2.0)
H_RES  = 0.7   # [A^2/ns] - resolution coefficient
# STANDARD MODE
J1_MIN = 0.005  # [T*m] min field integral (5 mT*m = 50 Gauss*m, somewhat arbitrary)
J1_MAX = 0.560  # [T*m] max field integral (actual 0.56 T*m, "nominal" 1.0 T*m)
J1_MIN = 0.0020 # [T*m] min field integral ( 2 mT*m = 20 Gauss*m, somewhat arbitrary)
J1_MAX = 0.5600 # [T*m] max field integral (actual 0.56 T*m, "nominal" 1.0 T*m)
# SHORTY_2 MODE
J2_MIN = 0.0005 # [T*m] min field integral (0.5 mTm =   5 Gauss*m) # TODO: verify this
J2_MAX = 0.0100 # [T*m] max field integral (10  mTm = 100 Gauss*m) # TODO: verify this
J2_MAX = 0.0200 # [T*m] max field integral (20  mTm = 200 Gauss*m) # TODO: verify this
#
J_LIMS = (J2_MIN, J1_MAX)

# 5. Misc other data
ATTENUATOR_TABLE_08A = {
@@ -296,7 +299,6 @@ def coverage(lmax, qmin, **kwargs):
    ntbin    = kwargs.pop('ntbin', 42  )
    detpos   = kwargs.pop('pos',  'p2' )
    dlam     = kwargs.pop('dlam', wavelength_bandwitdh(detpos))
    limits   = kwargs.pop('limits', True)
    rpixel   = kwargs.pop('rpixel', (NXCHAN//2))

    out     = StringIO()
+7 −4
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ data = [
    center = kwargs.pop('center', True)
    legend = kwargs.pop('legend', True)
    full   = kwargs.pop('full'  , False)
    maxlimits = kwargs.pop('maxlimits', False)
    max_limits = kwargs.pop('max_limits', False)
    #
    title  = kwargs.pop('title' , None)
    cmap   = kwargs.pop('cmap'  , 'jet')
@@ -140,8 +140,9 @@ data = [
        return

    data  = []
    if maxlimits:
        data = [ coverage(lmax, qmin, max_limits=True) ]
    if max_limits:
        print('this is not yet implemented')
        return
    else:
        try:
            lcls = locals()
@@ -458,7 +459,7 @@ def add_qtau_options(subparser, parents=None):
                       help='qtau',
                       description='qtau')
    pars.set_defaults(lmax=8.00, qmin=0.10, tbins=None, taus=None, pos='p2', mode='standard',
                        errors=True, legend=True, center=True,
                        errors=True, legend=True, center=True, max_limits=False,
                        logscalex=True, logscaley=False, cmap='jet', title='',
                        show_template=False)
    pars.add_argument('file',    metavar='filename', help='file to process', nargs='*')
@@ -484,6 +485,8 @@ def add_qtau_options(subparser, parents=None):
                        help='do not show plot legend')
    #grp.add_argument('--no-center', dest='center', action 'store_false',
    #                    help='TBD')
    #grp.add_argument('--max-limits', dest='max_limits', action='store_true',
    #                    help='show max. instrument range')
    grp.add_argument('--color-map', '-C', dest='cmap', metavar='map',
                        help='select colormap to use (default=%(default)s)')
    pars.add_argument('--show-template', dest='show_template', action='store_true',
+2 −2
Original line number Diff line number Diff line
@@ -2,8 +2,8 @@
PySEN revision module
"""
import sys
__version__  = "1.1"
__release__  = "release"
__version__  = "1.2"
__release__  = "rc1"
__date__     = "Oct 17, 2022"

def version(full=False):
+6 −6
Original line number Diff line number Diff line
@@ -12,27 +12,27 @@ class ConfigTestCase(unittest.TestCase):
    def test_tau_limits(self):
        #
        tmin, tmax = cfg.tau_limits( 5.0, mode='shorty_2')
        self.assertAlmostEqual(  0.0002 , tmin, 4)
        self.assertAlmostEqual(  0.0116 , tmin, 4)
        self.assertAlmostEqual(  0.4659 , tmax, 4)
        #
        tmin, tmax = cfg.tau_limits( 8.0, mode='shorty_2')
        self.assertAlmostEqual(  0.0010 , tmin, 4)
        self.assertAlmostEqual(  0.0477 , tmin, 4)
        self.assertAlmostEqual(  1.9083 , tmax, 4)
        #
        tmin, tmax = cfg.tau_limits(11.0, mode='shorty_2')
        self.assertAlmostEqual(  0.0025 , tmin, 4)
        self.assertAlmostEqual(  0.1240 , tmin, 4)
        self.assertAlmostEqual(  4.9607 , tmax, 4)
        #
        tmin, tmax = cfg.tau_limits( 5.0, mode='standard')
        self.assertAlmostEqual(  0.0233 , tmin, 4)
        self.assertAlmostEqual(  0.0466 , tmin, 4)
        self.assertAlmostEqual( 13.0447 , tmax, 4)
        #
        tmin, tmax = cfg.tau_limits( 8.0, mode='standard')
        self.assertAlmostEqual(  0.0954 , tmin, 4)
        self.assertAlmostEqual(  0.1908 , tmin, 4)
        self.assertAlmostEqual( 53.4313 , tmax, 4)
        #
        tmin, tmax = cfg.tau_limits(11.0, mode='standard')
        self.assertAlmostEqual(  0.2480 , tmin, 4)
        self.assertAlmostEqual(  0.4961 , tmin, 4)
        self.assertAlmostEqual(138.9004 , tmax, 4)

    def test_pixel_angle(self):