Commit c2e12aa6 authored by Somnath, Suhas's avatar Somnath, Suhas
Browse files

All translators use absolute path now

parent be05d1a9
......@@ -22,8 +22,8 @@ class BrukerAFMTranslator(Translator):
def translate(self, file_path, *args, **kwargs):
"""
Translates a given Bruker / Veeco AFM derived file to HDF5. Currently handles scans, force curves, and force
maps
Translates a given Bruker / Veeco / Nanoscope AFM derived file to HDF5. Currently handles scans, force curves,
and force-distance maps
Note that this translator was written with a single example file for each modality and may be buggy.
......@@ -37,7 +37,7 @@ class BrukerAFMTranslator(Translator):
h5_path : str / unicode
path to translated HDF5 file
"""
self.file_path = file_path
self.file_path = path.abspath(file_path)
self.meta_data, other_parms = self._extract_metadata()
# These files are weirdly named with extensions such as .001
......
......@@ -45,6 +45,7 @@ class ForcIVTranslator(Translator):
h5_path : string / unicode
Absolute path of the translated h5 file
"""
raw_data_path = path.abspath(raw_data_path)
folder_path, file_name = path.split(raw_data_path)
h5_path = path.join(folder_path, file_name[:-4] + '.h5')
......
......@@ -46,6 +46,7 @@ class GDMTranslator(Translator):
h5_path : string / unicode
Absolute path of the translated h5 file
"""
self.parm_path = path.abspath(parm_path)
(folder_path, file_name) = path.split(parm_path)
(file_name, base_name) = path.split(folder_path)
h5_path = path.join(folder_path, base_name + '.h5')
......
......@@ -43,6 +43,7 @@ class GLineTranslator(Translator):
h5_path : String / unicode
Absolute path of the h5 file
"""
file_path = path.abspath(file_path)
# Figure out the basename of the data:
(basename, parm_paths, data_paths) = self._parse_file_path(file_path)
......
......@@ -48,6 +48,7 @@ class GTuneTranslator(GLineTranslator):
Absolute path of the h5 file
"""
file_path = path.abspath(file_path)
# Figure out the basename of the data:
(basename, parm_paths, data_paths) = super(GTuneTranslator, self)._parse_file_path(file_path)
......
......@@ -41,6 +41,7 @@ class IgorIBWTranslator(Translator):
h5_path : String / unicode
Absolute path of the .h5 file
"""
file_path = path.abspath(file_path)
# Prepare the .h5 file:
folder_path, base_name = path.split(file_path)
base_name = base_name[:-4]
......
......@@ -27,6 +27,7 @@ class NanonisTranslator(Translator):
"""
super(Translator, self).__init__(*args, **kwargs)
filepath = os.path.abspath(filepath)
folder, basename = self._parse_file_path(filepath)
self.data_path = filepath
......
......@@ -101,6 +101,7 @@ class NDataTranslator(Translator):
Get the list of all files with the .tif extension and
the number of files in the list
'''
image_path = os.path.abspath(image_path)
file_list = self._parse_file_path(image_path)
image_parm_list = self._getimageparms(file_list)
......
......@@ -36,6 +36,7 @@ class AscTranslator(NumpyTranslator):
max_v = abs(max_v)
file_path = path.abspath(file_path)
folder_path, file_name = path.split(file_path)
file_name = file_name[:-4]
......
......@@ -99,6 +99,7 @@ class OneViewTranslator(Translator):
Get the list of all files with the .tif extension and
the number of files in the list
'''
image_path = os.path.abspath(image_path)
root_file_list, file_list = self._parse_file_path(image_path)
size, image_parms = self._getimageparms(file_list[0])
......
......@@ -84,6 +84,7 @@ class PtychographyTranslator(Translator):
raise
self.hdf = hdf
image_path = os.path.abspath(image_path)
# Get the list of all files with the .tif extension and the number of files in the list
if image_type == '.dm3':
......
......@@ -48,7 +48,7 @@ class SporcTranslator(Translator):
h5_path : string / unicode
Absolute path of the translated h5 file
"""
parm_path = path.abspath(parm_path)
(folder_path, file_name) = path.split(parm_path)
(file_name, base_name) = path.split(folder_path)
h5_path = path.join(folder_path, base_name + '.h5')
......
......@@ -75,7 +75,7 @@ class MovieTranslator(Translator):
except:
raise
self.hdf = hdf
image_path = os.path.abspath(image_path)
'''
Get the list of all files with the provided extension and the number of files in the list
'''
......
......@@ -99,6 +99,7 @@ class TRKPFMTranslator(Translator):
h5_path : string / unicode
Absolute path of the translated h5 file
"""
parm_path = path.abspath(parm_path)
parm_dict, excit_wfm = self._read_parms(parm_path)
self._parse_file_path(parm_path)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment