Commit 62f18056 authored by Yannick Roehlly's avatar Yannick Roehlly
Browse files

Convert input table to float

When reading a table from a file, convert all the integer columns to float
(except the 'id' column).  These columns are fluxes or error on fluxes and thus
should be treated as float even when they contain only integer.  This solves the
problem of trying to affect NaN value to an integer column.

Fixes #6
parent 1ce24132
......@@ -17,6 +17,8 @@ def read_table(file_):
This function first tries to automatically read the table with astropy,
if that fails, it tries with the ascii format.
All the integer columns, except the "id" column, are converted to float.
file_: string
......@@ -40,4 +42,9 @@ def read_table(file_):
raise Exception("The file <{}> can not be parsed as a data "
return table
# Convert all the integers to floats.
return Table([
col.astype(float) if != 'id' and col.dtype == int
else col
for col in table.columns.values()
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