Commit 49595411 authored by eric pellegrini's avatar eric pellegrini

Remove the units column from the plotter data tree

Added size column to the plotter data tree
Take into acoount the unit when exporting data now
parent 86e5e80c
......@@ -269,15 +269,15 @@ class Plotter1D(wx.Panel):
def export_data(self, event = None):
first = True
for v in self.plots.values():
line, label, varname = v
if first:
try:
axis = self.dataproxy[varname]['axis'][0]
data = [self.dataproxy[axis]['data']]
labels = ['%s (%s)'%(axis, self.dataproxy[axis]['units'])]
data = [self.dataproxy[axis]['data']*self.Xunit_conversion_factor]
labels = ['%s (%s)'%(axis, self.Xunit)]
except:
data = [numpy.arange(self.dataproxy[varname]['data'].shape[0])]
labels = ['default_axis (au)']
......@@ -285,8 +285,8 @@ class Plotter1D(wx.Panel):
try:
line.get_xydata()
data.append(line.get_ydata())
labels.append('%s (%s)'%(label, self.dataproxy[varname]['units']))
data.append(line.get_ydata()*self.Yunit_conversion_factor)
labels.append('%s (%s)'%(label, self.Yunit))
except:
raise Plotter1DError('encounter issue for variable %r while exporting data' % varname)
header = '# '
......
......@@ -217,11 +217,11 @@ class Plotter2D(wx.Panel):
def export_data(self, event = None):
header = '# Data : %s\n# First row : %s\n# First column : %s\n' % (self.varname,self.Xlabel,self.Ylabel)
header = '# Data : %s\n# First row : %s (%s)\n# First column : %s (%s)\n' % (self.varname,self.Xlabel,self.Xunit,self.Ylabel,self.Yunit)
output_fname = self.get_output_filename()
x = numpy.concatenate(([0],self.Xaxis))
data = numpy.vstack((x,numpy.hstack((self.Yaxis[:,numpy.newaxis],self.data))))
x = numpy.concatenate(([0],self.Xaxis))*self.Xunit_conversion_factor
data = numpy.vstack((x,numpy.hstack((self.Yaxis[:,numpy.newaxis]*self.Yunit_conversion_factor,self.data))))
if output_fname:
with open(output_fname, 'w') as f:
f.write(header)
......
......@@ -138,9 +138,10 @@ class DataPanel(wx.Panel):
self.datalist = wx.ListCtrl(self.setup, wx.ID_ANY,style = wx.LC_REPORT|wx.LC_SINGLE_SEL)
self.datalist.InsertColumn(0, 'Variable', width=100)
self.datalist.InsertColumn(1, 'Unit', width=65)
self.datalist.InsertColumn(2, 'Axis', width=50)
self.datalist.InsertColumn(3, 'Dimension')
# self.datalist.InsertColumn(1, 'Unit', width=65)
self.datalist.InsertColumn(1, 'Axis', width=50)
self.datalist.InsertColumn(2, 'Dimension')
self.datalist.InsertColumn(3, 'Size')
sizer1 = wx.BoxSizer(wx.HORIZONTAL)
......@@ -240,12 +241,11 @@ class DataPanel(wx.Panel):
self.datalist.DeleteAllItems()
for i, var in enumerate(sorted(self.dataproxy.keys())):
self.datalist.InsertStringItem(i, var)
self.datalist.SetStringItem(i, 1,self.dataproxy[var]['units'])
#self.datalist.SetStringItem(i, 1,self.dataproxy[var]['units'])
axis = ','.join(self.dataproxy[var]['axis'])
if not axis :
axis = 'None'
self.datalist.SetStringItem(i, 2,axis)
self.datalist.SetStringItem(i, 3,str(self.dataproxy[var]['data'].ndim))
self.datalist.SetStringItem(i, 1,axis)
self.datalist.SetStringItem(i, 2,str(self.dataproxy[var]['data'].ndim))
self.datalist.SetStringItem(i, 3,str(self.dataproxy[var]['data'].shape))
self.datalist.Select(0, True)
def on_select_variables(self, event = None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment