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
6afe5b0b
Commit
6afe5b0b
authored
Jan 31, 2019
by
Raj Giridharagopal
Browse files
piFM error check for an existing file, minor igor fix
parent
6b5f5598
Changes
2
Hide whitespace changes
Inline
Side-by-side
pycroscopy/io/translators/igor_ibw.py
View file @
6afe5b0b
...
...
@@ -13,7 +13,7 @@ from igor import binarywave as bw
from
pyUSID.io.translator
import
Translator
,
\
generate_dummy_main_parms
# Because this class extends the abstract Translator class
from
pyUSID.io.write_utils
import
VALUES_DTYPE
,
Dimension
,
clean_string_att
from
pyUSID.io.write_utils
import
VALUES_DTYPE
,
Dimension
from
pyUSID.io.hdf_utils
import
create_indexed_group
,
write_main_dataset
,
write_simple_attrs
,
write_ind_val_dsets
...
...
@@ -23,7 +23,7 @@ class IgorIBWTranslator(Translator):
"""
def
translate
(
self
,
file_path
,
verbose
=
False
,
append_path
=
''
,
grp_name
=
''
,
parm_encoding
=
'utf-8'
):
grp_name
=
'
Measurement
'
,
parm_encoding
=
'utf-8'
):
"""
Translates the provided file to .h5
...
...
@@ -34,7 +34,7 @@ class IgorIBWTranslator(Translator):
verbose : Boolean (Optional)
Whether or not to show print statements for debugging
append_path : string (Optional)
h5_file to add these data to
h5_file to add these data to
, must be a path to the h5_file on disk
grp_name : string (Optional)
Change from default "Measurement" name to something specific
parm_encoding : str, optional
...
...
@@ -123,10 +123,7 @@ class IgorIBWTranslator(Translator):
spec_desc
=
Dimension
(
'Z'
,
'm'
,
spec_data
)
# Create measurement group
if
not
grp_name
:
meas_grp
=
create_indexed_group
(
h5_file
,
'Measurement'
)
else
:
meas_grp
=
create_indexed_group
(
h5_file
,
grp_name
)
meas_grp
=
create_indexed_group
(
h5_file
,
grp_name
)
# Write file and measurement level parameters
global_parms
=
generate_dummy_main_parms
()
...
...
pycroscopy/io/translators/pifm.py
View file @
6afe5b0b
...
...
@@ -188,10 +188,10 @@ class PiFMTranslator(Translator):
if
not
append_path
:
h5_path
=
os
.
path
.
join
(
self
.
directory
,
self
.
basename
.
replace
(
'.txt'
,
'.h5'
))
if
os
.
path
.
exists
(
h5_path
):
self
.
h5_f
=
h5py
.
File
(
h5_path
,
mode
=
'w'
)
raise
FileExistsError
#if file already exists. (maybe there is a better way to check for this)
else
:
self
.
h5_f
=
h5py
.
File
(
h5_path
,
mode
=
'
r+
'
)
self
.
h5_f
=
h5py
.
File
(
h5_path
,
mode
=
'
w
'
)
else
:
self
.
h5_f
=
h5py
.
File
(
append_path
,
mode
=
'r+'
)
...
...
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