<s> import OpenPNM <EOL> import scipy as sp <EOL> import OpenPNM . Geometry . models as gm <EOL> class ThroatMiscTest : <EOL> def setup_class ( self ) : <EOL> self . net = OpenPNM . Network . Cubic ( shape = [ <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:5> ] ) <EOL> self . geo = OpenPNM . Geometry . GenericGeometry ( network = self . net , <EOL> pores = self . net . Ps , <EOL> throats = self . net . Ts ) <EOL> def test_random_no_seed ( self ) : <EOL> mod = gm . throat_misc . random <EOL> self . geo . models . add ( model = mod , <EOL> propname = '<STR_LIT>' , <EOL> seed = None ) <EOL> temp1 = self . geo [ '<STR_LIT>' ] . copy ( ) <EOL> self . geo . models . regenerate ( ) <EOL> temp2 = self . geo [ '<STR_LIT>' ] . copy ( ) <EOL> assert sp . all ( ~ ( temp1 == temp2 ) ) <EOL> def test_random_with_seed ( self ) : <EOL> mod = gm . throat_misc . random <EOL> self . geo . models . add ( model = mod , <EOL> propname = '<STR_LIT>' , <EOL> seed = <NUM_LIT:0> ) <EOL> temp1 = self . geo [ '<STR_LIT>' ] . copy ( ) <EOL> self . geo . models . regenerate ( ) <EOL> temp2 = self . geo [ '<STR_LIT>' ] . copy ( ) <EOL> assert sp . all ( temp1 == temp2 ) <EOL> def test_random_with_range ( self ) : <EOL> mod = gm . throat_misc . random <EOL> self . geo . models . add ( model = mod , <EOL> propname = '<STR_LIT>' , <EOL> num_range = [ <NUM_LIT:0.1> , <NUM_LIT> ] ) <EOL> assert sp . amax ( self . geo [ '<STR_LIT>' ] ) <= <NUM_LIT> <EOL> assert sp . amin ( self . geo [ '<STR_LIT>' ] ) >= <NUM_LIT:0.1> <EOL> def test_neighbor_min ( self ) : <EOL> catch = self . geo . pop ( '<STR_LIT>' , None ) <EOL> catch = self . geo . models . pop ( '<STR_LIT>' , None ) <EOL> mod = gm . throat_misc . neighbor <EOL> self . geo [ '<STR_LIT>' ] = sp . rand ( self . net . Np , ) <EOL> self . geo . models . add ( model = mod , <EOL> propname = '<STR_LIT>' , <EOL> pore_prop = '<STR_LIT>' , <EOL> mode = '<STR_LIT>' ) <EOL> P12 = self . net [ '<STR_LIT>' ] <EOL> tseed = sp . amin ( self . geo [ '<STR_LIT>' ] [ P12 ] , axis = <NUM_LIT:1> ) <EOL> assert sp . allclose ( self . geo [ '<STR_LIT>' ] , tseed ) <EOL> def test_neighbor_max ( self ) : <EOL> catch = self . geo . pop ( '<STR_LIT>' , None ) <EOL> catch = self . geo . models . pop ( '<STR_LIT>' , None ) <EOL> mod = gm . throat_misc . neighbor <EOL> self . geo [ '<STR_LIT>' ] = sp . rand ( self . net . Np , ) <EOL> self . geo . models . add ( model = mod , <EOL> propname = '<STR_LIT>' , <EOL> pore_prop = '<STR_LIT>' , <EOL> mode = '<STR_LIT>' ) <EOL> P12 = self . net [ '<STR_LIT>' ] <EOL> tseed = sp . amax ( self . geo [ '<STR_LIT>' ] [ P12 ] , axis = <NUM_LIT:1> ) <EOL> assert sp . allclose ( self . geo [ '<STR_LIT>' ] , tseed ) <EOL> def test_neighbor_mean ( self ) : <EOL> catch = self . geo . pop ( '<STR_LIT>' , None ) <EOL> catch = self . geo . models . pop ( '<STR_LIT>' , None ) <EOL> mod = gm . throat_misc . neighbor <EOL> self . geo [ '<STR_LIT>' ] = sp . rand ( self . net . Np , ) <EOL> self . geo . models . add ( model = mod , <EOL> propname = '<STR_LIT>' , <EOL> pore_prop = '<STR_LIT>' , <EOL> mode = '<STR_LIT>' ) <EOL> P12 = self . net [ '<STR_LIT>' ] <EOL> tseed = sp . mean ( self . geo [ '<STR_LIT>' ] [ P12 ] , axis = <NUM_LIT:1> ) <EOL> assert sp . allclose ( self . geo [ '<STR_LIT>' ] , tseed ) </s>
