Example #1
0
def interlude2( view ):
    val = [ moose.getField( i, view.mooField, "double" ) * view.mooScale for i in view.mooObj ]
    
    view.mooGroup.set("color", val, view.mapper)
    view.yaw( rotation )
    if moose.element("/clock").currentTime >= runtime:
        view.stop()
Example #2
0
def interlude( view ):
    moose.start( moogliDt )
    val = [ moose.getField( i, view.mooField, "double" ) * view.mooScale for i in view.mooObj ]
    view.mooGroup.set("color", val, view.mapper)
    view.yaw( rotation )
    #print moogliDt, len( val ), runtime
    if moose.element("/clock").currentTime >= runtime:
        view.stop()
Example #3
0
 def updateValues( self ):
     ''' Obtains values from the associated cell'''
     self.val = np.array([moose.getField( i, self.field, 'double' ) for i in self.activeObjs]) * self.fieldScale
     cmap = plt.get_cmap( self.colormap )
     if self.autoscale:
         valMin = min( self.val )
         valMax = max( self.val )
     else:
         valMin = self.valMin
         valMax = self.valMax
     scaleVal = (self.val - valMin) / (valMax - valMin)
     self.rgba = [ cmap(i) for i in scaleVal ]
     self.segments.set_color( self.rgba )
     return
Example #4
0
def extract_ftype_doc(cinfo, finfotype, docio):
    """Extract field documentation for all fields of type `finfotype`
    in class `cinfo` into `docio`.

    Parameters
    ----------
    cinfo: moose.Cinfo 
	class info object in MOOSE.
    
    finfotype: str
	finfo type (valueFinfo/srcFinfo/destFinfo/lookupFinfo/sharedFinfo

    docio: StringIO
	IO object to write the documentation into
    """
    numfinfo = moose.getField(cinfo, 'num_'+finfotype, 'unsigned')
    finfo = moose.ematrix('%s/%s' % (cinfo.path, finfotype))
    data = []
    inf = float( 'Inf' )
    max_width_name = -inf
    max_width_type = -inf
    for ii in range(numfinfo):
	fid = moose.melement(finfo, 0, ii, 0)
	
	if finfotype == 'destFinfo' and (fid.name.startswith('get_') or
					 fid.name.startswith('set_')):
	    continue
	
	dtype = type_mangling_regex.sub('', fid.type)
	name = '**`{0}`**'.format( fid.name )
	dtype = '`{0}`'.format( dtype )
	doc = fid.docs
	
	data.append( [ name, dtype, doc ] )
	
	if len( name ) > max_width_name:
	    max_width_name = len( name )
	
	if len( dtype ) > max_width_type:
	    max_width_type = len( dtype )
    
    if len( data ) == 0:
	return
    
    padding = 2
    format_string = '{{0: <{width}}}'
    format_strings = (
	format_string.format( width = max_width_name + padding ),
	format_string.format( width = max_width_type + padding ),
	'{0}'
    )
    col3_alignment = format_strings[0].format('') + format_strings[1].format('')
    for row in data:
	row[2] = row[2].replace( '\n', '\n' + col3_alignment )
    
    column_headings = ( 'Field', 'Type', 'Description' )
    docio.write( '\n' )
    for ( column_heading, format_string ) in zip( column_headings, format_strings ):
	docio.write( format_string.format( column_heading ) )
    docio.write( '\n' )
    for format_string in format_strings:
	docio.write( format_string.format( '----' ) )
    docio.write( '\n' )
    
    for row in data:
	for ( field, format_string ) in zip( row, format_strings ):
	    docio.write( format_string.format( field ) )
	docio.write( '\n' )