<s> import core . modules <EOL> import core . modules . module_registry <EOL> from core . modules . vistrails_module import Module , ModuleError <EOL> from core . modules . basic_modules import PythonSource <EOL> from Array import * <EOL> from Matrix import * <EOL> import pylab <EOL> import matplotlib <EOL> import urllib <EOL> import random <EOL> class ArrayPlot ( object ) : <EOL> namespace = '<STR_LIT>' <EOL> def get_label ( self , ar , i ) : <EOL> lab = ar . get_name ( i ) <EOL> if lab == None : <EOL> return '<STR_LIT>' + str ( i ) <EOL> else : <EOL> return lab <EOL> def is_cacheable ( self ) : <EOL> return False <EOL> def get_color ( self , colors , i , randomcolor ) : <EOL> if randomcolor : <EOL> return ( random . random ( ) , random . random ( ) , random . random ( ) ) <EOL> if self . color_dict == None : <EOL> self . color_dict = { } <EOL> for ( k , r , g , b ) in colors : <EOL> self . color_dict [ k ] = ( r , g , b ) <EOL> if self . color_dict . has_key ( i ) : <EOL> return self . color_dict [ i ] <EOL> else : <EOL> return None <EOL> def get_marker ( self , markers , i ) : <EOL> if markers == None : <EOL> return None <EOL> if self . marker_dict == None : <EOL> self . marker_dict = { } <EOL> for ( k , m ) in markers : <EOL> self . marker_dict [ k ] = m <EOL> if self . marker_dict . has_key ( i ) : <EOL> return self . marker_dict [ i ] <EOL> else : <EOL> return None <EOL> def get_alpha ( self , alphas , i ) : <EOL> return None <EOL> class ArrayImage ( ArrayPlot , Module ) : <EOL> '''<STR_LIT>''' <EOL> def compute ( self ) : <EOL> data = self . get_input ( "<STR_LIT>" ) <EOL> da_ar = data . get_array ( ) . squeeze ( ) <EOL> if da_ar . ndim != <NUM_LIT:2> : <EOL> raise ModuleError ( "<STR_LIT>" ) <EOL> aspect_ratio = self . force_get_input ( "<STR_LIT>" ) <EOL> colormap = self . force_get_input ( "<STR_LIT>" ) <EOL> colorbar = self . force_get_input ( "<STR_LIT>" ) <EOL> extents = self . force_get_input ( "<STR_LIT>" ) <EOL> if colormap == None : <EOL> colormap = "<STR_LIT>" <EOL> if not hasattr ( pylab , colormap ) : <EOL> colormap = "<STR_LIT>" <EOL> bg_color = self . force_get_input ( "<STR_LIT>" ) <EOL> array_x_t = self . force_get_input ( "<STR_LIT>" ) <EOL> array_y_t = self . force_get_input ( "<STR_LIT>" ) <EOL> p_title = self . force_get_input ( "<STR_LIT>" ) <EOL> x_label = self . force_get_input ( "<STR_LIT>" ) <EOL> y_label = self . force_get_input ( "<STR_LIT>" ) <EOL> s = urllib . unquote ( str ( self . force_get_input ( "<STR_LIT:source>" , '<STR_LIT>' ) ) ) <EOL> s = '<STR_LIT>' + '<STR_LIT>' + '<STR_LIT>' <EOL> if bg_color == None : <EOL> bg_color = '<STR_LIT:w>' <EOL> if type ( bg_color ) == type ( '<STR_LIT>' ) : <EOL> s += '<STR_LIT>' + bg_color + '<STR_LIT>' <EOL> else : <EOL> s += '<STR_LIT>' + str ( bg_color ) + '<STR_LIT>' <EOL> s += '<STR_LIT>' <EOL> if aspect_ratio != None : <EOL> s += '<STR_LIT>' + str ( aspect_ratio ) <EOL> if extents != None : <EOL> s += '<STR_LIT>' + str ( extents [ <NUM_LIT:0> ] ) + '<STR_LIT:U+002C>' + str ( extents [ <NUM_LIT:1> ] ) + '<STR_LIT:U+002C>' + str ( extents [ <NUM_LIT:2> ] ) + '<STR_LIT:U+002C>' + str ( extents [ <NUM_LIT:3> ] ) + '<STR_LIT:]>' <EOL> s += '<STR_LIT>' <EOL> s += colormap + '<STR_LIT>' <EOL> if colorbar : <EOL> s += '<STR_LIT>' <EOL> if array_x_t : <EOL> s += '<STR_LIT>' + data . get_domain_name ( ) + '<STR_LIT>' <EOL> elif x_label : <EOL> s += '<STR_LIT>' + x_label + '<STR_LIT>' <EOL> if array_y_t : <EOL> s += '<STR_LIT>' + data . get_range_name ( ) + '<STR_LIT>' <EOL> elif y_label : <EOL> s += '<STR_LIT>' + y_label + '<STR_LIT>' <EOL> if p_title : <EOL> s += '<STR_LIT>' + p_title + '<STR_LIT>' <EOL> exec s <EOL> self . set_output ( '<STR_LIT:source>' , s ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , namespace = cls . namespace ) <EOL> @ classmethod <EOL> def register_ports ( cls , reg , basic ) : <EOL> reg . add_input_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( NDArray , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Float , basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_output_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) ) <EOL> class Histogram ( ArrayPlot , Module ) : <EOL> '''<STR_LIT>''' <EOL> def compute ( self ) : <EOL> data = self . get_input_list ( "<STR_LIT>" ) <EOL> self . label_dict = None <EOL> self . color_dict = None <EOL> use_legend = self . force_get_input ( "<STR_LIT>" ) <EOL> randomcolors = self . force_get_input ( "<STR_LIT>" ) <EOL> colors = self . force_get_input_list ( "<STR_LIT>" ) <EOL> bg_color = self . force_get_input ( "<STR_LIT>" ) <EOL> array_x_t = self . force_get_input ( "<STR_LIT>" ) <EOL> array_y_t = self . force_get_input ( "<STR_LIT>" ) <EOL> p_title = self . force_get_input ( "<STR_LIT>" ) <EOL> x_label = self . force_get_input ( "<STR_LIT>" ) <EOL> nbins = self . force_get_input ( "<STR_LIT>" ) <EOL> if nbins == None : <EOL> nbins = <NUM_LIT:10> <EOL> normed = self . force_get_input ( "<STR_LIT>" ) <EOL> if normed == None : <EOL> normed = False <EOL> s = urllib . unquote ( str ( self . force_get_input ( "<STR_LIT:source>" , '<STR_LIT>' ) ) ) <EOL> self . source = '<STR_LIT>' <EOL> s = '<STR_LIT>' + '<STR_LIT>' + '<STR_LIT>' <EOL> if bg_color == None : <EOL> bg_color = '<STR_LIT:w>' <EOL> if type ( bg_color ) == type ( '<STR_LIT>' ) : <EOL> s += '<STR_LIT>' + bg_color + '<STR_LIT>' <EOL> else : <EOL> s += '<STR_LIT>' + str ( bg_color ) + '<STR_LIT>' <EOL> data_list = [ ] <EOL> for i in data : <EOL> data_list . append ( i . get_array ( ) . squeeze ( ) ) <EOL> da_ar = None <EOL> try : <EOL> da_ar = numpy . array ( data_list ) <EOL> except : <EOL> raise ModuleException ( "<STR_LIT>" ) <EOL> for i in range ( da_ar . shape [ <NUM_LIT:0> ] ) : <EOL> lab = self . get_label ( data [ i ] , i ) <EOL> col = self . get_color ( colors , i , randomcolors ) <EOL> s += '<STR_LIT>' + str ( i ) + '<STR_LIT>' + str ( nbins ) <EOL> if lab != None : <EOL> s += '<STR_LIT>' + lab + '<STR_LIT>' <EOL> if col != None : <EOL> s += '<STR_LIT>' + str ( col ) <EOL> s += '<STR_LIT>' + str ( normed ) <EOL> s += '<STR_LIT>' <EOL> if use_legend : <EOL> s += '<STR_LIT>' <EOL> if array_x_t : <EOL> s += '<STR_LIT>' + data [ <NUM_LIT:0> ] . get_domain_name ( ) + '<STR_LIT>' <EOL> elif x_label : <EOL> s += '<STR_LIT>' + x_label + '<STR_LIT>' <EOL> if array_y_t : <EOL> s += '<STR_LIT>' <EOL> if p_title : <EOL> s += '<STR_LIT>' + p_title + '<STR_LIT>' <EOL> exec s <EOL> self . set_output ( "<STR_LIT:source>" , s ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , namespace = cls . namespace ) <EOL> @ classmethod <EOL> def register_ports ( cls , reg , basic ) : <EOL> reg . add_input_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( NDArray , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Integer , basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Integer , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_output_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) ) <EOL> class BarChart ( ArrayPlot , Module ) : <EOL> '''<STR_LIT>''' <EOL> def get_ticks ( self , num ) : <EOL> a = [ ] <EOL> for i in range ( num ) : <EOL> a . append ( '<STR_LIT>' ) <EOL> for i in self . tick_dict . keys ( ) : <EOL> a [ i ] = self . tick_dict [ i ] <EOL> return a <EOL> def compute ( self ) : <EOL> data = self . get_input_list ( "<STR_LIT>" ) <EOL> errs = self . force_get_input_list ( "<STR_LIT>" ) <EOL> if len ( errs ) == <NUM_LIT:0> : <EOL> errs = None <EOL> self . label_dict = None <EOL> self . color_dict = None <EOL> use_legend = self . force_get_input ( "<STR_LIT>" ) <EOL> randomcolors = self . force_get_input ( "<STR_LIT>" ) <EOL> colors = self . force_get_input_list ( "<STR_LIT>" ) <EOL> bg_color = self . force_get_input ( "<STR_LIT>" ) <EOL> array_x_t = self . force_get_input ( "<STR_LIT>" ) <EOL> array_y_t = self . force_get_input ( "<STR_LIT>" ) <EOL> ticks = self . force_get_input_list ( "<STR_LIT>" ) <EOL> self . tick_dict = { } <EOL> for ( k , v ) in ticks : <EOL> self . tick_dict [ k ] = v <EOL> p_title = self . force_get_input ( "<STR_LIT>" ) <EOL> x_label = self . force_get_input ( "<STR_LIT>" ) <EOL> y_label = self . force_get_input ( "<STR_LIT>" ) <EOL> width = self . force_get_input ( "<STR_LIT>" ) <EOL> if width == None : <EOL> width = <NUM_LIT:0.5> <EOL> if errs != None : <EOL> if len ( data ) != len ( errs ) : <EOL> raise ModuleError ( "<STR_LIT>" ) <EOL> s = urllib . unquote ( str ( self . force_get_input ( "<STR_LIT:source>" , '<STR_LIT>' ) ) ) <EOL> self . source = '<STR_LIT>' <EOL> s = '<STR_LIT>' + '<STR_LIT>' + '<STR_LIT>' <EOL> if bg_color == None : <EOL> bg_color = '<STR_LIT:w>' <EOL> if type ( bg_color ) == type ( '<STR_LIT>' ) : <EOL> s += '<STR_LIT>' + bg_color + '<STR_LIT>' <EOL> else : <EOL> s += '<STR_LIT>' + str ( bg_color ) + '<STR_LIT>' <EOL> numpts = None <EOL> ind = None <EOL> prev = None <EOL> ind = numpy . arange ( data [ <NUM_LIT:0> ] . get_array ( ) . flatten ( ) . shape [ <NUM_LIT:0> ] ) <EOL> t = self . get_ticks ( data [ <NUM_LIT:0> ] . get_array ( ) . flatten ( ) . shape [ <NUM_LIT:0> ] ) <EOL> ag_ar = numpy . zeros ( ( len ( data ) , data [ <NUM_LIT:0> ] . get_array ( ) . flatten ( ) . shape [ <NUM_LIT:0> ] ) ) <EOL> for i in range ( len ( data ) ) : <EOL> da_ar = data [ i ] . get_array ( ) . flatten ( ) <EOL> ag_ar [ i , : ] = da_ar <EOL> er_ar = numpy . zeros ( ( len ( data ) , data [ <NUM_LIT:0> ] . get_array ( ) . flatten ( ) . shape [ <NUM_LIT:0> ] ) ) <EOL> if errs != None : <EOL> for i in range ( len ( data ) ) : <EOL> er_ar [ i , : ] = errs [ i ] . get_array ( ) . flatten ( ) <EOL> for i in range ( ag_ar . shape [ <NUM_LIT:0> ] ) : <EOL> s += '<STR_LIT>' + str ( i ) + '<STR_LIT>' <EOL> lab = self . get_label ( data [ i ] , i ) <EOL> col = self . get_color ( colors , i , randomcolors ) <EOL> if lab != None : <EOL> s += '<STR_LIT>' + lab + '<STR_LIT>' <EOL> if col != None : <EOL> s += '<STR_LIT>' + str ( col ) <EOL> if errs != None : <EOL> s += '<STR_LIT>' + str ( i ) + '<STR_LIT>' <EOL> if prev != None : <EOL> s += '<STR_LIT>' + str ( i - <NUM_LIT:1> ) + '<STR_LIT>' <EOL> s += '<STR_LIT>' <EOL> prev = ag_ar [ i ] <EOL> if use_legend : <EOL> s += '<STR_LIT>' <EOL> if array_x_t : <EOL> s += '<STR_LIT>' + data [ <NUM_LIT:0> ] . get_domain_name ( ) + '<STR_LIT>' <EOL> elif x_label : <EOL> s += '<STR_LIT>' + x_label + '<STR_LIT>' <EOL> if array_y_t : <EOL> s += '<STR_LIT>' + data [ <NUM_LIT:0> ] . get_range_name ( ) + '<STR_LIT>' <EOL> elif y_label : <EOL> s += '<STR_LIT>' + y_label + '<STR_LIT>' <EOL> if p_title : <EOL> s += '<STR_LIT>' + p_title + '<STR_LIT>' <EOL> s += '<STR_LIT>' <EOL> exec s <EOL> self . set_output ( "<STR_LIT:source>" , s ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , namespace = cls . namespace ) <EOL> @ classmethod <EOL> def register_ports ( cls , reg , basic ) : <EOL> reg . add_input_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( NDArray , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( NDArray , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Integer , basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Integer , basic . String ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) , True ) <EOL> reg . add_output_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) ) <EOL> class ScatterPlot ( ArrayPlot , Module ) : <EOL> '''<STR_LIT>''' <EOL> def compute ( self ) : <EOL> xdata = self . get_input_list ( "<STR_LIT>" ) <EOL> ydata = self . get_input_list ( "<STR_LIT>" ) <EOL> self . label_dict = None <EOL> use_legend = self . force_get_input ( "<STR_LIT>" ) <EOL> randomcolors = self . force_get_input ( "<STR_LIT>" ) <EOL> colors = self . force_get_input_list ( "<STR_LIT>" ) <EOL> self . color_dict = None <EOL> bg_color = self . force_get_input ( "<STR_LIT>" ) <EOL> markers = self . force_get_input_list ( "<STR_LIT>" ) <EOL> self . marker_dict = None <EOL> ps = self . force_get_input ( "<STR_LIT>" ) <EOL> array_x_t = self . force_get_input ( "<STR_LIT>" ) <EOL> array_y_t = self . force_get_input ( "<STR_LIT>" ) <EOL> p_title = self . force_get_input ( "<STR_LIT>" ) <EOL> x_label = self . force_get_input ( "<STR_LIT>" ) <EOL> y_label = self . force_get_input ( "<STR_LIT>" ) <EOL> s = urllib . unquote ( str ( self . force_get_input ( "<STR_LIT:source>" , '<STR_LIT>' ) ) ) <EOL> self . source = '<STR_LIT>' <EOL> if len ( xdata ) != len ( ydata ) : <EOL> raise ModuleError ( "<STR_LIT>" ) <EOL> s = '<STR_LIT>' + '<STR_LIT>' + '<STR_LIT>' <EOL> if bg_color == None : <EOL> bg_color = '<STR_LIT:w>' <EOL> if type ( bg_color ) == type ( '<STR_LIT>' ) : <EOL> s += '<STR_LIT>' + bg_color + '<STR_LIT>' <EOL> else : <EOL> s += '<STR_LIT>' + str ( bg_color ) + '<STR_LIT>' <EOL> xdata_ar = numpy . zeros ( ( len ( xdata ) , xdata [ <NUM_LIT:0> ] . get_array ( ) . flatten ( ) . shape [ <NUM_LIT:0> ] ) ) <EOL> ydata_ar = numpy . zeros ( ( len ( xdata ) , xdata [ <NUM_LIT:0> ] . get_array ( ) . flatten ( ) . shape [ <NUM_LIT:0> ] ) ) <EOL> for i in range ( len ( xdata ) ) : <EOL> xd = xdata [ i ] <EOL> yd = ydata [ i ] <EOL> xdata_ar [ i , : ] = xd . get_array ( ) . flatten ( ) <EOL> ydata_ar [ i , : ] = yd . get_array ( ) . flatten ( ) <EOL> for i in range ( len ( xdata ) ) : <EOL> xar = xdata [ i ] <EOL> yar = ydata [ i ] <EOL> lab = self . get_label ( xar , i ) <EOL> col = self . get_color ( colors , i , randomcolors ) <EOL> mar = self . get_marker ( markers , i ) <EOL> s += '<STR_LIT>' + str ( i ) + '<STR_LIT>' + str ( i ) + '<STR_LIT>' <EOL> if lab != None : <EOL> s += '<STR_LIT>' + lab + '<STR_LIT>' <EOL> if col != None : <EOL> s += '<STR_LIT>' + str ( col ) <EOL> if mar != None : <EOL> s += '<STR_LIT>' + mar + '<STR_LIT>' <EOL> if ps != None : <EOL> s += '<STR_LIT>' + str ( ps ) <EOL> s += '<STR_LIT>' <EOL> if use_legend : <EOL> s += '<STR_LIT>' <EOL> if array_x_t : <EOL> s += '<STR_LIT>' + xar . get_domain_name ( ) + '<STR_LIT>' <EOL> elif x_label : <EOL> s += '<STR_LIT>' + x_label + '<STR_LIT>' <EOL> if array_y_t : <EOL> s += '<STR_LIT>' + yar . get_domain_name ( ) + '<STR_LIT>' <EOL> elif y_label : <EOL> s += '<STR_LIT>' + y_label + '<STR_LIT>' <EOL> if p_title : <EOL> s += '<STR_LIT>' + p_title + '<STR_LIT>' <EOL> print s <EOL> exec s <EOL> self . set_output ( "<STR_LIT:source>" , s ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , namespace = cls . namespace ) <EOL> @ classmethod <EOL> def register_ports ( cls , reg , basic ) : <EOL> reg . add_input_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( NDArray , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( NDArray , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Integer , basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Integer , basic . String ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) , True ) <EOL> reg . add_output_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) ) <EOL> class LinePlot ( ArrayPlot , Module ) : <EOL> '''<STR_LIT>''' <EOL> def compute ( self ) : <EOL> data = self . get_input ( "<STR_LIT>" ) <EOL> indexes = self . force_get_input ( "<STR_LIT>" ) <EOL> self . label_dict = None <EOL> use_legend = self . force_get_input ( "<STR_LIT>" ) <EOL> randomcolors = self . force_get_input ( "<STR_LIT>" ) <EOL> colors = self . force_get_input_list ( "<STR_LIT>" ) <EOL> self . color_dict = None <EOL> markers = self . force_get_input_list ( "<STR_LIT>" ) <EOL> self . marker_dict = None <EOL> x_label = self . force_get_input ( "<STR_LIT>" ) <EOL> y_label = self . force_get_input ( "<STR_LIT>" ) <EOL> p_title = self . force_get_input ( "<STR_LIT>" ) <EOL> bg_color = self . force_get_input ( "<STR_LIT>" ) <EOL> array_x_t = self . force_get_input ( "<STR_LIT>" ) <EOL> array_y_t = self . force_get_input ( "<STR_LIT>" ) <EOL> s = urllib . unquote ( str ( self . force_get_input ( "<STR_LIT:source>" , '<STR_LIT>' ) ) ) <EOL> self . source = '<STR_LIT>' <EOL> da_ar = data . get_array ( ) <EOL> if da_ar . ndim > <NUM_LIT:2> : <EOL> raise ModuleError ( "<STR_LIT>" ) <EOL> s = '<STR_LIT>' + '<STR_LIT>' + '<STR_LIT>' <EOL> if bg_color == None : <EOL> bg_color = '<STR_LIT:w>' <EOL> if type ( bg_color ) == type ( '<STR_LIT>' ) : <EOL> s += '<STR_LIT>' + bg_color + '<STR_LIT>' <EOL> else : <EOL> s += '<STR_LIT>' + str ( bg_color ) + '<STR_LIT>' <EOL> if da_ar . ndim == <NUM_LIT:1> : <EOL> da_ar . shape = ( <NUM_LIT:1> , da_ar . shape [ <NUM_LIT:0> ] ) <EOL> xar = self . force_get_input ( "<STR_LIT>" ) <EOL> sf = self . force_get_input ( "<STR_LIT>" ) <EOL> if sf == None : <EOL> sf = <NUM_LIT:1.> <EOL> if xar == None : <EOL> start_i = None <EOL> end_i = None <EOL> if indexes == None : <EOL> start_i = <NUM_LIT:0> <EOL> end_i = da_ar . shape [ <NUM_LIT:1> ] <EOL> else : <EOL> start_i = indexes [ <NUM_LIT:0> ] <EOL> end_i = indexes [ <NUM_LIT:1> ] <EOL> xar = numpy . arange ( start_i , end_i ) <EOL> xar = xar * sf <EOL> else : <EOL> xar = xar . get_array ( ) <EOL> print da_ar . shape <EOL> print xar . shape <EOL> for i in range ( da_ar . shape [ <NUM_LIT:0> ] ) : <EOL> lab = self . get_label ( data , i ) <EOL> col = self . get_color ( colors , i , randomcolors ) <EOL> mar = self . get_marker ( markers , i ) <EOL> if indexes == None : <EOL> s += '<STR_LIT>' + str ( i ) + '<STR_LIT>' <EOL> else : <EOL> s += '<STR_LIT>' + str ( i ) + '<STR_LIT:U+002C>' + str ( indexes [ <NUM_LIT:0> ] ) + '<STR_LIT::>' + str ( indexes [ <NUM_LIT:1> ] ) + '<STR_LIT:]>' <EOL> if lab != None : <EOL> s += '<STR_LIT>' + lab + '<STR_LIT>' <EOL> if col != None : <EOL> s += '<STR_LIT>' + str ( col ) <EOL> if mar != None : <EOL> s += '<STR_LIT>' + mar + '<STR_LIT>' <EOL> s += '<STR_LIT>' <EOL> if use_legend : <EOL> s += '<STR_LIT>' <EOL> if array_x_t : <EOL> s += '<STR_LIT>' + data . get_domain_name ( ) + '<STR_LIT>' <EOL> elif x_label : <EOL> s += '<STR_LIT>' + x_label + '<STR_LIT>' <EOL> if array_y_t : <EOL> s += '<STR_LIT>' + data . get_range_name ( ) + '<STR_LIT>' <EOL> elif y_label : <EOL> s += '<STR_LIT>' + y_label + '<STR_LIT>' <EOL> if p_title : <EOL> s += '<STR_LIT>' + p_title + '<STR_LIT>' <EOL> exec s <EOL> self . set_output ( "<STR_LIT:source>" , s ) <EOL> @ classmethod <EOL> def register ( cls , reg , basic ) : <EOL> reg . add_module ( cls , namespace = cls . namespace ) <EOL> @ classmethod <EOL> def register_ports ( cls , reg , basic ) : <EOL> reg . add_input_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( NDArray , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( NDArray , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Integer , basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Integer , basic . String ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Boolean , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . String , '<STR_LIT>' ) ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Float , basic . Float , basic . Float ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , [ basic . Integer , basic . Integer ] , True ) <EOL> reg . add_input_port ( cls , "<STR_LIT>" , ( basic . Float , '<STR_LIT>' ) , True ) <EOL> reg . add_output_port ( cls , "<STR_LIT:source>" , ( basic . String , '<STR_LIT:source>' ) ) </s>
