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())

[((8, 19, 8, 57), 'OpenPNM.Network.Cubic', 'OpenPNM.Network.Cubic', (), '', False, 'import OpenPNM\n'), ((9, 21, 9, 66), 'OpenPNM.Phases.GenericPhase', 'OpenPNM.Phases.GenericPhase', (), '', False, 'import OpenPNM\n'), ((12, 20, 14, 72), 'OpenPNM.Physics.GenericPhysics', 'OpenPNM.Physics.GenericPhysics', (), '', False, 'import OpenPNM\n'), ((16, 19, 17, 78), 'OpenPNM.Algorithms.GenericLinearTransport', 'OpenPNM.Algorithms.GenericLinearTransport', (), '', False, 'import OpenPNM\n'), ((20, 20, 20, 37), 'numpy.arange', 'np.arange', ({(20, 30, 20, 32): '25', (20, 34, 20, 36): '35'}, {}), '(25, 35)', True, 'import numpy as np\n'), ((25, 15, 25, 41), 'numpy.all', 'np.all', ({(25, 22, 25, 40): '(ptest == BC1_pores)'}, {}), '(ptest == BC1_pores)', True, 'import numpy as np\n'), ((26, 20, 26, 37), 'numpy.arange', 'np.arange', ({(26, 30, 26, 32): '43', (26, 34, 26, 36): '50'}, {}), '(43, 50)', True, 'import numpy as np\n'), ((33, 20, 33, 35), 'numpy.arange', 'np.arange', ({(33, 30, 33, 31): '4', (33, 33, 33, 34): '9'}, {}), '(4, 9)', True, 'import numpy as np\n'), ((39, 15, 39, 41), 'numpy.all', 'np.all', ({(39, 22, 39, 40): '(ptest == BC3_pores)'}, {}), '(ptest == BC3_pores)', True, 'import numpy as np\n'), ((46, 15, 46, 41), 'numpy.all', 'np.all', ({(46, 22, 46, 40): '(ptest == BC4_pores)'}, {}), '(ptest == BC4_pores)', True, 'import numpy as np\n'), ((54, 13, 54, 47), 'numpy.sum', 'np.sum', ({(54, 20, 54, 46): "self.alg['pore.Dirichlet']"}, {}), "(self.alg['pore.Dirichlet'])", True, 'import numpy as np\n'), ((62, 22, 62, 39), 'numpy.arange', 'np.arange', ({(62, 32, 62, 34): '25', (62, 36, 62, 38): '35'}, {}), '(25, 35)', True, 'import numpy as np\n'), ((67, 15, 67, 44), 'numpy.all', 'np.all', ({(67, 22, 67, 43): '(t_test == BC1_throats)'}, {}), '(t_test == BC1_throats)', True, 'import numpy as np\n'), ((68, 22, 68, 39), 'numpy.arange', 'np.arange', ({(68, 32, 68, 34): '43', (68, 36, 68, 38): '50'}, {}), '(43, 50)', True, 'import numpy as np\n'), ((75, 22, 75, 37), 'numpy.arange', 'np.arange', ({(75, 32, 75, 33): '4', (75, 35, 75, 36): '9'}, {}), '(4, 9)', True, 'import numpy as np\n'), ((81, 15, 81, 44), 'numpy.all', 'np.all', ({(81, 22, 81, 43): '(t_test == BC3_throats)'}, {}), '(t_test == BC3_throats)', True, 'import numpy as np\n'), ((88, 15, 88, 44), 'numpy.all', 'np.all', ({(88, 22, 88, 43): '(t_test == BC4_throats)'}, {}), '(t_test == BC4_throats)', True, 'import numpy as np\n'), ((96, 13, 96, 49), 'numpy.sum', 'np.sum', ({(96, 20, 96, 48): "self.alg['throat.Dirichlet']"}, {}), "(self.alg['throat.Dirichlet'])", True, 'import numpy as np\n'), ((104, 20, 104, 55), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((111, 20, 111, 55), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((121, 20, 121, 55), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((129, 20, 129, 55), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((145, 13, 145, 47), 'numpy.sum', 'np.sum', ({(145, 20, 145, 46): "self.alg['pore.Dirichlet']"}, {}), "(self.alg['pore.Dirichlet'])", True, 'import numpy as np\n'), ((153, 22, 153, 57), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((160, 22, 160, 57), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((170, 22, 170, 57), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((178, 22, 178, 57), 'numpy.zeros', 'np.zeros', (), '', True, 'import numpy as np\n'), ((194, 13, 194, 49), 'numpy.sum', 'np.sum', ({(194, 20, 194, 48): "self.alg['throat.Dirichlet']"}, {}), "(self.alg['throat.Dirichlet'])", True, 'import numpy as np\n'), ((203, 20, 203, 37), 'numpy.arange', 'np.arange', ({(203, 30, 203, 32): '20', (203, 34, 203, 36): '30'}, {}), '(20, 30)', True, 'import numpy as np\n'), ((207, 20, 207, 37), 'numpy.arange', 'np.arange', ({(207, 30, 207, 32): '45', (207, 34, 207, 36): '66'}, {}), '(45, 66)', True, 'import numpy as np\n'), ((212, 20, 212, 37), 'numpy.arange', 'np.arange', ({(212, 30, 212, 32): '87', (212, 34, 212, 36): '94'}, {}), '(87, 94)', True, 'import numpy as np\n'), ((217, 20, 217, 35), 'numpy.arange', 'np.arange', ({(217, 30, 217, 31): '3', (217, 33, 217, 34): '7'}, {}), '(3, 7)', True, 'import numpy as np\n'), ((254, 19, 254, 36), 'numpy.arange', 'np.arange', ({(254, 29, 254, 31): '25', (254, 33, 254, 35): '35'}, {}), '(25, 35)', True, 'import numpy as np\n'), ((259, 15, 259, 53), 'numpy.all', 'np.all', ({(259, 22, 259, 52): '(self.alg.Ps[mask1] == S1_pores)'}, {}), '(self.alg.Ps[mask1] == S1_pores)', True, 'import numpy as np\n'), ((260, 15, 260, 53), 'numpy.all', 'np.all', ({(260, 22, 260, 52): '(self.alg.Ps[mask2] == S1_pores)'}, {}), '(self.alg.Ps[mask2] == S1_pores)', True, 'import numpy as np\n'), ((265, 19, 265, 37), 'numpy.array', 'np.array', ({(265, 28, 265, 36): '[30, 31]'}, {}), '([30, 31])', True, 'import numpy as np\n'), ((270, 15, 270, 53), 'numpy.all', 'np.all', ({(270, 22, 270, 52): '(self.alg.Ps[mask1] == S2_pores)'}, {}), '(self.alg.Ps[mask1] == S2_pores)', True, 'import numpy as np\n'), ((274, 16, 274, 64), 'numpy.isnan', 'np.isnan', ({(274, 25, 274, 63): "self.alg['pore.source_nonlinear_s1_B']"}, {}), "(self.alg['pore.source_nonlinear_s1_B'])", True, 'import numpy as np\n'), ((275, 15, 275, 56), 'numpy.all', 'np.all', ({(275, 22, 275, 55): '(self.alg.Ps[mask1] == self.alg.Ps)'}, {}), '(self.alg.Ps[mask1] == self.alg.Ps)', True, 'import numpy as np\n'), ((221, 23, 221, 43), 'numpy.array', 'np.array', ({(221, 32, 221, 42): '[6.42e-13]'}, {}), '([6.42e-13])', True, 'import numpy as np\n'), ((230, 15, 230, 45), 'numpy.absolute', 'np.absolute', ({(230, 27, 230, 44): '(r1 + r2 + r3 + r4)'}, {}), '(r1 + r2 + r3 + r4)', True, 'import numpy as np\n'), ((231, 15, 231, 58), 'numpy.size', 'np.size', ({(231, 23, 231, 57): 'self.alg.super_pore_conductance[0]'}, {}), '(self.alg.super_pore_conductance[0])', True, 'import numpy as np\n'), ((232, 15, 232, 58), 'numpy.size', 'np.size', ({(232, 23, 232, 57): 'self.alg.super_pore_conductance[1]'}, {}), '(self.alg.super_pore_conductance[1])', True, 'import numpy as np\n'), ((233, 15, 233, 58), 'numpy.size', 'np.size', ({(233, 23, 233, 57): 'self.alg.super_pore_conductance[2]'}, {}), '(self.alg.super_pore_conductance[2])', True, 'import numpy as np\n'), ((257, 17, 257, 65), 'numpy.isnan', 'np.isnan', ({(257, 26, 257, 64): "self.alg['pore.source_nonlinear_s1_A']"}, {}), "(self.alg['pore.source_nonlinear_s1_A'])", True, 'import numpy as np\n'), ((258, 17, 258, 65), 'numpy.isnan', 'np.isnan', ({(258, 26, 258, 64): "self.alg['pore.source_nonlinear_s2_A']"}, {}), "(self.alg['pore.source_nonlinear_s2_A'])", True, 'import numpy as np\n'), ((269, 17, 269, 65), 'numpy.isnan', 'np.isnan', ({(269, 26, 269, 64): "self.alg['pore.source_nonlinear_s1_A']"}, {}), "(self.alg['pore.source_nonlinear_s1_A'])", True, 'import numpy as np\n'), ((32, 31, 32, 69), 'numpy.concatenate', 'np.concatenate', ({(32, 46, 32, 68): '(BC1_pores, BC2_pores)'}, {}), '((BC1_pores, BC2_pores))', True, 'import numpy as np\n'), ((74, 32, 74, 74), 'numpy.concatenate', 'np.concatenate', ({(74, 47, 74, 73): '(BC1_throats, BC2_throats)'}, {}), '((BC1_throats, BC2_throats))', True, 'import numpy as np\n'), ((105, 18, 105, 35), 'numpy.arange', 'np.arange', ({(105, 28, 105, 30): '(25)', (105, 32, 105, 34): '(35)'}, {}), '(25, 35)', True, 'import numpy as np\n'), ((112, 18, 112, 35), 'numpy.arange', 'np.arange', ({(112, 28, 112, 30): '(43)', (112, 32, 112, 34): '(50)'}, {}), '(43, 50)', True, 'import numpy as np\n'), ((120, 31, 120, 55), 'numpy.concatenate', 'np.concatenate', ({(120, 46, 120, 54): '(B1, B2)'}, {}), '((B1, B2))', True, 'import numpy as np\n'), ((122, 18, 122, 33), 'numpy.arange', 'np.arange', ({(122, 28, 122, 29): '(4)', (122, 31, 122, 32): '(9)'}, {}), '(4, 9)', True, 'import numpy as np\n'), ((154, 20, 154, 37), 'numpy.arange', 'np.arange', ({(154, 30, 154, 32): '(25)', (154, 34, 154, 36): '(35)'}, {}), '(25, 35)', True, 'import numpy as np\n'), ((161, 20, 161, 37), 'numpy.arange', 'np.arange', ({(161, 30, 161, 32): '(43)', (161, 34, 161, 36): '(50)'}, {}), '(43, 50)', True, 'import numpy as np\n'), ((169, 32, 169, 56), 'numpy.concatenate', 'np.concatenate', ({(169, 47, 169, 55): '(B1, B2)'}, {}), '((B1, B2))', True, 'import numpy as np\n'), ((171, 20, 171, 35), 'numpy.arange', 'np.arange', ({(171, 30, 171, 31): '(4)', (171, 33, 171, 34): '(9)'}, {}), '(4, 9)', True, 'import numpy as np\n'), ((262, 48, 262, 69), 'numpy.ones', 'np.ones', ({(262, 56, 262, 68): 'self.phys.Np'}, {}), '(self.phys.Np)', True, 'import numpy as np\n')]