Coverage for m_pool\axis_pool.py : 51%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
'''No Matter What, return an Axis obj''' return Axis( axOrD ) # make an axis from a dictionary
return Axis() # a default Axis
'''An AxisPool object is a Collection of Axis objects. It is used to define a collection of Matrix objects
*** Structured to easily pickle via a dictionary of named values for properties. *** '''
'''Initialize with a dictionary so that pickle files can easily save and read objects'''
self.axisL = [axis_obj_dammit(axOrD) for axOrD in axesDefL] else:
# uses self.axisD to get an Axis object by name
# use axisD to get an Axis object by name
'''Be sure that axisNameL is the correct order for the axes'''
A = self.axisD[ axisName ] i = A.add_value( val ) return i
sL = ['AxisPool'] for A in self.axisL: sL.append( str(A) ) return '\n'.join( sL )
return len( self.axisL )
for value in self.axisL: yield value
return self.axisD.get( axisName, None)
epsAxis = Axis({'name':'eps', 'valueL':[10., 20., 30., 40., 50.], 'units':'', 'transform':'log10'})
# Just a dict, not an Axis obj pcAxis = {'name':'pc', 'valueL':[100.,200.,300,400], 'units':'psia', 'transform':'log10'}
mrAxis = Axis({'name':'mr', 'valueL':[1,2,3], 'units':'', 'transform':''})
axesDefL = [epsAxis, pcAxis]
AP = AxisPool( {'axesDefL':axesDefL} )
print(AP) #print AP.axisD print('_'*20,'Add another axis called "mr"','_'*20) AP.add_axis( mrAxis ) print(AP) print('_'*20,'Add value 2.5 to axis "mr"','_'*20) i =AP.add_value_to_Axis( 'mr', 2.5 ) print('Added 2.5 at position',i,'in "mr"') print(AP) |