Пример #1
0
 def load_data_set(self, fname): #(only in this one)
     if not fname == None:
         extension = fname.rsplit('.')[len(fname.rsplit('.')) - 1]
         if extension == "adat":
             [data, labels] = io.load_file_windows(fname, '\t')
         elif extension == "adat2":
             [data, labels] = io.load_file_windows(fname)
         elif extension == "a5dat":
             data, param = load_experiment(fname)
             data = np.transpose(np.array(data))
             labels = {}
             labels["param"] = ["Vc", "T", "P"]
         else:
             [data, labels] = io.load_file_windows(fname)
 #        print "load data set "+fname
         new_data_set = DataSet(data, labels)
         self.change_data_set(new_data_set)
Пример #2
0
def create_plw(parent, load_fname = None):
    """
        add a new plot load window in the MDI area. The data and channels 
        are loaded from a file
    """
    # maintain the previous functionality if file name not passed in
    if not load_fname:
        load_fname = str(parent.widgets["loadPlotWidget"].load_file_name())
        
    logging.info("loading %s for plot"%(load_fname))

    extension = load_fname.rsplit('.')[len(load_fname.rsplit('.')) - 1]
#        print extension

    if extension == "ldat":
        lb_data = LabeledData(fname = load_fname)
        data = lb_data.data
        labels = {}
        labels["param"] = lb_data.labels
    else:
        [data, labels] = IOTool.load_file_windows(load_fname)
        #add the header to the header text area
        parent.widgets["loadPlotWidget"].header_text(labels['hdr'])
                
        #update the name information in the widget
        parent.widgets["loadPlotWidget"].load_file_name(load_fname)          
                
        #store the hdr is there is more than one file
        parent.loaded_data_header[load_fname] = labels['hdr']

    chan_contr = OrderedDict()
    chan_contr["groupBox_Name"] = ["Channel", "lineEdit"]
    chan_contr["groupBox_X"] = ["X", "radioButton"]
    chan_contr["groupBox_Y"] = ["YL", "checkBox"]
    chan_contr["groupBox_YR"] = ["YR", "checkBox"]
    chan_contr["groupBox_fit"] = ["fit", "radioButton"]
    chan_contr["groupBox_invert"] = ["+/-", "checkBox"]
    chan_contr["groupBox_marker"] = ["M", "comboBox"]
    chan_contr["groupBox_line"] = ["L", "comboBox"]

    logging.info("channel names are ", labels)
#        print data
    nb_channels = np.size(data, 1)
    logging.info("%i channels in total"% (nb_channels))
    plw = PlotDisplayWindow.PlotDisplayWindow(
        data_array = data, 
        name = PlotDisplayWindow.PLOT_WINDOW_TITLE_PAST + load_fname, 
        window_type = PlotDisplayWindow.PLOT_WINDOW_TYPE_PAST,
        default_channels = nb_channels, 
        channel_controls = chan_contr)
    
    
    parent.connect(plw.mplwidget, SIGNAL(
        "limits_changed(int,PyQt_PyObject)"), parent.emit_axis_lim)
        
    parent.connect(parent.widgets['AnalyseDataWidget'], SIGNAL(
        "data_set_updated(PyQt_PyObject)"), plw.update_plot)
        
    parent.connect(parent.widgets['AnalyseDataWidget'], SIGNAL(
        "update_fit(PyQt_PyObject)"), plw.update_fit)
        
    parent.connect(parent, SIGNAL("remove_fit()"), plw.remove_fit)

    try:
        for i, param in enumerate(labels['channel_labels']):
            plw.lineEdit_Name[i].setText(param)
    except:
        pass
    
    try:
        plw.set_axis_ticks(IOTool.load_pset_file(load_fname, labels['param']))
    except:
        pass

#        self.dataAnalyseWidget.refresh_active_set()
    
    plw.update_labels(labels['channel_labels'])
    parent.widgets['AnalyseDataWidget'].update_data_and_fit(data)
#        plw.update_plot(data)
    parent.zoneCentrale.addSubWindow(plw)
    plw.show()