Skip to content

Commit

Permalink
Merge pull request #132 from BlytheDumerer/patch-1
Browse files Browse the repository at this point in the history
Updated np gwyddion.py
  • Loading branch information
ramav87 authored Jun 21, 2024
2 parents 001506b + 6bed5b3 commit 439d7bf
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions SciFiReaders/readers/microscopy/spm/afm/gwyddion.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,17 +125,32 @@ def gsf_read(self):
data_set.data_type = 'Image'

#Add quantity and units
data_set.units = metadata['ZUnits']

try:
data_set.units = metadata['ZUnits']
except Exception as e:
# If an error occurs, fall back to using "a.u"
data_set.units = "a.u"
data_set.quantity = metadata['Title']

#Add dimension info
data_set.set_dimension(0, sid.Dimension(np.linspace(0, metadata['XReal'], num_cols),
name = 'x',
units=metadata['XYUnits'], quantity = 'x',
try:
units = metadata['XYUnits'],
except Exception as e:
# If an error occurs, fall back to using "a.u"
units= "a.u",
quantity = 'x',
dimension_type='spatial'))
data_set.set_dimension(1, sid.Dimension(np.linspace(0, metadata['YReal'], num_rows),
name = 'y',
units=metadata['XYUnits'], quantity = 'y',
try:
units = metadata['XYUnits'],
except Exception as e:
# If an error occurs, fall back to using "a.u"
units= "a.u",
quantity = 'y',
dimension_type='spatial'))

# append metadata
Expand Down Expand Up @@ -331,4 +346,4 @@ def _translate_volume(self, gwy_data, obj):


def _translate_xyz(self, gwy_data, obj):
return
return

0 comments on commit 439d7bf

Please sign in to comment.