Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Vasudevan, Rama K
pycroscopy
Commits
6d4f362a
Commit
6d4f362a
authored
Nov 08, 2018
by
Patrik Marschalik
Browse files
Fix extraction of file name extensions
parent
91b76e63
Changes
1
Hide whitespace changes
Inline
Side-by-side
pycroscopy/io/translators/df_utils/nanonispy/read.py
View file @
6d4f362a
...
...
@@ -56,11 +56,12 @@ class NanonisFile(object):
'sxm', or 'dat'.
"""
if
self
.
fname
[
-
3
:]
==
'3ds'
:
_
,
fname_ext
=
os
.
path
.
splitext
(
self
.
fname
)
if
fname_ext
==
'.3ds'
:
return
'grid'
elif
self
.
fname
[
-
3
:]
==
'sxm'
:
elif
self
.
fname
[
-
3
:]
==
'
.
sxm'
:
return
'scan'
elif
self
.
fname
[
-
3
:]
==
'dat'
:
elif
self
.
fname
[
-
3
:]
==
'
.
dat'
:
return
'spec'
else
:
raise
UnhandledFileError
(
...
...
@@ -760,5 +761,6 @@ def _is_valid_file(fname, ext):
"""
Detect if invalid file is being initialized by class.
"""
if
fname
[
-
3
:]
!=
ext
:
_
,
fname_ext
=
os
.
path
.
splitext
(
fname
)
if
fname_ext
[
1
:]
!=
ext
:
raise
UnhandledFileError
(
'{} is not a {} file'
.
format
(
fname
,
ext
))
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment