Skip to content

Commit c854f9b

Browse files
author
Felix Marczinowski
committed
added copyright notice
1 parent 28fe24a commit c854f9b

15 files changed

+905
-98
lines changed

COPYING

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

README

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
PySXM is supposed to become a Python module for reading and working with
2+
scanning tunneling microscopy data.
3+
4+
PySXM provides classes for STM data and some typical analysis routines.
5+
6+
Right now, Omikron SCALA (*.par etc.) and TOPSystem formats can be read.

SXM/Data.py

Lines changed: 18 additions & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,21 @@
1-
#@+leo-ver=4
2-
#@+node:@file D:\Arbeit\SXM\SXM\Data.py
3-
#@@language python
4-
#@@tabwidth -4
5-
#@+others
6-
#@+node:Data declarations
1+
# Copyright 2008 Felix Marczinowski <[email protected]>
2+
#
3+
# This file is part of PySXM.
4+
#
5+
# PySXM is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# PySXM is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with PySXM. If not, see <http://www.gnu.org/licenses/>.
17+
#
18+
719
"""Data types and functions.
820
@author: fm
921
@version: $Rev: 123 $
@@ -14,8 +26,6 @@
1426
import FileIO
1527
import pilutil
1628

17-
#@-node:Data declarations
18-
#@+node:class DataField
1929
class DataField(object):
2030
"""Base class for physical data.
2131
@@ -43,8 +53,6 @@ class DataField(object):
4353
@ivar dataLoaded: has the data been read?
4454
@type dataLoaded: bool
4555
"""
46-
#@ @+others
47-
#@+node:__init__
4856

4957
def __init__(self,data=None):
5058
super(DataField,self).__init__()
@@ -60,42 +68,30 @@ def __init__(self,data=None):
6068
self.dataLoaded = False
6169
self.Temperature = None
6270

63-
#@-node:__init__
64-
#@+node:dataChanged
6571
def dataChanged(self):
6672
self.updateDataRange()
6773
try:
6874
super(DataField, self).dataChanged(self)
6975
except AttributeError:
7076
pass
7177

72-
#@-node:dataChanged
73-
#@+node:updateDataRange
7478
def updateDataRange(self):
7579
"""Update the values of dataMax and dataMin, call this after changing the data."""
7680
if self.d != None:
7781
self.dataMax = self.d.max()
7882
self.dataMin = self.d.min()
7983
return self
8084

81-
#@-node:updateDataRange
82-
#@+node:setReader
8385
def setReader(self,reader):
8486
"""Set the reader class."""
8587
self.Reader = reader()
8688

87-
#@-node:setReader
88-
#@+node:findReader
8989
def findReader(self):
9090
"""Find a reader class from available format plugins for our filename."""
9191
reader = FileIO.findReaderForFilename(self.filename)
9292
self.setReader(reader)
9393

94-
#@-node:findReader
95-
#@+node:loadHeader
9694
def loadHeader(self,force=False):
97-
#@ << docstring >>
98-
#@+node:<< docstring >>
9995
"""Load the header.
10096
10197
This function reads the header information from the file given in this
@@ -109,9 +105,6 @@ def loadHeader(self,force=False):
109105
@keyword force: Set to True if header should be read even if it was already read before.
110106
@type force: bool
111107
"""
112-
#@nonl
113-
#@-node:<< docstring >>
114-
#@nl
115108
if self.Reader == None:
116109
self.findReader()
117110
if force or not self.headerLoaded:
@@ -124,11 +117,7 @@ def loadHeader(self,force=False):
124117
raise
125118
return self
126119

127-
#@-node:loadHeader
128-
#@+node:loadData
129120
def loadData(self,force=False):
130-
#@ << docstring >>
131-
#@+node:<< docstring >>
132121
"""Load the data.
133122
134123
This function reads the actual data from the file given in this
@@ -144,9 +133,6 @@ def loadData(self,force=False):
144133
@keyword force: Set to True if data should be read even if it was already read before.
145134
@type force: bool
146135
"""
147-
#@nonl
148-
#@-node:<< docstring >>
149-
#@nl
150136
if force or not self.dataLoaded:
151137
if force or not self.headerLoaded:
152138
self.loadHeader(force)
@@ -160,8 +146,6 @@ def loadData(self,force=False):
160146
raise
161147
return self
162148

163-
#@-node:loadData
164-
#@+node:load
165149
def load(self):
166150
"""Read data from file.
167151
@@ -170,26 +154,16 @@ def load(self):
170154
self.loadData()
171155
return self
172156

173-
#@-node:load
174-
#@-others
175-
#@-node:class DataField
176-
#@+node:class G1D
177157
class G1D(DataField):
178158
"""General 1-dimensional data.
179159
180160
This is mainly intended as a base class.
181161
This class should implement methods common to 1-dimensional data types
182162
"""
183-
#@ @+others
184-
#@+node:__init__
185163

186164
def __init__(self):
187165
super(G1D,self).__init__()
188166

189-
#@-node:__init__
190-
#@-others
191-
#@-node:class G1D
192-
#@+node:class G2D
193167
class G2D(DataField):
194168
"""General 2-dimensional data.
195169
@@ -201,16 +175,12 @@ class G2D(DataField):
201175
@ivar YRes: Number of datapoints in Y-direction
202176
@type YRes: number
203177
"""
204-
#@ @+others
205-
#@+node:__init__
206178

207179
def __init__(self):
208180
super(G2D,self).__init__()
209181
self.XRes = 0
210182
self.YRes = 0
211183

212-
#@-node:__init__
213-
#@+node:bgRowwiseZOffset
214184
def bgRowwiseZOffset(self):
215185
"""Subtract each row's mean value from it.
216186
"""
@@ -221,8 +191,6 @@ def bgRowwiseZOffset(self):
221191
self.updateDataRange()
222192
return self
223193

224-
#@-node:bgRowwiseZOffset
225-
#@+node:bgColwiseZOffset
226194
def bgColwiseZOffset(self):
227195
"""Subtract each column's mean value from it.
228196
"""
@@ -233,8 +201,6 @@ def bgColwiseZOffset(self):
233201
self.updateDataRange()
234202
return self
235203

236-
#@-node:bgColwiseZOffset
237-
#@+node:bgPlaneSubtract
238204
def bgPlaneSubtract(self):
239205
"""Subtract a plane.
240206
@@ -256,51 +222,33 @@ def bgPlaneSubtract(self):
256222
self.updateDataRange()
257223
return self
258224

259-
#@-node:bgPlaneSubtract
260-
#@+node:savePNG
261225
def savePNG(self,cmin=None,cmax=None,pal='grey'):
262226
self.saveImage(self.filename + '.png', cmin=cmin, cmax=cmax, pal=pal)
263227

264-
#@-node:savePNG
265-
#@+node:saveImage
266228
def saveImage(self,fname,cmin=None,cmax=None,pal='grey'):
267229
format = os.path.splitext(fname)[1][1:]
268230
savefile = open(fname,'wb')
269231
self.toImage(savefile,format=format,cmin=cmin,cmax=cmax,pal=pal)
270232
savefile.close()
271233

272-
#@-node:saveImage
273-
#@+node:toImage
274234
def toImage(self,fobj,format="bmp",cmin=None,cmax=None,pal='grey'):
275235
img = scipy.misc.pilutil.toimage(self.d,cmin=cmin,cmax=cmax)
276236
palette = pilutil.stdpal(pal)
277237
img.putpalette(palette)
278238
img.save(fobj, format)
279239

280-
#@-node:toImage
281-
#@-others
282-
#@-node:class G2D
283-
#@+node:class G3D
284240
class G3D(DataField):
285241
"""General 3-dimensional data.
286242
287243
This is mainly intended as a base class.
288244
This class should implement methods common to 3-dimensional data types
289245
"""
290-
#@ @+others
291-
#@+node:__init__
292246

293247
def __init__(self):
294248
super(G3D,self).__init__()
295249

296-
#@-node:__init__
297-
#@-others
298-
#@-node:class G3D
299-
#@+node:class LockInData
300250
class LockInData(object):
301251
"""Class for lock-in measurements."""
302-
#@ @+others
303-
#@+node:__init__
304252

305253
def __init__(self):
306254
self.LIMod = None #: Lock-In modulation amplitude
@@ -309,27 +257,15 @@ def __init__(self):
309257
self.LISens = None #: Lock-In sensitivity
310258
self.LITau = None #: Lock-In time constant
311259

312-
#@-node:__init__
313-
#@-others
314-
#@-node:class LockInData
315-
#@+node:class Spectroscopy
316260
class Spectroscopy(object):
317261
"""Class for spectroscopy measurements."""
318-
#@ @+others
319-
#@+node:__init__
320262
def __init__(self):
321263
self.SamplesT = None #: samples per curve, trace
322264
self.SamplesR = None #: samples per curve, retrace
323265

324-
#@-node:__init__
325-
#@-others
326-
#@-node:class Spectroscopy
327-
#@+node:class Image
328266
class Image(G2D,LockInData):
329267
"""Base class for SXM images.
330268
"""
331-
#@ @+others
332-
#@+node:__init__
333269

334270
def __init__(self):
335271
super(Image,self).__init__()
@@ -344,27 +280,13 @@ def __init__(self):
344280
self.ScanSpeed = 0 # nm/s
345281
self.Angle = 0
346282

347-
#@-node:__init__
348-
#@+node:__repr__
349283
def __repr__(self):
350284
return "<SPMImage %s %ix%inm %ix%ipx U:%.2fV I:%.2f1nA %s>" % (self.ImageType,self.XSize,self.YSize,self.XRes,self.YRes,self.UBias,self.ISet,self.Name)
351285

352-
#@-node:__repr__
353-
#@-others
354-
#@-node:class Image
355-
#@+node:class SpecField
356286
class SpecField(G3D,LockInData):
357287
"""Base class for spectroscopy fields.
358288
"""
359-
#@ @+others
360-
#@+node:__init__
361289

362290
def __init__(self):
363291
super(SpecField,self).__init__()
364292

365-
#@-node:__init__
366-
#@-others
367-
#@-node:class SpecField
368-
#@-others
369-
#@-node:@file D:\Arbeit\SXM\SXM\Data.py
370-
#@-leo

SXM/FileIO.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Copyright 2008 Felix Marczinowski <[email protected]>
2+
#
3+
# This file is part of PySXM.
4+
#
5+
# PySXM is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# PySXM is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with PySXM. If not, see <http://www.gnu.org/licenses/>.
17+
#
118
"""File in/output support.
219
320
@author: fm
@@ -154,4 +171,4 @@ def readHeader(self,data):
154171
"""
155172
pass
156173

157-
174+

SXM/FormatPlugins/OmikronPlugin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Copyright 2008 Felix Marczinowski <[email protected]>
2+
#
3+
# This file is part of PySXM.
4+
#
5+
# PySXM is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# PySXM is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with PySXM. If not, see <http://www.gnu.org/licenses/>.
17+
#
118
from SXM import Data,FileIO
219
import scipy
320
import os

SXM/FormatPlugins/TopsPlugin.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# Copyright 2008 Felix Marczinowski <[email protected]>
2+
#
3+
# This file is part of PySXM.
4+
#
5+
# PySXM is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# PySXM is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with PySXM. If not, see <http://www.gnu.org/licenses/>.
17+
#
118
"""Plugin for reading TOPS files.
219
320
The module reads files produced by the old DOS-based software, as well as

SXM/ImageOps.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,19 @@
1+
# Copyright 2008 Felix Marczinowski <[email protected]>
2+
#
3+
# This file is part of PySXM.
4+
#
5+
# PySXM is free software: you can redistribute it and/or modify
6+
# it under the terms of the GNU General Public License as published by
7+
# the Free Software Foundation, either version 3 of the License, or
8+
# (at your option) any later version.
9+
#
10+
# PySXM is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with PySXM. If not, see <http://www.gnu.org/licenses/>.
17+
#
118
from SXM import Data
219

0 commit comments

Comments
 (0)