import OpenPNM
import numpy as np
import OpenPNM.Physics.models as pm


class GenericLinearTransportTest:
    def setup_class(self):
        self.net = OpenPNM.Network.Cubic(shape=[5, 5, 5])
        self.phase = OpenPNM.Phases.GenericPhase(network=self.net)
        Ps = self.net.Ps
        Ts = self.net.Ts
        self.phys = OpenPNM.Physics.GenericPhysics(network=self.net,
                                                   phase=self.phase,
                                                   pores=Ps, throats=Ts)
        self.phys['throat.cond'] = 5e-8
        self.alg = OpenPNM.Algorithms.GenericLinearTransport(network=self.net,
                                                             phase=self.phase)

    def test_set_BC_modes_pores(self):
        BC1_pores = np.arange(25, 35)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         pores=BC1_pores)
        ptest = self.alg.pores('pore.Dirichlet')
        assert np.all(ptest == BC1_pores)
        BC2_pores = np.arange(43, 50)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         pores=BC2_pores,
                                         mode='merge')
        ptest = self.alg.pores('pore.Dirichlet')
        assert np.all(ptest == np.concatenate((BC1_pores, BC2_pores)))
        BC3_pores = np.arange(4, 9)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         pores=BC3_pores,
                                         mode='overwrite')
        ptest = self.alg.pores('pore.Dirichlet')
        assert np.all(ptest == BC3_pores)
        BC4_pores = [11, 90]
        self.alg.set_boundary_conditions(bctype='Neumann',
                                         bcvalue=0.5,
                                         pores=BC4_pores,
                                         mode='overwrite')
        ptest = self.alg.pores('pore.Neumann')
        assert np.all(ptest == BC4_pores)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         pores=BC1_pores,
                                         bcvalue=0.3)
        ptest = self.alg.pores('pore.Dirichlet')
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         pores=self.alg.Ps,
                                         mode='remove')
        Dp = np.sum(self.alg['pore.Dirichlet'])
        assert Dp == 0
        self.alg.set_boundary_conditions(bctype='Neumann',
                                         mode='remove')
        label = 'pore.Neumann'
        assert (label not in self.alg.labels())

    def test_set_BC_modes_throats(self):
        BC1_throats = np.arange(25, 35)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         throats=BC1_throats)
        t_test = self.alg.throats('throat.Dirichlet')
        assert np.all(t_test == BC1_throats)
        BC2_throats = np.arange(43, 50)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         throats=BC2_throats,
                                         mode='merge')
        t_test = self.alg.throats('throat.Dirichlet')
        assert np.all(t_test == np.concatenate((BC1_throats, BC2_throats)))
        BC3_throats = np.arange(4, 9)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         throats=BC3_throats,
                                         mode='overwrite')
        t_test = self.alg.throats('throat.Dirichlet')
        assert np.all(t_test == BC3_throats)
        BC4_throats = [11, 90]
        self.alg.set_boundary_conditions(bctype='Neumann',
                                         bcvalue=0.5,
                                         throats=BC4_throats,
                                         mode='overwrite')
        t_test = self.alg.throats('throat.Neumann')
        assert np.all(t_test == BC4_throats)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         throats=BC1_throats,
                                         bcvalue=0.3)
        t_test = self.alg.throats('throat.Dirichlet')
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         throats=self.alg.Ts,
                                         mode='remove')
        Dp = np.sum(self.alg['throat.Dirichlet'])
        assert Dp == 0
        self.alg.set_boundary_conditions(bctype='Neumann',
                                         mode='remove')
        label = 'throat.Neumann'
        assert (label not in self.alg.labels())

    def test_set_BC_modes_with_boolean_masks_pores(self):
        BC1_pores = np.zeros(self.alg.Np, dtype='bool')
        BC1_pores[np.arange(25, 35)] = True
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         pores=BC1_pores)
        ptest = self.alg.pores('pore.Dirichlet')
        assert np.all(ptest == self.alg._parse_locations(BC1_pores))
        BC2_pores = np.zeros(self.alg.Np, dtype='bool')
        BC2_pores[np.arange(43, 50)] = True
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         pores=BC2_pores,
                                         mode='merge')
        ptest = self.alg.pores('pore.Dirichlet')
        B1 = self.alg._parse_locations(BC1_pores)
        B2 = self.alg._parse_locations(BC2_pores)
        assert np.all(ptest == np.concatenate((B1, B2)))
        BC3_pores = np.zeros(self.alg.Np, dtype='bool')
        BC3_pores[np.arange(4, 9)] = True
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         pores=BC3_pores,
                                         mode='overwrite')
        ptest = self.alg.pores('pore.Dirichlet')
        assert np.all(ptest == self.alg._parse_locations(BC3_pores))
        BC4_pores = np.zeros(self.alg.Np, dtype='bool')
        BC4_pores[[11, 90]] = True
        self.alg.set_boundary_conditions(bctype='Neumann',
                                         bcvalue=0.5,
                                         pores=BC4_pores,
                                         mode='overwrite')
        ptest = self.alg.pores('pore.Neumann')
        assert np.all(ptest == self.alg._parse_locations(BC4_pores))
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         pores=BC1_pores,
                                         bcvalue=0.3)
        ptest = self.alg.pores('pore.Dirichlet')
        removed_p = self.alg._parse_locations(self.alg.Ps)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         pores=removed_p,
                                         mode='remove')
        Dp = np.sum(self.alg['pore.Dirichlet'])
        assert Dp == 0
        self.alg.set_boundary_conditions(bctype='Neumann',
                                         mode='remove')
        label = 'pore.Neumann'
        assert (label not in self.alg.labels())

    def test_set_BC_modes_with_boolean_masks_throats(self):
        BC1_throats = np.zeros(self.alg.Nt, dtype='bool')
        BC1_throats[np.arange(25, 35)] = True
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         throats=BC1_throats)
        t_test = self.alg.throats('throat.Dirichlet')
        assert np.all(t_test == self.alg._parse_locations(BC1_throats))
        BC2_throats = np.zeros(self.alg.Nt, dtype='bool')
        BC2_throats[np.arange(43, 50)] = True
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         throats=BC2_throats,
                                         mode='merge')
        t_test = self.alg.throats('throat.Dirichlet')
        B1 = self.alg._parse_locations(BC1_throats)
        B2 = self.alg._parse_locations(BC2_throats)
        assert np.all(t_test == np.concatenate((B1, B2)))
        BC3_throats = np.zeros(self.alg.Nt, dtype='bool')
        BC3_throats[np.arange(4, 9)] = True
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.8,
                                         throats=BC3_throats,
                                         mode='overwrite')
        t_test = self.alg.throats('throat.Dirichlet')
        assert np.all(t_test == self.alg._parse_locations(BC3_throats))
        BC4_throats = np.zeros(self.alg.Nt, dtype='bool')
        BC4_throats[[11, 90]] = True
        self.alg.set_boundary_conditions(bctype='Neumann',
                                         bcvalue=0.5,
                                         throats=BC4_throats,
                                         mode='overwrite')
        t_test = self.alg.throats('throat.Neumann')
        assert np.all(t_test == self.alg._parse_locations(BC4_throats))
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         throats=BC1_throats,
                                         bcvalue=0.3)
        t_test = self.alg.throats('throat.Dirichlet')
        removed_t = self.alg._parse_locations(self.alg.Ts)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         throats=removed_t,
                                         mode='remove')
        Dp = np.sum(self.alg['throat.Dirichlet'])
        assert Dp == 0
        self.alg.set_boundary_conditions(bctype='Neumann',
                                         mode='remove')
        label = 'pore.Neumann'
        assert (label not in self.alg.labels())

    def test_super_pore_conductance(self):
        g_super = []
        BC1_pores = np.arange(20, 30)
        self.alg.set_boundary_conditions(bctype='Dirichlet',
                                         bcvalue=0.4,
                                         pores=BC1_pores)
        BC2_pores = np.arange(45, 66)
        self.alg.set_boundary_conditions(bctype='Neumann_group',
                                         bcvalue=1.4e-10,
                                         pores=BC2_pores)
        g_super.append(2e-12)
        BC3_pores = np.arange(87, 94)
        self.alg.set_boundary_conditions(bctype='Neumann_group',
                                         bcvalue=-0.9e-10,
                                         pores=BC3_pores)
        g_super.append(np.ones(len(BC3_pores)) * 1.5e-12)
        BC4_pores = np.arange(3, 7)
        self.alg.set_boundary_conditions(bctype='Neumann_group',
                                         bcvalue=0.1e-10,
                                         pores=BC4_pores)
        g_super.append(np.array([6.42e-13]))
        self.alg.run(conductance='throat.cond',
                     quantity='pore.mole_fraction',
                     super_pore_conductance=g_super)
        self.alg.return_results()
        r1 = self.alg.rate(BC1_pores)[0]
        r2 = self.alg.rate(BC2_pores)[0]
        r3 = self.alg.rate(BC3_pores)[0]
        r4 = self.alg.rate(BC4_pores)[0]
        assert np.absolute(r1 + r2 + r3 + r4) < 1e-20
        assert np.size(self.alg.super_pore_conductance[0]) == 1
        assert np.size(self.alg.super_pore_conductance[1]) == 7
        assert np.size(self.alg.super_pore_conductance[2]) == 1

    def test_source_term_modes(self):
        self.phys['pore.item1'] = 0.5e-12
        self.phys['pore.item2'] = 2.5
        self.phys['pore.item3'] = -1.4e-11
        self.phys.models.add(propname='pore.A',
                             model=pm.generic_source_term.power_law,
                             A1='pore.item1',
                             A2='pore.item2',
                             A3='pore.item3',
                             x='mole_fraction',
                             return_rate=False,
                             regen_mode='on_demand')
        self.phys.models.add(propname='pore.B',
                             model=pm.generic_source_term.linear,
                             A1='pore.item1',
                             A2='pore.item3',
                             x='mole_fraction',
                             return_rate=False,
                             regen_mode='on_demand')
        S1_pores = np.arange(25, 35)
        self.alg.set_source_term(source_name=['pore.A', 'pore.B'],
                                 pores=S1_pores)
        mask1 = ~np.isnan(self.alg['pore.source_nonlinear_s1_A'])
        mask2 = ~np.isnan(self.alg['pore.source_nonlinear_s2_A'])
        assert np.all(self.alg.Ps[mask1] == S1_pores)
        assert np.all(self.alg.Ps[mask2] == S1_pores)
        self.alg.set_source_term(source_name='pore.A',
                                 pores=[26], x0=np.ones(self.phys.Np),
                                 mode='update')
        assert self.alg['pore.source_nonlinear_s1_A'][26] == 1.25e-12
        S2_pores = np.array([30, 31])
        self.alg.set_source_term(source_name='pore.A',
                                 pores=S2_pores,
                                 mode='overwrite')
        mask1 = ~np.isnan(self.alg['pore.source_nonlinear_s1_A'])
        assert np.all(self.alg.Ps[mask1] == S2_pores)
        self.alg.set_source_term(source_name='pore.B',
                                 pores=S1_pores,
                                 mode='remove')
        mask1 = np.isnan(self.alg['pore.source_nonlinear_s1_B'])
        assert np.all(self.alg.Ps[mask1] == self.alg.Ps)
        self.alg.set_source_term(source_name=['pore.A', 'pore.B'],
                                 pores=self.alg.Ps,
                                 mode='remove')
        assert ('pore.source_B' in self.alg.labels())
        assert ('pore.source_A' in self.alg.labels())
        self.alg.set_source_term(source_name=['pore.A', 'pore.B'],
                                 mode='remove')
        assert ('pore.source_B' not in self.alg.labels())
        assert ('pore.source_A' not in self.alg.labels())

[((152, 190), 'OpenPNM.Network.Cubic', 'OpenPNM.Network.Cubic', ([], {'shape': '[5, 5, 5]'}), '(shape=[5, 5, 5])\n', (173, 190), False, 'import OpenPNM\n'), ((212, 257), 'OpenPNM.Phases.GenericPhase', 'OpenPNM.Phases.GenericPhase', ([], {'network': 'self.net'}), '(network=self.net)\n', (239, 257), False, 'import OpenPNM\n'), ((328, 420), 'OpenPNM.Physics.GenericPhysics', 'OpenPNM.Physics.GenericPhysics', ([], {'network': 'self.net', 'phase': 'self.phase', 'pores': 'Ps', 'throats': 'Ts'}), '(network=self.net, phase=self.phase, pores=Ps,\n    throats=Ts)\n', (358, 420), False, 'import OpenPNM\n'), ((578, 655), 'OpenPNM.Algorithms.GenericLinearTransport', 'OpenPNM.Algorithms.GenericLinearTransport', ([], {'network': 'self.net', 'phase': 'self.phase'}), '(network=self.net, phase=self.phase)\n', (619, 655), False, 'import OpenPNM\n'), ((777, 794), 'numpy.arange', 'np.arange', (['(25)', '(35)'], {}), '(25, 35)\n', (786, 794), True, 'import numpy as np\n'), ((1032, 1058), 'numpy.all', 'np.all', (['(ptest == BC1_pores)'], {}), '(ptest == BC1_pores)\n', (1038, 1058), True, 'import numpy as np\n'), ((1079, 1096), 'numpy.arange', 'np.arange', (['(43)', '(50)'], {}), '(43, 50)\n', (1088, 1096), True, 'import numpy as np\n'), ((1465, 1480), 'numpy.arange', 'np.arange', (['(4)', '(9)'], {}), '(4, 9)\n', (1474, 1480), True, 'import numpy as np\n'), ((1777, 1803), 'numpy.all', 'np.all', (['(ptest == BC3_pores)'], {}), '(ptest == BC3_pores)\n', (1783, 1803), True, 'import numpy as np\n'), ((2125, 2151), 'numpy.all', 'np.all', (['(ptest == BC4_pores)'], {}), '(ptest == BC4_pores)\n', (2131, 2151), True, 'import numpy as np\n'), ((2564, 2598), 'numpy.sum', 'np.sum', (["self.alg['pore.Dirichlet']"], {}), "(self.alg['pore.Dirichlet'])\n", (2570, 2598), True, 'import numpy as np\n'), ((2880, 2897), 'numpy.arange', 'np.arange', (['(25)', '(35)'], {}), '(25, 35)\n', (2889, 2897), True, 'import numpy as np\n'), ((3144, 3173), 'numpy.all', 'np.all', (['(t_test == BC1_throats)'], {}), '(t_test == BC1_throats)\n', (3150, 3173), True, 'import numpy as np\n'), ((3196, 3213), 'numpy.arange', 'np.arange', (['(43)', '(50)'], {}), '(43, 50)\n', (3205, 3213), True, 'import numpy as np\n'), ((3598, 3613), 'numpy.arange', 'np.arange', (['(4)', '(9)'], {}), '(4, 9)\n', (3607, 3613), True, 'import numpy as np\n'), ((3919, 3948), 'numpy.all', 'np.all', (['(t_test == BC3_throats)'], {}), '(t_test == BC3_throats)\n', (3925, 3948), True, 'import numpy as np\n'), ((4281, 4310), 'numpy.all', 'np.all', (['(t_test == BC4_throats)'], {}), '(t_test == BC4_throats)\n', (4287, 4310), True, 'import numpy as np\n'), ((4734, 4770), 'numpy.sum', 'np.sum', (["self.alg['throat.Dirichlet']"], {}), "(self.alg['throat.Dirichlet'])\n", (4740, 4770), True, 'import numpy as np\n'), ((5069, 5104), 'numpy.zeros', 'np.zeros', (['self.alg.Np'], {'dtype': '"""bool"""'}), "(self.alg.Np, dtype='bool')\n", (5077, 5104), True, 'import numpy as np\n'), ((5460, 5495), 'numpy.zeros', 'np.zeros', (['self.alg.Np'], {'dtype': '"""bool"""'}), "(self.alg.Np, dtype='bool')\n", (5468, 5495), True, 'import numpy as np\n'), ((5994, 6029), 'numpy.zeros', 'np.zeros', (['self.alg.Np'], {'dtype': '"""bool"""'}), "(self.alg.Np, dtype='bool')\n", (6002, 6029), True, 'import numpy as np\n'), ((6442, 6477), 'numpy.zeros', 'np.zeros', (['self.alg.Np'], {'dtype': '"""bool"""'}), "(self.alg.Np, dtype='bool')\n", (6450, 6477), True, 'import numpy as np\n'), ((7328, 7362), 'numpy.sum', 'np.sum', (["self.alg['pore.Dirichlet']"], {}), "(self.alg['pore.Dirichlet'])\n", (7334, 7362), True, 'import numpy as np\n'), ((7663, 7698), 'numpy.zeros', 'np.zeros', (['self.alg.Nt'], {'dtype': '"""bool"""'}), "(self.alg.Nt, dtype='bool')\n", (7671, 7698), True, 'import numpy as np\n'), ((8070, 8105), 'numpy.zeros', 'np.zeros', (['self.alg.Nt'], {'dtype': '"""bool"""'}), "(self.alg.Nt, dtype='bool')\n", (8078, 8105), True, 'import numpy as np\n'), ((8622, 8657), 'numpy.zeros', 'np.zeros', (['self.alg.Nt'], {'dtype': '"""bool"""'}), "(self.alg.Nt, dtype='bool')\n", (8630, 8657), True, 'import numpy as np\n'), ((9086, 9121), 'numpy.zeros', 'np.zeros', (['self.alg.Nt'], {'dtype': '"""bool"""'}), "(self.alg.Nt, dtype='bool')\n", (9094, 9121), True, 'import numpy as np\n'), ((9997, 10033), 'numpy.sum', 'np.sum', (["self.alg['throat.Dirichlet']"], {}), "(self.alg['throat.Dirichlet'])\n", (10003, 10033), True, 'import numpy as np\n'), ((10336, 10353), 'numpy.arange', 'np.arange', (['(20)', '(30)'], {}), '(20, 30)\n', (10345, 10353), True, 'import numpy as np\n'), ((10547, 10564), 'numpy.arange', 'np.arange', (['(45)', '(66)'], {}), '(45, 66)\n', (10556, 10564), True, 'import numpy as np\n'), ((10796, 10813), 'numpy.arange', 'np.arange', (['(87)', '(94)'], {}), '(87, 94)\n', (10805, 10813), True, 'import numpy as np\n'), ((11074, 11089), 'numpy.arange', 'np.arange', (['(3)', '(7)'], {}), '(3, 7)\n', (11083, 11089), True, 'import numpy as np\n'), ((12853, 12870), 'numpy.arange', 'np.arange', (['(25)', '(35)'], {}), '(25, 35)\n', (12862, 12870), True, 'import numpy as np\n'), ((13134, 13172), 'numpy.all', 'np.all', (['(self.alg.Ps[mask1] == S1_pores)'], {}), '(self.alg.Ps[mask1] == S1_pores)\n', (13140, 13172), True, 'import numpy as np\n'), ((13188, 13226), 'numpy.all', 'np.all', (['(self.alg.Ps[mask2] == S1_pores)'], {}), '(self.alg.Ps[mask2] == S1_pores)\n', (13194, 13226), True, 'import numpy as np\n'), ((13490, 13508), 'numpy.array', 'np.array', (['[30, 31]'], {}), '([30, 31])\n', (13498, 13508), True, 'import numpy as np\n'), ((13745, 13783), 'numpy.all', 'np.all', (['(self.alg.Ps[mask1] == S2_pores)'], {}), '(self.alg.Ps[mask1] == S2_pores)\n', (13751, 13783), True, 'import numpy as np\n'), ((13952, 14000), 'numpy.isnan', 'np.isnan', (["self.alg['pore.source_nonlinear_s1_B']"], {}), "(self.alg['pore.source_nonlinear_s1_B'])\n", (13960, 14000), True, 'import numpy as np\n'), ((14016, 14057), 'numpy.all', 'np.all', (['(self.alg.Ps[mask1] == self.alg.Ps)'], {}), '(self.alg.Ps[mask1] == self.alg.Ps)\n', (14022, 14057), True, 'import numpy as np\n'), ((11294, 11314), 'numpy.array', 'np.array', (['[6.42e-13]'], {}), '([6.42e-13])\n', (11302, 11314), True, 'import numpy as np\n'), ((11682, 11712), 'numpy.absolute', 'np.absolute', (['(r1 + r2 + r3 + r4)'], {}), '(r1 + r2 + r3 + r4)\n', (11693, 11712), True, 'import numpy as np\n'), ((11736, 11779), 'numpy.size', 'np.size', (['self.alg.super_pore_conductance[0]'], {}), '(self.alg.super_pore_conductance[0])\n', (11743, 11779), True, 'import numpy as np\n'), ((11800, 11843), 'numpy.size', 'np.size', (['self.alg.super_pore_conductance[1]'], {}), '(self.alg.super_pore_conductance[1])\n', (11807, 11843), True, 'import numpy as np\n'), ((11864, 11907), 'numpy.size', 'np.size', (['self.alg.super_pore_conductance[2]'], {}), '(self.alg.super_pore_conductance[2])\n', (11871, 11907), True, 'import numpy as np\n'), ((13004, 13052), 'numpy.isnan', 'np.isnan', (["self.alg['pore.source_nonlinear_s1_A']"], {}), "(self.alg['pore.source_nonlinear_s1_A'])\n", (13012, 13052), True, 'import numpy as np\n'), ((13070, 13118), 'numpy.isnan', 'np.isnan', (["self.alg['pore.source_nonlinear_s2_A']"], {}), "(self.alg['pore.source_nonlinear_s2_A'])\n", (13078, 13118), True, 'import numpy as np\n'), ((13681, 13729), 'numpy.isnan', 'np.isnan', (["self.alg['pore.source_nonlinear_s1_A']"], {}), "(self.alg['pore.source_nonlinear_s1_A'])\n", (13689, 13729), True, 'import numpy as np\n'), ((1405, 1443), 'numpy.concatenate', 'np.concatenate', (['(BC1_pores, BC2_pores)'], {}), '((BC1_pores, BC2_pores))\n', (1419, 1443), True, 'import numpy as np\n'), ((3532, 3574), 'numpy.concatenate', 'np.concatenate', (['(BC1_throats, BC2_throats)'], {}), '((BC1_throats, BC2_throats))\n', (3546, 3574), True, 'import numpy as np\n'), ((5123, 5140), 'numpy.arange', 'np.arange', (['(25)', '(35)'], {}), '(25, 35)\n', (5132, 5140), True, 'import numpy as np\n'), ((5514, 5531), 'numpy.arange', 'np.arange', (['(43)', '(50)'], {}), '(43, 50)\n', (5523, 5531), True, 'import numpy as np\n'), ((5948, 5972), 'numpy.concatenate', 'np.concatenate', (['(B1, B2)'], {}), '((B1, B2))\n', (5962, 5972), True, 'import numpy as np\n'), ((6048, 6063), 'numpy.arange', 'np.arange', (['(4)', '(9)'], {}), '(4, 9)\n', (6057, 6063), True, 'import numpy as np\n'), ((7719, 7736), 'numpy.arange', 'np.arange', (['(25)', '(35)'], {}), '(25, 35)\n', (7728, 7736), True, 'import numpy as np\n'), ((8126, 8143), 'numpy.arange', 'np.arange', (['(43)', '(50)'], {}), '(43, 50)\n', (8135, 8143), True, 'import numpy as np\n'), ((8574, 8598), 'numpy.concatenate', 'np.concatenate', (['(B1, B2)'], {}), '((B1, B2))\n', (8588, 8598), True, 'import numpy as np\n'), ((8678, 8693), 'numpy.arange', 'np.arange', (['(4)', '(9)'], {}), '(4, 9)\n', (8687, 8693), True, 'import numpy as np\n'), ((13330, 13351), 'numpy.ones', 'np.ones', (['self.phys.Np'], {}), '(self.phys.Np)\n', (13337, 13351), True, 'import numpy as np\n')]