Commit b76bddc1 authored by Zolnierczuk, Piotr's avatar Zolnierczuk, Piotr
Browse files

config updates

parent 6ab068b0
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -124,7 +124,7 @@ def phi_limits(pos='p2'):

def wavelenth_bandwitdh(pos='p2'):
    """ get instrument wavelength bandwitdh limits in Angstroms"""
    return DLAMBDA.get(pos, 2.4)
    return DLAMBDA.get(pos, DLAMBDA['p2'])

def pixel_angle(ix, iy, theta0, **kwargs):
    """get pixel polar and azimuth angles in the lab frame
@@ -295,8 +295,8 @@ def coverage(lmax, qmin, **kwargs):
    sa = sin(theta)
    z  = L2
    # TODO this is way overkill
    xlims  = linspace(-XDET/2.0, XDET/2.0, NXCHAN/2)
    ylims  = linspace(-YDET/2.0, YDET/2.0, NYCHAN/2)
    xlims  = linspace(-XDET/2.0, XDET/2.0, NXCHAN//2)
    ylims  = linspace(-YDET/2.0, YDET/2.0, NYCHAN//2)
    for x in xlims:
        for y in ylims:
            xrot =  x*ca + z*sa

test/test_config.py

0 → 100755
+46 −0
Original line number Diff line number Diff line
#!/usr/bin/env python
"""
Python unit test cases for pysen.config module
"""
import unittest

import numpy as np

import pysen.config as cfg

class ConfigTestCase(unittest.TestCase):
    def test_tau_limits(self):
        #
        tmin, tmax = cfg.tau_limits( 5.0, mode='shorty_2')
        self.assertAlmostEqual(  0.001 , tmin, 3)
        self.assertAlmostEqual(  0.466 , tmax, 3)
        #
        tmin, tmax = cfg.tau_limits( 8.0, mode='shorty_2')
        self.assertAlmostEqual(  0.005 , tmin, 3)
        self.assertAlmostEqual(  1.908 , tmax, 3)
        #
        tmin, tmax = cfg.tau_limits(11.0, mode='shorty_2')
        self.assertAlmostEqual(  0.012 , tmin, 3)
        self.assertAlmostEqual(  4.961 , tmax, 3)
        #
        tmin, tmax = cfg.tau_limits( 5.0, mode='standard')
        self.assertAlmostEqual(  0.023 , tmin, 3)
        self.assertAlmostEqual( 13.045 , tmax, 3)
        #
        tmin, tmax = cfg.tau_limits( 8.0, mode='standard')
        self.assertAlmostEqual(  0.095 , tmin, 3)
        self.assertAlmostEqual( 53.431 , tmax, 3)
        #
        tmin, tmax = cfg.tau_limits(11.0, mode='standard')
        self.assertAlmostEqual(  0.248 , tmin, 3)
        self.assertAlmostEqual(138.900 , tmax, 3)

    def not_ready_coverage(self):
        lmax, qmin, result, limits, msg = cfg.coverage(8.0, 0.15)
        print(lmax, qmin)
        print(result.shape)
        for _ in limits:
            print(len(_))

if __name__ == "__main__":
    unittest.main(exit=False, verbosity=2)