Example #1
0
 def generate_plot(widget):
     clear_output(wait=True)
     pyplot.close("all")
     display(frame._object_list['window']) #CR
     state = frame.get_state()
     data = frame.get_state_data("runs", state)
     
     plotted_data = False
     comp_data = True
     
     if len(data) != 0:
         st = stellab.stellab()
         element = frame.get_attribute("select_elem", "value")
         yaxis = '['+element+'/Fe]'
         st.plot_spectro(xaxis='[Fe/H]', yaxis=yaxis,norm='Grevesse_Sauval_1998',galaxy=state,show_err=True)
         for i in xrange(len(data)):
             instance, name, line_style, line_color, widget_name = data[i]
             label = name+", "+yaxis
             selected = frame.get_attribute(widget_name, "value")
             if selected:
                 plotted_data=True
                 xy = instance.plot_spectro(xaxis='[Fe/H]', yaxis=yaxis, return_x_y=True)
                 pyplot.plot(xy[0], xy[1], color=color_convert.to_rgba("w", 0.8), linestyle="-", marker=" ", linewidth=4)
                 if comp_data:
                     comp_data=False
 
         for i in xrange(len(data)):
             instance, name, line_style, line_color, widget_name = data[i]
             label = name+", "+yaxis
             selected = frame.get_attribute(widget_name, "value")
             if selected:
                 plotted_data=True
                 xy = instance.plot_spectro(xaxis='[Fe/H]', yaxis=yaxis, return_x_y=True)
                 pyplot.plot(xy[0], xy[1], color=line_color, linestyle=line_style, marker=" ", linewidth=2, label=label)
                 if comp_data:
                     comp_data=False
         #pyplot.legend(loc='center left', bbox_to_anchor=(1.01, 0.5), markerscale=0.8, fontsize=12)
         
         if plotted_data:
             frame.set_attributes("warning_msg", visibility='hidden')
             if state=="sculptor":
                 pyplot.ylim(-1.0,1.6)
                 pyplot.xlim(-4.0, -0.5)
             elif state=="carina":
                 pyplot.ylim(-1.0,1.6)
                 pyplot.xlim(-4.0, -0.5)
             if state=="fornax":
                 pyplot.ylim(-1.0,1.4)
                 pyplot.xlim(-3.5, 0)
         
             matplotlib.rcParams.update({'font.size': 14})
             pyplot.subplots_adjust(right=0.6)
             pyplot.subplots_adjust(bottom=0.15)
             pyplot.legend(loc='center left', bbox_to_anchor=(1.01, 0.5), prop={'size':12})
             pyplot.show()
         else:
             frame.set_attributes("warning_msg", visibility='visible', value="<h3>Error no runs selected!</h3>")
             
     else:
         frame.set_attributes("warning_msg", visibility='visible', value="<h3>Error no run data!</h3>")
Example #2
0
 def generate_plot(widget):
     clear_output()
     pyplot.close("all")
     state = frame.get_state()
     data = frame.get_state_data("runs", state)
     
     plotted_data = False
     comp_data = True
     
     if len(data) != 0:
         st = stellab.stellab()
         element = frame.get_attribute("select_elem", "value")
         yaxis = '['+element+'/Fe]'
         st.plot_spectro(xaxis='[Fe/H]', yaxis=yaxis,norm='Grevesse_Sauval_1998',galaxy=state,show_err=True)
         for i in xrange(len(data)):
             instance, name, line_style, line_color, widget_name = data[i]
             label = name+", "+yaxis
             selected = frame.get_attribute(widget_name, "value")
             if selected:
                 plotted_data=True
                 xy = instance.plot_spectro(xaxis='[Fe/H]', yaxis=yaxis, return_x_y=True)
                 pyplot.plot(xy[0], xy[1], color=color_convert.to_rgba("w", 0.8), linestyle="-", marker=" ", linewidth=4)
                 if comp_data:
                     comp_data=False
 
         for i in xrange(len(data)):
             instance, name, line_style, line_color, widget_name = data[i]
             label = name+", "+yaxis
             selected = frame.get_attribute(widget_name, "value")
             if selected:
                 plotted_data=True
                 xy = instance.plot_spectro(xaxis='[Fe/H]', yaxis=yaxis, return_x_y=True)
                 pyplot.plot(xy[0], xy[1], color=line_color, linestyle=line_style, marker=" ", linewidth=2, label=label)
                 if comp_data:
                     comp_data=False
         #pyplot.legend(loc='center left', bbox_to_anchor=(1.01, 0.5), markerscale=0.8, fontsize=12)
         
         if plotted_data:
             frame.set_attributes("warning_msg", visible=False)
             if state=="sculptor":
                 pyplot.ylim(-1.0,1.6)
                 pyplot.xlim(-4.0, -0.5)
             elif state=="carina":
                 pyplot.ylim(-1.0,1.6)
                 pyplot.xlim(-4.0, -0.5)
             if state=="fornax":
                 pyplot.ylim(-1.0,1.4)
                 pyplot.xlim(-3.5, 0)
         
             matplotlib.rcParams.update({'font.size': 14})
             pyplot.subplots_adjust(right=0.6)
             pyplot.subplots_adjust(bottom=0.15)
             pyplot.legend(loc='center left', bbox_to_anchor=(1.01, 0.5), prop={'size':12})
             pyplot.show()
         else:
             frame.set_attributes("warning_msg", visible=True, value="<h3>Error no runs selected!</h3>")
             
     else:
         frame.set_attributes("warning_msg", visible=True, value="<h3>Error no run data!</h3>")
Example #3
0
 def run_stellab(self):
     import stellab as st
     st1 = st.stellab()
Example #4
0
     def run_stellab(self):
	  import stellab as st
	  st1 = st.stellab()