Commit 387c9f25 authored by Médéric Boquien's avatar Médéric Boquien Committed by Yannick Roehlly

Simplify the tests to detect the file format

parent bd77cb6a
......@@ -183,10 +183,8 @@ class Psum(AnalysisModule):
# Read the observation table and complete it by adding error where
# none is provided and by adding the systematic deviation.
if data_file[-4:] == 'fits':
obs_table = Table.read(data_file, format='fits')
elif data_file[-3:] == 'vot':
obs_table = Table.read(data_file, format='vot')
if data_file.endswith(('fits', 'vot', 'xml')):
obs_table = Table.read(data_file)
else:
obs_table = Table.read(data_file, format='ascii')
for name in filter_list:
......
......@@ -64,10 +64,8 @@ class SfhFromFile(CreationModule):
"""
filename = self.parameters['filename']
if filename[-4:] == 'fits':
table = Table.read(filename, format='fits')
elif data_file[-3:] == 'vot':
table = Table.read(filename, format='vot')
if filename.endswith(('fits', 'vot', 'xml')):
table = Table.read(filename)
else:
table = Table.read(filename, format='ascii')
......
......@@ -149,10 +149,8 @@ class Configuration(object):
filter_list = base.get_filter_list()[0]
# Finding the known filters in the data table
if self.config['data_file'][-4:] == 'fits':
obs_table = Table.read(self.config['data_file'], format='fits')
elif self.config['data_file'][-3:] == 'vot':
obs_table = Table.read(self.config['data_file'], format='votable')
if self.config['data_file'].endswith(('fits', 'vot', 'xml')):
obs_table = Table.read(self.config['data_file'])
else:
obs_table = Table.read(self.config['data_file'], format='ascii')
column_list = []
......
Markdown is supported
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