Loading SubKit/process/Hdf5Tools.py +32 −30 Original line number Diff line number Diff line Loading @@ -53,9 +53,9 @@ class Hdf5Interface(object): for state in range(1, me.numState+1): me._stateDatasets[state] = me.h5['STATE_{:04d}'.format(state)].keys() if 'CORE/pin_numaxial' in me.h5: me.pinNumAxial = me.h5['CORE/pin_numaxial'][:] me.numPin = len(me.pinNumAxial) if me.numPin>0: me.pinNumAxial = me.h5['CORE/pin_numaxial'][:] me.pinNumSector = me.h5['CORE/pin_num_azimuthal'][:] me.pinNumRadial = me.h5['CORE/pin_numradial'][:] Loading Loading @@ -185,6 +185,8 @@ class Hdf5Interface(object): def _pinHasCouplingData(me, pin): """ Checks if the pin has coupling mesh data """ if 'mesh' not in me.h5['CORE']: return False if 'reconstruction' in me.h5['CORE/mesh/PIN_{:05d}'.format(pin)]: if 'axial_nodes' not in me.h5['CORE/mesh/PIN_{:05d}/reconstruction'.format(pin)]: return False Loading Loading @@ -267,7 +269,7 @@ class Hdf5Interface(object): """ me._pinIndexValid(pin) return me.h5['/CORE/mesh/PIN_{:05d}/axial_nodes'.format(pin)][()] return me.pinAxialNodes[0:me.pinNumAxial[pin-1], pin-1] def getChanArea(me, ch): Loading Loading @@ -579,7 +581,7 @@ class Hdf5Interface(object): me._pinIndexValid(pin) n = me.pinNumAxial[pin-1] s = me.getPinNumSector(pin) return me.h5['/STATE_{:04d}/pin_temp'][0:s, 0:n, -1, pin-1][()] return me.h5['/STATE_{:04d}/pin_temp'.format(state)][0:s, 0:n, -1, pin-1][:, :].T def getCouplingThetaBounds(me, dataset, pin): """ Returns the boundaries of the azimuthal sectors in the reconstruction mesh Loading @@ -590,9 +592,9 @@ class Hdf5Interface(object): dataset (str) : Name of the dataset in the file pin (int) : Pin index (1-based) """ me._datasetValid(dataset) me._pinIndexValid(pin) if me._pinHasCouplingData(pin): me._datasetValid(dataset) azimuthal_nodes = me.h5['/CORE/mesh/PIN_{:05d}/reconstruction/azimuthal_nodes'.format(pin)][()] # Assume the azimuthal mesh is uniform daz = azimuthal_nodes[1]-azimuthal_nodes[0] Loading @@ -612,13 +614,13 @@ class Hdf5Interface(object): dataset (str) : Name of the dataset in the file pin (int) : Pin index (1-based) """ me._datasetValid(dataset) me._pinIndexValid(pin) if me._pinHasCouplingData(pin): me._datasetValid(dataset) # Assume that each CTF level will be subdivided equally # Use the reconstruction axial mesh to figure out how many times they are divided axial_nodes = me.h5['/CORE/mesh/PIN_{:05d}/reconstruction/axial_nodes'.format(pin)][()] base_dz = me.h5['/CORE/mesh/PIN_{:05d}/axial_heights'.format(pin)][()] base_dz = me.pinAxialHeights[0:me.pinNumAxial[pin-1], pin-1] assert(len(axial_nodes)%len(base_dz)==0) numDiv = len(axial_nodes)/len(base_dz) bounds = [axial_nodes[0]] Loading Loading @@ -648,9 +650,9 @@ class Hdf5Interface(object): dataset (float) : 2D array of the data (takes level, sector) """ me._stateValid(state) me._datasetValid(dataset) me._pinIndexValid(pin) if me._pinHasCouplingData(pin): me._datasetValid(dataset) axial_nodes = me.h5['/CORE/mesh/PIN_{:05d}/reconstruction/axial_nodes'.format(pin)][()] azimuthal_nodes = me.h5['/CORE/mesh/PIN_{:05d}/reconstruction/azimuthal_nodes'.format(pin)][()] return (axial_nodes, azimuthal_nodes, me.h5['/STATE_{:04d}/{:s}'.format(state, dataset)][0:len(axial_nodes), 0:len(azimuthal_nodes), pin-1][()]) Loading Loading @@ -982,7 +984,7 @@ class Hdf5Interface(object): """ me._pinIndexValid(pin) chans = me.h5['CORE/mesh/PIN_{:05d}/chan_index'.format(pin)][()].flatten() chans = me.pinChanConnections[:, :, pin-1].flatten() return chans[chans>0] def getConnChan(me, pin, level, sector): Loading Loading @@ -1315,26 +1317,26 @@ class Hdf5Interface(object): secID = me.chanSections[chan-1] return np.sum(me.sectionHeights[0:me.sectionNumLevel[secID-1]-2, secID-1]) def _getPinStart(me, pin): """ Gets the global axial location at the bottom of the pin Pins can exist in different sections and do not necessarily start in the first section. This procedure returns the global location at the bottom of the pin assuming section 1 starts at 0.0. Args: pin (int) : Pin index (1-based) """ pinConn = me.h5['CORE/mesh/PIN_{:05d}/chan_index'.format(pin)] zStart = 0.0 for section in range(pinConn.shape[0]): if np.all(pinConn[()][section, :]==0): chans = me.getChansInSection(section+1) zStart = zStart+me.getChanHeight(chans[0]) else: break return zStart #def _getPinStart(me, pin): # """ Gets the global axial location at the bottom of the pin # Pins can exist in different sections and do not necessarily start in the first section. # This procedure returns the global location at the bottom of the pin assuming section 1 starts # at 0.0. # Args: # pin (int) : Pin index (1-based) # """ # pinConn = me.h5['CORE/mesh/PIN_{:05d}/chan_index'.format(pin)] # zStart = 0.0 # for section in range(pinConn.shape[0]): # if np.all(pinConn[()][section, :]==0): # chans = me.getChansInSection(section+1) # zStart = zStart+me.getChanHeight(chans[0]) # else: # break # return zStart def getPressure(me, chan, state=1): """ Returns the channel pressure distribution and axial mesh Loading tests/unitTests/test_Hdf5Tools.py +92 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ class test_Hdf5Tools(unittest.TestCase): def setUp(me): me.obj = Hdf5Interface(myPath+'/dummy.h5') me.trans = Hdf5Interface(myPath+'/dummy_transient.h5') me.coupling = Hdf5Interface(myPath+'/coupling.h5') def test_base(me): Loading Loading @@ -83,6 +84,12 @@ class test_Hdf5Tools(unittest.TestCase): for i in range(len(dz)): me.assertAlmostEqual(dz[i], dz_exp[i]) z = me.obj.getPinZ(1) z_exp = [0.0, 0.12499999999999999, 0.37499999999999994, 0.6249999999999999, 0.8749999999999999, 1.2499999999999998, 1.7499999999999998, 1.9999999999999998] for i, z_ in enumerate(z_exp): me.assertAlmostEqual(z_exp[i], z[i]) def test_getChanAxialMesh(me): Loading Loading @@ -280,6 +287,91 @@ class test_Hdf5Tools(unittest.TestCase): for i in range(len(ref)): me.assertAlmostEqual(data[i], ref[i]) def test_getPinSurfaceTemp(me): data = me.obj.getPinSurfaceTemp(state=2, pin=1) numAz = me.obj.getPinNumSector(pin=1) numAxial = me.obj.getPinNumLev(pin=1) ref = np.array( [[315.51547322267130, 315.28208968751680], [315.51547322267135, 315.28208968751690], [316.64265266180310, 316.23475097684934], [317.60432645421406, 317.08070670380220], [318.36675846447230, 317.81429149625370], [318.46963722566437, 317.97743452768110], [319.21910521184390, 318.92200497043860], [319.21910521184395, 318.92200497043860]]) me.assertEqual(numAxial, ref.shape[0]) me.assertEqual(numAz, ref.shape[1]) for i in range(numAxial): for j in range(numAz): me.assertAlmostEqual(data[i, j], ref[i, j]) def test_getCoupling(me): # Should return None for files with no coupling data me.assertTrue(me.obj.getCouplingThetaBounds('coupling_corrosion_thickness', 1) is None) me.assertTrue(me.obj.getCouplingAxialBounds('coupling_corrosion_thickness', 1) is None) theta, axial, data = me.obj.getCouplingDatasetAndMesh('coupling_corrosion_thickness', 2, 1) me.assertTrue(theta is None and axial is None and data is None) az = me.coupling.getCouplingThetaBounds('coupling_corrosion_thickness', pin=1) az_exp = [6./8.*2*np.pi, 7./8.*2*np.pi, 8./8.*2*np.pi] for i in range(len(az_exp)): me.assertAlmostEqual(az_exp[i], az[i]) ax = me.coupling.getCouplingAxialBounds('coupling_corrosion_thickness', pin=1) heights = me.coupling.getPinDz(pin=1) ax_exp = [0.0] for dz_base in heights: for j in range(3): ax_exp.append(ax_exp[-1]+dz_base/3) for i in range(len(ax_exp)): me.assertAlmostEqual(ax_exp[i], ax[i]) # Unlike the previous two procedures, this returns actual node center locations, which is just straight # copied from the HDF5 file. Only check first 10 levels. ax_exp = [0.0, 0.00792125, 0.013202083333333333, 0.023763749999999997, 0.03960624999999999, 0.055448749999999984, 0.07393333333333334, 0.09506, 0.11618666666666667, 0.13731166666666667] az_exp = [0.39269908169872414, 1.1780972450961724, 1.9634954084936207, 2.748893571891069, 3.5342917352885173, 4.319689898685965, 5.105088062083413, 5.890486225480862] ax, az, data = me.coupling.getCouplingDatasetAndMesh('coupling_corrosion_thickness', state=2, pin=6) # Just do a portion data_exp = np.array( [[0.8544761216493767, 0.8544761216493767, 0.8147596534690574, 0.8147596534690574, 0.8143408872851734, 0.8143408872851734, 0.8541859658270178, 0.8541859658270178], [0.8544761216493767, 0.8544761216493767, 0.8147596534690574, 0.8147596534690574, 0.8143408872851734, 0.8143408872851734, 0.8541859658270178, 0.8541859658270178], [0.8544761216493767, 0.8544761216493767, 0.8147596534690574, 0.8147596534690574, 0.8143408872851734, 0.8143408872851734, 0.8541859658270178, 0.8541859658270178], [0.8544768404236014, 0.8544768404236014, 0.8147608491260339, 0.8147608491260339, 0.8143415056364889, 0.8143415056364889, 0.8541873528737968, 0.8541873528737968], [0.8544768404236014, 0.8544768404236014, 0.8147608491260339, 0.8147608491260339, 0.8143415056364889, 0.8143415056364889, 0.8541873528737968, 0.8541873528737968], [0.8544768404236014, 0.8544768404236014, 0.8147608491260339, 0.8147608491260339, 0.8143415056364889, 0.8143415056364889, 0.8541873528737968, 0.8541873528737968], [0.8580169276316719, 0.8580169276316719, 0.8268494952119989, 0.8268494952119989, 0.8255059494940720, 0.8255059494940720, 0.8571197167198811, 0.8571197167198811], [0.8580169276316719, 0.8580169276316719, 0.8268494952119989, 0.8268494952119989, 0.8255059494940720, 0.8255059494940720, 0.8571197167198811, 0.8571197167198811], [0.8580169276316719, 0.8580169276316719, 0.8268494952119989, 0.8268494952119989, 0.8255059494940720, 0.8255059494940720, 0.8571197167198811, 0.8571197167198811], [0.8619763903212668, 0.8619763903212668, 0.8387845529458456, 0.8387845529458456, 0.8361113079762249, 0.8361113079762249, 0.8602605503868502, 0.8602605503868502]]) me.assertEqual(len(ax_exp), data_exp.shape[0]) me.assertEqual(len(az_exp), data_exp.shape[1]) for i in range(data_exp.shape[0]): me.assertAlmostEqual(ax[i], ax_exp[i]) for j in range(data_exp.shape[1]): me.assertAlmostEqual(az[j], az_exp[j]) me.assertAlmostEqual(data[i, j], data_exp[i, j]) def test_getPinAllConnChans(me): pin1_exp = [1, 2, 6, 7] pin2_exp = [8, 10] pin3_exp = [9] pin1 = me.obj.getPinAllConnChans(pin=1) pin2 = me.obj.getPinAllConnChans(pin=2) pin3 = me.obj.getPinAllConnChans(pin=3) me.assertEqual(len(pin1_exp), len(pin1)) for i in range(len(pin1_exp)): me.assertTrue(pin1[i] in pin1_exp) me.assertEqual(len(pin2_exp), len(pin2)) for i in range(len(pin2_exp)): me.assertTrue(pin2[i] in pin2_exp) me.assertEqual(len(pin3_exp), len(pin3)) for i in range(len(pin3_exp)): me.assertTrue(pin3[i] in pin3_exp) def test_getPinWithMinDNBR(me): # Pass nothing and get the global minimum Loading Loading
SubKit/process/Hdf5Tools.py +32 −30 Original line number Diff line number Diff line Loading @@ -53,9 +53,9 @@ class Hdf5Interface(object): for state in range(1, me.numState+1): me._stateDatasets[state] = me.h5['STATE_{:04d}'.format(state)].keys() if 'CORE/pin_numaxial' in me.h5: me.pinNumAxial = me.h5['CORE/pin_numaxial'][:] me.numPin = len(me.pinNumAxial) if me.numPin>0: me.pinNumAxial = me.h5['CORE/pin_numaxial'][:] me.pinNumSector = me.h5['CORE/pin_num_azimuthal'][:] me.pinNumRadial = me.h5['CORE/pin_numradial'][:] Loading Loading @@ -185,6 +185,8 @@ class Hdf5Interface(object): def _pinHasCouplingData(me, pin): """ Checks if the pin has coupling mesh data """ if 'mesh' not in me.h5['CORE']: return False if 'reconstruction' in me.h5['CORE/mesh/PIN_{:05d}'.format(pin)]: if 'axial_nodes' not in me.h5['CORE/mesh/PIN_{:05d}/reconstruction'.format(pin)]: return False Loading Loading @@ -267,7 +269,7 @@ class Hdf5Interface(object): """ me._pinIndexValid(pin) return me.h5['/CORE/mesh/PIN_{:05d}/axial_nodes'.format(pin)][()] return me.pinAxialNodes[0:me.pinNumAxial[pin-1], pin-1] def getChanArea(me, ch): Loading Loading @@ -579,7 +581,7 @@ class Hdf5Interface(object): me._pinIndexValid(pin) n = me.pinNumAxial[pin-1] s = me.getPinNumSector(pin) return me.h5['/STATE_{:04d}/pin_temp'][0:s, 0:n, -1, pin-1][()] return me.h5['/STATE_{:04d}/pin_temp'.format(state)][0:s, 0:n, -1, pin-1][:, :].T def getCouplingThetaBounds(me, dataset, pin): """ Returns the boundaries of the azimuthal sectors in the reconstruction mesh Loading @@ -590,9 +592,9 @@ class Hdf5Interface(object): dataset (str) : Name of the dataset in the file pin (int) : Pin index (1-based) """ me._datasetValid(dataset) me._pinIndexValid(pin) if me._pinHasCouplingData(pin): me._datasetValid(dataset) azimuthal_nodes = me.h5['/CORE/mesh/PIN_{:05d}/reconstruction/azimuthal_nodes'.format(pin)][()] # Assume the azimuthal mesh is uniform daz = azimuthal_nodes[1]-azimuthal_nodes[0] Loading @@ -612,13 +614,13 @@ class Hdf5Interface(object): dataset (str) : Name of the dataset in the file pin (int) : Pin index (1-based) """ me._datasetValid(dataset) me._pinIndexValid(pin) if me._pinHasCouplingData(pin): me._datasetValid(dataset) # Assume that each CTF level will be subdivided equally # Use the reconstruction axial mesh to figure out how many times they are divided axial_nodes = me.h5['/CORE/mesh/PIN_{:05d}/reconstruction/axial_nodes'.format(pin)][()] base_dz = me.h5['/CORE/mesh/PIN_{:05d}/axial_heights'.format(pin)][()] base_dz = me.pinAxialHeights[0:me.pinNumAxial[pin-1], pin-1] assert(len(axial_nodes)%len(base_dz)==0) numDiv = len(axial_nodes)/len(base_dz) bounds = [axial_nodes[0]] Loading Loading @@ -648,9 +650,9 @@ class Hdf5Interface(object): dataset (float) : 2D array of the data (takes level, sector) """ me._stateValid(state) me._datasetValid(dataset) me._pinIndexValid(pin) if me._pinHasCouplingData(pin): me._datasetValid(dataset) axial_nodes = me.h5['/CORE/mesh/PIN_{:05d}/reconstruction/axial_nodes'.format(pin)][()] azimuthal_nodes = me.h5['/CORE/mesh/PIN_{:05d}/reconstruction/azimuthal_nodes'.format(pin)][()] return (axial_nodes, azimuthal_nodes, me.h5['/STATE_{:04d}/{:s}'.format(state, dataset)][0:len(axial_nodes), 0:len(azimuthal_nodes), pin-1][()]) Loading Loading @@ -982,7 +984,7 @@ class Hdf5Interface(object): """ me._pinIndexValid(pin) chans = me.h5['CORE/mesh/PIN_{:05d}/chan_index'.format(pin)][()].flatten() chans = me.pinChanConnections[:, :, pin-1].flatten() return chans[chans>0] def getConnChan(me, pin, level, sector): Loading Loading @@ -1315,26 +1317,26 @@ class Hdf5Interface(object): secID = me.chanSections[chan-1] return np.sum(me.sectionHeights[0:me.sectionNumLevel[secID-1]-2, secID-1]) def _getPinStart(me, pin): """ Gets the global axial location at the bottom of the pin Pins can exist in different sections and do not necessarily start in the first section. This procedure returns the global location at the bottom of the pin assuming section 1 starts at 0.0. Args: pin (int) : Pin index (1-based) """ pinConn = me.h5['CORE/mesh/PIN_{:05d}/chan_index'.format(pin)] zStart = 0.0 for section in range(pinConn.shape[0]): if np.all(pinConn[()][section, :]==0): chans = me.getChansInSection(section+1) zStart = zStart+me.getChanHeight(chans[0]) else: break return zStart #def _getPinStart(me, pin): # """ Gets the global axial location at the bottom of the pin # Pins can exist in different sections and do not necessarily start in the first section. # This procedure returns the global location at the bottom of the pin assuming section 1 starts # at 0.0. # Args: # pin (int) : Pin index (1-based) # """ # pinConn = me.h5['CORE/mesh/PIN_{:05d}/chan_index'.format(pin)] # zStart = 0.0 # for section in range(pinConn.shape[0]): # if np.all(pinConn[()][section, :]==0): # chans = me.getChansInSection(section+1) # zStart = zStart+me.getChanHeight(chans[0]) # else: # break # return zStart def getPressure(me, chan, state=1): """ Returns the channel pressure distribution and axial mesh Loading
tests/unitTests/test_Hdf5Tools.py +92 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ class test_Hdf5Tools(unittest.TestCase): def setUp(me): me.obj = Hdf5Interface(myPath+'/dummy.h5') me.trans = Hdf5Interface(myPath+'/dummy_transient.h5') me.coupling = Hdf5Interface(myPath+'/coupling.h5') def test_base(me): Loading Loading @@ -83,6 +84,12 @@ class test_Hdf5Tools(unittest.TestCase): for i in range(len(dz)): me.assertAlmostEqual(dz[i], dz_exp[i]) z = me.obj.getPinZ(1) z_exp = [0.0, 0.12499999999999999, 0.37499999999999994, 0.6249999999999999, 0.8749999999999999, 1.2499999999999998, 1.7499999999999998, 1.9999999999999998] for i, z_ in enumerate(z_exp): me.assertAlmostEqual(z_exp[i], z[i]) def test_getChanAxialMesh(me): Loading Loading @@ -280,6 +287,91 @@ class test_Hdf5Tools(unittest.TestCase): for i in range(len(ref)): me.assertAlmostEqual(data[i], ref[i]) def test_getPinSurfaceTemp(me): data = me.obj.getPinSurfaceTemp(state=2, pin=1) numAz = me.obj.getPinNumSector(pin=1) numAxial = me.obj.getPinNumLev(pin=1) ref = np.array( [[315.51547322267130, 315.28208968751680], [315.51547322267135, 315.28208968751690], [316.64265266180310, 316.23475097684934], [317.60432645421406, 317.08070670380220], [318.36675846447230, 317.81429149625370], [318.46963722566437, 317.97743452768110], [319.21910521184390, 318.92200497043860], [319.21910521184395, 318.92200497043860]]) me.assertEqual(numAxial, ref.shape[0]) me.assertEqual(numAz, ref.shape[1]) for i in range(numAxial): for j in range(numAz): me.assertAlmostEqual(data[i, j], ref[i, j]) def test_getCoupling(me): # Should return None for files with no coupling data me.assertTrue(me.obj.getCouplingThetaBounds('coupling_corrosion_thickness', 1) is None) me.assertTrue(me.obj.getCouplingAxialBounds('coupling_corrosion_thickness', 1) is None) theta, axial, data = me.obj.getCouplingDatasetAndMesh('coupling_corrosion_thickness', 2, 1) me.assertTrue(theta is None and axial is None and data is None) az = me.coupling.getCouplingThetaBounds('coupling_corrosion_thickness', pin=1) az_exp = [6./8.*2*np.pi, 7./8.*2*np.pi, 8./8.*2*np.pi] for i in range(len(az_exp)): me.assertAlmostEqual(az_exp[i], az[i]) ax = me.coupling.getCouplingAxialBounds('coupling_corrosion_thickness', pin=1) heights = me.coupling.getPinDz(pin=1) ax_exp = [0.0] for dz_base in heights: for j in range(3): ax_exp.append(ax_exp[-1]+dz_base/3) for i in range(len(ax_exp)): me.assertAlmostEqual(ax_exp[i], ax[i]) # Unlike the previous two procedures, this returns actual node center locations, which is just straight # copied from the HDF5 file. Only check first 10 levels. ax_exp = [0.0, 0.00792125, 0.013202083333333333, 0.023763749999999997, 0.03960624999999999, 0.055448749999999984, 0.07393333333333334, 0.09506, 0.11618666666666667, 0.13731166666666667] az_exp = [0.39269908169872414, 1.1780972450961724, 1.9634954084936207, 2.748893571891069, 3.5342917352885173, 4.319689898685965, 5.105088062083413, 5.890486225480862] ax, az, data = me.coupling.getCouplingDatasetAndMesh('coupling_corrosion_thickness', state=2, pin=6) # Just do a portion data_exp = np.array( [[0.8544761216493767, 0.8544761216493767, 0.8147596534690574, 0.8147596534690574, 0.8143408872851734, 0.8143408872851734, 0.8541859658270178, 0.8541859658270178], [0.8544761216493767, 0.8544761216493767, 0.8147596534690574, 0.8147596534690574, 0.8143408872851734, 0.8143408872851734, 0.8541859658270178, 0.8541859658270178], [0.8544761216493767, 0.8544761216493767, 0.8147596534690574, 0.8147596534690574, 0.8143408872851734, 0.8143408872851734, 0.8541859658270178, 0.8541859658270178], [0.8544768404236014, 0.8544768404236014, 0.8147608491260339, 0.8147608491260339, 0.8143415056364889, 0.8143415056364889, 0.8541873528737968, 0.8541873528737968], [0.8544768404236014, 0.8544768404236014, 0.8147608491260339, 0.8147608491260339, 0.8143415056364889, 0.8143415056364889, 0.8541873528737968, 0.8541873528737968], [0.8544768404236014, 0.8544768404236014, 0.8147608491260339, 0.8147608491260339, 0.8143415056364889, 0.8143415056364889, 0.8541873528737968, 0.8541873528737968], [0.8580169276316719, 0.8580169276316719, 0.8268494952119989, 0.8268494952119989, 0.8255059494940720, 0.8255059494940720, 0.8571197167198811, 0.8571197167198811], [0.8580169276316719, 0.8580169276316719, 0.8268494952119989, 0.8268494952119989, 0.8255059494940720, 0.8255059494940720, 0.8571197167198811, 0.8571197167198811], [0.8580169276316719, 0.8580169276316719, 0.8268494952119989, 0.8268494952119989, 0.8255059494940720, 0.8255059494940720, 0.8571197167198811, 0.8571197167198811], [0.8619763903212668, 0.8619763903212668, 0.8387845529458456, 0.8387845529458456, 0.8361113079762249, 0.8361113079762249, 0.8602605503868502, 0.8602605503868502]]) me.assertEqual(len(ax_exp), data_exp.shape[0]) me.assertEqual(len(az_exp), data_exp.shape[1]) for i in range(data_exp.shape[0]): me.assertAlmostEqual(ax[i], ax_exp[i]) for j in range(data_exp.shape[1]): me.assertAlmostEqual(az[j], az_exp[j]) me.assertAlmostEqual(data[i, j], data_exp[i, j]) def test_getPinAllConnChans(me): pin1_exp = [1, 2, 6, 7] pin2_exp = [8, 10] pin3_exp = [9] pin1 = me.obj.getPinAllConnChans(pin=1) pin2 = me.obj.getPinAllConnChans(pin=2) pin3 = me.obj.getPinAllConnChans(pin=3) me.assertEqual(len(pin1_exp), len(pin1)) for i in range(len(pin1_exp)): me.assertTrue(pin1[i] in pin1_exp) me.assertEqual(len(pin2_exp), len(pin2)) for i in range(len(pin2_exp)): me.assertTrue(pin2[i] in pin2_exp) me.assertEqual(len(pin3_exp), len(pin3)) for i in range(len(pin3_exp)): me.assertTrue(pin3[i] in pin3_exp) def test_getPinWithMinDNBR(me): # Pass nothing and get the global minimum Loading