diff --git a/src/msspec/iodata.py b/src/msspec/iodata.py index dde6b81..144bd03 100644 --- a/src/msspec/iodata.py +++ b/src/msspec/iodata.py @@ -889,7 +889,7 @@ class _DataSetView(object): R_ticks = 2 * np.tan(np.radians(theta_ticks/2.)) #R = np.tan(np.radians(theta/2.)) X, Y = np.meshgrid(np.radians(phi), R) - im = axes.pcolormesh(X, Y, Xsec) + im = axes.pcolormesh(X, Y, Xsec, shading='gouraud') axes.set_yticks(R_ticks) axes.set_yticklabels(theta_ticks) diff --git a/src/msspec/iodata_gi.py b/src/msspec/iodata_gi.py index 1742f47..2a61b6d 100644 --- a/src/msspec/iodata_gi.py +++ b/src/msspec/iodata_gi.py @@ -235,8 +235,8 @@ class DataSet(object): float: '{:<20.10e}', complex: 's'} self._formats = ((np.integer, '{:<20d}'), (np.floating, '{:<20.10e}'), - (np.complex, '({0.real:<.10e} {0.imag:<.10e}j)'), - (np.bool, '{:s}'), + (complex, '({0.real:<.10e} {0.imag:<.10e}j)'), + (bool, '{:s}'), (str, '{:s}')) @@ -450,9 +450,13 @@ class DataSet(object): :return: The cluster :rtype: :py:class:`ase.Atoms` """ + p = self.get_parameter(group='Cluster', name='cluster')['value'] s = StringIO() s.write(self.get_parameter(group='Cluster', name='cluster')['value']) - return ase.io.read(s, format='xyz') + s.seek(0) + #return ase.io.read(s, format='xyz') + cluster = list(read_xyz(s))[-1] + return cluster def select(self, *args, **kwargs): @@ -785,13 +789,13 @@ class Data(object): dset = output.add_dset(dset_name) dset.notes = fd['DATA'][dset_name].attrs['notes'] for h5dset in fd['DATA'][dset_name]: - dset.add_columns(**{h5dset: fd['DATA'][dset_name][h5dset].value}) + dset.add_columns(**{h5dset: fd['DATA'][dset_name][h5dset][...]}) try: vfile = LooseVersion(fd['MsSpec viewer metainfo'].attrs['version']) if vfile > LooseVersion(msspec.__version__): raise NameError('File was saved with a more recent format') - xml = fd['MsSpec viewer metainfo']['info'].value.tostring() + xml = fd['MsSpec viewer metainfo']['info'][...].tobytes() root = etree.fromstring(xml) for elt0 in root.iter('parameters'): dset_name = elt0.attrib['dataset'] @@ -854,7 +858,7 @@ class Data(object): #win.show() #Gtk.main() app = _Application(self) - exit_status = app.run(sys.argv) + exit_status = app.run()#sys.argv) sys.exit(exit_status) class _Application(Gtk.Application): @@ -947,7 +951,8 @@ class _DataSetView(object): if np.shape(values)[0] == 1: xvalues = list(range(len(values[0]))) axes.bar(xvalues, values[0], label=label, - picker=5) + # picker=5 + ) axes.set_xticks(xvalues) else: if proj in ('ortho', 'stereo'): @@ -961,7 +966,7 @@ class _DataSetView(object): R_ticks = 2 * np.tan(np.radians(theta_ticks/2.)) #R = np.tan(np.radians(theta/2.)) X, Y = np.meshgrid(np.radians(phi), R) - im = axes.pcolormesh(X, Y, Xsec) + im = axes.pcolormesh(X, Y, Xsec, shading='gouraud') axes.set_yticks(R_ticks) axes.set_yticklabels(theta_ticks) @@ -969,7 +974,7 @@ class _DataSetView(object): elif proj == 'polar': values[0] = np.radians(values[0]) - axes.plot(*values, label=label, picker=5, + axes.plot(*values, label=label, #picker=5, marker=opts['marker']) else: if scale == 'semilogx': @@ -980,7 +985,7 @@ class _DataSetView(object): pltcmd = axes.loglog else: pltcmd = axes.plot - pltcmd(*values, label=label, picker=5, + pltcmd(*values, label=label, #picker=5, marker=opts['marker']) axes.grid(opts['grid']) axes.set_title(opts['title']) @@ -988,6 +993,7 @@ class _DataSetView(object): axes.set_ylabel(opts['ylabel']) axes.set_xlim(*opts['xlim']) axes.set_ylim(*opts['ylim']) + #axes.set_pickradius(5) if label: axes.legend() axes.autoscale(enable=opts['autoscale']) @@ -1242,7 +1248,7 @@ class _DataWindow(Gtk.ApplicationWindow): def on_close(self, action, param): if self.data.is_dirty(): dlg = Gtk.Dialog(title="Warning: Unsaved data", - transient_for=self, flags=Gtk.DialogFlags.MODAL) + transient_for=self, modal=True) dlg.add_buttons(Gtk.STOCK_YES, Gtk.ResponseType.YES, Gtk.STOCK_NO, Gtk.ResponseType.NO) dlg.set_default_size(150, 100) @@ -1474,9 +1480,14 @@ class OLD_DataWindow(wx.Frame): cluster_viewer = ClusterViewer(win, size=wx.Size(480, 340)) dset = self.data[self._current_dset] - s = StringIO() - s.write(dset.get_parameter(group='Cluster', name='cluster')['value']) - atoms = ase.io.read(s, format='xyz') + #s = StringIO() + #s.write(dset.get_parameter(group='Cluster', name='cluster')['value']) + #_s = dset.get_parameter(group='Cluster', name='cluster')['value'] + #print(_s) + # rewind to the begining of the string + #s.seek(0) + #atoms = ase.io.read(s, format='xyz') + atoms = dset.get_cluster() cluster_viewer.set_atoms(atoms, rescale=True, center=True) cluster_viewer.rotate_atoms(0., 180.) cluster_viewer.rotate_atoms(-45., -45.) @@ -1677,7 +1688,7 @@ class OLD_DataWindow(wx.Frame): if __name__ == "__main__": - if True: + if False: data = Data('all my data') dset = data.add_dset('Dataset 0') X = np.arange(0, 20) @@ -1713,6 +1724,7 @@ if __name__ == "__main__": view.select('x', 'y') data.view() - #import sys - #data = Data.load(sys.argv[1]) - #data.view() + exit() + import sys + data = Data.load(sys.argv[1]) + data.view()